<?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>blog.rudylee.com</title>
	<atom:link href="http://blog.rudylee.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.rudylee.com</link>
	<description>keep it humble</description>
	<lastBuildDate>Tue, 24 Jan 2012 23:13:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Auto redirect in CakePHP jQuery AutoComplete</title>
		<link>http://blog.rudylee.com/2011/12/12/auto-redirect-in-cakephp-jquery-autocomplete/</link>
		<comments>http://blog.rudylee.com/2011/12/12/auto-redirect-in-cakephp-jquery-autocomplete/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 04:11:56 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[ajax autocomplete]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[array controller]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[guest id]]></category>
		<category><![CDATA[guest search]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[line 1]]></category>
		<category><![CDATA[line 3]]></category>
		<category><![CDATA[little bit]]></category>
		<category><![CDATA[result line]]></category>
		<category><![CDATA[search field]]></category>
		<category><![CDATA[select option]]></category>
		<category><![CDATA[time user]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=751</guid>
		<description><![CDATA[Demo : http://cbunny.rudylee.com/autocomplete_redirect Demo source code : https://github.com/rudylee/cbunny In my previous post ( http://blog.rudylee.com/2011/07/25/jquery-ui-autocomplete-in-cakephp/ ) we have successfully integrated the jQuery AutoComplete with CakePHP with a little bit hacky way. Now we gonna add another feature that can redirect user to our desired place when they click the result value in the AutoComplete ( try the demo ...<p><a href="http://blog.rudylee.com/2011/12/12/auto-redirect-in-cakephp-jquery-autocomplete/">Auto redirect in CakePHP jQuery AutoComplete</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<blockquote>
<h2>Demo : <a href="http://cbunny.rudylee.com/autocomplete_redirect">http://cbunny.rudylee.com/autocomplete_redirect</a></h2>
<p>Demo source code :<a href=" https://github.com/rudylee/cbunny"> https://github.com/rudylee/cbunny</a>
</p></blockquote>
<p>In my previous post ( <a href="http://blog.rudylee.com/2011/07/25/jquery-ui-autocomplete-in-cakephp/">http://blog.rudylee.com/2011/07/25/jquery-ui-autocomplete-in-cakephp/</a> ) we have successfully integrated the jQuery AutoComplete with CakePHP with a little bit hacky way. Now we gonna add another feature that can redirect user to our desired place when they click the result value in the AutoComplete ( try the demo for more details ).</p>
<p>So let&#8217;s start the coding ( I assume you have integrated the jQuery UI AutoComplete in your apps, if you haven&#8217;t, just read my previous post ), so basically what we need to do are divided into 4 steps:</p>
<ul>
<li>Wrap the jQuery UI AutoComplete search field in a form tag.</li>
<li>Add a hidden field which will hold the ID of the result.</li>
<li>Add &#8216;select&#8217; option into the helper.</li>
<li>Set up the action that will handle the form submit</li>
</ul>
<p>Here is the sample code :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">create</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'autoComplete'</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'controller'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'users'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'action'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'autoComplete'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'GuestForm'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">hidden</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Guest.id'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Ajax</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">autoComplete</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Guest.search'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'source'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	    <span style="color: #0000ff;">'controller'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'users'</span><span style="color: #339933;">,</span>
	    <span style="color: #0000ff;">'action'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'autoComplete'</span><span style="color: #339933;">,</span>
	    <span style="color: #0000ff;">'prefix'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'admin'</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'select'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'function(event, ui){
	    $(&quot;#GuestId&quot;).val(ui.item.id);
	    $(&quot;#GuestForm&quot;).submit()}'</span>
    <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">?&gt;</span>
    &lt;/form&gt;</pre></td></tr></table></div>

<p>As you can see in line 1, I defined the form and the controller + action that will handle the form submit. Line 2 is the hidden field that will hold the ID of the result. Line 3 is the AutoComplete form, I have added select option into the helper which will run the function defined to it each time user click the result. Line 10 means that the hidden field ( field that has ID GuestID ) will have value based on the AutoComplete Item ID ( which came from ui.item.id) and Line 11 will submit the form.</p>
<p>Here is the sample of the action code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> admin_autoComplete<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">redirect</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'controller'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'users'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'action'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'view'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Guest'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</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: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">autoRender</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$guests</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">User</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getGuests</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	    <span style="color: #0000ff;">'conditions'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'OR'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		    <span style="color: #0000ff;">'User.name LIKE'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'%'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'term'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'%'</span><span style="color: #339933;">,</span>
		    <span style="color: #0000ff;">'User.surname LIKE'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'%'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'term'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'%'</span>
		<span style="color: #009900;">&#41;</span>
	    <span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #990000;">json_encode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">User</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">autoComplete_encode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$guests</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Just ignore line 8 and so, we gonna focus on line 2 to 7. In that line, I redirect the user to the view action which based on the Guest ID which I got from the form. You can change the controller/action in this section. I hope everything is clear. Cheers.</p>
<p><a href="http://blog.rudylee.com/2011/12/12/auto-redirect-in-cakephp-jquery-autocomplete/">Auto redirect in CakePHP jQuery AutoComplete</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2011/12/12/auto-redirect-in-cakephp-jquery-autocomplete/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Holiday has arrived</title>
		<link>http://blog.rudylee.com/2011/11/23/holiday-has-arrived/</link>
		<comments>http://blog.rudylee.com/2011/11/23/holiday-has-arrived/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 07:40:11 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[My Stories]]></category>
		<category><![CDATA[200k]]></category>
		<category><![CDATA[30 minutes]]></category>
		<category><![CDATA[amount of time]]></category>
		<category><![CDATA[current place]]></category>
		<category><![CDATA[girlfriend]]></category>
		<category><![CDATA[holidays]]></category>
		<category><![CDATA[indonesia]]></category>
		<category><![CDATA[indonesian rupiah]]></category>
		<category><![CDATA[new language]]></category>
		<category><![CDATA[passport]]></category>
		<category><![CDATA[point of view]]></category>
		<category><![CDATA[wasting money]]></category>
		<category><![CDATA[wasting time]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=708</guid>
		<description><![CDATA[Today is the last day of my exams and I will have holiday for 3 months. It&#8217;s quite long considering that you spent the same amount of time for study as well. That means in one semester you will have 3 months study and another 3 months for holiday. From my perspective, it&#8217;s not efficient, ...<p><a href="http://blog.rudylee.com/2011/11/23/holiday-has-arrived/">Holiday has arrived</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://blog.rudylee.com/wp-content/uploads/2011/11/3048143981_e990820985_z1.jpg"><img class="size-full wp-image-716 aligncenter" title="3048143981_e990820985_z" src="http://blog.rudylee.com/wp-content/uploads/2011/11/3048143981_e990820985_z1.jpg" alt="" width="590" height="393" /></a></p>
<p>Today is the last day of my exams and I will have holiday for 3 months. It&#8217;s quite long considering that you spent the same amount of time for study as well. That means in one semester you will have 3 months study and another 3 months for holiday. From my perspective, it&#8217;s not efficient, wasting time and of course wasting money <img src='http://blog.rudylee.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> . But who am I to judge the system, the system is there for a reason which I don&#8217;t care much.</p>
<p>So what is my plan for holiday ? not sure, I was planning to go back to Indonesia but looks like I am gonna trapped here with a bunch of works to do. I wish I can surprise my girlfriend by I suddenly appear at her rented room and let her hug me tightly like in the movies but looks like that impossible to happen at the moment. I hope she can understand ( I know she can&#8217;t <img src='http://blog.rudylee.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  ).</p>
<p>By the way, I have a number of tasks that need to be done during this break. First thing is to renew my passport which will be expired in January 2012. Without this passport, I can&#8217;t go back to Indonesia because you need to have passport that expired more than 6 months if you are planning to go overseas. That&#8217;s what I have been told, not sure whether it&#8217;s true or not. It cost around 40$ to get a new passport, not too expensive considering the living cost in here is far different from Indonesia ( 40$ is just like 200k in Indonesian rupiah ).</p>
<p>The second thing is to find new place to stay that closer to my university. My current place is not bad at all considering I have lived there for almost 1 year, quite comfortable with the people that live there and it&#8217;s just around 20-30 minutes walk from my university. But, I think it&#8217;s better if I can find a place that nearer to my university and of course cheaper <img src='http://blog.rudylee.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>The third one and the final one is to complete pending projects that have been waiting for months. Most of them are fun projects which I created to learn new technology. Fascinating, but the reality is not easy as it looks especially because I am well-known for being undisciplined and unmotivated person.</p>
<p>That&#8217;s all my story for this month, still need to write a blog post for last month <img src='http://blog.rudylee.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Picture is taken from <a href="http://www.flickr.com/photos/8810648@N03/3048143981/">http://www.flickr.com/photos/8810648@N03/3048143981/</a></p>
<p><a href="http://blog.rudylee.com/2011/11/23/holiday-has-arrived/">Holiday has arrived</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2011/11/23/holiday-has-arrived/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Short conversation with my mom</title>
		<link>http://blog.rudylee.com/2011/10/23/short-conversation-with-my-mom/</link>
		<comments>http://blog.rudylee.com/2011/10/23/short-conversation-with-my-mom/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 07:54:59 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[My Stories]]></category>
		<category><![CDATA[aja]]></category>
		<category><![CDATA[ama]]></category>
		<category><![CDATA[belom]]></category>
		<category><![CDATA[blom]]></category>
		<category><![CDATA[donk]]></category>
		<category><![CDATA[gitu]]></category>
		<category><![CDATA[gwa]]></category>
		<category><![CDATA[kapan]]></category>
		<category><![CDATA[ketar]]></category>
		<category><![CDATA[koko]]></category>
		<category><![CDATA[lu]]></category>
		<category><![CDATA[mom]]></category>
		<category><![CDATA[pun]]></category>
		<category><![CDATA[rumah]]></category>
		<category><![CDATA[tau]]></category>
		<category><![CDATA[ted]]></category>
		<category><![CDATA[telepon]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=723</guid>
		<description><![CDATA[Sepenggal perbincangan di telepon dengan nyokap&#8230; Gwa: Jadi kapan koko ted bakal married ? ( koko ted adalah panggilan gwa buat koko gwa ) Nyokap: Belom tau, rumah aja blom selesai dibangun. Gwa: Oh gitu&#8230; Nyokap: Jadi setelah si Teddy married, giliran lu lagi la ? Gwa: Enggak donk&#8230; kan beda umur gwa ama koko ...<p><a href="http://blog.rudylee.com/2011/10/23/short-conversation-with-my-mom/">Short conversation with my mom</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Sepenggal perbincangan di telepon dengan nyokap&#8230;</p>
<p>Gwa: Jadi kapan koko ted bakal married ? ( koko ted adalah panggilan gwa buat koko gwa <img src='http://blog.rudylee.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  )</p>
<p>Nyokap: Belom tau, rumah aja blom selesai dibangun.</p>
<p>Gwa: Oh gitu&#8230;</p>
<p>Nyokap: Jadi setelah si Teddy married, giliran lu lagi la ?</p>
<p>Gwa: Enggak donk&#8230; kan beda umur gwa ama koko 5 tahun&#8230; jadi gwa married masih 5 tahun lagi&#8230;</p>
<p>Nyokap: Emang orang tuanya Riani bolehin ? bukannya biasanya orang tua suka ketar ketir kalo belum jelas kek begini. Kalau gwa jadi orang tuanya pun khawatir.</p>
<p>Gwa: &#8230;</p>
<p>PS : kata2 sedikit diubah agar mudah dimengerti</p>
<p><a href="http://blog.rudylee.com/2011/10/23/short-conversation-with-my-mom/">Short conversation with my mom</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2011/10/23/short-conversation-with-my-mom/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Reasons why I hate long weekend</title>
		<link>http://blog.rudylee.com/2011/09/30/reasons-why-i-hate-long-weekend/</link>
		<comments>http://blog.rudylee.com/2011/09/30/reasons-why-i-hate-long-weekend/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 07:44:44 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[My Stories]]></category>
		<category><![CDATA[girlfriend]]></category>
		<category><![CDATA[productive tasks]]></category>
		<category><![CDATA[sleep]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=680</guid>
		<description><![CDATA[Too much sleep Less productive Tasks waiting after holiday and Far away from your girlfriend Reasons why I hate long weekend is a post from: blog.rudylee.com<p><a href="http://blog.rudylee.com/2011/09/30/reasons-why-i-hate-long-weekend/">Reasons why I hate long weekend</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<h1 style="text-align: center;"><strong>Too much sleep</strong><br />
<a href="http://blog.rudylee.com/wp-content/uploads/2011/10/302271589_0a29afd756_z.jpg"><img class="aligncenter size-full wp-image-681" title="302271589_0a29afd756_z" src="http://blog.rudylee.com/wp-content/uploads/2011/10/302271589_0a29afd756_z.jpg" alt="" width="512" height="384" /></a></h1>
<h1 style="text-align: center;"><strong>Less productive</strong></h1>
<p><a href="http://blog.rudylee.com/wp-content/uploads/2011/10/857874987_d8a2142d2a_z.jpg"><img class="aligncenter size-full wp-image-682" title="857874987_d8a2142d2a_z" src="http://blog.rudylee.com/wp-content/uploads/2011/10/857874987_d8a2142d2a_z.jpg" alt="" width="512" height="384" /></a></p>
<h1 style="text-align: center;"><strong>Tasks waiting after holiday</strong><br />
<a href="http://blog.rudylee.com/wp-content/uploads/2011/10/6192893731_716e3567e1_z.jpg"><img class="aligncenter size-full wp-image-687" title="6192893731_716e3567e1_z" src="http://blog.rudylee.com/wp-content/uploads/2011/10/6192893731_716e3567e1_z.jpg" alt="" width="512" height="384" /></a></h1>
<h1 style="text-align: center;"></h1>
<h1 style="text-align: center;"><strong>and</strong></h1>
<h1 style="text-align: center;"></h1>
<h1 style="text-align: center;"><strong>Far away from your girlfriend</strong></h1>
<h1 style="text-align: center;"><a href="http://blog.rudylee.com/wp-content/uploads/2011/10/5422183699_ceda9b84c6_z.jpg"><img class="aligncenter size-full wp-image-690" title="heysey 2" src="http://blog.rudylee.com/wp-content/uploads/2011/10/5422183699_ceda9b84c6_z.jpg" alt="" width="478" height="640" /></a></h1>
<p><a href="http://blog.rudylee.com/2011/09/30/reasons-why-i-hate-long-weekend/">Reasons why I hate long weekend</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2011/09/30/reasons-why-i-hate-long-weekend/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Gource</title>
		<link>http://blog.rudylee.com/2011/08/28/gource/</link>
		<comments>http://blog.rudylee.com/2011/08/28/gource/#comments</comments>
		<pubDate>Sun, 28 Aug 2011 07:39:32 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[Unix and Linux]]></category>
		<category><![CDATA[bazaar]]></category>
		<category><![CDATA[command line tool]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[linux kernel project]]></category>
		<category><![CDATA[software version control]]></category>
		<category><![CDATA[using software]]></category>
		<category><![CDATA[visualization tool]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=640</guid>
		<description><![CDATA[Gource is a software version control visualization tool. It was built using C/C++ ( not sure ). Several version controls that supported by Gource are Git, SVN, Mercurial and Bazaar. Basically Gource is a command line tool that you can use to visualize your project&#8217;s progress that using software version control. Here is the example ...<p><a href="http://blog.rudylee.com/2011/08/28/gource/">Gource</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<blockquote><p>Gource is a software version control visualization tool. It was built using C/C++ ( not sure ). Several version controls that supported by Gource are Git, SVN, Mercurial and Bazaar.</p></blockquote>
<p>Basically Gource is a command line tool that you can use to visualize your project&#8217;s progress that using software version control. Here is the example of my project :</p>
<p><iframe src="http://www.youtube.com/embed/BLFCr0zwYyI" frameborder="0" width="560" height="345"></iframe></p>
<p>Cool isn&#8217;t it ? In my video, there is only one person because I am working for this project alone. However, if you are looking in YouTube, you can find a lot of big projects that using Gource to visualize their progress. One of the project that you should see is the Linux Kernel project.</p>
<p>Here is the link to the <a href="http://code.google.com/p/gource/">Gource Website</a></p>
<p><a href="http://blog.rudylee.com/2011/08/28/gource/">Gource</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2011/08/28/gource/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery UI AutoComplete in CakePHP</title>
		<link>http://blog.rudylee.com/2011/07/25/jquery-ui-autocomplete-in-cakephp/</link>
		<comments>http://blog.rudylee.com/2011/07/25/jquery-ui-autocomplete-in-cakephp/#comments</comments>
		<pubDate>Mon, 25 Jul 2011 03:30:00 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[autocomplete]]></category>
		<category><![CDATA[callback]]></category>
		<category><![CDATA[field options]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[little bit]]></category>
		<category><![CDATA[pl]]></category>
		<category><![CDATA[return string]]></category>
		<category><![CDATA[script check]]></category>
		<category><![CDATA[source options]]></category>
		<category><![CDATA[string field]]></category>
		<category><![CDATA[unset]]></category>
		<category><![CDATA[url options]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=616</guid>
		<description><![CDATA[Demo : http://cbunny.rudylee.com/autocomplete Demo source code : https://github.com/rudylee/cbunny The post to add auto redirect feature into the AutoComplete : http://blog.rudylee.com/2011/12/12/auto-redirect-in-cakephp-jquery-autocomplete/ You can copy the modified Ajax and Javascript helpers from here https://github.com/rudylee/topping Last week I was trying to use jQuery UI Autocomplete in my CakePHP apps. However, CakePHP Ajax and Javascript helpers don&#8217;t support jQuery ...<p><a href="http://blog.rudylee.com/2011/07/25/jquery-ui-autocomplete-in-cakephp/">jQuery UI AutoComplete in CakePHP</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<blockquote>
<h2>Demo : <a href="http://cbunny.rudylee.com/autocomplete">http://cbunny.rudylee.com/autocomplete</a></h2>
<p>Demo source code :<a href=" https://github.com/rudylee/cbunny"> https://github.com/rudylee/cbunny</a><br />
The post to add auto redirect feature into the AutoComplete : <a href="http://blog.rudylee.com/2011/12/12/auto-redirect-in-cakephp-jquery-autocomplete/">http://blog.rudylee.com/2011/12/12/auto-redirect-in-cakephp-jquery-autocomplete/</a><br />
You can copy the modified Ajax and Javascript helpers from here <a href="https://github.com/rudylee/topping">https://github.com/rudylee/topping</a></p></blockquote>
<p>Last week I was trying to use <a href="http://jqueryui.com/demos/autocomplete/">jQuery UI Autocomplete</a> in my CakePHP apps. However, CakePHP Ajax and Javascript helpers don&#8217;t support jQuery by default. After googling a little bit, I found that this guy ( <a href="http://www.cakephp.bee.pl/">http://www.cakephp.bee.pl/</a> ) already made Ajax and Javascript helpers for jQuery.</p>
<p>So I just copied these helpers from his site and put it into my apps. It&#8217;s done ? obviously not. It turned out that the autocomplete script that he using in his helper is the old one ( <a href="http://docs.jquery.com/Plugins/autocomplete">http://docs.jquery.com/Plugins/autocomplete</a> ).</p>
<p>Thus, I had to add a method inside that helper to use jQuery UI autocomplete. Here are the sample codes ( you can copy from my github for the complete file, this one is just snippet ) :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> <span style="color: #009933; font-style: italic;">/**
     * Options for auto-complete editor.
     *
     * @var array
     */</span>
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$autoCompleteOptions</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'select'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'source'</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * Create a text field with Jquery UI Autocomplete.
     *
     * Creates an autocomplete field with the given ID and options.
     * needs include jQuery UI Autocomplete file
     *
     * @param string $field DOM ID of field to observe
     * @param array $options Ajax options
     * @return string Ajax script
     * check out http://jqueryui.com/demos/autocomplete/
     */</span>
    <span style="color: #000000; font-weight: bold;">function</span> autoComplete<span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><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;">$var</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'var'</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;">$var</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'var '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'var'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' = '</span><span style="color: #339933;">;</span>
	    <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'var'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'source'</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;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'source'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">.</span>Router<span style="color: #339933;">::</span><span style="color: #004000;">url</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'source'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</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;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> Inflector<span style="color: #339933;">::</span><span style="color: #004000;">camelize</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;_&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000088;">$htmlOptions</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>__getHtmlOptions<span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$htmlOptions</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'autocomplete'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;off&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">autoCompleteOptions</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$opt</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$htmlOptions</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$opt</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_optionsToString<span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'multipleSeparator'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$callbacks</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'formatItem'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'formatMatch'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'formatResult'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'highlight'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$callbacks</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$callback</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$callback</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;">$name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$callback</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$code</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$callback</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'formatResult'</span><span style="color: #339933;">:</span>
			<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;function(data, i, max) {&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$code</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;}&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
		    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'highlight'</span><span style="color: #339933;">:</span>
			<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;function(data, search) {&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$code</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;}&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
		    <span style="color: #b1b100;">default</span><span style="color: #339933;">:</span>
			<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;function(row, i, max, term) {&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$code</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;}&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	    <span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_buildOptions<span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">autoCompleteOptions</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">text</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #339933;">,</span> <span style="color: #000088;">$htmlOptions</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$script</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">{$var}</span> $('#<span style="color: #006699; font-weight: bold;">{$htmlOptions['id']}</span>').autocomplete(&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$script</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">{$options}</span>);&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">{$text}</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Javascript</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">codeBlock</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$script</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>And here are the sample to use it in our application</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Ajax</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">autoComplete</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Guest.search'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'source'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'controller'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'users'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'action'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'autoComplete'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'prefix'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'host'</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Action code :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> <span style="color: #009933; font-style: italic;">/**
     * Auto Complete Action for Host
     *
     * Auto Complete action for host list of guests
     * also process the search
     */</span>
    <span style="color: #000000; font-weight: bold;">function</span> host_autoComplete<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">redirect</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'controller'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'users'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'action'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'view'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Guest'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</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: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">autoRender</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$guests</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">User</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getGuests</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		    <span style="color: #0000ff;">'host_id'</span> <span style="color: #339933;">=&gt;</span> Configure<span style="color: #339933;">::</span><span style="color: #004000;">read</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'User.id'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		    <span style="color: #0000ff;">'conditions'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
			<span style="color: #0000ff;">'OR'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
			    <span style="color: #0000ff;">'User.name LIKE'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'%'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'term'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'%'</span><span style="color: #339933;">,</span>
			    <span style="color: #0000ff;">'User.surname LIKE'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'%'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'term'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'%'</span>
			<span style="color: #009900;">&#41;</span>
		    <span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #990000;">json_encode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">User</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">autoComplete_encode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$guests</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Model method ( encode the data array to display fields that we want, in this example I am just showing firstname and surname )</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #009933; font-style: italic;">/**
     * autoComplete encode
     *
     * Parsing passed array and change it to consume-able
     * by autocomplete jQuery UI
     * @param array $data
     * @return json $data
     */</span>
    <span style="color: #000000; font-weight: bold;">function</span> autoComplete_encode<span style="color: #009900;">&#40;</span><span style="color: #000088;">$postData</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><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;">$temp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$postData</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$user</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #990000;">array_push</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$temp</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$user</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'User'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'label'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$user</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'User'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">.</span><span style="color: #000088;">$user</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'User'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'surname'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'value'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$user</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'User'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</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;">$temp</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Don&#8217;t forget to use $_GET['term'] to get data from autocomplete field and also encode the data to JSON so it can be displayed by jQuery UI.</p>
<p><a href="http://blog.rudylee.com/2011/07/25/jquery-ui-autocomplete-in-cakephp/">jQuery UI AutoComplete in CakePHP</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2011/07/25/jquery-ui-autocomplete-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Change wordpress default email and name</title>
		<link>http://blog.rudylee.com/2011/06/20/change-wordpress-default-email-and-name/</link>
		<comments>http://blog.rudylee.com/2011/06/20/change-wordpress-default-email-and-name/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 04:12:53 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=609</guid>
		<description><![CDATA[Actually you can find this solution easily in Google. However, I&#8217;ll put it in my blog just because I am lazy to find it again. So wordpress has default email address and name which are &#8220;WordPress&#8221; as the name, wordpress@yourdomain.com as the email. To change it you can use plugin or put these wordpress action ...<p><a href="http://blog.rudylee.com/2011/06/20/change-wordpress-default-email-and-name/">Change wordpress default email and name</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Actually you can find this solution easily in Google. However, I&#8217;ll put it in my blog just because I am lazy to find it again.</p>
<p>So wordpress has default email address and name which are &#8220;WordPress&#8221; as the name, wordpress@yourdomain.com as the email. To change it you can use plugin or put these wordpress action to your functions.php file in themes folder :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_mail_from'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'new_mail_from'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_mail_from_name'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'new_mail_from_name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> new_mail_from<span style="color: #009900;">&#40;</span><span style="color: #000088;">$old</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'no-reply@rudylee.com'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> new_mail_from_name<span style="color: #009900;">&#40;</span><span style="color: #000088;">$old</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'Rudy'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Just change the email address and name to your&#8217;s. Hope it works, cheers.</p>
<p><a href="http://blog.rudylee.com/2011/06/20/change-wordpress-default-email-and-name/">Change wordpress default email and name</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2011/06/20/change-wordpress-default-email-and-name/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fixing rake command error in rails 3.0.7</title>
		<link>http://blog.rudylee.com/2011/05/29/fixing-rake-command-error-in-rails-3-0/</link>
		<comments>http://blog.rudylee.com/2011/05/29/fixing-rake-command-error-in-rails-3-0/#comments</comments>
		<pubDate>Sun, 29 May 2011 06:39:57 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[application folder]]></category>
		<category><![CDATA[laptop]]></category>
		<category><![CDATA[little bit]]></category>
		<category><![CDATA[pop up window]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rake]]></category>
		<category><![CDATA[rudy]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=601</guid>
		<description><![CDATA[Today I was trying to add rails project to Netbeans 6.9,but suddenly there is a pop up window that said &#8220;Rake task fecthing failed&#8221; with bunch of other errors. After that, I tried go to my application folder and try to run the rake command rake -D However I got this error rudy@rudy-laptop:~/www/depot$ rake -D ...<p><a href="http://blog.rudylee.com/2011/05/29/fixing-rake-command-error-in-rails-3-0/">Fixing rake command error in rails 3.0.7</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Today I was trying to add rails project to Netbeans 6.9,but suddenly there is a pop up window that said &#8220;Rake task fecthing failed&#8221; with bunch of other errors. After that, I tried go to my application folder and try to run the rake command</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">rake <span style="color:#006600; font-weight:bold;">-</span>D</pre></div></div>

<p>However I got this error</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rudy<span style="color: #000000; font-weight: bold;">@</span>rudy-laptop:~<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>depot$ rake <span style="color: #660033;">-D</span>
rake aborted<span style="color: #000000; font-weight: bold;">!</span>
undefined method <span style="color: #000000; font-weight: bold;">`</span>task<span style="color: #ff0000;">' for #&lt;Depot::Application:0x91fa9c4&gt;
&nbsp;
(See full trace by running task with --trace)</span></pre></div></div>

<p>After a little bit research, I found that I have to uninstall my rake 0.9 and install 0.8.7 instead. So I ran this command :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gem uninstall rake <span style="color: #660033;">-v</span> <span style="color: #000000;">0.9</span>
gem <span style="color: #c20cb9; font-weight: bold;">install</span> rake <span style="color: #660033;">-v</span> 0.8.7</pre></div></div>

<p>Edited the gem file and added this code inside that file :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gem <span style="color: #ff0000;">'rake'</span>, <span style="color: #ff0000;">'0.8.7'</span></pre></div></div>

<p>Last step is update the bundle</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">bundle update</pre></div></div>

<p>After that you can try run your rake command or import your project to Netbans, it&#8217;s should be fine.</p>
<p>UPDATE :<br />
It turns out that the problem is because I was using rake 0.9 and it&#8217;s break out all the installation.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gem <span style="color: #c20cb9; font-weight: bold;">install</span> bundler</pre></div></div>

<p>You might want to install bundler if you encounter some errors related to Netbeans couldn&#8217;t find bundler setup. Another thing is you have to add gem path to your Netbeans ( Tools > Rubygems ) and add your gem path. </p>
<p>I am using rvm to install ruby and also rails. So I run this command to find gem path</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rvm gemdir</pre></div></div>

<p><a href="http://blog.rudylee.com/2011/05/29/fixing-rake-command-error-in-rails-3-0/">Fixing rake command error in rails 3.0.7</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2011/05/29/fixing-rake-command-error-in-rails-3-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make wordpress using the latest jQuery</title>
		<link>http://blog.rudylee.com/2011/05/24/wordpress-uses-the-latest-jquery/</link>
		<comments>http://blog.rudylee.com/2011/05/24/wordpress-uses-the-latest-jquery/#comments</comments>
		<pubDate>Tue, 24 May 2011 04:45:58 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[content theme]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[libs]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[theme folder]]></category>
		<category><![CDATA[wp]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=597</guid>
		<description><![CDATA[I just copied this from another website, put it here just in case that I forgot. if&#40; !is_admin&#40;&#41;&#41;&#123; wp_deregister_script&#40;'jquery'&#41;; wp_register_script&#40;'jquery', &#40;&#34;http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js&#34;&#41;, false, ''&#41;; wp_enqueue_script&#40;'jquery'&#41;; &#125; Put this snippet to functions.php file in your theme folder ( eg : wp-content/theme/whatever/functions.php ) Make wordpress using the latest jQuery is a post from: blog.rudylee.com<p><a href="http://blog.rudylee.com/2011/05/24/wordpress-uses-the-latest-jquery/">Make wordpress using the latest jQuery</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I just copied this from another website, put it here just in case that I forgot.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span>is_admin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   wp_deregister_script<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'jquery'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   wp_register_script<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'jquery'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   wp_enqueue_script<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'jquery'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Put this snippet to functions.php file in your theme folder ( eg : wp-content/theme/whatever/functions.php )</p>
<p><a href="http://blog.rudylee.com/2011/05/24/wordpress-uses-the-latest-jquery/">Make wordpress using the latest jQuery</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2011/05/24/wordpress-uses-the-latest-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache GeoIP</title>
		<link>http://blog.rudylee.com/2011/04/13/apache-geoip/</link>
		<comments>http://blog.rudylee.com/2011/04/13/apache-geoip/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 04:33:20 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[Unix and Linux]]></category>
		<category><![CDATA[apache module]]></category>
		<category><![CDATA[australia]]></category>
		<category><![CDATA[country code]]></category>
		<category><![CDATA[geoip]]></category>
		<category><![CDATA[htaccess file]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[restart apache]]></category>
		<category><![CDATA[rewriterule]]></category>
		<category><![CDATA[www canada]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=587</guid>
		<description><![CDATA[Apache GeoIP is an apache module for detecting your visitor&#8217;s IP and block/redirect them to another website. Installing and configuring GeoIP is very easy in Ubuntu. Here are the steps : 1.Install the Apache GeoIP module and restart apache webserver sudo apt-get install libapache2-geoip sudo /etc/init.d/apache2 restart 2.Create the .htaccess file and put in your ...<p><a href="http://blog.rudylee.com/2011/04/13/apache-geoip/">Apache GeoIP</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Apache GeoIP is an apache module for detecting your visitor&#8217;s IP and block/redirect them to another website. Installing and configuring GeoIP is very easy in Ubuntu. Here are the steps :</p>
<p>1.Install the Apache GeoIP module and restart apache webserver</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libapache2-geoip
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

<p>2.Create the .htaccess file and put in your webroot folder / website folder</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">GeoIPEnable On
&nbsp;
<span style="color: #666666; font-style: italic;"># Redirect one country</span>
RewriteEngine on
RewriteCond <span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>ENV:GEOIP_COUNTRY_CODE<span style="color: #7a0874; font-weight: bold;">&#125;</span> ^AU$
RewriteRule ^<span style="color: #7a0874; font-weight: bold;">&#40;</span>.<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>$ http:<span style="color: #000000; font-weight: bold;">//</span>www.canada.com<span style="color: #007800;">$1</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>L<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>In the example above, GeoIP will check whether the visitor is from Australia or not. If the visitor is from Australia then apache will redirect the visitor to http://www.canada.com. Quite simple and straight forward. You can see another example in here<a href="http://www.maxmind.com/app/mod_geoip"> http://www.maxmind.com/app/mod_geoip</a> ( ignore the GeoIPDBFile because it will cause error ).</p>
<p><a href="http://blog.rudylee.com/2011/04/13/apache-geoip/">Apache GeoIP</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2011/04/13/apache-geoip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

