<?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>Rob Allen&#039;s DevNotes &#187; Development</title>
	<atom:link href="http://akrabat.com/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://akrabat.com</link>
	<description>Developing PHP software in the Real World, by Rob Allen</description>
	<lastBuildDate>Wed, 01 Sep 2010 14:33:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Using PDT with Zend Framework Projects</title>
		<link>http://akrabat.com/development/using-pdt-with-zend-framework-projects/</link>
		<comments>http://akrabat.com/development/using-pdt-with-zend-framework-projects/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 06:36:29 +0000</pubDate>
		<dc:creator>Rob...</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://akrabat.com/?p=983</guid>
		<description><![CDATA[I original wrote this as a comment on Victor Nicollet's blog, but I thought I should document it here too so that I can refer other people to the information. These are some tips and tricks when using PDT with Zend Framework that make my life easier: Autocompletion for dynamic properties Zend_Db_Table_Row_Abstract uses __get() and [...]]]></description>
			<content:encoded><![CDATA[<p>I original wrote this as a <a href="http://www.nicollet.net/2010/03/why-i-gave-up-on-the-zend-framework/#comment-21302">comment</a> on Victor Nicollet's blog, but I thought I should document it here too so that I can refer other people to the information.</p>
<p>These are some tips and tricks when using PDT with Zend Framework that make my life easier:</p>
<h4>Autocompletion for dynamic properties</h4>
<p><tt>Zend_Db_Table_Row_Abstract</tt> uses <tt>__get()</tt> and <tt>__set()</tt> magic in order to map to the underlying database table row in question. This means that you can use property autocompletion on an instance of it. You can however tell your your table class which class to use for the row objects:</p>
<pre class="phpcode"><span style="color: #0000BB">class&nbsp;Application_Model_Users&nbsp;</span><span style="color: #007700">extends&nbsp;</span><span style="color: #0000BB">Zend_Db_Table_Abstract
</span><span style="color: #007700">{
&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;</span><span style="color: #0000BB">$_name&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'users'</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;database&nbsp;table&nbsp;name
&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">protected&nbsp;</span><span style="color: #0000BB">$_rowClass&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'Application_Model_User'</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;row&nbsp;class&nbsp;to&nbsp;use
</span><span style="color: #007700">}
</span>
</span></code></pre>
<p>With your row class, you can take advantage of the <tt>@property</tt> docblock element to document the fields in the class:</p>
<pre class="phpcode"><span style="color: #0000BB"></span><span style="color: #FF8000">/**
&nbsp;*&nbsp;@property&nbsp;string&nbsp;$user_id
&nbsp;*&nbsp;@property&nbsp;string&nbsp;$username
&nbsp;*&nbsp;@property&nbsp;string&nbsp;$password
&nbsp;*/
</span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">Application_Model_User&nbsp;</span><span style="color: #007700">extends&nbsp;</span><span style="color: #0000BB">Zend_Db_Table_Row_Abstact
</span><span style="color: #007700">{
}</span>
</span></code></pre>
<p>Autocomplete on instances of <tt>Application_Model_User</tt> will now work.</p>
<p><tt>Zend_View</tt> scripts are more complicated as they use <tt>$this</tt> to access magic properties. You can do however use the <tt>@var</tt> trick at the top of the .phtml file:</p>
<pre class="phpcode"><span style="color: #0000BB">$user&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">user</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">/*&nbsp;@var&nbsp;$user&nbsp;Application_Model_User&nbsp;*/
</span><span style="color: #0000BB">$page&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">page</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">/*&nbsp;@var&nbsp;$user&nbsp;Application_Model_Page&nbsp;*/
</span><span style="color: #0000BB">etc</span><span style="color: #007700">...</span>
</span></code></pre>
<p>You can now autocomplete on <tt>$user</tt> and <tt>$page</tt>. This also has the side-effect of documenting  which view properties are used in this view script.</p>
<h4>Opening an arbitrary method</h4>
<p>View helpers are also magic methods on Zend_View's <tt>$this</tt> within a script file. This means that you can't cmd+click( or press F3) on the view helper's method name to jump directly to the code for that method. You can however take advantage of PDT's <em>Navigation->Open Method</em> feature. Simply select the method name and then press <strong>shift+cmd+m</strong>. The "Open Method" dialog appears and usually the view helper is selected as the first item. Just press <strong>return</strong> to go directly to the code for that view helper.</p>
<h4>Opening an arbitrary file</h4>
<p>For opening up an arbitrary file that's in my project, I find that PDT's <em>Navigation->Open Resource</em> (<strong>shift+cmd+r</strong>) is handy. For TextMate users, this is similar to the cmd+t feature.</p>
<h4>Opening an arbitrary class</h4>
<p>Using <em>Navigation->Open Type</em> (<strong>shift+cmd+t</strong>), you can also jump to classes easily. e.g. I regularly hit <strong>shift+cmd+t</strong> followed by "<tt>*Model_</tt>" and I get a list of all my models and can jump to the one I want using the down arrow key and then return.</p>
<h4>Finding the current open file in the project tree</h4>
<p>Just press <strong>cmd+option+w</strong>. You have to be careful here as it's very similar keyboard shortcut to close and close all! However if you have an entity file open and you name your files like I do, then the mapper is next to it in the project list, so it's only a couple of keystrokes to open it up.</p>
<h4>Conclusion</h4>
<p>These tips obviously work with all frameworks and any PHP coding :) Netbeans also has similar features, so I would guess all IDEs do. If you are wedded to vim or such like, then <a href="http://ctags.sourceforge.net/">ctags</a> is helpful for jumping around your code. </p>
<p>If you have a favourite tip that I haven't mentioned, let me know in the comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://akrabat.com/development/using-pdt-with-zend-framework-projects/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Site Stats</title>
		<link>http://akrabat.com/development/site-stats/</link>
		<comments>http://akrabat.com/development/site-stats/#comments</comments>
		<pubDate>Sun, 09 Mar 2008 08:39:03 +0000</pubDate>
		<dc:creator>Rob...</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://akrabat.com/2008/03/09/site-stats/</guid>
		<description><![CDATA[One thing I get asked a lot about at work is site stats. Usually, the client wants to know how many visitors they get on any other day along with other data such as where the visitors came from and which search terms they may have used. So far, I've used Google Analytics and PHPMyVisites [...]]]></description>
			<content:encoded><![CDATA[<p>One thing I get asked a lot about at work is site stats. Usually, the client wants to know how many visitors they get on any other day along with other data such as where the visitors came from and which search terms they may have used.</p>
<p>So far, I've used <a href="https://www.google.com/analytics">Google Analytics</a> and <a href="">PHPMyVisites</a> JS based logging along with <a href="http://www.analog.cx/">Analog</a> on the logs themselves. I've also experimented with <a href="http://haveamint.com/">Mint</a> on one site. </p>
<p>Generally, I've found that Analytics requires lots of drilling down to find anything, PHPMyVisites can be a little simplistic (though it is getting more features with each release) and Mint doesn't provide enough history.</p>
<p>Are there better solutions out that that are cost-effective for relatively small clients?</p>
]]></content:encoded>
			<wfw:commentRss>http://akrabat.com/development/site-stats/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>YSlow!</title>
		<link>http://akrabat.com/development/yslow/</link>
		<comments>http://akrabat.com/development/yslow/#comments</comments>
		<pubDate>Mon, 06 Aug 2007 20:47:42 +0000</pubDate>
		<dc:creator>Rob...</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://akrabat.com/2007/08/06/yslow/</guid>
		<description><![CDATA[I've been playing recently with YSlow! from Yahoo! and it's quite cool. It's a plug-in for Firefox that works in combination with Firebug that gives you pointers as to why your site isn't as fast as it could be. I noticed that one site that I'm developing at the moment was rated C, so thought [...]]]></description>
			<content:encoded><![CDATA[<p>I've been playing recently with <a href="http://developer.yahoo.com/yslow/">YSlow!</a> from Yahoo! and it's quite cool. It's a plug-in for Firefox that works in combination with <a href="http://www.getfirebug.com/">Firebug</a> that gives you pointers as to why your site isn't as fast as it could be.</p>
<p>I noticed that one site that I'm developing at the moment was rated C, so thought I'd see what I could do easily to improve it. These are the items that I sorted out.</p>
<h3>Configure ETags</h3>
<p>[<a href="http://developer.yahoo.com/performance/rules.html#etags">notes</a>] ETags are related to caching and don't seem especially useful from the notes, so I turned them off in my .htaccess:</p>
<pre class="apacheconf">FileETag none</pre>
<h3>GZip Components</h3>
<p>[<a href="http://developer.yahoo.com/performance/rules.html#gzip">notes</a>] For Apache 2.x, mod_deflate can be used to compress the text data that is sent to the browser. I enabled it in my .htaccess using:</p>
<pre class="apacheconf">&lt;ifmodule deflate_module&gt;
  AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
&lt;/ifmodule&gt;</pre>
<p>Note that the Apache docs have better configuration settings if you need to support older browsers and other edge cases.</p>
<h3>Add an Expires Header</h3>
<p>[<a href="http://developer.yahoo.com/performance/rules.html#expires">notes</a>] The Expires header tells the browser when to look for a new version of a given file. mod_expires is the Apache module required and the .htaccess settings I've used are:</p>
<pre class="apacheconf">&lt;ifmodule expires_module&gt;
    ExpiresActive On
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType application/x-shockwave-flash "access plus 1 month"
&lt;/ifmodule&gt;</pre>
<p><strong>Note</strong> Don't use the expires statements when developing!</p>
<h3>Conclusion</h3>
<p>There you have it. Some simple Apache configuration settings to help improve the performance of your website. </p>
<p>As usual, comments, criticisms and suggested improvements very welcome!</p>
]]></content:encoded>
			<wfw:commentRss>http://akrabat.com/development/yslow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
