<?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/"
	>

<channel>
	<title>Amit Yadav &#187; PHP</title>
	<atom:link href="http://www.amityadav.name/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.amityadav.name</link>
	<description>Things to know for effective coding</description>
	<lastBuildDate>Fri, 10 Sep 2010 04:32:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>PHP ORM: Doctrine 2</title>
		<link>http://www.amityadav.name/php-orm-doctrine-2/</link>
		<comments>http://www.amityadav.name/php-orm-doctrine-2/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 03:51:20 +0000</pubDate>
		<dc:creator>Amit</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[Object-Oriented]]></category>
		<category><![CDATA[Object-oriented programming]]></category>
		<category><![CDATA[Object-relational mapping]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Programming language]]></category>
		<category><![CDATA[Same Old Php Orm View]]></category>

		<guid isPermaLink="false">http://www.amityadav.name/?p=672</guid>
		<description><![CDATA[At the start of my career as a developer, there were almost no ORM for PHP, there existed some classes that enabled you to easily access DB but not ORM. ORM(Object Relational Mapping) in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. In other words it maps the relational database [...]]]></description>
			<content:encoded><![CDATA[<p><img style="visibility: hidden; width: 0px; height: 0px;" src="http://counters.gigya.com/wildfire/IMP/CXNID=2000002.0NXC/bT*xJmx*PTEyODQwOTAxMTk*NjkmcHQ9MTI4NDA5MDEyNTAxNSZwPTEwMTkxJmQ9c3NfZW1iZWQmZz*yJm89YTIyNzQ4NWM4M2I*/NGE*ODk4MjIyM2JiM2E3NDMyNGImb2Y9MA==.gif" border="0" alt="" width="0" height="0" /></p>
<p>At the start of my career as a developer, there were almost no <a class="zem_slink" title="Object-relational mapping" rel="wikipedia" href="http://en.wikipedia.org/wiki/Object-relational_mapping">ORM</a> for <a class="zem_slink" title="PHP" rel="homepage" href="http://www.php.net/">PHP</a>, there existed some classes that enabled you to easily access DB but not ORM.</p>
<p>ORM(Object Relational Mapping) in computer <a class="zem_slink" title="Computer software" rel="wikipedia" href="http://en.wikipedia.org/wiki/Computer_software">software</a> is a <a title="Computer programming" href="http://en.wikipedia.org/wiki/Computer_programming">programming</a> technique for converting data between incompatible <a title="Type system" href="http://en.wikipedia.org/wiki/Type_system">type systems</a> in <a title="Object-oriented" href="http://en.wikipedia.org/wiki/Object-oriented">object-oriented</a> programming languages. In other words it maps the relational database to the objects in your application. So each table becomes and object.</p>
<p>Doctrine is one of the powerful ORM present for PHP and with Doctrine 2 its has provided more features and ease of accessing database.</p>
<div style="width: 425px;"><strong><a title="Doctrine 2 - Not The Same Old Php Orm" href="http://www.slideshare.net/jwage/doctrine-2-not-the-same-old-php-orm">Doctrine 2 &#8211; Not The Same Old Php Orm</a></strong><object id="__sse3197175" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=doctrine2-notthesameoldphporm-100216104508-phpapp01&amp;stripped_title=doctrine-2-not-the-same-old-php-orm" /><param name="name" value="__sse3197175" /><param name="allowfullscreen" value="true" /><embed id="__sse3197175" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=doctrine2-notthesameoldphporm-100216104508-phpapp01&amp;stripped_title=doctrine-2-not-the-same-old-php-orm" name="__sse3197175" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
<div id="__ss_3197175" style="width: 425px;">
<div style="padding: 5px 0 12px;">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/jwage">Jonathan Wage</a>.</div>
</div>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/pixy.gif?x-id=b0c94c79-5057-49ba-9485-b62d893e955e" alt="" /><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.amityadav.name/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.amityadav.name/php-orm-doctrine-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP Migrations Plugin</title>
		<link>http://www.amityadav.name/cakephp-migrations-plugin/</link>
		<comments>http://www.amityadav.name/cakephp-migrations-plugin/#comments</comments>
		<pubDate>Mon, 06 Sep 2010 04:22:03 +0000</pubDate>
		<dc:creator>Amit</dc:creator>
				<category><![CDATA[Application Design]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[migrations]]></category>

		<guid isPermaLink="false">http://www.amityadav.name/?p=627</guid>
		<description><![CDATA[I regularly read through http://cakedc.com/, they have lots of CakePHP plugin that i can use in my CakePHP development. I was facing some problems with cakePHP migrations, i am not saying that CakePHP does not support that but its not come by default with the framework, you have to put some efforts to get it done. [...]]]></description>
			<content:encoded><![CDATA[<p>I regularly read through http://cakedc.com/, they have lots of CakePHP plugin that i can use in my CakePHP development. I was facing some problems with cakePHP migrations, i am not saying that CakePHP does not support that but its not come by default with the framework, you have to put some efforts to get it done.<br />
I came across <a title="CakePHP Migration Plugin" href="http://cakedc.com/eng/downloads/view/cakephp_migrations_plugin" target="_blank">this </a>CakePHP migration plugin that seems to be very useful in keeping my DB migration manageable.</p>
<p>The Migrations plugin provides a comprehensive management system  whereby the database schema for a CakePHP project can fluctuate during  development involving any number of developers. This is achieved by  incrementally managing database changes, providing customisable hooks  and callbacks for data migration and changes to meet migration paths,  and migration maps to provide flexible application of migration  instances.</p>
<p>Migrations is great for any development team, or individual that  wants to manage database schema and data changes throughout the  development lifetime of a project.</p>
<h3>Requirements</h3>
<p>CakePHP 1.3 or higher.</p>
<p>If you need a version to use with CakePHP 1.2 please contact us directly.</p>
<p>You can download the plugin from CakeDC site http://cakedc.com/eng/downloads/view/cakephp_migrations_plugin</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.amityadav.name/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.amityadav.name/cakephp-migrations-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP Paginate Count with group by</title>
		<link>http://www.amityadav.name/cakephp-paginate-count-with-group-by/</link>
		<comments>http://www.amityadav.name/cakephp-paginate-count-with-group-by/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 09:08:04 +0000</pubDate>
		<dc:creator>Amit</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://www.amityadav.name/?p=584</guid>
		<description><![CDATA[I am working on a CakePHP project these days, today i ran into a different problem with CakePHP. Sometimes i feel that there are small-small things that are sometimes missed by the Cake developers, but thank God that there are some workarounds available to them.  Here is the problem statement that i encountered, i had [...]]]></description>
			<content:encoded><![CDATA[<p>I am working on a CakePHP project these days, today i ran into a different problem with CakePHP. Sometimes i feel that there are small-small things that are sometimes missed by the Cake developers, but thank God that there are some workarounds available to them.  Here is the problem statement that i encountered, i had a table in which i was having duplicate records and i wanted to show only distinct records in the data grid which was using the CakePHP paginator class to create a paginated data grid.</p>
<p>Now to show only the distinct rows i used the group by clause to eliminate the duplicate records, the records were coming fine but when i saw the paging it was not working right at all. The problem was that the paginator&#8217;s &#8220;paginateCount&#8221; function was also considering the &#8220;Group By&#8221; clause while doing the counting of the total records. This was crazy.</p>
<p>I searched through Google to get a solution to that and found <a href="https://trac.cakephp.org/ticket/5123" target="_blank">this </a>link, where people have already reported a his error to the cake developers. The solution that worked for me was that i needed to override the &#8220;paginateCount&#8221; function and use a different function in my model to get the correct number of total records. I added this function to my model and whola it worked for me. Here is the function that needs to be added model to get things right.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p584code2'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5842"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code" id="p584code2"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> paginateCount<span style="color: #009900;">&#40;</span><span style="color: #000088;">$conditions</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$recursive</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$extra</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$parameters</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/compact"><span style="color: #990000;">compact</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'conditions'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'recursive'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$extra</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'group'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$parameters</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'fields'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$extra</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'group'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/is_string"><span style="color: #990000;">is_string</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parameters</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'fields'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #666666; font-style: italic;">// pagination with single GROUP BY field</span>
				<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parameters</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'fields'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">9</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'DISTINCT '</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #000088;">$parameters</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'fields'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'DISTINCT '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$parameters</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'fields'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
				<a href="http://www.php.net/unset"><span style="color: #990000;">unset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$extra</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'group'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>find<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'count'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array_merge"><span style="color: #990000;">array_merge</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parameters</span><span style="color: #339933;">,</span> <span style="color: #000088;">$extra</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #666666; font-style: italic;">// resort to inefficient method for multiple GROUP BY fields</span>
				<span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>find<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'count'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array_merge"><span style="color: #990000;">array_merge</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parameters</span><span style="color: #339933;">,</span> <span style="color: #000088;">$extra</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>getAffectedRows<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// regular pagination</span>
			<span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>find<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'count'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array_merge"><span style="color: #990000;">array_merge</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parameters</span><span style="color: #339933;">,</span> <span style="color: #000088;">$extra</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$count</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/pixy.gif?x-id=cc53dd5d-c0c6-46ff-8d1d-eb7ae69e4fea" alt="" /><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.amityadav.name/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.amityadav.name/cakephp-paginate-count-with-group-by/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CakePHP Sharing sessions between apps on the same domain</title>
		<link>http://www.amityadav.name/cakephp-sharing-sessions-between-apps-on-the-same-domain/</link>
		<comments>http://www.amityadav.name/cakephp-sharing-sessions-between-apps-on-the-same-domain/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 10:07:43 +0000</pubDate>
		<dc:creator>Amit</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.amityadav.name/?p=415</guid>
		<description><![CDATA[Few days back i was working on two separate CakePHP applications, suddenly there was a need to maintain session between these two separate apps working on the same domain. Let me explain a bit more. Cake-logo Image via Wikipedia I was having two apps (i)wishlist (ii) lighthouse These are two separate apps under the root [...]]]></description>
			<content:encoded><![CDATA[<p>Few days back i was working on two separate <a class="zem_slink" title="CakePHP" rel="wikipedia" href="http://en.wikipedia.org/wiki/CakePHP">CakePHP</a> <a class="zem_slink" title="Application software" rel="wikipedia" href="http://en.wikipedia.org/wiki/Application_software">applications</a>, suddenly there was a need to maintain session between these two separate apps working on the same domain. Let me explain a bit more.</p>
<div class="zemanta-img zemanta-action-dragged" style="margin: 1em; display: block;">
<div>
<dl class="wp-caption alignright" style="width: 190px;">
<dt class="wp-caption-dt"><div class="img " style="width:76px;">
	<a href="http://en.wikipedia.org/wiki/File:Cake-logo.png"><img src="http://upload.wikimedia.org/wikipedia/en/9/9a/Cake-logo.png" alt="Cake-logo" width="76" height="76" /></a>
	<div>Cake-logo</div>
</div></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;">Image via <a href="http://en.wikipedia.org/wiki/File:Cake-logo.png">Wikipedia</a></dd>
</dl>
</div>
</div>
<p>I was having two apps (i)wishlist (ii) lighthouse</p>
<p>These are two separate apps under the root folder having the directory structure as:<br />
/htdocs<br />
/wishlist<br />
/app<br />
/config<br />
&#8230;.<br />
/lighthouse<br />
/app<br />
/config &#8230;.</p>
<p>By default the sessions are created relative to the apps directory, and this was the problem i was dealing with, not a big thing but i spent a lot of time figuring this, but for you its will work like a charm.</p>
<p>Steps that i follow to make the two apps share sessions between them.<br />
<strong>1.</strong> Edit &#8220;core.php&#8221; for wishlist and the lighthouse and add the line<br />
<span style="color: #ff0000;">ini_set(&#8216;session.cookie_path&#8217;, &#8220;/&#8221;);</span><br />
This is to direct the CakePHP app to create the session on the root</p>
<p><strong>2. </strong>The <strong>Session.cookie</strong> name should be same for the two apps</p>
<p><strong>3.</strong> The <strong>Session.salt</strong> should be same for the two apps</p>
<p><strong>4.</strong> Security.level should be low in both the apps</p>
<p>This is it what is required. Let me know if you are still stuck with the things, happy coding.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/pixy.gif?x-id=8d80a122-92fc-4bf8-bbf4-c6a5617afc42" alt="" /><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.amityadav.name/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.amityadav.name/cakephp-sharing-sessions-between-apps-on-the-same-domain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Fuzzy Address Matching Algo (Levenshtein)</title>
		<link>http://www.amityadav.name/php-fuzzy-address-matching-algo-levenshtein/</link>
		<comments>http://www.amityadav.name/php-fuzzy-address-matching-algo-levenshtein/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 10:13:30 +0000</pubDate>
		<dc:creator>Amit</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[levenshtein]]></category>

		<guid isPermaLink="false">http://www.amityadav.name/?p=409</guid>
		<description><![CDATA[Few days back i encountered a weird problem. I had three tables in my DB viz: students, sites, company. Student table has the address fields and a column named &#8220;site_id&#8221; to connect it to the sites table. Sites table also has its address fields. Now the challenge was to update the &#8220;site_id&#8221; field of the [...]]]></description>
			<content:encoded><![CDATA[<p>Few days back i encountered a weird problem.<br />
I had three tables in my DB viz: students, sites, company. Student table has the address fields and a column named &#8220;site_id&#8221; to connect it to the sites table. Sites table also has its address fields.</p>
<p>Now the challenge was to update the &#8220;site_id&#8221; field of the students table based on the matching address in the student and the site table. The address fields in both the tables were divided into following fields</p>
<ul>
<li> address1</li>
<li> address2</li>
<li> city</li>
<li> state</li>
<li> country</li>
<li> zip</li>
</ul>
<p>Now i had to think of a solution of how to do it. After googling a while i found a function called &#8220;levenshtein()&#8221; in PHP. This function calculated the distance between two given strings, bingo i got an idea and implemented the sddress matching algorithm. I have attached the file with this post.<br />
Kindly let me if that was helpful to you.</p>
<p>Download the code from here -&gt; <a href="../wp-content/uploads/2010/04/fuzzy-match.pdf">fuzzy-match</a></p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/pixy.gif?x-id=11459b1d-9cf9-4078-9aec-0c84c184c5ba" alt="" /><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.amityadav.name/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.amityadav.name/php-fuzzy-address-matching-algo-levenshtein/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook: HipHop for PHP</title>
		<link>http://www.amityadav.name/facebook-hiphop-for-php/</link>
		<comments>http://www.amityadav.name/facebook-hiphop-for-php/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 06:25:12 +0000</pubDate>
		<dc:creator>Amit</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Hip hop]]></category>
		<category><![CDATA[Just-in-time compilation]]></category>

		<guid isPermaLink="false">http://www.amityadav.name/?p=396</guid>
		<description><![CDATA[﻿Facebook officially announced the project, titled HipHop, this morning and confirmed that it would be released as open source this evening. Facebook has been working on a PHP compiler that will increase speed by around 80% and offer a just-in-time (JIT) compilation engine that will offer a number of advantages. Less CPU means fewer servers, which [...]]]></description>
			<content:encoded><![CDATA[<p>﻿Facebook officially announced the project, titled HipHop, this morning and confirmed that it would be  released as <a class="zem_slink" title="Open source" rel="wikipedia" href="http://en.wikipedia.org/wiki/Open_source">open source</a> this evening.</p>
<p><a class="zem_slink" title="Facebook" rel="homepage" href="http://facebook.com">Facebook</a> has been working on a <a class="zem_slink" title="PHP" rel="homepage" href="http://www.php.net/">PHP</a> <a class="zem_slink" title="Compiler" rel="wikipedia" href="http://en.wikipedia.org/wiki/Compiler">compiler</a> that will increase  speed by around 80% and offer a just-in-time (<a class="zem_slink" title="Just-in-time compilation" rel="wikipedia" href="http://en.wikipedia.org/wiki/Just-in-time_compilation">JIT</a>) compilation engine  that will offer a number of advantages.</p>
<p>Less <a class="zem_slink" title="Central processing unit" rel="wikipedia" href="http://en.wikipedia.org/wiki/Central_processing_unit">CPU</a> means fewer servers, which means less overhead. This project  has had a tremendous impact on Facebook</p>
<p>HipHop for PHP isn&#8217;t technically a compiler itself, it is a source <a class="zem_slink" title="Source code" rel="wikipedia" href="http://en.wikipedia.org/wiki/Source_code">code</a> transformer.  HipHop programmatically transforms your  PHP source code into highly optimized C++ and then uses g++ to compile  it.</p>
<p>HipHop executes the source code in a semantically equivalent manner and  sacrifices some rarely used features — such as <a class="zem_slink" title="Eval" rel="wikipedia" href="http://en.wikipedia.org/wiki/Eval">eval()</a> — in exchange for  improved performance.</p>
<p>HipHop includes a code transformer, a reimplementation of PHP&#8217;s <a class="zem_slink" title="Run-time system" rel="wikipedia" href="http://en.wikipedia.org/wiki/Run-time_system">runtime  system</a>, and a rewrite of many common PHP Extensions to take advantage of  these performance optimizations.</p>
<p>You can read more about HipHop <a title="HipHop" href="http://developers.facebook.com/news.php?blog=1&amp;story=358">here</a></p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/pixy.gif?x-id=e26871b7-b7f7-4fd9-8ef4-ef80f4aaa634" alt="" /><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.amityadav.name/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.amityadav.name/facebook-hiphop-for-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nice to visit Websites</title>
		<link>http://www.amityadav.name/nice-to-visit-websites/</link>
		<comments>http://www.amityadav.name/nice-to-visit-websites/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 07:06:29 +0000</pubDate>
		<dc:creator>Amit</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web design]]></category>

		<guid isPermaLink="false">http://www.amityadav.name/?p=132</guid>
		<description><![CDATA[General Resources An A-Z Index of the Bash command line for Linux. Happy Christmas List of file formats Complete Listing of World Wonders Resources for Web Design PHP Resources PHP:  Hypertext Preprocessor PHP Builder:  The Resource For PHP Developers Zend Technologies:  PHP Tools PHP Wizard:  Building Dynamic Websites with PHP PHP Resource Index PHP Knowledge [...]]]></description>
			<content:encoded><![CDATA[<h2><strong>General Resources</strong></h2>
<ul>
<li><a title="An A-Z Index of the Bash command line for Linux." href="http://www.ss64.com/bash/" target="_blank">An A-Z Index of the </a><span class="grn"><a title="An A-Z Index of the Bash command line for Linux." href="http://www.ss64.com/bash/" target="_blank">Bash</a></span><a title="An A-Z Index of the Bash command line for Linux." href="http://www.ss64.com/bash/" target="_blank"> command line for Linux.</a></li>
<li><a title="Happy Christmas" href="http://www.akqa.com/happychristmas/" target="_blank">Happy Christmas</a></li>
<li><a title="All file formats" href="http://www.ace.net.nz/tech/TechFileFormat.html" target="_blank">List of file formats</a></li>
<li><a title="Complete Listing of World Wonders" href="http://www.wonderclub.com/AllWorldWonders.html" target="_blank">Complete Listing of World Wonders</a></li>
<li><a title="Web Design Resources" href="http://www.kayodeok.btinternet.co.uk/favorites/webdesign.htm" target="_blank">Resources for Web Design</a></li>
</ul>
<h2><strong>PHP Resources</strong></h2>
<div class="cell">
<ul>
<li><a href="http://www.php.net/">PHP:  Hypertext Preprocessor</a></li>
<li><a href="http://www.phpbuilder.com/">PHP Builder:  The Resource For PHP Developers</a></li>
<li><a href="http://www.zend.com/">Zend Technologies:  PHP Tools</a></li>
<li><a href="http://www.phpwizard.net/">PHP Wizard:  Building Dynamic Websites with PHP</a></li>
<li><a href="http://php.resourceindex.com/">PHP Resource Index</a></li>
<li><a href="http://www.faqts.com/knowledge_base/index.phtml/fid/51">PHP Knowledge Base</a></li>
<li><a href="http://www.evilwalrus.com/">Evil Walrus Group:  PHP at is best</a></li>
<li><a href="http://www.thescripts.com/serversidescripting/php/">TheScripts.com:  PHP</a></li>
<li><a href="http://www.hotscripts.com/PHP/">HotScripts.com:  PHP</a></li>
<li><a href="http://www.php.net/links.php">PHP.Net:  Links</a></li>
<li><a href="http://hotwired.lycos.com/webmonkey/programming/php/index.html">WebMonkey: PHP</a></li>
<li><a href="http://www.d.umn.edu/itss/support/Training/Online/webdesign/php.html">Web Design Reference: PHP</a></li>
<li><a href="http://www.devshed.com/Server_Side/PHP">DevShed &#8211; PHP Articles</a></li>
<li><a href="http://alltasks.net/code/php_coding_standard.html">PHP Coding Standard</a></li>
<li><a href="http://www.alt-php-faq.org/">PHP FAQ</a></li>
<li><a href="http://www.zend.com/zend/tut/">Zend: PHP Tutorials</a></li>
<li><a href="http://simon.incutio.com/archive/2003/06/17/theHolyGrail">Easier Form Validation with PHP</a></li>
<li><a href="http://www.alt-php-faq.org/">alt.php faq</a></li>
<li><a href="http://www.devshed.com/c/a/PHP/PHP-Security-Mistakes/">PHP Security Mistakes</a></li>
<li><a href="http://www-106.ibm.com/developerworks/linux/library/wa-phprock1/">Develop rock-solid code in PHP: Lay the foundation, Part 1</a></li>
<li><a href="http://www-106.ibm.com/developerworks/library/wa-phprock2/">Develop rock-solid code in PHP: Use variables effectively, Part 2</a></li>
<li><a href="http://www-106.ibm.com/developerworks/web/library/wa-phprock3/">Develop rock-solid code in PHP: Write reusable functions, Part 3</a></li>
</ul>
<div>
<div class="cell">
<h2>Web Tools</h2>
<ul>
<li><a href="http://www.delorie.com/web/">Delorie Web Tools</a></li>
<li><a href="http://www.searchengineworld.com/misc/tools.htm">Search Engine World: Online Search Engine Tools</a></li>
<li><a href="http://webtools.mozilla.org/web-sniffer/">Web Sniffer:  View HTTP and HTML Source</a></li>
<li><a href="http://www.delorie.com/web/headers.html">HTTP Header Viewer</a></li>
<li><a href="http://livehttpheaders.mozdev.org/">Live HTTP Headers</a></li>
<li><a href="http://www.httprevealer.com/">HTTP Revealer</a></li>
<li><a href="http://www.delorie.com/web/ses.cgi">Search Engine Simulator</a></li>
<li><a href="http://www.searchengineworld.com/cgi-bin/sim_spider.cgi">Search Engine Spider Simulator</a></li>
<li><a href="http://www.searchengineworld.com/cgi-bin/robotcheck.cgi">Robots.txt Validator</a></li>
<li><a href="http://www.htmlhelp.com/tools/valet/">Link Valet</a></li>
<li><a href="http://validator.w3.org/checklink">Link Checker</a></li>
<li><a href="http://home.snafu.de/tilman/xenulink.html">Xenu&#8217;s Link Sleuth</a></li>
<li><a href="http://perso.wanadoo.fr/ablavier/TidyGUI/">Tidy GUI</a></li>
<li><a href="http://infohound.net/tidy/">HTML Tidy Online</a></li>
<li><a href="http://tidy.sourceforge.net/">HTML Tidy Project Page</a></li>
<li><a href="http://checky.mozdev.org/">Checky Plug-in For Mozilla Based Browser</a></li>
<li><a href="http://linky.mozdev.org/">Linky Plug-in</a></li>
<li><a href="http://editcss.mozdev.org/">EditCSS</a></li>
<li><a href="http://www.delorie.com/web/lynxview.html">Lynx Viewer</a></li>
<li><a href="http://www.websiteoptimization.com/services/analyze/">Web Page Analyzer</a></li>
<li><a href="http://www.dnsreport.com/">DNS Report</a></li>
<li><a href="http://www.sambar.com/wwwping/">WWW Ping</a></li>
</ul>
</div>
</div>
</div>
<p> </p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Zemified by Zemanta" href="http://reblog.zemanta.com/zemified/eeeb0c8b-b05e-4012-9122-605038370a50/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=eeeb0c8b-b05e-4012-9122-605038370a50" alt="Reblog this post [with Zemanta]" /></a></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.amityadav.name/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.amityadav.name/nice-to-visit-websites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basic CMS for converting static sites to dynamic!</title>
		<link>http://www.amityadav.name/basic-cms-for-converting-static-sites-to-dynamic/</link>
		<comments>http://www.amityadav.name/basic-cms-for-converting-static-sites-to-dynamic/#comments</comments>
		<pubDate>Sun, 20 Jul 2008 19:03:40 +0000</pubDate>
		<dc:creator>Amit</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[WYSIWYG]]></category>

		<guid isPermaLink="false">http://www.amityadav.name/basic-cms-for-converting-static-sites-to-dynamic/</guid>
		<description><![CDATA[Here is a solution that can convert a static sites to dynamic site on the fly with very little inputs. Here is a content management system that will manage the content of your sites. This is one of the project that i worked on, its still in very basic version but i am still working [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a solution that can convert a static sites to dynamic site on the fly with very little inputs.</p>
<p>Here is a content management system that will manage the content of your sites. This is one of the project that i worked on, its still in very basic version but i am still working on it. This CMS has following features:</p>
<p>- Create pages and one level sub pages for your site.<br />
- Enable/Disable pages that you do not want other to see while they are still under construction.<br />
- Drag and drop one sub page to other parent without any hassle.<br />
-TinyMCE is integrated as the WYSIWYG editor through which you can easily manage your sites pages.</p>
<p>The file attached contains all the needed code and the sql file.</p>
<p>If anyone need my help in getting things work, please let me know.</p>
<p>So guys lets get the best out of the things.</p>
<p><strong><a title="Download CMS" href="http://amityadav.name/PHP_CMS.rar"><span style="color: #ff0000;">Download</span></a></strong></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.amityadav.name/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.amityadav.name/basic-cms-for-converting-static-sites-to-dynamic/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Improved Error Messages in PHP 5</title>
		<link>http://www.amityadav.name/improved-error-messages-in-php-5/</link>
		<comments>http://www.amityadav.name/improved-error-messages-in-php-5/#comments</comments>
		<pubDate>Fri, 13 Jun 2008 04:33:41 +0000</pubDate>
		<dc:creator>Amit</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.amityadav.name/improved-error-messages-in-php-5/</guid>
		<description><![CDATA[Sometimes its the little things that make a difference. If you run the this test program in PHP 4 (tested on 4.4.7): &#60; ?php function test($arg) { echo "talk like a pirate."; } test(); ?&#62; You get the following message:Warning: Missing argument 1 for test() in /usr/bin/- on line 2 The error message here is [...]]]></description>
			<content:encoded><![CDATA[<div class="content">Sometimes its the little things that make a difference. If you run the this  test program in PHP 4 (tested on 4.4.7):</p>
<pre class="php">&lt; ?php
<span style="font-weight: bold; color: #000000">function</span> test<span style="color: #66cc66">(</span><span style="color: #0000ff">$arg</span><span style="color: #66cc66">)</span> <span style="color: #66cc66">{</span> <a href="http://www.php.net/echo"><span style="color: #000066">echo</span></a> <span style="color: #ff0000">"talk like a pirate."</span>; <span style="color: #66cc66">}</span>
test<span style="color: #66cc66">(</span><span style="color: #66cc66">)</span>;
<span style="font-weight: bold; color: #000000">?&gt;</span></pre>
<p>You get  the following message:<code>Warning: Missing argument 1 for test() in /usr/bin/- on line  2</code></p>
<p>The error message here is reported at the position of the definition of the  function, but really the error was in how the function was called. The required  parameter to test was not passed. This error can be annoying, forcing you to  consult a stack trace to find the actual error location. Something some  beginners may not know how to do.</p>
<p>However, if you run the same message in PHP 5 (tested on 5.2.2):</p>
<p><code>Warning: Missing argument 1 for test(), called in /Users/jeff/- on line  3 and defined in /Users/jeff/- on line 2</code></p>
<p>Sweet improvement!</p>
<p>One more reason to ditch PHP 4 and go php 5.</p></div>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.amityadav.name/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.amityadav.name/improved-error-messages-in-php-5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
