<?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>Louie Miranda</title>
	<atom:link href="http://www.louiemiranda.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.louiemiranda.com</link>
	<description>Software Developer, Seasonal Designer, System Administrator, Entrepreneur and Amateur Photographer.</description>
	<lastBuildDate>Mon, 02 Jan 2012 09:56:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Happy New Year! 2012</title>
		<link>http://www.louiemiranda.com/2012/01/02/happy-new-year-2012/</link>
		<comments>http://www.louiemiranda.com/2012/01/02/happy-new-year-2012/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 09:56:12 +0000</pubDate>
		<dc:creator>Louie Miranda</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.louiemiranda.com/?p=555</guid>
		<description><![CDATA[Yahoo! Happy New Year!]]></description>
			<content:encoded><![CDATA[<p>Yahoo! Happy New Year!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.louiemiranda.com/2012/01/02/happy-new-year-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Batch copy then rename multiple files on linux</title>
		<link>http://www.louiemiranda.com/2011/12/29/batch-rename-multiple-files-on-linux/</link>
		<comments>http://www.louiemiranda.com/2011/12/29/batch-rename-multiple-files-on-linux/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 05:43:03 +0000</pubDate>
		<dc:creator>Louie Miranda</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Linux Scripts Bash]]></category>

		<guid isPermaLink="false">http://www.louiemiranda.com/?p=552</guid>
		<description><![CDATA[You can use this script to rename multiple files on linux. for i in us_*; do cp $i `echo $i&#124;sed &#8216;s/us_/nz_/g`; done The first line will loop to your files matching us_*. Then it will copy the listed files, piping it to sed to do a quick replacement from us_* to uk_*. Hope this helps]]></description>
			<content:encoded><![CDATA[<p>You can use this script to rename multiple files on linux.</p>
<p>for i in us_*;<br />
do cp $i `echo $i|sed &#8216;s/us_/nz_/g`;<br />
done</p>
<p>The first line will loop to your files matching us_*. Then it will copy the listed files, piping it to sed to do a quick replacement from us_* to uk_*.</p>
<p>Hope this helps <img src='http://www.louiemiranda.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.louiemiranda.com/2011/12/29/batch-rename-multiple-files-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pingdom&#8217;s HTTP Custom Monitoring</title>
		<link>http://www.louiemiranda.com/2010/11/04/pingdoms-http-custom-monitoring/</link>
		<comments>http://www.louiemiranda.com/2010/11/04/pingdoms-http-custom-monitoring/#comments</comments>
		<pubDate>Thu, 04 Nov 2010 01:39:44 +0000</pubDate>
		<dc:creator>Louie Miranda</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[Pingdom]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[Uptime]]></category>

		<guid isPermaLink="false">http://www.louiemiranda.com/?p=537</guid>
		<description><![CDATA[Pingdom is a great company that focuses on your server&#8217;s health and I&#8217;ve been using them. Then I found this excellent PHP script that Jon Stacey wrote on his blog. pingdom-core.php This is my core services check. It makes sure that web services and MySQL are operational. Simply configure the script with the username and [...]]]></description>
			<content:encoded><![CDATA[<p>Pingdom is a great company that focuses on your server&#8217;s health and I&#8217;ve been using them.</p>
<p>Then I found this excellent PHP script that Jon Stacey wrote on his blog.</p>
<blockquote><p><em>pingdom-core.php</em></p>
<p>This is my core services check. It makes sure that web services and MySQL are operational. Simply configure the script with the username and password of a MySQL database. If the script cannot make a connection to the database server, then a ‘MYSQL DOWN’ status will be returned to Pingdom. Of course, if the script doesn’t respond at all, then the web service is down and Pingdom will report a down status.</p>
<p><em>pingdom-server.php</em></p>
<p>This script is intended to be an early warning system. It will raise the alarm if something looks out of the ordinary so that I can be prepared for a possible service failure. The following server vitals are checked: swap usage, hard drive usage, and cpu usage. If any one of these goes beyond the preset thresholds, a down status will be returned to Pingdom.</p>
<p>You might be thinking that checks like these could be done with a monitoring script on the server without using Pingdom at all, and there is merit to that argument. However, if you run out of memory and your system comes crashing to a halt, that probably means that services like email, which you would have used to alert yourself to the problem, would no longer be working. By performing these checks remotely, you can sleep a little easier. Plus, Pingdom will generate nifty looking graphs, and I like graphs.</p>
<p><em>pingdom.php</em> –Added on 12/4/2009–</p>
<p>This script is a combination of pingdom-core.php and pingdom-server.php if you’re using the free acount</p></blockquote>
<p>You can check his website for all the updates at <a href="http://jonsview.com/how-i-use-pingdoms-http-custom-feature">http://jonsview.com/how-i-use-pingdoms-http-custom-feature</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.louiemiranda.com/2010/11/04/pingdoms-http-custom-monitoring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP Fulltext Search with Pagination</title>
		<link>http://www.louiemiranda.com/2010/10/28/cakephp-fulltext-search-with-pagination/</link>
		<comments>http://www.louiemiranda.com/2010/10/28/cakephp-fulltext-search-with-pagination/#comments</comments>
		<pubDate>Thu, 28 Oct 2010 07:42:11 +0000</pubDate>
		<dc:creator>Louie Miranda</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[BOOLEAN]]></category>
		<category><![CDATA[Full Text Search]]></category>
		<category><![CDATA[Match]]></category>
		<category><![CDATA[Mode]]></category>
		<category><![CDATA[Score]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.louiemiranda.com/?p=531</guid>
		<description><![CDATA[This is a working code that I was able to implement for my e-commerce application that uses cakephp full text search with pagination. &#60;?php $this-&#62;paginate&#91;'Publication'&#93;&#91;'conditions'&#93; = &#34;MATCH(Publication.Code, Publication.Name, Publication.Language) AGAINST ('&#34;.$input.&#34;' IN BOOLEAN MODE)&#34;; $this-&#62;paginate&#91;'Publication'&#93;&#91;'fields'&#93; = &#34;*, MATCH(Publication.Code, Publication.Name, Publication.Language) AGAINST ('&#34;.$input.&#34;' IN BOOLEAN MODE) AS score&#34;; $this-&#62;paginate&#91;'Publication'&#93;&#91;'order'&#93; = &#34;score DESC&#34;; $results = $this-&#62;paginate&#40;'Publication'&#41;; ?&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>This is a working code that I was able to implement for my e-commerce application that uses cakephp full text search with pagination.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">paginate</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Publication'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'conditions'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;MATCH(Publication.Code, Publication.Name, Publication.Language) AGAINST ('&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$input</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' IN BOOLEAN MODE)&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">paginate</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Publication'</span><span style="color: #009900;">&#93;</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;">&quot;*, MATCH(Publication.Code, Publication.Name, Publication.Language) AGAINST ('&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$input</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' IN BOOLEAN MODE) AS score&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">paginate</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Publication'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'order'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;score DESC&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$results</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">paginate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Publication'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Please make sure that you are using MyISAM on MySQL to fully implement this and you where able to set the full-text capability of the table.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.louiemiranda.com/2010/10/28/cakephp-fulltext-search-with-pagination/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I tried CakePHP Search Plugin</title>
		<link>http://www.louiemiranda.com/2010/10/28/i-tried-cakephp-search-plugin/</link>
		<comments>http://www.louiemiranda.com/2010/10/28/i-tried-cakephp-search-plugin/#comments</comments>
		<pubDate>Thu, 28 Oct 2010 06:57:06 +0000</pubDate>
		<dc:creator>Louie Miranda</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Keywords]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.louiemiranda.com/?p=527</guid>
		<description><![CDATA[So, I tried CakePHP Search Plugin on my current project that I am creating for an e-commerce website. The search plugin is an easy way to include search into your application. Using this plugin you will able to have paginable search in any controller. Plugin support simple methods to search inside models using strict and [...]]]></description>
			<content:encoded><![CDATA[<p>So, I tried CakePHP Search Plugin on my current project that I am creating for an e-commerce website.</p>
<blockquote><p>The search plugin is an easy way to include search into your application. Using this plugin you will able to have paginable search in any controller. Plugin support simple methods to search inside models using strict and non-strict comparing, but also allows you to implement any complex type of searching.</p></blockquote>
<p>I&#8217;ve search my products table and id use the following types parameter.</p>
<ul>
<li>like, This type of search used when you need to search using &#8216;LIKE&#8217; sql keyword.</li>
<li>value, This type of search very usefull when you need exact compare. So if you have select box in your view as a filter than you definetely should use value type.</li>
</ul>
<p>Overall, it is a great plugin. Although, it did not fit my current requirements for now. <img src='http://www.louiemiranda.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> .  But, I will definitely use it in my future projects.</p>
<p>Have a look here: <a href="http://cakedc.com/downloads/view/cakephp_search_plugin">http://cakedc.com/downloads/view/cakephp_search_plugin</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.louiemiranda.com/2010/10/28/i-tried-cakephp-search-plugin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CakePHP Self Adjusting Credit Card Year</title>
		<link>http://www.louiemiranda.com/2010/10/18/cakephp-self-adjusting-credit-card-year/</link>
		<comments>http://www.louiemiranda.com/2010/10/18/cakephp-self-adjusting-credit-card-year/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 02:01:12 +0000</pubDate>
		<dc:creator>Louie Miranda</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[1.3]]></category>
		<category><![CDATA[Adjusting]]></category>
		<category><![CDATA[Credit Card]]></category>
		<category><![CDATA[Date]]></category>
		<category><![CDATA[Form]]></category>
		<category><![CDATA[Input]]></category>

		<guid isPermaLink="false">http://www.louiemiranda.com/?p=522</guid>
		<description><![CDATA[When I used to program on PEAR, I&#8217;ve used the following code to auto-generate succeeding years. $form-&#62;addElement&#40;'date', 'CCexpiry', 'Credit Card Expiration', array&#40;'format' =&#62; 'F-Y', 'minYear' =&#62; date&#40;'Y'&#41;, 'maxYear' =&#62; date&#40;'Y'&#41; + 10&#41;&#41;; Now, when I used CakePHP (1.2/1.3). They have a similar approach that we can all use. &#60;?php echo $this-&#62;Form-&#62;input&#40;'cc_expy', array&#40;'div' =&#62; false, 'label' [...]]]></description>
			<content:encoded><![CDATA[<p>When I used to program on PEAR, I&#8217;ve used the following code to auto-generate succeeding years.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addElement</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'date'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'CCexpiry'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Credit Card Expiration'</span><span style="color: #339933;">,</span>
			  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'format'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'F-Y'</span><span style="color: #339933;">,</span>
					<span style="color: #0000ff;">'minYear'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
					<span style="color: #0000ff;">'maxYear'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Now, when I used CakePHP (1.2/1.3). They have a similar approach that we can all use.</p>

<div class="wp_syntax"><div 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;">input</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cc_expy'</span><span style="color: #339933;">,</span>
              <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'div'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'label'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'date'</span><span style="color: #339933;">,</span>
              <span style="color: #0000ff;">'maxYear'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #339933;">,</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'+ 7 years'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
              <span style="color: #0000ff;">'minYear'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
              <span style="color: #0000ff;">'dateFormat'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Y'</span><span style="color: #339933;">,</span>
              <span style="color: #0000ff;">'default'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
              <span style="color: #0000ff;">'orderYear'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'asc'</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></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.louiemiranda.com/2010/10/18/cakephp-self-adjusting-credit-card-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free Telephone Calls from Gmail</title>
		<link>http://www.louiemiranda.com/2010/08/26/free-telephone-calls-from-gmail/</link>
		<comments>http://www.louiemiranda.com/2010/08/26/free-telephone-calls-from-gmail/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 03:04:16 +0000</pubDate>
		<dc:creator>Louie Miranda</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[Call]]></category>
		<category><![CDATA[Free]]></category>
		<category><![CDATA[Gmail]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Sept]]></category>
		<category><![CDATA[Voice]]></category>
		<category><![CDATA[VOIP]]></category>

		<guid isPermaLink="false">http://www.louiemiranda.com/?p=517</guid>
		<description><![CDATA[Gmail voice and video chat makes it easy to stay in touch with friends and family using your computer’s microphone and speakers. But until now, this required both people to be at their computers, signed into Gmail at the same time. Given that most of us don’t spend all day in front of our computers, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://gmailblog.blogspot.com/2008/11/say-hello-to-gmail-voice-and-video-chat.html">Gmail voice and video chat</a> makes it easy to stay in touch with friends and family using your  computer’s microphone and speakers. But until now, this required both  people to be at their computers, signed into Gmail at the same time.  Given that most of us don’t spend all day in front of our computers, we  thought, “wouldn’t it be nice if you could call people directly on their  phones?”</p>
<p>Starting today, you can call any phone right from Gmail.</p>
<p><a href="http://www.youtube.com/watch?v=_-DzpAg0SdU">www.youtube.com/watch?v=_-DzpAg0SdU</a></p>
<p><span id="more-517"></span>Calls to the U.S. and Canada will be free for at least the rest of the year and calls to other countries will be billed at our very <a href="https://www.google.com/voice/rates">low rates</a>.</p>
<p>Will be able to try this on Sept 2010. <img src='http://www.louiemiranda.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.louiemiranda.com/2010/08/26/free-telephone-calls-from-gmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Happy Birthday Debian</title>
		<link>http://www.louiemiranda.com/2010/08/16/happy-birthday-debian/</link>
		<comments>http://www.louiemiranda.com/2010/08/16/happy-birthday-debian/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 14:09:32 +0000</pubDate>
		<dc:creator>Louie Miranda</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://www.louiemiranda.com/?p=514</guid>
		<description><![CDATA[Happy Birthday Debian! My favorite flavor in the whole wide world!]]></description>
			<content:encoded><![CDATA[<p>Happy Birthday Debian! My favorite flavor in the whole wide world! <img src='http://www.louiemiranda.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.louiemiranda.com/2010/08/16/happy-birthday-debian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP: Validate dependent field (select dropdown + input field)</title>
		<link>http://www.louiemiranda.com/2010/07/15/cakephp-validate-dependent-field-select-dropdown-input-field/</link>
		<comments>http://www.louiemiranda.com/2010/07/15/cakephp-validate-dependent-field-select-dropdown-input-field/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 03:44:01 +0000</pubDate>
		<dc:creator>Louie Miranda</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Application]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Dropdown]]></category>
		<category><![CDATA[Field]]></category>
		<category><![CDATA[Geek]]></category>
		<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Input]]></category>
		<category><![CDATA[return]]></category>
		<category><![CDATA[Select]]></category>
		<category><![CDATA[Validation]]></category>
		<category><![CDATA[Web Application]]></category>

		<guid isPermaLink="false">http://www.louiemiranda.com/?p=473</guid>
		<description><![CDATA[Earlier this week, I was working on a project where I needed to validate two dependent fields. &#60;?php echo input&#40;'office', array&#40;'type' =&#62; 'select', 'options' =&#62; $nd&#91;0&#93;&#41;&#41;; ?&#62; &#60;?php echo input&#40;'office_other', array&#40;'maxlength' =&#62; '255', 'size' =&#62; '35', 'label' =&#62; 'Other Office'&#41;&#41;; ?&#62; The &#8220;office&#8221; field is a select (drop down box) from my data array(). What [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier this week, I was working on a project where I needed to validate two dependent fields.</p>

<div class="wp_syntax"><div 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> input<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'office'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'select'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'options'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$nd</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</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: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> input<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'office_other'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'maxlength'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'255'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'size'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'35'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'label'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Other Office'</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></pre></div></div>

<p>The &#8220;<strong>office</strong>&#8221; field is a select (<em>drop down box</em>) from my data array(). What I needed is to be able to add another data from a field and name it as &#8220;<strong>office_other</strong>&#8221; where it would initially capture and re-list again new offices if it does not exist.</p>
<p><span id="more-473"></span></p>
<p>I found an article on the web that seems to relate on this similar goal <a title="Edward" href="http://edwardawebb.com/web-development/cakephp/validating-optional-fields-cakephp-dreaded-scenario" target="_blank">here</a> (thanks).</p>
<p>Here&#8217;s my code for this project:</p>
<p><strong>Model, where rule validation should be imposed.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$validate</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
<span style="color: #0000ff;">'office'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
  <span style="color: #0000ff;">'notempty'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'rule'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'notempty'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'message'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Please select your office.'</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'allowEmpty'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span>
  <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'office_other'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
  <span style="color: #0000ff;">'validateoffice'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'rule'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'validateOtherOffice'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'office_other'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'message'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Kindly enter new office code.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
  <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span></pre></div></div>

<p>The key here is to add a custom validation process, mine is the <strong>validateOtherOffice()</strong> function.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> validateOtherOffice<span style="color: #009900;">&#40;</span><span style="color: #000088;">$check</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$valid</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">//debug($check);</span>
  <span style="color: #666666; font-style: italic;">//debug($this-&gt;data['Account']);</span>
&nbsp;
  <span style="color: #b1b100;">if</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;">&#91;</span><span style="color: #0000ff;">'Account'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'office'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'office_new'</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;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$check</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'office_other'</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;">$valid</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</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: #000088;">$valid</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</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: #000088;">$valid</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$valid</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now my application was able to validate two dependent fields.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.louiemiranda.com/2010/07/15/cakephp-validate-dependent-field-select-dropdown-input-field/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Let the change start within</title>
		<link>http://www.louiemiranda.com/2010/06/30/let-the-change-start-within/</link>
		<comments>http://www.louiemiranda.com/2010/06/30/let-the-change-start-within/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 01:37:29 +0000</pubDate>
		<dc:creator>Louie Miranda</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Change]]></category>
		<category><![CDATA[Philippines]]></category>
		<category><![CDATA[President]]></category>

		<guid isPermaLink="false">http://www.louiemiranda.com/2010/06/30/let-the-change-start-within/</guid>
		<description><![CDATA[A few hours from now the Filipino people will have a new president. May he guide the people and be truthful to his words. Goodluck!]]></description>
			<content:encoded><![CDATA[<p>A few hours from now the Filipino people will have a new president. May he guide the people and be truthful to his words. Goodluck!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.louiemiranda.com/2010/06/30/let-the-change-start-within/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

