<?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>Lennaert Ekelmans</title>
	<atom:link href="http://lennaert.nu/feed/" rel="self" type="application/rss+xml" />
	<link>http://lennaert.nu</link>
	<description>Writing about CakePHP and other things</description>
	<lastBuildDate>Tue, 28 Feb 2012 16:36:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Using CakePHP? Follow these interesting twitter accounts</title>
		<link>http://lennaert.nu/2011/12/11/using-cakephp-follow-these-interesting-twitter-accounts/</link>
		<comments>http://lennaert.nu/2011/12/11/using-cakephp-follow-these-interesting-twitter-accounts/#comments</comments>
		<pubDate>Sun, 11 Dec 2011 13:50:46 +0000</pubDate>
		<dc:creator>lennaert</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://lennaert.nu/?p=65</guid>
		<description><![CDATA[The best way to keep yourself up to date with your favorite PHP framework is to follow interesting people in the industry. Here&#8217;s a list of 7 twitter accounts you should follow when you develop in CakePHP. Mark Story (@mark_story) CakePHP guy, Developer at FreshBooks and sometimes designer in Toronto Ontario. Jose Zap (@jose_zap) Venezuelan [...]]]></description>
			<content:encoded><![CDATA[<p>The best way to keep yourself up to date with your favorite PHP framework is to follow interesting people in the industry.</p>
<p>Here&#8217;s a list of 7 twitter accounts you should follow when you develop in CakePHP.</p>
<table width="100%">
<tbody>
<tr>
<td width="60">
<h3><img src="https://twimg0-a.akamaihd.net/profile_images/75919103/mouth.png" alt="Mark Story" width="48" height="48" /></h3>
</td>
<td style="text-align: left;" valign="top"><strong>Mark Story (<a title="Mark Story Twitter" href="https://twitter.com/#!/mark_story" target="_blank">@mark_story</a>)</strong><br />
CakePHP guy, Developer at FreshBooks and sometimes designer in Toronto Ontario.</td>
</tr>
<tr>
<td width="60"><img src="https://twimg0-a.akamaihd.net/profile_images/75591628/gran_sabanaaa__049_normal.jpg" alt="Mark Story" width="48" height="48" /></td>
<td style="text-align: left;" valign="top"><strong>Jose Zap (<a title="Jose Zap Twitter" href="https://twitter.com/#!/jose_zap" target="_blank">@jose_zap</a>)</strong><br />
Venezuelan Software engineer. CakePHP core developer. And most of all a guy who only seeks inner peace.</td>
</tr>
<tr>
<td width="60"><img src="https://twimg0-a.akamaihd.net/profile_images/303502280/user_normal.jpg" alt="Mark Story" width="48" height="48" /></td>
<td style="text-align: left;" valign="top"><strong>Ichikaway (<a title="Ichikaway Twitter" href="https://twitter.com/#!/ichikaway" target="_blank">@Ichikaway</a>)</strong><br />
I&#8217;m interested in Cakephp, MongoDB and author of MongoDB datasource for CakePHP.</td>
</tr>
<tr>
<td width="120"><img src="https://twimg0-a.akamaihd.net/profile_images/1240828607/me_normal.png" alt="Mark Story" width="48" height="48" /></td>
<td style="text-align: left;" valign="top"><strong>Larry E. Masters (<a href="https://twitter.com/#!/PhpNut">@phpnut</a>)</strong><br />
CakePHP Founder/Lead Developer</td>
</tr>
<tr>
<td width="120"><img src="https://twimg0-a.akamaihd.net/profile_images/1130623398/Slavitica_Avatar__No_Text__normal.png" alt="Mark Story" width="48" height="48" /></td>
<td style="text-align: left;" valign="top"><strong>Graham Weldon (<a title="Graham Weldon Twitter" href="https://twitter.com/#!/predominant" target="_blank">@predominant</a>)</strong><br />
Web developer, gamer, speaker, Contributor to CakePHP, and all round easy going kinda guy.</td>
</tr>
<tr>
<td width="120"><img src="https://twimg0-a.akamaihd.net/profile_images/302259536/monkey_normal.png" alt="Mark Story" width="48" height="48" /></td>
<td style="text-align: left;" valign="top"><strong>Andy Dawson (<a title="Andy Dawson Twitter" href="https://twitter.com/#!/AD7six">@ad7six</a>)</strong><br />
Contributor to CakePHP</td>
</tr>
<tr>
<td width="120"><img src="https://twimg0-a.akamaihd.net/profile_images/1633941664/IMG_3673_normal.jpeg" alt="Mark Story" width="48" height="48" /></td>
<td style="text-align: left;" valign="top"><strong>Jose Diaz-Gonzalez (<a title="Jose Diaz-Gonzalez Twitter" href="https://twitter.com/#!/savant">@savant</a>)</strong><br />
Experienced with #PHPCake scripts. Looking for Job in startup world. 20 years experience in Rails, 33 years with Coffeescript. NodeJS Ninja Guru. #rockstar</td>
</tr>
</tbody>
</table>
<p>And then it&#8217;s also nice to follow <a title="CakePHP twitter" href="https://twitter.com/#!/cakephp" target="_blank">@CakePHP</a> and <a title="CakeDC twitter" href="https://twitter.com/#!/CakeDC" target="_blank">@CakeDC</a>.</p>
<p>I recommend to use the Twitter search to look for <a href="https://twitter.com/#!/search/CakePHP" target="_blank">CakePHP related talk</a>. Maybe you&#8217;ll find someone who will inspire you as well!</p>
]]></content:encoded>
			<wfw:commentRss>http://lennaert.nu/2011/12/11/using-cakephp-follow-these-interesting-twitter-accounts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP Performance: Rewrite plugin assets in Nginx</title>
		<link>http://lennaert.nu/2011/01/21/cakephp-performance-rewrite-plugin-assets-in-nginx/</link>
		<comments>http://lennaert.nu/2011/01/21/cakephp-performance-rewrite-plugin-assets-in-nginx/#comments</comments>
		<pubDate>Fri, 21 Jan 2011 18:06:53 +0000</pubDate>
		<dc:creator>lennaert</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://lennaert.nu/?p=23</guid>
		<description><![CDATA[Lately I&#8217;m playing with the Nginx webserver. Nginx is a free, open-source, high-performance HTTP server hosting 7.5% of all webservers on the internet (that&#8217;s 20.5M webservers). CakePHP plugin assets are served through PHP, which makes it obviously slower than serving it without invoking PHP. I found a little solution that speeds up every plugin asset [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;m playing with the <a href="http://nginx.org/" target="_blank">Nginx webserver</a>. Nginx is a free, open-source, high-performance HTTP server hosting 7.5% of all webservers on the internet (that&#8217;s 20.5M webservers).</p>
<p>CakePHP plugin assets are served through PHP, which makes it obviously slower than serving it without invoking PHP. I found a little solution that speeds up every plugin asset by ~ 60ms. So when you have lots of images, css and javascript files in your plugin, you can speed up your page load time by several seconds!</p>
<p>One of the great benefits is the freedom and flexibility of the configuration files, so I played a bit with the &#8216;<a href="http://wiki.nginx.org/HttpCoreModule#try_files" target="_blank">try_files functionality</a>&#8216; which results in amazing performance improvements. Of course I&#8217;m willing to share it, feel free to comment/critize it;<span id="more-23"></span></p>
<div class="javascript php" style="font-family: monospace;"># Serve CakePHP plugin assets directlylocation ~ <span style="color: #339933;">/</span><span style="color: #009900;">(</span>.<span style="color: #339933;">+</span><span style="color: #009900;">)</span><span style="color: #339933;">/</span><span style="color: #009900;">(</span>img<span style="color: #339933;">|</span>css<span style="color: #339933;">|</span>js<span style="color: #339933;">|</span>files<span style="color: #009900;">)</span><span style="color: #339933;">/</span><span style="color: #009900;">(</span>.<span style="color: #339933;">*</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>access_log off<span style="color: #339933;">;</span>expires 10d<span style="color: #339933;">;</span>add_header Cache<span style="color: #339933;">-</span>Control <span style="color: #003366; font-weight: bold;">public</span><span style="color: #339933;">;</span>        try_files $uri $uri<span style="color: #339933;">/</span> <span style="color: #339933;">/</span>..<span style="color: #339933;">/</span>plugins<span style="color: #339933;">/</span>$1<span style="color: #339933;">/</span>webroot<span style="color: #339933;">/</span>$2<span style="color: #339933;">/</span>$3 <span style="color: #009966; font-style: italic;">/../</span>..<span style="color: #339933;">/</span>plugins<span style="color: #339933;">/</span>$1<span style="color: #339933;">/</span>webroot<span style="color: #339933;">/</span>$2<span style="color: #339933;">/</span>$3 <span style="color: #339933;">/</span>index.<span style="color: #660066;">php</span><span style="color: #339933;">?</span>url<span style="color: #339933;">=</span>$uri<span style="color: #339933;">;</span><span style="color: #009900;">}</span></div>
<p>You can find (and fork) my full configuration example in my github repo:</p>
<p><a href="https://github.com/Lennaert/Lennaerts-Snippets" target="_blank">https://github.com/Lennaert/Lennaerts-Snippets</a></p>
<p>For a full Nginx / PHP / CakePHP setup I could truly recommend the blog post of <a href="http://kevin.vanzonneveld.net/techblog/article/cakephp_and_nginx/" target="_blank">Kevin van Zonneveld</a> and <a href="http://www.littlehart.net/atthekeyboard/2009/01/25/cakephp-nginx-configuration-update/" target="_blank">Chris Hartjes</a>, I learned a lot from them!</p>
]]></content:encoded>
			<wfw:commentRss>http://lennaert.nu/2011/01/21/cakephp-performance-rewrite-plugin-assets-in-nginx/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Newzbin Chrome extensions</title>
		<link>http://lennaert.nu/2010/12/17/newzbin-chrome-extensions/</link>
		<comments>http://lennaert.nu/2010/12/17/newzbin-chrome-extensions/#comments</comments>
		<pubDate>Fri, 17 Dec 2010 18:06:12 +0000</pubDate>
		<dc:creator>lennaert</dc:creator>
				<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://lennaert.nu/?p=21</guid>
		<description><![CDATA[I created a helpful tool that makes my life easier when it comes to exploring new movies/music so I can buy it later. It happens quite a lot I see something on the internet what I would like to search for on my favorite NZB platform; Newzbin.com. I hope you can also benefit from this little [...]]]></description>
			<content:encoded><![CDATA[<p>I created a helpful tool that makes my life easier when it comes to exploring new movies/music so I can buy it later. It happens quite a lot I see something on the internet what I would like to search for on my favorite NZB platform; Newzbin.com.</p>
<p>I hope you can also benefit from this little extension;</p>
<p><a href="https://chrome.google.com/webstore/detail/bafnaogcdnmeaieeegbkhohkeocdagbn">https://chrome.google.com/webstore/detail/bafnaogcdnmeaieeegbkhohkeocdagbn</a></p>
<p><a href="http://lennaert.nu/wp-content/uploads/2010/12/help01.png"><img class="alignnone size-full wp-image-57" title="help01" src="http://lennaert.nu/wp-content/uploads/2010/12/help01.png" alt="" width="275" height="132" /></a> <a href="http://lennaert.nu/wp-content/uploads/2010/12/help02.png"><img class="alignnone size-full wp-image-58" title="help02" src="http://lennaert.nu/wp-content/uploads/2010/12/help02.png" alt="" width="275" height="132" /></a></p>
<p>One of the features I&#8217;m proud of is the single-click search function on known websites;</p>
<pre id="cx-desc-text" style="font: normal normal normal 100%/normal arial, sans-serif; overflow-x: hidden; overflow-y: hidden; white-space: pre-wrap; word-wrap: break-word; padding: 0px; margin: 0px;">
<div class="quoteBox">
<div class="quote-text">When you're on known websites with movie/game/app/music content, an alert on the top right corner of the page will pop-up with a single-click search feature! Known websites so far: moviemeter.nl, amazon.com, amazon.co.uk, imdb.com, flixster.com, gamespot.com, jinni.com, gamez.nl, gamer.nl, insidegamer.nl, filmtipset.se, nyheter24.se and bol.com. <a href="https://chrome.google.com/webstore/detail/bafnaogcdnmeaieeegbkhohkeocdagbn" target="_blank">Download Newzbin Toolbox for Google Chrome</a></div>
</div>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lennaert.nu/2010/12/17/newzbin-chrome-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Webdesigner vs Webdeveloper</title>
		<link>http://lennaert.nu/2010/11/28/webdesigner-vs-webdeveloper/</link>
		<comments>http://lennaert.nu/2010/11/28/webdesigner-vs-webdeveloper/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 18:04:31 +0000</pubDate>
		<dc:creator>lennaert</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://lennaert.nu/?p=16</guid>
		<description><![CDATA[Web designers vs Web developers. Scary it&#8217;s almost true! Bigger and via: SixRevisions]]></description>
			<content:encoded><![CDATA[<p>Web designers vs Web developers.</p>
<p>Scary it&#8217;s almost true!</p>
<p><a href="http://lennaert.nu/wp-content/uploads/2010/11/webdesigner-vs-webdeveloper.jpg"><img class="aligncenter size-full wp-image-47" title="webdesigner-vs-webdeveloper" src="http://lennaert.nu/wp-content/uploads/2010/11/webdesigner-vs-webdeveloper.jpg" alt="" width="550" height="856" /></a></p>
<p>Bigger and via: <a href="http://sixrevisions.com/infographics/web-designers-vs-web-developers-infographic/" target="_blank">SixRevisions</a></p>
]]></content:encoded>
			<wfw:commentRss>http://lennaert.nu/2010/11/28/webdesigner-vs-webdeveloper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Five useful CakePHP functions I just dicovered</title>
		<link>http://lennaert.nu/2009/06/25/five-useful-cakephp-functions-i-just-dicovered/</link>
		<comments>http://lennaert.nu/2009/06/25/five-useful-cakephp-functions-i-just-dicovered/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 17:04:01 +0000</pubDate>
		<dc:creator>lennaert</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://lennaert.nu/?p=14</guid>
		<description><![CDATA[I don&#8217;t have to explain why CakePHP is such a brilliant PHP framework, it simply is. The good part with frameworks is that they include a rich reusable API library full of functions that will make life easier for most programmers. CakePHP is such a framework with an enormous rich library. I only know half [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t have to explain why <a href="http://www.cakephp.org" target="_blank">CakePHP</a> is such a brilliant PHP framework, it simply is. The good part with frameworks is that they include a rich reusable API library full of functions that will make life easier for most programmers. CakePHP is such a framework with an enormous rich library. I only know half of the functions but every day I discover some new great functions which some of them I want to share.</p>
<p><span id="more-14"></span></p>
<p><strong>1. Httpsocket </strong></p>
<p>After I wrote an article about <a href="/2009/03/24/how-we-built-twittermailcom-in-48-hours">how we built Twittermail in 48 hours</a>, Matt from <a href="http://www.pseudocoder.com/archives/2009/02/16/httpsocket-instead-of-curl-in-cakephp-apps/" target="_blank">PseudoCoder.com </a>wrote a blogpost about Httpsocket. I was constantly using the curl library from PHP, I just did not know CakePHP had it&#8217;s own &#8216;grabber&#8217; included. It&#8217;s called Httpsocket, it&#8217;s a core Utility library and it&#8217;s quite interesting what the possibilities are. I truly love curl because they have many functions like handling cookies, auto follow header locations and other very handy stuff. But for quick calls it&#8217;s just as easy to use the CakePHP Httpsocket. Here&#8217;s an example:</p>
<p>To simply get my LastFM timeline, I only need:</p>
<p>&nbsp;</p>
<div class="php" style="font-family: monospace;">App<span style="color: #339933;">::</span><span style="color: #004000;">import</span><span style="color: #009900;">(</span><span style="color: #0000ff;">&#8216;Core&#8217;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&#8216;HttpSocket&#8217;</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></p>
<p><span style="color: #000088;">$HttpSocket</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HttpSocket<span style="color: #009900;">(</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></p>
<p><span style="color: #000088;">$lastFMxml</span><span style="color: #339933;">=</span> <span style="color: #000088;">$HttpSocket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">(</span><span style="color: #0000ff;">&#8216;http://ws.audioscrobbler.com/1.0/user/LennieZ/recenttracks.xml&#8217;</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span><span class="Apple-style-span" style="font-family: 'Times New Roman';"> You can be much more specific with the Httpsocket library like giving a User Agent or supplying user authentication. </span><span class="Apple-style-span" style="font-family: 'Times New Roman';"><a href="http://book.cakephp.org/view/804/request" target="_blank">See this page</a></span><span class="Apple-style-span" style="font-family: 'Times New Roman';"> to get more info about that.</span></div>
<p>&nbsp;</p>
<p><strong>2. Convert an Object into an Array</strong></p>
<p>For data I prefer array&#8217;s more than objects. To get my LastFM timeline I need to retrieve an XML file. I always used <em>simplexml_load_string</em> to convert the results to an XML object. After that I had to convert the object to an array and therefore I used a custom function I found on php.net. Lately I discovered the beautiful &#8216;Set&#8217; Core library from CakePHP. In the Set Core Utility library there are some very useful functions to manipulate arrays and objects. One of the functions is called Reverse, and this function is doing exactly what I want in just 1 line:</p>
<pre class="brush: php"></pre>
<div class="php" style="font-family: monospace;">
<pre class="brush: php"><span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> Set<span style="color: #339933;">::</span><span style="color: #004000;">reverse</span><span style="color: #009900;">(</span><span style="color: #000088;">$lastFMxml</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></pre>
</div>
<p><strong>3. The XML library </strong> Coming to the next point, the XML library. I did not know CakePHP had an XML core library and that&#8217;s why I had to use <em>&#8216;simplexml_load_string</em>&#8216;. With the XML library you can easily convert a string to an XML object.</p>
<p>&nbsp;</p>
<div class="php" style="font-family: monospace;"><span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Xml<span style="color: #009900;">(</span><span style="color: #000088;">$input</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> Set<span style="color: #339933;">::</span><span style="color: #004000;">reverse</span><span style="color: #009900;">(</span><span style="color: #000088;">$xml</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div>
<div class="php" style="font-family: monospace;"></div>
<div class="php" style="font-family: monospace;"><span class="Apple-style-span" style="font-family: 'Times New Roman';">You can even get a remote XML file by using an URL!</span></div>
<p>&nbsp;</p>
<pre class="brush: php"></pre>
<div class="php" style="font-family: monospace;">
<pre class="brush: php"><span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Xml<span style="color: #009900;">(</span><span style="color: #0000ff;">'http://ws.audioscrobbler.com/1.0/user/LennieZ/recenttracks.xml'</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> Set<span style="color: #339933;">::</span><span style="color: #004000;">reverse</span><span style="color: #009900;">(</span><span style="color: #000088;">$xml</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span>

<span class="Apple-style-span" style="font-family: 'Times New Roman'; white-space: normal;"><strong>4. Cache::set() </strong></span></pre>
</div>
<p>I just love cache, I use it quite often and can&#8217;t live without it. The only problem is that when I use <em>Cache::write()</em>, in the past I could always tell this function for how long it should be cached. For some reason this is not working anymore and you need to supply a config name. In my core.php file I told some configs for how long it should be cached. Today I found out I can tell the cache on the fly for how long it should be cached! Using<em> Cache::set()</em>!</p>
<p>&nbsp;</p>
<div class="php" style="font-family: monospace;">Cache<span style="color: #339933;">::</span><span style="color: #004000;">set</span><span style="color: #009900;">(</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">(</span><span style="color: #0000ff;">&#8216;duration&#8217;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&#8216;+30 days&#8217;</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> Cache<span style="color: #339933;">::</span><span style="color: #004000;">write</span><span style="color: #009900;">(</span><span style="color: #0000ff;">&#8216;results&#8217;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Later on </span> Cache<span style="color: #339933;">::</span><span style="color: #004000;">set</span><span style="color: #009900;">(</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">(</span><span style="color: #0000ff;">&#8216;duration&#8217;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&#8216;+30 days&#8217;</span><span style="color: #009900;">)</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span> <span style="color: #000088;">$results</span> <span style="color: #339933;">=</span> Cache<span style="color: #339933;">::</span><span style="color: #004000;">read</span><span style="color: #009900;">(</span><span style="color: #0000ff;">&#8216;results&#8217;</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></div>
<div class="php" style="font-family: monospace;"></div>
<div class="php" style="font-family: monospace;"><span class="Apple-style-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Times New Roman'; white-space: normal;">For some reason you also need to supply </span><span class="Apple-style-span" style="font-family: 'Times New Roman'; white-space: normal;"><em>Cache::set</em></span><span class="Apple-style-span" style="font-family: 'Times New Roman'; white-space: normal;"> when you read your data.</span></span></div>
<div class="php" style="font-family: monospace;"></div>
<div class="php" style="font-family: monospace;"><strong>5. String insert </strong></div>
<p>&nbsp;</p>
<p>Most of my projects I prepare for Internationalization so it will be easy to add more languages in the future. Therefore I&#8217;m using the <em>__(&#8216;Hello!&#8217;) </em>function for every text I need. But what if you need data in your text like a name or an age. You can use sprintf and the %s signs in the text, but I just think that&#8217;s not so nice in the PO files. By using String insert you have a more accessible text in your PO files which is easier to understand for translators.</p>
<p><span class="Apple-style-span" style="font-family: monospace;">String</span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #339933;">::</span></span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #004000;">insert</span></span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #009900;">(</span></span><span class="Apple-style-span" style="font-family: monospace;">__</span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #009900;">(</span></span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #0000ff;">&#8216;My name is :name and I am :age years old.&#8217;</span></span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #339933;">,</span></span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #009900; font-weight: bold;">true</span></span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #009900;">)</span></span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #339933;">,</span></span><span class="Apple-style-span" style="font-family: monospace;"><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a></span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #009900;">(</span></span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #0000ff;">&#8216;name&#8217;</span></span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #339933;">=&gt;</span></span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #0000ff;">&#8216;Bob&#8217;</span></span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #339933;">,</span></span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #0000ff;">&#8216;age&#8217;</span></span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #339933;">=&gt;</span></span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #0000ff;">&#8217;65&#8242;</span></span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #009900;">)</span></span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #009900;">)</span></span><span class="Apple-style-span" style="font-family: monospace;"><span style="color: #339933;">;</span></span></p>
<p>&nbsp;</p>
<p>Next month I will talk about hacking, so stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://lennaert.nu/2009/06/25/five-useful-cakephp-functions-i-just-dicovered/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Canon RAW thumbnails in Windows 7</title>
		<link>http://lennaert.nu/2009/05/11/getting-canon-raw-thumbnails-in-windows-7/</link>
		<comments>http://lennaert.nu/2009/05/11/getting-canon-raw-thumbnails-in-windows-7/#comments</comments>
		<pubDate>Mon, 11 May 2009 17:03:06 +0000</pubDate>
		<dc:creator>lennaert</dc:creator>
				<category><![CDATA[Photography]]></category>

		<guid isPermaLink="false">http://lennaert.nu/?p=12</guid>
		<description><![CDATA[Trying out the latest Windows 7 is quite awesome. The day Windows Vista was released I slept in front of the store so I could install Windows Vista immediately on my computer. Now Microsoft will release later this year the even more awesome Windows 7. I won&#8217;t bore you with the new features because there [...]]]></description>
			<content:encoded><![CDATA[<p>Trying out the latest Windows 7 is quite awesome. The day Windows Vista was released I slept in front of the store so I could install Windows Vista immediately on my computer. Now Microsoft will release later this year the even more awesome Windows 7. I won&#8217;t bore you with the new features because there are <a href="http://blogsearch.google.nl/blogsearch?hl=nl&amp;q=Windows%207%20RC1%20review&amp;um=1&amp;ie=UTF-8&amp;sa=N&amp;tab=wb" target="_blank">plenty of blogs</a> who already talk about it.</p>
<p>Photography is one of my hobbies and because I want a quick overview of my photos without using external software to see them I previously always shot both in RAW and JPG. In that case I could see the JPG thumbnails so I knew which CR2 file I had to open with Photoshop. I still can remember a photoshop trick with Windows XP and the first Adobe Photoshop CS version where you just had to copy a DLL file to a shell folder in the Adobe Common group. Windows 7 has by default a RAW viewer, but since I&#8217;m shooting with a Canon 5D Mark II it&#8217;s still not compatible with the Windows Raw viewer. I searched for several hours on the Internet however the solution is pretty simple. Canon supplies software and it&#8217;s called the Canon RAW Codec (1.5). It&#8217;s made for Windows XP but it&#8217;s also working on a Windows 7 machine.</p>
<p><a href="http://software.canon-europe.com/" target="_blank">Canon Software Drivers</a> &gt; Cameras &gt; EOS 5D Mark II &gt; Canon RAW Codec (1.5).</p>
<p>After installing the Canon RAW codec I&#8217;m able to browse with Windows Explorer through all my photos and I&#8217;m able to view thumbnails from CR2 files of the Canon EOS 5D Mark II. Keep your Adobe Photoshop up to date because with last updates they also supported the 5D Mark II CR2 files. The solution is incredible easy but nobody told me so far how to get CR2 raw files as thumbnails in my Windows 7. Have fun on your Windows 7 machine!</p>
<p style="text-align: center;"><a href="http://lennaert.nu/wp-content/uploads/2009/05/cs2-win7.png"><img class="aligncenter size-full wp-image-45" title="cs2-win7" src="http://lennaert.nu/wp-content/uploads/2009/05/cs2-win7.png" alt="" width="400" height="223" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://lennaert.nu/2009/05/11/getting-canon-raw-thumbnails-in-windows-7/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>CakePHP: No markup with formhelper input</title>
		<link>http://lennaert.nu/2009/04/10/cakephp-no-markup-with-formhelper-input/</link>
		<comments>http://lennaert.nu/2009/04/10/cakephp-no-markup-with-formhelper-input/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 17:01:53 +0000</pubDate>
		<dc:creator>lennaert</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://lennaert.nu/?p=10</guid>
		<description><![CDATA[Just a short blog post about CakePHP, I see loads of people around me who don&#8217;t want any markup like DIVS or LABELS around their form input elements. There are plenty reasons you don&#8217;t want those markup, for example when you need your form in a table. I see programmers using $form-&#62;select(); or $form-&#62;radio(); to [...]]]></description>
			<content:encoded><![CDATA[<p>Just a short blog post about CakePHP, I see loads of people around me who don&#8217;t want any markup like DIVS or LABELS around their form input elements. There are plenty reasons you don&#8217;t want those markup, for example when you need your form in a table.</p>
<p>I see programmers using $form-&gt;select(); or $form-&gt;radio(); to avoid all the markup, but there&#8217;s a simple trick to hide all the additional elements and still benefit from all the magic features of $form-&gt;input();</p>
<p>Just add two parameters in the input options:</p>
<p><code>input('title', array('div' =&gt; false,</p>
<p>'label' =&gt; false)</p>
<p>);</code></p>
]]></content:encoded>
			<wfw:commentRss>http://lennaert.nu/2009/04/10/cakephp-no-markup-with-formhelper-input/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Blake Jarrell presents Concentrate 2009</title>
		<link>http://lennaert.nu/2009/04/08/blake-jarrell-presents-concentrate-2009/</link>
		<comments>http://lennaert.nu/2009/04/08/blake-jarrell-presents-concentrate-2009/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 17:00:39 +0000</pubDate>
		<dc:creator>lennaert</dc:creator>
				<category><![CDATA[Music]]></category>

		<guid isPermaLink="false">http://lennaert.nu/?p=8</guid>
		<description><![CDATA[This is the first time I write a review about a new music album. Normally I wouldn&#8217;t write reviews, but I really want to share a new album because it&#8217;s really brilliant. I pre ordered the album a few weeks ago and last weekend I found it in my mailbox. I started listening it immediately [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://lennaert.nu/wp-content/uploads/2011/08/blakejarrell-concentrate.jpg"><img class="alignleft size-full wp-image-25" title="blakejarrell-concentrate" src="http://lennaert.nu/wp-content/uploads/2011/08/blakejarrell-concentrate.jpg" alt="" width="200" height="200" /></a>This is the first time I write a review about a new music album. Normally I wouldn&#8217;t write reviews, but I really want to share a new album because it&#8217;s really brilliant. I pre ordered the album a few weeks ago and last weekend I found it in my mailbox. I started listening it immediately and felt in love with the story of deep progressive beats, trancy melodies, housy sceneries and indulging side-effects called &#8216; Blake Jarrell &#8211; Cencentrate 2009&#8242;.</p>
<p><a href="http://www.blakejarrell.com" target="_blank">Blake Jarrell</a> is an American DJ originally from New Orleans, after the Katrina disaster he moved to Chicago and started his DJ Career. After listening to a few of Blake&#8217;s tracks, Armin van Buuren himself contacted Blake and right after that he started touring with Armin all over the world. Personally I first heard of Blake Jarrell after the <a href="http://www.youtube.com/watch?v=TFbCQvrv_lY" target="_blank">Anna Nalick &#8211; Breathe remix</a>, which was my absolute favourite track in 2006 and made my summer perfect with loads of great memories. I started following Blake Jarrell and was pleased to watch him live in The Sand in Amsterdam. He started his radio show, also called concentrate which is a monthly radio show full of nice progressive music. Since I was searching for a less main-stream DJ, Blake Jarrell is now one of my favourite &#8216;future talents&#8217;.</p>
<p>The first CD of the album is full of new remixes from Blake and his very own track called &#8216;Eilat&#8217;. The tracks are really amazing, Blake is one of the best remix DJ&#8217;s I&#8217;ve ever seen, he remixed artists like Snow Patrol, Anna Nalick, Linkin Park and now on this album he remixed some tracks of his colleagues in the Blake Jarrell style, which are quite brilliant. I would almost say this album is quite ambience, every track is a story within very big story, it&#8217;s perfectly mixed together and this first CD is one big pleasure for my ears, my brains and my body.</p>
<p>The second (bonus) Cd are tracks we already know from Blake Jarrell which are awesome. I thoroughly enjoyed hearing &#8216; Not Alone tonight &#8216; again and his brilliant remix of &#8216; Wouldn&#8217;t change a thing&#8217; from Jose Amnesia feat Jennifer Rene. Also, a few of his own produced tracks are on this album, a perfect CD for in my car, I love it.</p>
<p>Blake Jarrell didn&#8217;t want to create ‘just&#8217; an artist or mix album. Blake needed something special. In my opinion he succeeded. <a href="http://supra.armadamusic.nl/?id=2450" target="_blank">Blake&#8217;s album</a> is Focusing on Blake&#8217;s remixes and productions, all in optimal balance to one another. Blake Jarrell is also in 2009 my favourite future talent, although he&#8217;s already a huge talent. I can&#8217;t wait to see him spinning again in Holland. <span id="more-8"></span></p>
<p><strong>Tracklist</strong></p>
<p><strong>Disc 1</strong></p>
<p>01 Blake Jarrell &#8211; Concentrate 2009 Intro</p>
<p>02 Astrid Suryanto &#8211; Distant Bar (Blake Jarrell Remix)</p>
<p>03 Mike Foyle &#8211; Bittersweet Nightshade (Blake Jarrell Remix)</p>
<p>04 Gabriel &amp; Dresden feat. Molly Bancro &#8211; Let Go (Blake Jarrell Remix)</p>
<p>05 Nosmo v Kris B &#8211; One For The Road 2008 Deep Mix (Blake Jarrell Remix)</p>
<p>06 Dobenbeck feat. Joanna &#8211; Please Don&#8217;t Go (Blake Jarrell Remix)</p>
<p>07 Blake Jarrell &#8211; Eilat (Original Mix)</p>
<p>08 Michael Cassette &#8211; David (Blake Jarrell Remix)</p>
<p>09 Jerome Isma-Ae &#8211; Smile When You Kill Me (Blake Jarrell Remix)</p>
<p>10 Arnej feat. Josie &#8211; Strangers We&#8217;ve Become (Blake Jarrell Remix)</p>
<p>11 Kyau &amp; Albert &#8211; Walk Down (Blake Jarrell Remix)</p>
<p>12 Cerf, Mitiska &amp; Jaren &#8211; You Never Said (Blake Jarrell Remix)</p>
<p>13 Khaz &amp; Boris M.D. &#8211; Eliana (Blake Jarrell Remix)</p>
<p><strong>Disc 2</strong></p>
<p>01 Blake Jarrell &#8211; Animal (Original Mix)</p>
<p>02 Marscruiser feat. Kendra Foster &#8211; Not Alone Tonight (Blake Jarrell Club Mix)</p>
<p>03 Blake Jarrell &#8211; Take Care (Original Mix)</p>
<p>04 Christopher Manik &#8211; 2 Piano&#8217;s (Blake Jarrell Mix)</p>
<p>05 Royal Sapien &#8211; Everyone (Blake Jarrell Mix)</p>
<p>06 Blake Jarrell &#8211; Punta Del Este (Arnej&#8217;s Minimal Drum Dub)</p>
<p>07 Jose Amnesia feat. Jennifer Rene &#8211; Wouldn&#8217;t Change A Thing (Blake Jarrell 190 Db Remix)</p>
<p>08 Blake Jarrell &#8211; Tabanka (Original Mix)</p>
<p>09 Hammer &amp; Herbick feat. Boytronic &#8211; You (Blake Jarrell Instrumental Mix)</p>
<p>10 Moussa Clarke &amp; Terrafunka &#8211; She Wants Him (Blake Jarrell&#8217;s Panty Dropper Remix)</p>
<p>11 Blake Jarrell Presents Thraser &#8211; Hosoi (Original Mix)</p>
<p>12 Blake Jarrell Presents Thraser &#8211; Hosoi (Simon &amp; Shaker Remix)</p>
]]></content:encoded>
			<wfw:commentRss>http://lennaert.nu/2009/04/08/blake-jarrell-presents-concentrate-2009/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>How we built Twittermail in 48 hours</title>
		<link>http://lennaert.nu/2009/03/24/how-we-built-twittermail-in-48-hours/</link>
		<comments>http://lennaert.nu/2009/03/24/how-we-built-twittermail-in-48-hours/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 17:58:58 +0000</pubDate>
		<dc:creator>lennaert</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://lennaert.nu/?p=6</guid>
		<description><![CDATA[Okay, for those who don&#8217;t know Twittermail, Twittermail is an open idea by Boris Veldhuijzen van Zanten, he thought that it would be great if people could e-mail their tweets to Twitter.com. This is potentially very useful for people who use mobile phones. Of course you can go to the mobile webpage of Twitter, but [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, for those who don&#8217;t know Twittermail, Twittermail is an open idea by Boris Veldhuijzen van Zanten, he thought that it would be great if people could e-mail their tweets to Twitter.com.</p>
<p>This is potentially very useful for people who use mobile phones. Of course you can go to the mobile webpage of Twitter, but sending an e-mail is pretty much easier. Some older phones do not even contain a browser and only have e-mail functionality. Also a lot of businesses block Twitter.com on their corporate network but with Twittermail you can continually update your Twitter account even from your business e-mail address.</p>
<p>Those who register at Twittermail, get a secret unique email address like <em>1234abcde [AT] twittermail com. </em>When you send an e-mail to this secret email address, it will get posted instantly to Twitter.com through the Twitter API.</p>
<p><span id="more-6"></span></p>
<h3>The Environment</h3>
<p>Twittermail is a small project so basically we only need a sign-up form, a settings page and we need to show some recent activity. Since we handle loads of visitors and more than 3000 emails a day this project needed to be very scalable and thin. We read a lot about the benchmarking results[sub]1[/sub]. We managed to do this project in exactly 48 hours, thanks to CakePHP (and Coca Cola).</p>
<h3>Custom Validation</h3>
<p>Users supply us their Twitter credentials so that we can create a unique email address. Because we need to verify if the information they provide is valid, we created a custom validation which checks the Twitter API whether or not everything is valid. In our model we created a custom function called &#8216;isValidTwitter&#8217;, in this function we make a CURL call to the Twitter API, we parse the output from JSON to an array and we get back the user information or an error.</p>
<pre>array(
            'rule' =&gt; array('isValidTwitter'),
            'message' =&gt; __('The credentials you supplied are not valid! Please try again')
        )
    );
?&gt;</pre>
<pre>data[$this-&gt;name]['twitter_username'].":".$this-&gt;data[$this-&gt;name]['twitter_password']);
        curl_setopt($curl_twitter, CURLOPT_POST, true);
        curl_setopt($curl_twitter, CURLOPT_RETURNTRANSFER, true);
        $curl_result = curl_exec($curl_twitter);
        curl_close($curl_twitter);

        $twitterResponse = json_decode($curl_result, true);
?&gt;</pre>
<p>From now on you can do whatever you want with the results. In our project we encode the password, fetch some Twitter information and save it to the database.</p>
<p>Because we don&#8217;t need a very complex User Authentication, we didn&#8217;t use ACL.</p>
<h3>Localization &amp; Internationalization, l10n and i18n</h3>
<p>At the moment our Website is English-only, but we already made it multi-language proof by using the __(&#8216;Login&#8217;) function. For those who never worked with localization, in the cake console you can simply generate a language file by using the command &#8216;cake I18n&#8217; here you get the option to extract all __(&#8221;) strings to POI files. You can read more about localization at the wonderful Cookbook at <a href="http://book.cakephp.org/view/162/Localizing-Your-Application" target="_blank">http://book.cakephp.org/view/162/Localizing-Your-Application</a></p>
<h3>Scaling</h3>
<h4>Caching</h4>
<p>Because we&#8217;re currently serving more than 25,000 users and more than 1,000,000 emails have been sent, scaling is an serious subject. First of all, use Cache! You don&#8217;t need to get all data over and over again from the database. For example in the sidebar we have &#8216;Newest Twittermailers&#8217;. This is cached for a year (yes, a year), every time when someone is registering, we&#8217;re resetting the cache. Cache isn&#8217;t a thing you should forget, and for those who never worked with it please read the Cookbook.</p>
<pre>// Reset / Delete the cache, so next time the newest Twittermailers list will be re-generated.
Cache::delete('sidebar_newesttwitters');</pre>
<h4>Containable Behavior</h4>
<p>This is a very substantial improvement in the Cake 1.2 series, in the past I always used for my CakePHP projects &#8216;expect&#8217; (For 1.1 users: http://bakery.cakephp.org/articles/view/keeping-bindmodel-and-unbindmodel-out-of-your-controllers). This model behavior allows you to filter and limit model find operations. Using Containable will help you cut down on needless wear and tear on your database, increasing the speed and overall performance of your application. The class will also help you search and filter your data for your users in a clean and consistent way.</p>
<p>It helps you to select only the data you really want, it&#8217;s recommended to read the full recept about this at <a href="http://book.cakephp.org/view/474/Containable" target="_blank">http://book.cakephp.org/view/474/Containable</a></p>
<h3>Think about security</h3>
<p>Often developers forget to think about security, but security is a very important subject when you&#8217;re developing web-applications. Use the validations and double check them with the sanitize object built-in CakePHP.</p>
<pre>App::import('Sanitize');</pre>
<p><em>Put this code in your AppController and AppModel to achieve a higher lever of security, read about it at http://book.cakephp.org/view/153/Data-Sanitization/ </em> For example:</p>
<pre>echo Sanitize::html($untrustedString, true);</pre>
<p>And remember: NEVER trust the input of your users!<br />
Then there&#8217;s the Model::save function, that lacks a complete description in the cakebook, but in my opinion the $fieldList method is very important.</p>
<p>Like I said before, never trust the input of your users, supply $fieldList with an array of all the fields you&#8217;re supposed to fill.</p>
<p>For example:</p>
<pre>$this-&gt;Twitter-&gt;save($this-&gt;data, true, array('username', 'password', 'email'));</pre>
<h3>How we did it in 48 hours</h3>
<p>f course, this is a (very) small project, but because of Cake we were able to manage this project in 48 hours. It&#8217;s essential to stick to the CakePHP &#8216;rules&#8217;, just use the validation methods, use the helpers, use the build-in components, it actually helps you with keeping your code clean and compact.</p>
<h3>Some respect</h3>
<p>Show the world you&#8217;re happy with CakePHP, put the &#8216;cakephp &#8211; power&#8217; button on your website, be proud you&#8217;re using CakePHP. Also don&#8217;t forget to donate, the cake developers team are working day-and-night to supply us a better CakePHP, the only thing we could do is using CakePHP and show our satisfaction, at the end of 2009 we will donate the Cake Foundation 10% of Twittermail&#8217;s profit.<br />
Happy baking,</p>
<p>Bram Kok</p>
<p>Lennaert Ekelmans</p>
<p>http://www.twittermail.com</p>
]]></content:encoded>
			<wfw:commentRss>http://lennaert.nu/2009/03/24/how-we-built-twittermail-in-48-hours/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

