<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Web PHP programming and more</title>
	<atom:link href="http://programmingandmore.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://programmingandmore.wordpress.com</link>
	<description>Just another php, programming, webservices and more by Milan Rukavina</description>
	<lastBuildDate>Wed, 26 Aug 2009 07:43:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='programmingandmore.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Web PHP programming and more</title>
		<link>http://programmingandmore.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://programmingandmore.wordpress.com/osd.xml" title="Web PHP programming and more" />
	<atom:link rel='hub' href='http://programmingandmore.wordpress.com/?pushpress=hub'/>
		<item>
		<title>FreshBooks API JavaScript Library</title>
		<link>http://programmingandmore.wordpress.com/2009/03/16/freshbooks-api-javascript-library/</link>
		<comments>http://programmingandmore.wordpress.com/2009/03/16/freshbooks-api-javascript-library/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 18:16:12 +0000</pubDate>
		<dc:creator>rukavina</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web applications]]></category>
		<category><![CDATA[freshbooks ajax javascript]]></category>

		<guid isPermaLink="false">http://programmingandmore.wordpress.com/?p=59</guid>
		<description><![CDATA[As I mentioned already, here I&#8217;ll explain the motivation, the idea and the implementation of freshbooks api javascript library. Rich client web applications are trend. There are a lot of processing which could (and should) be moved from a server to a client machine. There are different technologies to achieve this, but browser native javascript  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingandmore.wordpress.com&amp;blog=5669306&amp;post=59&amp;subd=programmingandmore&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-67" style="margin:0 5px 5px 0;" title="freshbooks1" src="http://programmingandmore.files.wordpress.com/2009/03/freshbooks1.gif?w=700" alt="freshbooks"   />As I <a href="http://programmingandmore.wordpress.com/2009/03/15/freshbooks-api-php-5-library/">mentioned</a> already, here I&#8217;ll explain the motivation, the idea and the implementation of freshbooks api javascript library. Rich client web applications are trend. There are a lot of processing which could (and should) be moved from a server to a client machine. There are different technologies to achieve this, but browser native javascript  is most common way. There are plenty of powerful javascript frameworks. That&#8217;s why I think is always useful to have js library which communicates with web services and APIs with none or minimum usage of server side technology which in many cases does nothing more than spends server resources in order to generate web page interface.</p>
<p><span id="more-59"></span></p>
<p>Still there&#8217;s one important limitation. Browsers will NOT allow cross-domain AJAX calls. For example, if your web page executes on www.mypage.com you cannot call www.freshbooks.com from ajax &#8211; and that&#8217;s what we need here. That&#8217;s why I created proxy php script which has to reside on the same domain as your  js and htm files. Our ajax script calls proxy and proxy gets content from freshbooks.com with no limitations. So we have one extra step, but it should work.</p>
<p>Another approach could be to use flash component like <a href="http://flxhr.flensed.com/" target="_blank">flXHR</a> without extra server side proxy scripts. BTW. cross domain ajax calls will probably be supported/allowed in new browser versions (like FireFox 3.1).</p>
<p>Here&#8217;s demo usage:</p>
<blockquote><p>&lt;!DOCTYPE HTML PUBLIC &#8220;-//W3C//DTD HTML 4.01 Transitional//EN&#8221; &#8220;http://www.w3.org/TR/html4/loose.dtd&#8221;&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv=&#8221;content-type&#8221; content=&#8221;text/html; charset=utf-8&#8243;&gt;<br />
&lt;title&gt;Test Ajax JS&lt;/title&gt;<br />
&lt;!&#8211; INCLUDE JS FILES &#8211; ALWAYS HttpClient.js and Element.js, for Invoice, Recurring and Estimate include BaseInvoice.js as well &#8211;&gt;<br />
&lt;script language=&#8221;javascript&#8221; type=&#8221;text/javascript&#8221; src=&#8221;library/FreshBooks/<strong>HttpClient.js</strong>&#8220;&gt;&lt;/script&gt;<br />
&lt;script language=&#8221;javascript&#8221; type=&#8221;text/javascript&#8221; src=&#8221;library/FreshBooks/<strong>Element.js</strong>&#8220;&gt;&lt;/script&gt;<br />
&lt;script language=&#8221;javascript&#8221; type=&#8221;text/javascript&#8221; src=&#8221;library/FreshBooks/<strong>Client.js</strong>&#8220;&gt;&lt;/script&gt;<br />
&lt;!&#8211; helper js, defines dump() function similar to php print_r()  &#8211;&gt;<br />
&lt;script language=&#8221;javascript&#8221; type=&#8221;text/javascript&#8221; src=&#8221;library/dumper.js&#8221;&gt;&lt;/script&gt;<br />
&lt;script language=&#8221;javascript&#8221; type=&#8221;text/javascript&#8221;&gt;<br />
//&lt;!&#8211;<br />
//you API url and token obtained from freshbooks.com<br />
var url = &#8216;your-url-please-replace&#8217;;<br />
var token = &#8216;your-token-please-replace&#8217;;<br />
//proxy server script &#8211; if your server doesn&#8217;t support php try creating similar file in supported server side technology<br />
var proxyUrl = &#8216;proxy.php&#8217;;<br />
//init global FreshBooks_HttpClient<br />
<strong>var httpClient = new FreshBooks_HttpClient(url,token,proxyUrl);</strong></p>
<p>function getClient(){<br />
//new Client object<br />
<strong>var client = new FreshBooks_Client();</strong><br />
//try to get client with client_id 1<br />
<strong>if(client.get(1)){</strong><br />
//investigate populated data<br />
document.getElementById(&#8216;response&#8217;).value = dump(client);<br />
}<br />
else{<br />
//no data &#8211; read error<br />
document.getElementById(&#8216;response&#8217;).value = client.lastError;<br />
}<br />
}<br />
//&#8211;&gt;<br />
&lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;h1&gt;FreshBooks API js library Example&lt;/h1&gt;<br />
&lt;input type=&#8221;button&#8221; name=&#8221;test&#8221; id=&#8221;test&#8221; value=&#8221;Get Client ID 1&#8243; onclick=&#8221;getClient();&#8221; /&gt;<br />
&lt;textarea id=&#8221;response&#8221; name=&#8221;response&#8221; rows=&#8221;5&#8243; cols=&#8221;60&#8243; style=&#8221;width:100%; height: 300px;&#8221;&gt;&lt;/textarea&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p></blockquote>
<p>As you can see it doesn&#8217;t differ too much from php version even though porting is not trivial, mainly because javascript OO concept is primitive compared to php 5 (even php 4).</p>
<p>Please take a look at<a href="http://rukavina.co.cc/freshbooks/js/docs/" target="_blank"> js library documentation</a> and native XML <a href="http://developers.freshbooks.com/" target="_blank">freshbooks api documentation</a> in order to learn more.</p>
<p><a href="http://code.google.com/p/freshbooks-javascript-library/downloads/list" target="_blank">DOWNLOAD FRESHBOOKS API JAVASCRIPT LIBRARY</a></p>
<p><a href="http://code.google.com/p/freshbooks-javascript-library/" target="_blank">PROJECT PAGE</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/programmingandmore.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/programmingandmore.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/programmingandmore.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/programmingandmore.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/programmingandmore.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/programmingandmore.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/programmingandmore.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/programmingandmore.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/programmingandmore.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/programmingandmore.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/programmingandmore.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/programmingandmore.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/programmingandmore.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/programmingandmore.wordpress.com/59/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingandmore.wordpress.com&amp;blog=5669306&amp;post=59&amp;subd=programmingandmore&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://programmingandmore.wordpress.com/2009/03/16/freshbooks-api-javascript-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04391622821491ddcc3cb2dd112deebe?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rukavina</media:title>
		</media:content>

		<media:content url="http://programmingandmore.files.wordpress.com/2009/03/freshbooks1.gif" medium="image">
			<media:title type="html">freshbooks1</media:title>
		</media:content>
	</item>
		<item>
		<title>FreshBooks API PHP 5 Library</title>
		<link>http://programmingandmore.wordpress.com/2009/03/15/freshbooks-api-php-5-library/</link>
		<comments>http://programmingandmore.wordpress.com/2009/03/15/freshbooks-api-php-5-library/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 10:35:21 +0000</pubDate>
		<dc:creator>rukavina</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[web applications]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[freshbooks]]></category>
		<category><![CDATA[saas]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://programmingandmore.wordpress.com/?p=48</guid>
		<description><![CDATA[If you are interested in SAAS concept (as I am) I&#8217;m sure you have heard of FreshBooks . This is an great and easy to use online invoice, time tracking and expence service. In my opinion this kind of software has a great potential.  I suppose at the moment it cannot have big companies as [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingandmore.wordpress.com&amp;blog=5669306&amp;post=48&amp;subd=programmingandmore&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-54" title="freshbooks invoice" src="http://programmingandmore.files.wordpress.com/2009/03/freshbooks-invoice.gif?w=700" alt="freshbooks invoice"   />If you are interested in <a href="http://en.wikipedia.org/wiki/Software_as_a_service" target="_blank">SAAS</a> concept (as I am) I&#8217;m sure you have heard of <a href="http://www.freshbooks.com/" target="_blank">FreshBooks</a> . This is an great and easy to use online invoice, time tracking and expence service. In my opinion this kind of software has a great potential.  I suppose at the moment it cannot have big companies as clients. Still majority of companies are not so big I guess &#8211; so that market must be huge.</p>
<p>As a developer I&#8217;m more intereset in <a href="http://developers.freshbooks.com/" target="_blank">API</a> they offer. Like their user interface and general usability, the API request/response XML structures are nice, consistent and simple. Actually, you don&#8217;t have to deal with XML &#8211; there are some <a href="http://developers.freshbooks.com/sample-code/" target="_blank">3rd party libraries</a> for various languages. Yet, I was not impressed with php/symphony library. I was thinking of something more <a href="http://framework.zend.com/" target="_blank">zend framework</a> like object oriented implementation. So I decided to offer <a href="http://code.google.com/p/freshbooks-php-library/downloads/list" target="_blank">my own implementation</a>.</p>
<p><span id="more-48"></span></p>
<p>Here&#8217;s sample usage:</p>
<blockquote><p>&lt;?<br />
//include particular file for entity you need (Client, Invoice, Category&#8230;)<br />
<strong>include_once &#8220;library/FreshBooks/Client.php&#8221;;</strong></p>
<p>//you API url and token obtained from freshbooks.com<br />
$url = &#8220;your-url-please-replace&#8221;;<br />
$token = &#8220;your-token-please-replace&#8221;;</p>
<p>//init singleton FreshBooks_HttpClient<br />
<strong>FreshBooks_HttpClient::init($url,$token);</strong></p>
<p>//new Client object<br />
<strong>$client = new FreshBooks_Client();</strong></p>
<p>//try to get client with client_id 3<br />
<strong>if(!$client-&gt;get(3)){</strong><br />
//no data &#8211; read error<br />
echo $client-&gt;lastError;<br />
}<br />
else{<br />
//investigate populated data<br />
print_r($client);<br />
}</p>
<p><strong>//new invoice example</strong></p>
<p><span style="font-family:Courier New,Courier,monospace;">//new Invoice object<br />
$invoice= new FreshBooks_Invoice();</span><br />
//populate data<br />
$invoice-&gt;clientId = 123;<br />
$invoice-&gt;date = &#8217;2009-06-03&#8242;; //mysql format<br />
&#8230;//all other required properties should be populated<br />
//lines (items) is array of asoc. arrays<br />
$invoice-&gt;lines = array(<br />
//1st item<br />
array(<br />
&#8216;name&#8217;=&gt;&#8217;xyz&#8217;,<br />
&#8216;unitCost&#8217;=&gt;99.99,<br />
&#8230;//all other required properties should be populated<br />
),<br />
//2nd item<br />
array(<br />
&#8216;name&#8217;=&gt;&#8217;yyy&#8217;,<br />
&#8216;unitCost&#8217;=&gt;199.99,<br />
&#8230;<br />
)<br />
&#8230;<br />
);<br />
//try to create new invoice with provided data on FB server<br />
if(!<strong>$invoice-&gt;create()</strong>){<br />
//read error<br />
echo $invoice-&gt;lastError;<br />
}<br />
else{<br />
//investigate populated data<br />
print_r($invoice);<br />
}</p>
<p><strong>//new client example</strong></p>
<p>//new Client object<br />
$client = new FreshBooks_Client();</p>
<p>//populate client&#8217;s properties<br />
$client-&gt;email = &#8216;test@test.com&#8217;;<br />
$client-&gt;firstName = &#8216;Chad&#8217;;<br />
$client-&gt;lastName = &#8216;Smith&#8217;;</p>
<p>&#8230;//all other required properties should be populated</p>
<p>//try to create new client with provided data on FB server<br />
if(!<strong>$client-&gt;create()</strong>){<br />
//read error<br />
echo $client-&gt;lastError;<br />
}<br />
else{<br />
//investigate populated data<br />
print_r($client);<br />
}</p>
<p>?&gt;</p></blockquote>
<p>Should be simple enough. For more details please refer to library <a href="http://rukavina.co.cc/freshbooks/php/docs/" target="_blank">documentation</a> and <a href="http://developers.freshbooks.com/" target="_blank">freshbooks api</a>.</p>
<p>Also, here&#8217;s <a href="http://rukavina.co.cc/freshbooks/tester/" target="_blank">bonus tool for raw communication with freshbooks api using AJAX</a>. You can  download the source from <a href="http://rukavina.co.cc/freshbooks/download/freshbooks-tester-1.0.zip">here</a>.</p>
<p>I&#8217;m about to post javascript port of this library. I hope it  should find its use in numerous rich client javascript applications.</p>
<p><a href="http://code.google.com/p/freshbooks-php-library/downloads/list" target="_blank">DOWNLOAD LIBRARIES</a></p>
<p><a href="http://code.google.com/p/freshbooks-php-library/" target="_blank">PROJECT PAGE</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/programmingandmore.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/programmingandmore.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/programmingandmore.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/programmingandmore.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/programmingandmore.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/programmingandmore.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/programmingandmore.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/programmingandmore.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/programmingandmore.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/programmingandmore.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/programmingandmore.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/programmingandmore.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/programmingandmore.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/programmingandmore.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingandmore.wordpress.com&amp;blog=5669306&amp;post=48&amp;subd=programmingandmore&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://programmingandmore.wordpress.com/2009/03/15/freshbooks-api-php-5-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04391622821491ddcc3cb2dd112deebe?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rukavina</media:title>
		</media:content>

		<media:content url="http://programmingandmore.files.wordpress.com/2009/03/freshbooks-invoice.gif" medium="image">
			<media:title type="html">freshbooks invoice</media:title>
		</media:content>
	</item>
		<item>
		<title>Don&#8217;t Forget to Index Database Tables</title>
		<link>http://programmingandmore.wordpress.com/2008/12/27/dont-forget-to-index-database-tables/</link>
		<comments>http://programmingandmore.wordpress.com/2008/12/27/dont-forget-to-index-database-tables/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 07:16:19 +0000</pubDate>
		<dc:creator>rukavina</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[optimization]]></category>

		<guid isPermaLink="false">http://programmingandmore.wordpress.com/?p=32</guid>
		<description><![CDATA[Your dynamic web page opens too slow? Your desktop application window freezes during a query execution? The most common cause of these problems is lack of proper indexes on tables. During a development of a web application in particular, it&#8217;s hard to notice this problem &#8211; there&#8217;s just test data, your are using local development [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingandmore.wordpress.com&amp;blog=5669306&amp;post=32&amp;subd=programmingandmore&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Your dynamic web page opens too slow? Your desktop application window freezes during a query execution? The most common cause of these problems is lack of proper indexes on tables. During a development of a web application in particular, it&#8217;s hard to notice this problem &#8211; there&#8217;s just test data, your are using local development server without real life load and everything seems to be working just fine. Then you launch a site, it&#8217;s DB grows and pages start to open slower and slower and finally server even stops responding.</p>
<div id="attachment_35" class="wp-caption alignnone" style="width: 490px"><a href="http://programmingandmore.files.wordpress.com/2008/12/phpmyadmin.png"><img class="size-full wp-image-35" title="phpmyadmin" src="http://programmingandmore.files.wordpress.com/2008/12/phpmyadmin.png?w=700" alt="phpmyadmin"   /></a><p class="wp-caption-text">phpmyadmin</p></div>
<p><span id="more-32"></span>It makes really big difference for big tables and complex queries to have and not to have proper indexes set up. Image unsorted address book and looking for &#8220;Smith Chad&#8221;. He can be anywhere in the book &#8211; in worst case scenario you&#8217;ll have to go through all entries for the book to find that one. But if you have alphabetically sorted address by by last name and &#8220;tabs&#8221; for each first letter than you&#8217;ll be able to jump to &#8220;S&#8221; and in the worst case scenario just go through all entries starting with &#8220;S&#8221;. So this is much faster search, right?</p>
<p>So if your database structure is OK then all you have to do is just set up indexes. But which fields should be indexed, which indexes should include multiple fields? Basically all foreign-key fields should be indexed &#8211; it helps a lot db server to return JOIN queries faster. But in general you will need to analyze each particular query especially WHERE clause. Fields existing in a WHERE condition should be included in an INDEX. Of course, you should use optimization tools as much as possible. For example if your DB is MySQL there is test query syntax EXPLAIN &#8211; just execute the same query with the word &#8220;EXPLAIN&#8221; before the SELECT. The output will inform you if keys and indexes are being used and which ones.</p>
<p>Sometimes it&#8217;s even hard to find &#8220;slow&#8221; query. By you can prepare your code to track it down. You could create your own query function to encapsulate mysql_query</p>
<blockquote><p>$time_before = microtime();</p>
<p>$result = mysql_query(<em>SQL_QUERY</em>);</p>
<p>$time_after = microtime();</p>
<p>if(($time_after &#8211; $time_before)/1000 &gt; 1) <em>log_this_query</em>(<em>SQL_QUERY</em>)</p></blockquote>
<p>This way can log (save to database or file) queries which last more than 1 second. Basically similar kind of logging exist on the database system level but generally is not available on shared hosts.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/programmingandmore.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/programmingandmore.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/programmingandmore.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/programmingandmore.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/programmingandmore.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/programmingandmore.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/programmingandmore.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/programmingandmore.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/programmingandmore.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/programmingandmore.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/programmingandmore.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/programmingandmore.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/programmingandmore.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/programmingandmore.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingandmore.wordpress.com&amp;blog=5669306&amp;post=32&amp;subd=programmingandmore&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://programmingandmore.wordpress.com/2008/12/27/dont-forget-to-index-database-tables/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04391622821491ddcc3cb2dd112deebe?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rukavina</media:title>
		</media:content>

		<media:content url="http://programmingandmore.files.wordpress.com/2008/12/phpmyadmin.png" medium="image">
			<media:title type="html">phpmyadmin</media:title>
		</media:content>
	</item>
		<item>
		<title>Multilingual (multilanguage) web applications</title>
		<link>http://programmingandmore.wordpress.com/2008/12/13/multilanguage-web-applications/</link>
		<comments>http://programmingandmore.wordpress.com/2008/12/13/multilanguage-web-applications/#comments</comments>
		<pubDate>Sat, 13 Dec 2008 09:07:42 +0000</pubDate>
		<dc:creator>rukavina</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web applications]]></category>
		<category><![CDATA[internationalization i18n]]></category>
		<category><![CDATA[localization l10n]]></category>
		<category><![CDATA[multilanguage web applications]]></category>

		<guid isPermaLink="false">http://programmingandmore.wordpress.com/?p=11</guid>
		<description><![CDATA[Developing multilanguage web applications (internationalization i18n , localization l10n) is not trivial. You should integrate multilanguage support on 3 levels at least. As your application should have MVC layers, your localization should be applied on Model, View and Controller as well. I&#8217;m going to write here about strategies to accomplish this on each level. Model [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingandmore.wordpress.com&amp;blog=5669306&amp;post=11&amp;subd=programmingandmore&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://programmingandmore.files.wordpress.com/2008/11/localization.png"><img class="alignright size-full wp-image-15" title="localization" src="http://programmingandmore.files.wordpress.com/2008/11/localization.png?w=700" alt="localization"   /></a>Developing multilanguage web applications (<a href="http://en.wikipedia.org/wiki/Internationalization_and_localization" target="_blank">internationalization i18n , localization l10n</a>) is not trivial. You should integrate multilanguage support on 3 levels at least. As your application should have <a href="http://en.wikipedia.org/wiki/MVC" target="_self">MVC</a> layers, your localization should be applied on Model, View and Controller as well. I&#8217;m going to write here about strategies to accomplish this on each level.</p>
<p><span id="more-11"></span></p>
<h2>Model</h2>
<p>Let&#8217;s say we have simple news application with db table news: news_id, title, content and we want to extend this model to accept Spanish language as well. There are at least 2 approaches:</p>
<ol>
<li>we can add 2 new fields: es_title and es_content</li>
<li>we can add new table news_translation with columns: translation_id, news_id, language, title, content</li>
</ol>
<p>While the approach 1. is straightforward 2. is much more flexible &#8211; if you want to extend an application to support French for example you don&#8217;t have to change database structure again. For each language you have one row in the translation table while original table stores common entity data and primary language translation.</p>
<p>In both scenarios you&#8217;re expected to have utility functions to encapsulate db read/write in the context of particular row, for example <em>get_field_value($row,$field_name, $language)</em>.</p>
<h2>View</h2>
<p>It&#8217;s expected to have html views (templates) separated from a (php) code. Localized version could use separate templates but it&#8217;s always good idea to have as much as possible reusable elements. Instead of have labels and text hard coded you have them populated dynamically based on the current language and common dictionary. The dictionary itself could be implemented as an include file or database table which should be more flexible to be maintained by end users.</p>
<blockquote><p>&lt;h1&gt;News&lt;h1&gt;          becomes        &lt;h1&gt;{NEWS_HEADING}&lt;/h1&gt;</p></blockquote>
<h2>Controller</h2>
<p>It&#8217;s last but not least important part of interationalization of web application. It&#8217;s very important that each page for each language has unique URL. Lets say we have a page news.php:</p>
<p><strong>English url: <em>example.com/news.php</em><br />
Spanish url: <em>example.com/news.php</em></strong></p>
<p>This is no good! Both languages share the same url, probably distinction is implemented using session variable but it has to be globally unique url. Image you want to send a friend spanish version of this page, and there&#8217;s a problem since both links are the same. Also we live the internet run by search engines and they are very confused to have completelly different content in one address &#8211; or ost likely they will be unable to get and index one version</p>
<p><strong>English url: <em>example.com/en/news.php</em><br />
Spanish url: <em>example.com/es/news.php</em></strong></p>
<p>This is much better. Each file is in separate folder. Note that it doesn&#8217;t have to be physically it&#8217;s a common solution to use web server&#8217;s url rewrite engine and target the same file which takes language code (es, en) as a paramater and produces html output (view + model) based on it.</p>
<p>Still this might not be good enough for search engines. news.php doesn&#8217;t mean anything in spanish and words in urls are very imprtant for search engines. So this would be the best version:</p>
<p><strong>English url: <em>example.com/en/news.php</em><br />
Spanish url: <em>example.com/es/noticias.php</em></strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/programmingandmore.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/programmingandmore.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/programmingandmore.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/programmingandmore.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/programmingandmore.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/programmingandmore.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/programmingandmore.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/programmingandmore.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/programmingandmore.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/programmingandmore.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/programmingandmore.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/programmingandmore.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/programmingandmore.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/programmingandmore.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingandmore.wordpress.com&amp;blog=5669306&amp;post=11&amp;subd=programmingandmore&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://programmingandmore.wordpress.com/2008/12/13/multilanguage-web-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04391622821491ddcc3cb2dd112deebe?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rukavina</media:title>
		</media:content>

		<media:content url="http://programmingandmore.files.wordpress.com/2008/11/localization.png" medium="image">
			<media:title type="html">localization</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating Google Visualization Data Source in PHP</title>
		<link>http://programmingandmore.wordpress.com/2008/12/05/creating-google-visualization-data-source-in-php/</link>
		<comments>http://programmingandmore.wordpress.com/2008/12/05/creating-google-visualization-data-source-in-php/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 18:22:36 +0000</pubDate>
		<dc:creator>rukavina</dc:creator>
				<category><![CDATA[google]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[google api]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[visualization]]></category>

		<guid isPermaLink="false">http://programmingandmore.wordpress.com/?p=21</guid>
		<description><![CDATA[Sooner or later your web application needs some kind of graph, chart or similar. Google has really cool API for this purpose &#8211; Google Visualization API. It&#8217;s client side javascript library, and the output is SVG or flash SWF depending on particular graph. But like with any output you can control this from php. It&#8217;s [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingandmore.wordpress.com&amp;blog=5669306&amp;post=21&amp;subd=programmingandmore&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id="attachment_24" class="wp-caption alignright" style="width: 280px"><a href="http://programmingandmore.files.wordpress.com/2008/12/visualization.gif"><img class="size-full wp-image-24" title="visualization" src="http://programmingandmore.files.wordpress.com/2008/12/visualization.gif?w=700" alt="Google Visualization"   /></a><p class="wp-caption-text">Google Visualization</p></div>
<p>Sooner or later your web application needs some kind of graph, chart or similar. Google has really cool API for this purpose &#8211; <a href="http://code.google.com/apis/visualization/" target="_blank">Google Visualization API</a>. It&#8217;s client side javascript library, and the output is SVG or flash SWF depending on particular graph. But like with any output you can control this from php.</p>
<p><span id="more-21"></span></p>
<p>It&#8217;s pretty simple, here&#8217;s <a href="http://code.google.com/apis/visualization/documentation/using_overview.html#The_Hello_World_of_Using_Visualizations" target="_blank">an example</a> of html/js source.</p>
<p>So you simply include remote js file:</p>
<blockquote><p>&lt;script type=&#8221;text/javascript&#8221; src=&#8221;http://www.google.com/jsapi&#8221;&gt;&lt;/script&gt;</p></blockquote>
<p>then load particular &#8220;package&#8221;:</p>
<blockquote><p>google.load(&#8216;visualization&#8217;, &#8217;1&#8242;, {packages:['piechart']});</p></blockquote>
<p>inform library which method to call on load:</p>
<blockquote><p>google.setOnLoadCallback(drawChart);</p></blockquote>
<p>and write that method:</p>
<blockquote><p>function drawChart() {<br />
var data = new google.visualization.DataTable();<br />
data.addColumn(&#8216;string&#8217;, &#8216;Task&#8217;);<br />
data.addColumn(&#8216;number&#8217;, &#8216;Hours per Day&#8217;);<br />
data.addRows(5);<br />
data.setValue(0, 0, &#8216;Work&#8217;);<br />
data.setValue(0, 1, 11);<br />
data.setValue(1, 0, &#8216;Eat&#8217;);<br />
data.setValue(1, 1, 2);<br />
//&#8230;<br />
var chart = new google.visualization.PieChart(document.getElementById(&#8216;chart_div&#8217;));<br />
chart.draw(data, {width: 400, height: 240, is3D: true, title: &#8216;My Daily Activities&#8217;});<br />
}</p></blockquote>
<p>Note that your HTML needs to have DIV with id chart_div where graph is to show up.</p>
<p><a href="http://programmingandmore.files.wordpress.com/2008/12/icon-piechart.png"><img class="alignnone size-full wp-image-25" title="icon-piechart" src="http://programmingandmore.files.wordpress.com/2008/12/icon-piechart.png?w=700" alt="icon-piechart"   /></a><a href="http://programmingandmore.files.wordpress.com/2008/12/icon-areachart.png"><img class="alignnone size-full wp-image-26" title="icon-areachart" src="http://programmingandmore.files.wordpress.com/2008/12/icon-areachart.png?w=700" alt="icon-areachart"   /></a><a href="http://programmingandmore.files.wordpress.com/2008/12/icon-intensitymap.png"><img class="alignnone size-full wp-image-27" title="icon-intensitymap" src="http://programmingandmore.files.wordpress.com/2008/12/icon-intensitymap.png?w=700" alt="icon-intensitymap"   /></a><a href="http://programmingandmore.files.wordpress.com/2008/12/icon-orgchart.png"><img class="alignnone size-full wp-image-28" title="icon-orgchart" src="http://programmingandmore.files.wordpress.com/2008/12/icon-orgchart.png?w=700" alt="icon-orgchart"   /></a></p>
<p>Not too complex, but how to control data, how to dynamically populate chart values from database for example. You can always manipulate html, js output and parse dynamically using php js code lines. It&#8217;s possible but it becomes messy soon. It&#8217;s much better way to develop <a href="http://code.google.com/apis/visualization/documentation/dev/implementing_data_source.html" target="_blank">data source</a> which outputs JSON and change your code a bit:</p>
<blockquote><p>function drawChart() {<br />
var dsURL = &#8216;http://<em>datasourceurl</em>&#8216;;<br />
var query = new google.visualization.Query(dsURL);<br />
//cal query and set handle function<br />
query.send(handleQueryResponse);<br />
}</p></blockquote>
<p>define callback method to handle response from datasource:</p>
<blockquote><p>function handleQueryResponse(response) {<br />
if (response.isError()) {<br />
alert(&#8216;Error in query: &#8216; + response.getMessage() + &#8216; &#8216; + response.getDetailedMessage());<br />
return;<br />
}<br />
//get data<br />
<strong>var data = response.getDataTable();</strong><br />
var chart = new google.visualization.PieChart(document.getElementById(&#8216;chart_div&#8217;));<br />
chart.draw(data,{width: 700, height: 400, is3D: true, title: &#8216;Sold Cars in 2007&#8242;});<br />
}</p></blockquote>
<p>Key question is how to develop data source? Here google provided specification <a href="http://code.google.com/apis/visualization/documentation/dev/implementing_data_source.html">http://code.google.com/apis/visualization/documentation/dev/implementing_data_source.html</a></p>
<p>In order to organize my code better I create a simple class <a title="google visualization php class source" href="http://rukavina.co.cc/google/visualization/docs/class.GVisDS.zip">class.GVisDS.php</a> which could be helpful. Here&#8217;s sample usage:</p>
<p>//create DS object<br />
$ds = new GVisDS();<br />
//define cols<br />
$ds-&gt;addColumn(&#8220;country&#8221;,&#8221;string&#8221;,&#8221;Country&#8221;);<br />
$ds-&gt;addColumn(&#8220;sold&#8221;,&#8221;number&#8221;,&#8221;Sold Cars&#8221;);<br />
//add data rows<br />
$result = mysql_query(&#8220;SELECT * FROM sold_cars_country&#8221;);<br />
if($result &amp;&amp; mysql_num_rows($result)){<br />
while($l = mysql_fetch_assoc($result)){<br />
$ds-&gt;addRow(array(<br />
&#8220;country&#8221;            =&gt; $l['country_code'],<br />
&#8220;sold&#8221;                =&gt; $l['amount']<br />
));<br />
}<br />
}<br />
echo $ds-&gt;getJSResponse();</p>
<p>So it reads data for sample table sold_cars_country which has 2 columns: country_code and amount. At the end it just prints out JS response (JSON array).</p>
<div id="attachment_29" class="wp-caption alignnone" style="width: 490px"><a title="Live example" href="http://rukavina.co.cc/google/visualization/timeline.html" target="_blank"><img class="size-full wp-image-29" title="timeline" src="http://programmingandmore.files.wordpress.com/2008/12/timeline.png?w=700" alt="Timeline"   /></a><p class="wp-caption-text">Timeline</p></div>
<p>Take a look at live examples:</p>
<ul>
<li><a href="http://rukavina.co.cc/google/visualization/timeline.html" target="_blank">timeline</a></li>
<li><a href="http://rukavina.co.cc/google/visualization/pie-chart.html" target="_blank">pie</a></li>
<li><a href="http://rukavina.co.cc/google/visualization/line-chart.html" target="_blank">line</a></li>
<li><a href="http://rukavina.co.cc/google/visualization/column-chart.html" target="_blank">column</a></li>
<li><a href="http://rukavina.co.cc/google/visualization/area-chart.html" target="_blank">area</a></li>
<li><a href="http://rukavina.co.cc/google/visualization/map-chart.html" target="_blank">map</a></li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/programmingandmore.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/programmingandmore.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/programmingandmore.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/programmingandmore.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/programmingandmore.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/programmingandmore.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/programmingandmore.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/programmingandmore.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/programmingandmore.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/programmingandmore.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/programmingandmore.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/programmingandmore.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/programmingandmore.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/programmingandmore.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingandmore.wordpress.com&amp;blog=5669306&amp;post=21&amp;subd=programmingandmore&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://programmingandmore.wordpress.com/2008/12/05/creating-google-visualization-data-source-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04391622821491ddcc3cb2dd112deebe?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rukavina</media:title>
		</media:content>

		<media:content url="http://programmingandmore.files.wordpress.com/2008/12/visualization.gif" medium="image">
			<media:title type="html">visualization</media:title>
		</media:content>

		<media:content url="http://programmingandmore.files.wordpress.com/2008/12/icon-piechart.png" medium="image">
			<media:title type="html">icon-piechart</media:title>
		</media:content>

		<media:content url="http://programmingandmore.files.wordpress.com/2008/12/icon-areachart.png" medium="image">
			<media:title type="html">icon-areachart</media:title>
		</media:content>

		<media:content url="http://programmingandmore.files.wordpress.com/2008/12/icon-intensitymap.png" medium="image">
			<media:title type="html">icon-intensitymap</media:title>
		</media:content>

		<media:content url="http://programmingandmore.files.wordpress.com/2008/12/icon-orgchart.png" medium="image">
			<media:title type="html">icon-orgchart</media:title>
		</media:content>

		<media:content url="http://programmingandmore.files.wordpress.com/2008/12/timeline.png" medium="image">
			<media:title type="html">timeline</media:title>
		</media:content>
	</item>
		<item>
		<title>How Does Google Make All Those GDATA APIs?</title>
		<link>http://programmingandmore.wordpress.com/2008/11/29/how-does-google-make-all-those-gdata-apis/</link>
		<comments>http://programmingandmore.wordpress.com/2008/11/29/how-does-google-make-all-those-gdata-apis/#comments</comments>
		<pubDate>Sat, 29 Nov 2008 11:27:44 +0000</pubDate>
		<dc:creator>rukavina</dc:creator>
				<category><![CDATA[google]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[atom]]></category>
		<category><![CDATA[atompub]]></category>
		<category><![CDATA[gdata]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[webservice]]></category>

		<guid isPermaLink="false">http://programmingandmore.wordpress.com/?p=3</guid>
		<description><![CDATA[If you have ever visited this page http://code.google.com/apis you would find impressive number of available APIs to use google services in your own applications. Some of them have specific way to be included in your projects but most of them use a common platform. Google call it GDATA. It&#8217;s both format specification for the data [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingandmore.wordpress.com&amp;blog=5669306&amp;post=3&amp;subd=programmingandmore&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id="attachment_6" class="wp-caption alignright" style="width: 135px"><a href="http://programmingandmore.files.wordpress.com/2008/11/gdata-atom.png"><img class="size-full wp-image-6" title="gdata-atom" src="http://programmingandmore.files.wordpress.com/2008/11/gdata-atom.png?w=700" alt="GDATA Atom Logo"   /></a><p class="wp-caption-text">GDATA Atom Logo</p></div>
<p>If you have ever visited this page <a title="Google APis" href="http://code.google.com/apis" target="_blank">http://code.google.com/apis</a> you would find impressive number of available APIs to use google services in your own applications. Some of them have specific way to be included in your projects but most of them use a common platform. Google call it <a title="GDATA" href="http://code.google.com/apis/gdata/" target="_blank">GDATA</a>. It&#8217;s both format specification for the data to be received and sent to/from clients and the protocol how to do that. Actually there isn&#8217;t much of new technology it&#8217;s all about xml and http and that&#8217;s why it&#8217;s simple and great. To be more precise it&#8217;s not even new specification but it&#8217;s an extension to <a href="http://www.ietf.org/rfc/rfc4287" target="_blank">atom syndication xml format</a> and <a href="http://tools.ietf.org/html/rfc5023" target="_blank">atom publication protocol</a> (AtomPub). So it&#8217;s really great that behind this there is a standard so there must be great tools and libraries to create and use atom based services like google gdata apis.</p>
<p><span id="more-3"></span><a href="http://programmingandmore.files.wordpress.com/2008/11/google-apis.gif"><img class="size-full wp-image-5" title="google-apis" src="http://programmingandmore.files.wordpress.com/2008/11/google-apis.gif?w=700" alt="Google APIs Page"   /></a></p>
<div class="mceTemp">
<dl class="wp-caption alignnone">
<dd class="wp-caption-dd">Google APIs Page</dd>
</dl>
</div>
<p>Actually yes and no. Yes, there are a lot of <a href="http://code.google.com/apis/gdata/clientlibs.html" target="_blank">client libraries</a> but what if you want to create your own api &#8211; your own atom based service/server? I&#8217;m particularly interested in some kind of php framework to do so. Imagine you have great mysql-php web application (<a href="http://en.wikipedia.org/wiki/Software_as_a_Service" target="_blank">SaaS</a> if you feel geeky) and you want to extend it to create  another interface, not human readable like web page but to expose data to be processed by other software. Should you write custom interface: custom protocol and custom data? Should you write SOAP web service functions ? Last one could be easy since it has good support for all programming languages and development tools &#8211; it&#8217;s almost as easy as writing or calling local methods. The problems is that each api has it&#8217;s own set of methods and complex in/out parameters. Basically all we need is just 4 methods to manage the world (or any data entity): Create, Retreive, Update, Delete or in http terminology: Post, Get, Put, Delete. Defining data format to be transferred is more complex but atom is good enough to start with. But what about common framework or platform? For example youtube existed before google bought it and provided us <a href="http://code.google.com/apis/youtube/overview.html" target="_blank">youtube api</a> to read and write youtube data, as well as their other service. I&#8217;m sure they have common framework to be extended for particular service.</p>
<p>After googling I found these:</p>
<p><a href="http://www.isolani.co.uk/blog/atom/PhpAtomApiImplementation" target="_blank">http://www.isolani.co.uk/blog/atom/PhpAtomApiImplementation</a><br />
<a href="http://code.google.com/p/php-atompub-server/" target="_blank">http://code.google.com/p/php-atompub-server/</a></p>
<p>While these are great to explore possibilities, I was looking for something <a title="MVC" href="http://en.wikipedia.org/wiki/Model-view-controller" target="_blank">MVC</a> like, to share similar philosophy with <a href="http://cakephp.org/" target="_blank">cakephp</a>, <a href="http://codeigniter.com/" target="_blank">codeigniter</a> etc. but to produce Atom XML input/output instead of human readable (x)html. I decided to start my own project <a href="http://code.google.com/p/atom-php-framework/" target="_blank">Atom Php Framework</a>. It&#8217;s based on just a few classes to be extended to develop custom AtomPub server: controller, parser, model and atom elements.</p>
<div class="wp-caption alignnone" style="width: 602px"><a href="http://code.google.com/p/atom-php-framework/wiki/Diagrams"><img title="APF component diagram" src="http://atom-php-framework.googlecode.com/svn/trunk/docs/get-implementation-diagram.jpg" alt="APF component diagram" width="592" height="342" /></a><p class="wp-caption-text">APF component diagram</p></div>
<p>I&#8217;m looking forward to seeing your comments or maybe &#8220;insider&#8221; information which could help us answer the heading question. Bottom line is that php community really needs common platform to develop AtomPub services.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/programmingandmore.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/programmingandmore.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/programmingandmore.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/programmingandmore.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/programmingandmore.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/programmingandmore.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/programmingandmore.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/programmingandmore.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/programmingandmore.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/programmingandmore.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/programmingandmore.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/programmingandmore.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/programmingandmore.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/programmingandmore.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingandmore.wordpress.com&amp;blog=5669306&amp;post=3&amp;subd=programmingandmore&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://programmingandmore.wordpress.com/2008/11/29/how-does-google-make-all-those-gdata-apis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04391622821491ddcc3cb2dd112deebe?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rukavina</media:title>
		</media:content>

		<media:content url="http://programmingandmore.files.wordpress.com/2008/11/gdata-atom.png" medium="image">
			<media:title type="html">gdata-atom</media:title>
		</media:content>

		<media:content url="http://programmingandmore.files.wordpress.com/2008/11/google-apis.gif" medium="image">
			<media:title type="html">google-apis</media:title>
		</media:content>

		<media:content url="http://atom-php-framework.googlecode.com/svn/trunk/docs/get-implementation-diagram.jpg" medium="image">
			<media:title type="html">APF component diagram</media:title>
		</media:content>
	</item>
	</channel>
</rss>
