<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>DaveDevelopment</title>
	
	<link>http://www.davedevelopment.co.uk</link>
	<description>Dave Marshall</description>
	<lastBuildDate>Tue, 30 Jun 2009 09:59:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/Davedevelopment" type="application/rss+xml" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">Davedevelopment</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Mozilla’s Content Security Policy (CSP)</title>
		<link>http://www.davedevelopment.co.uk/2009/06/30/mozillas-content-security-policy-csp/</link>
		<comments>http://www.davedevelopment.co.uk/2009/06/30/mozillas-content-security-policy-csp/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 09:53:04 +0000</pubDate>
		<dc:creator>davedevelopment</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[XHTML/CSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[xss]]></category>

		<guid isPermaLink="false">http://www.davedevelopment.co.uk/?p=419</guid>
		<description><![CDATA[I saw this post via SlashDot and can&#8217;t help but think it&#8217;s a little overkill? 
Content Security Policy is intended to mitigate a large class of Web Application Vulnerabilities: Cross Site Scripting. Cross Site Request Forgery has also become a large scale problem in Web Application Security, though it is not a primary focus of [...]]]></description>
			<content:encoded><![CDATA[<p>I saw <a href="http://blog.mozilla.com/security/2009/06/19/shutting-down-xss-with-content-security-policy/">this post</a> via <a href="http://slashdot.org">SlashDot</a> and can&#8217;t help but think it&#8217;s a little overkill? </p>
<blockquote><p><a href="http://people.mozilla.org/~bsterne/content-security-policy/">Content Security Policy</a> is intended to mitigate a large class of Web Application Vulnerabilities: Cross Site Scripting. Cross Site Request Forgery has also become a large scale problem in Web Application Security, though it is not a primary focus of Content Security Policy.</p>
</blockquote>
<p>In an ideal world, this would be great, but getting all the browsers on board and implemented may take a while. I was thinking about this the other day and I don&#8217;t see why the browsers/w3c can&#8217;t standardise on some sort of tag or conditional comments that says don&#8217;t execute any script in here. This would be simple to use and surely simple to implement. Browsers already know what to do with <a href="http://www.w3schools.com/TAGS/tag_noscript.asp"><code>&lt;noscript&gt;</code></a></p>
<p>For Example: </p>
<pre class="php" name="code">
&lt;dontexecutescript&gt;
    &lt;?php echo $this-&gt;escape($userProvidedContent);?&gt;
&lt;/dontexecutescript&gt;
</pre>
<p>Or:</p>
<pre class="php" name="code">
&lt;!--[dontexecutescript] --&gt;
    &lt;?php echo $this-&gt;escape($userProvidedContent);?&gt;
&lt;!--[dontexecutescript]--&gt;
</pre>
<p>I&#8217;m no expert on <a href="http://en.wikipedia.org/wiki/Cross-site_scripting">XSS</a>, but I&#8217;m pretty sure this would solve most of the issues encountered. </p>
<p><strong>Update:</strong></p>
<p>Okay, so one obvious problem might be that the <code>$userProvidedContent</code> contains a closing <code>&lt;/dontexecutescript&gt;</code> tag, but that&#8217;s just semantics. Unique identifiers for each block, ignoring tags that don&#8217;t match up, these browser developers are clever, they could come up with something. </p>




	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F06%2F30%2Fmozillas-content-security-policy-csp%2F&amp;title=Mozilla%27s%20Content%20Security%20Policy%20%28CSP%29&amp;bodytext=I%20saw%20this%20post%20via%20SlashDot%20and%20can%27t%20help%20but%20think%20it%27s%20a%20little%20overkill%3F%20%0D%0A%0D%0AContent%20Security%20Policy%20is%20intended%20to%20mitigate%20a%20large%20class%20of%20Web%20Application%20Vulnerabilities%3A%20Cross%20Site%20Scripting.%20Cross%20Site%20Request%20Forgery%20has%20also%20become%20a%20lar" title="Digg"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://delicious.com/post?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F06%2F30%2Fmozillas-content-security-policy-csp%2F&amp;title=Mozilla%27s%20Content%20Security%20Policy%20%28CSP%29&amp;notes=I%20saw%20this%20post%20via%20SlashDot%20and%20can%27t%20help%20but%20think%20it%27s%20a%20little%20overkill%3F%20%0D%0A%0D%0AContent%20Security%20Policy%20is%20intended%20to%20mitigate%20a%20large%20class%20of%20Web%20Application%20Vulnerabilities%3A%20Cross%20Site%20Scripting.%20Cross%20Site%20Request%20Forgery%20has%20also%20become%20a%20lar" title="del.icio.us"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F06%2F30%2Fmozillas-content-security-policy-csp%2F&amp;h=Mozilla%27s%20Content%20Security%20Policy%20%28CSP%29" title="NewsVine"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F06%2F30%2Fmozillas-content-security-policy-csp%2F&amp;title=Mozilla%27s%20Content%20Security%20Policy%20%28CSP%29" title="Reddit"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="" title="Furl"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F06%2F30%2Fmozillas-content-security-policy-csp%2F&amp;title=Mozilla%27s%20Content%20Security%20Policy%20%28CSP%29" title="DZone"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F06%2F30%2Fmozillas-content-security-policy-csp%2F&amp;title=Mozilla%27s%20Content%20Security%20Policy%20%28CSP%29" title="StumbleUpon"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F06%2F30%2Fmozillas-content-security-policy-csp%2F" title="Technorati"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/Davedevelopment/~4/0va_I03BFEc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.davedevelopment.co.uk/2009/06/30/mozillas-content-security-policy-csp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using message queues to improve user experience</title>
		<link>http://www.davedevelopment.co.uk/2009/06/01/using-message-queues-to-improve-user-experience/</link>
		<comments>http://www.davedevelopment.co.uk/2009/06/01/using-message-queues-to-improve-user-experience/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 13:22:48 +0000</pubDate>
		<dc:creator>davedevelopment</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.davedevelopment.co.uk/?p=407</guid>
		<description><![CDATA[A major part of the application I develop on my day job is a big DMS, part of which is the ability to distribute documents to staff and external parties. The distribution system works in such a way that, if sending a document to 300 people, there will actually be 300 individual emails created, rather [...]]]></description>
			<content:encoded><![CDATA[<p>A major part of the application I develop on my day job is a big <a href="http://en.wikipedia.org/wiki/Document_management_system"><abbr title="Document Management System">DMS</abbr></a>, part of which is the ability to distribute documents to staff and external parties. The distribution system works in such a way that, if sending a document to 300 people, there will actually be 300 individual emails created, rather than one email with a list of recipients. This is desired behavior. My problem is, sending 300 emails at the click of a button can take a little time, degrading the experience for the users. This portion of the <a href="http://en.wikipedia.org/wiki/Call_graph">call graph</a> shows sending to just five people was taking 1+ seconds.</p>
<p><a href="http://www.davedevelopment.co.uk/wp-content/uploads/2009/06/screenshot2.png"><img src="http://www.davedevelopment.co.uk/wp-content/uploads/2009/06/screenshot2.png" alt="screenshot2" title="screenshot2" width="299" height="180" class="alignnone size-full wp-image-412" /></a></p>
<p>To solve this, I started out to implement a simple <a href="http://en.wikipedia.org/wiki/Queue_(data_structure)" title="Read about queues on WikiPedia">queuing</a> system, whereby the distribution requests are added to a queue, before being sent out by a scheduled task. </p>
<p>Rather than refactor a lot of code and do this some fancy way, I quickly put in a solution that proved the concept and seems to work pretty well for now, with minimal effort. As an example (our code&#8217;s slightly more complex, I don&#8217;t get paid for nothing), here&#8217;s what I started with:</p>
<pre name="code" class="php">
< ?php
class EmailSender {
    /**
     * Takes an array of addresses and sends an email to each one.
     *
     * @param array $address
     */
    public static function sendEmails($address) {
        /**
         * Code in here
         */
    }
}
</pre>
<p>The idea was fairly simple and I'm sure it's been done many times before. First step was to rename the existing method and make it private. I then wrote a new method, that checked to see if there was a queue available, if so adds the request to the queue, otherwise calls the old method. Then all I had to do was write a method that checks the queue, running any requests it finds through the original method. We've recently adopted the <a href="http://framework.zend.com/" title="Zend Framework">Zend Framework</a>, so checking out <a href="http://framework.zend.com/wiki/display/ZFPROP/Zend_Queue+-+Justin+Plock">Zend_Queue</a> from the <a href="http://framework.zend.com/svn/framework/standard/incubator/" title="Zend Framework Incubator">incubator</a>, reading some documentation with my <a href="http://www.docbook.org/">docbook</a> goggles on (couldn't be bothered to build it) and it was pretty much in place.</p>
</pre>
<pre name="code" class="php">
< ?php
/**
 * Zend_Queue offline processing hack example
 *
 * @author      Dave Marshall
 * @version     $Rev: $
 * @since       $Date: $
 * @link        $URL: $
 */
class EmailSender {

    private static $queue = null;

    /**
     * Set Queue
     *
     * @param Zend_Queue $queue
     */
    public static function setQueue($queue)
    {
        self::$queue = $queue;
    }

    /**
     * Takes an array of addresses and sends an email to each one.
     *
     * @see reallySendEmail
     * @see sendQueuedEmails
     * @param array $address
     */
    public static function sendEmail($address)
    {
        if (self::$queue === null) {
            return self::reallySendEmail($address);
        }

        self::$queue->send(serialize(func_get_args()));
    }

    /**
     * Takes an array of addresses and sends an email to each one.
     *
     * @see sendEmail
     * @param array $address
     */
    private static function reallySendEmail($address)
    {
        /**
         * Code in here
         */
        echo 'Sending email to ' . implode(', ', $address) . PHP_EOL;
    }

    /**
     * Reads emails from the queue and sends them
     *
     * @param int $count - The number of queued items to process
     */
    public static function sendQueuedEmails($count)
    {
        /**
         * Should really check the queue is good here
         */

        $messages = self::$queue->receive(intval($count));
        foreach($messages as $msg) {
            $args = unserialize($msg->body);
            call_user_func_array(array(__CLASS__, 'reallySendEmail'), $args);
            self::$queue->deleteMessage($msg);
        }
    }
}

set_include_path(
    dirname(__FILE__) . '/src/Zend_Framework/library' . PATH_SEPARATOR
    . dirname(__FILE__) . '/src/ZendI/library' . PATH_SEPARATOR
    . get_include_path()
);

require_once "Zend/Loader.php";
Zend_Loader::registerAutoload();

define('DB_SERVER', 'localhost');
define('DB_PORT', 3306);
define('DB_USER', 'root');
define('DB_PASS', 'password');
define('DB_NAME', 'queue_example');

/**
 * Transmittal Queue
 *
 */
$config = array(
    'name' => 'transmittal',
    'driverOptions' => array(
        'host'     => DB_SERVER,
        'port'     => DB_PORT,
        'username' => DB_USER,
        'password' => DB_PASS,
        'dbname'   => DB_NAME,
        'type'     => 'pdo_mysql'
    )
);

// Create a database queue
$queue = new Zend_Queue('Db', $config);
$queue->createQueue('myqueue'); // called for good measure

EmailSender::setQueue($queue);

/**
 * Usage for adding to the queue
 */
EmailSender::sendEmail(array('davemastergeneral@gmail.com'));

/**
 * Usage for scheduled task
 */
EmailSender::sendQueuedEmails(5);
</pre>
<p>This may not be the best practice in the world, but it <a href="http://www.davedevelopment.co.uk/2007/07/10/getting-things-done/">got the job done</a>. Check it out at <a href="http://www.zfsnippets.com/snippets/view/id/60">ZFSnippets.com</a>.</p>




	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F06%2F01%2Fusing-message-queues-to-improve-user-experience%2F&amp;title=Using%20message%20queues%20to%20improve%20user%20experience&amp;bodytext=A%20major%20part%20of%20the%20application%20I%20develop%20on%20my%20day%20job%20is%20a%20big%20DMS%2C%20part%20of%20which%20is%20the%20ability%20to%20distribute%20documents%20to%20staff%20and%20external%20parties.%20The%20distribution%20system%20works%20in%20such%20a%20way%20that%2C%20if%20sending%20a%20document%20to%20300%20people%2C%20there%20wil" title="Digg"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://delicious.com/post?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F06%2F01%2Fusing-message-queues-to-improve-user-experience%2F&amp;title=Using%20message%20queues%20to%20improve%20user%20experience&amp;notes=A%20major%20part%20of%20the%20application%20I%20develop%20on%20my%20day%20job%20is%20a%20big%20DMS%2C%20part%20of%20which%20is%20the%20ability%20to%20distribute%20documents%20to%20staff%20and%20external%20parties.%20The%20distribution%20system%20works%20in%20such%20a%20way%20that%2C%20if%20sending%20a%20document%20to%20300%20people%2C%20there%20wil" title="del.icio.us"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F06%2F01%2Fusing-message-queues-to-improve-user-experience%2F&amp;h=Using%20message%20queues%20to%20improve%20user%20experience" title="NewsVine"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F06%2F01%2Fusing-message-queues-to-improve-user-experience%2F&amp;title=Using%20message%20queues%20to%20improve%20user%20experience" title="Reddit"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="" title="Furl"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F06%2F01%2Fusing-message-queues-to-improve-user-experience%2F&amp;title=Using%20message%20queues%20to%20improve%20user%20experience" title="DZone"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F06%2F01%2Fusing-message-queues-to-improve-user-experience%2F&amp;title=Using%20message%20queues%20to%20improve%20user%20experience" title="StumbleUpon"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F06%2F01%2Fusing-message-queues-to-improve-user-experience%2F" title="Technorati"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/Davedevelopment/~4/3HaO3tQC_hI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.davedevelopment.co.uk/2009/06/01/using-message-queues-to-improve-user-experience/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Redmine Issue Tracker/Project Management</title>
		<link>http://www.davedevelopment.co.uk/2009/04/20/review-redmine-issue-trackerproject-management/</link>
		<comments>http://www.davedevelopment.co.uk/2009/04/20/review-redmine-issue-trackerproject-management/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 15:30:42 +0000</pubDate>
		<dc:creator>davedevelopment</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[bug tracker]]></category>
		<category><![CDATA[issue tracker]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[project management]]></category>
		<category><![CDATA[redmine]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.davedevelopment.co.uk/?p=290</guid>
		<description><![CDATA[
We recently started using Redmine as our issue tracking software and we&#8217;re very pleased with it. I trialled several alternatives, both open source and commercial, including Jira, FogBugz, Mantis and Trac, but decided on Redmine. Jira and FogBugz look like excellent products, but I don&#8217;t feel we would use the extra functionality that warrants the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.redmine.org/"><img src="http://www.davedevelopment.co.uk/wp-content/uploads/2009/01/redmine_logo_bw.png" alt="redmine_logo_bw" title="redmine_logo_bw" width="459" height="235" class="alignnone size-full wp-image-291" /></a></p>
<p>We recently started using <a href="http://www.redmine.org" title="Redmine">Redmine</a> as our issue tracking software and we&#8217;re very pleased with it. I trialled several alternatives, both open source and commercial, including <a href="http://www.atlassian.com/software/jira/">Jira</a>, <a href="http://www.fogcreek.com/FogBUGZ/">FogBugz</a>, <a href="http://www.mantisbt.org/">Mantis</a> and <a href="http://trac.edgewall.org/">Trac</a>, but decided on Redmine. Jira and FogBugz look like excellent products, but I don&#8217;t feel we would use the extra functionality that warrants the price tag. Mantis looks a bit dated and although it&#8217;s been a while, last time I tried to install and configure Trac, it was a bit of a nightmare.</p>
<p>First thing first, here are some of our requirements for an issue tracker:</p>
<ul>
<li>Multiple Projects</li>
<li>Time tracking</li>
<li>Notifications (email, rss, im etc.)</li>
<li>Wiki</li>
<li>SCM integration</li>
</ul>
<p>Redmine does all of this and a little more, but we haven&#8217;t used the other features that much. It does what we want really well, so that&#8217;s good enough for us.</p>
<h4>What I like</h4>
<p>Editing issues in bulk is fantastic. We deploy our application fairly casually, and when we do we set all the issues that have been deployed as closed and assign them a version number. Highlight the issues, right click and set the version number.</p>
<p><a href="http://www.davedevelopment.co.uk/wp-content/uploads/2009/04/screenshot-1.png"><img src="http://www.davedevelopment.co.uk/wp-content/uploads/2009/04/screenshot-1-300x275.png" alt="screenshot-1" title="screenshot-1" width="300" height="275" class="alignnone size-medium wp-image-382" /></a></p>
<p>The SCM integration does all we need it to. If we add Fixes #500 or Implements #500 to a commit message, issue 500 will be set to resolved and 100% complete and the revision number and commit message appears on the issue&#8217;s page. Alternatively, just putting Refs #500 will show the revision number and commit message in the page, without changing the status.</p>
<p><a href="http://www.davedevelopment.co.uk/wp-content/uploads/2009/04/screenshot21.png"><img src="http://www.davedevelopment.co.uk/wp-content/uploads/2009/04/screenshot21.png" alt="screenshot21" title="screenshot21" width="461" height="120" class="alignnone size-full wp-image-400" /></a></p>
<p>Issues themselves can have custom fields, but we don&#8217;t use them all that much. We do make lots of use of the descriptions and notes as they both take wiki markup, meaning we can enter rich text including source code highlighting and images, linking to changesets, wiki pages, target versions, source code and other issues. I like the ability to embed screenshots and call graphs in issues.</p>
<h4>What I don&#8217;t like</h4>
<p>Here&#8217;s a couple of things that bother me, if I shift my arse I might look into creating patches for the simple ones.</p>
<p>No API! It would be really nice to have an API and there&#8217;s one in <a href="http://www.redmine.org/issues/296">the works</a>, but it&#8217;s sounds like it&#8217;s a bit of a ballache changing fat controllers into <a href="http://www.davedevelopment.co.uk/2008/06/17/fat-models-and-the-data-access-layer/">fat models</a>.</p>
<p>I often wish a few more items where &#8216;clickable&#8217;. For instance when viewing the issue list, I&#8217;d like to be able to click the Category name in one of the rows and see a list of issues for that category. </p>
<p>You can save filters on the issue list, which is ace, but it would be nice if you can &#8217;save as new&#8217;. I often create lots of very similar queries and have to build up each one from scratch.</p>




	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F20%2Freview-redmine-issue-trackerproject-management%2F&amp;title=Redmine%20Issue%20Tracker%2FProject%20Management&amp;bodytext=%0D%0A%0D%0AWe%20recently%20started%20using%20Redmine%20as%20our%20issue%20tracking%20software%20and%20we%27re%20very%20pleased%20with%20it.%20I%20trialled%20several%20alternatives%2C%20both%20open%20source%20and%20commercial%2C%20including%20Jira%2C%20FogBugz%2C%20Mantis%20and%20Trac%2C%20but%20decided%20on%20Redmine.%20Jira%20and%20FogBugz%20" title="Digg"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://delicious.com/post?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F20%2Freview-redmine-issue-trackerproject-management%2F&amp;title=Redmine%20Issue%20Tracker%2FProject%20Management&amp;notes=%0D%0A%0D%0AWe%20recently%20started%20using%20Redmine%20as%20our%20issue%20tracking%20software%20and%20we%27re%20very%20pleased%20with%20it.%20I%20trialled%20several%20alternatives%2C%20both%20open%20source%20and%20commercial%2C%20including%20Jira%2C%20FogBugz%2C%20Mantis%20and%20Trac%2C%20but%20decided%20on%20Redmine.%20Jira%20and%20FogBugz%20" title="del.icio.us"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F20%2Freview-redmine-issue-trackerproject-management%2F&amp;h=Redmine%20Issue%20Tracker%2FProject%20Management" title="NewsVine"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F20%2Freview-redmine-issue-trackerproject-management%2F&amp;title=Redmine%20Issue%20Tracker%2FProject%20Management" title="Reddit"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="" title="Furl"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F20%2Freview-redmine-issue-trackerproject-management%2F&amp;title=Redmine%20Issue%20Tracker%2FProject%20Management" title="DZone"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F20%2Freview-redmine-issue-trackerproject-management%2F&amp;title=Redmine%20Issue%20Tracker%2FProject%20Management" title="StumbleUpon"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F20%2Freview-redmine-issue-trackerproject-management%2F" title="Technorati"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/Davedevelopment/~4/KvX45MisbP4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.davedevelopment.co.uk/2009/04/20/review-redmine-issue-trackerproject-management/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rev=Canonical and all that Jazz</title>
		<link>http://www.davedevelopment.co.uk/2009/04/15/revcanonical-and-all-that-jazz/</link>
		<comments>http://www.davedevelopment.co.uk/2009/04/15/revcanonical-and-all-that-jazz/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 11:58:29 +0000</pubDate>
		<dc:creator>davedevelopment</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[revcanonical]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.davedevelopment.co.uk/?p=389</guid>
		<description><![CDATA[If anybody missed it, the last few days has seen plenty of buzz around a new proposal on how to solve the problem with URL shorteners. I kind of got lost in all the different methods and proposals people are discussing, suggesting or implementing, but I went ahead and added some simple logic to lnkd.in, [...]]]></description>
			<content:encoded><![CDATA[<p>If anybody missed it, the last few days has seen <a href="http://search.twitter.com/search?q=%23revcanonical">plenty of buzz</a> around a <a href="http://revcanonical.appspot.com/">new proposal</a> on how to solve the <a href="http://joshua.schachter.org/2009/04/on-url-shorteners.html">problem with URL shorteners</a>. I kind of got lost in all the different methods and proposals people are <a href="http://benramsey.com/archives/a-revcanonical-rebuttal/">discussing</a>, <a href="http://shiflett.org/blog/2009/apr/a-rev-canonical-http-header">suggesting</a> or <a href="http://simonwillison.net/2009/Apr/11/revcanonical/">implementing</a>, but I went ahead and added some simple logic to <a href="http://lnkd.in">lnkd.in</a>, to do a HTTP HEAD request to the given URL, looking for headers in a couple of the formats suggested. I figured that was going to get out of date pretty quickly, so I modified it to use the <a href="http://revcanonical.appspot.com/api">RevCanonical API</a>, seems to work pretty well, returning a rev=canonical url wherever possible.</p>
<p>I also contributed a basic bit of code to <a href="http://akrabat.com">Rob Allen&#8217;s</a> <a href="http://akrabat.com/shorter-links">Shorter Links</a> plugin for wordpress, allowing users to specifying a base url, davedevelopment.co.uk isn&#8217;t all that good for short URLs. Just need to upgrade the plugin and decide on a short domain for my blog now.</p>
<p><strong>Update</strong>: registerd <a href="http://daved.in">daved.in</a>, works a treat</p>




	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F15%2Frevcanonical-and-all-that-jazz%2F&amp;title=Rev%3DCanonical%20and%20all%20that%20Jazz&amp;bodytext=If%20anybody%20missed%20it%2C%20the%20last%20few%20days%20has%20seen%20plenty%20of%20buzz%20around%20a%20new%20proposal%20on%20how%20to%20solve%20the%20problem%20with%20URL%20shorteners.%20I%20kind%20of%20got%20lost%20in%20all%20the%20different%20methods%20and%20proposals%20people%20are%20discussing%2C%20suggesting%20or%20implementing%2C%20bu" title="Digg"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://delicious.com/post?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F15%2Frevcanonical-and-all-that-jazz%2F&amp;title=Rev%3DCanonical%20and%20all%20that%20Jazz&amp;notes=If%20anybody%20missed%20it%2C%20the%20last%20few%20days%20has%20seen%20plenty%20of%20buzz%20around%20a%20new%20proposal%20on%20how%20to%20solve%20the%20problem%20with%20URL%20shorteners.%20I%20kind%20of%20got%20lost%20in%20all%20the%20different%20methods%20and%20proposals%20people%20are%20discussing%2C%20suggesting%20or%20implementing%2C%20bu" title="del.icio.us"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F15%2Frevcanonical-and-all-that-jazz%2F&amp;h=Rev%3DCanonical%20and%20all%20that%20Jazz" title="NewsVine"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F15%2Frevcanonical-and-all-that-jazz%2F&amp;title=Rev%3DCanonical%20and%20all%20that%20Jazz" title="Reddit"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="" title="Furl"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F15%2Frevcanonical-and-all-that-jazz%2F&amp;title=Rev%3DCanonical%20and%20all%20that%20Jazz" title="DZone"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F15%2Frevcanonical-and-all-that-jazz%2F&amp;title=Rev%3DCanonical%20and%20all%20that%20Jazz" title="StumbleUpon"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F15%2Frevcanonical-and-all-that-jazz%2F" title="Technorati"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/Davedevelopment/~4/WBkUO1uC4pA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.davedevelopment.co.uk/2009/04/15/revcanonical-and-all-that-jazz/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Url Shortener in CodeIgniter</title>
		<link>http://www.davedevelopment.co.uk/2009/04/10/url-shortener-in-codeigniter/</link>
		<comments>http://www.davedevelopment.co.uk/2009/04/10/url-shortener-in-codeigniter/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 00:38:52 +0000</pubDate>
		<dc:creator>davedevelopment</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[php5]]></category>

		<guid isPermaLink="false">http://www.davedevelopment.co.uk/?p=384</guid>
		<description><![CDATA[After seeing a response to a thread on Hacker News, I thought I&#8217;d have a crack at making a simple little URL shortener with CodeIgniter. I&#8217;ve never used the framework before and it was a nice quick little app to implement and get a feel for things. It&#8217;s not quite worthy of competing with Bit.ly [...]]]></description>
			<content:encoded><![CDATA[<p>After seeing a <a href="http://news.ycombinator.com/item?id=550939">response</a> to a thread on <a href="http://news.ycombinator.com">Hacker News</a>, I thought I&#8217;d have a crack at making a simple little URL shortener with <a href="http://codeigniter.com/">CodeIgniter</a>. I&#8217;ve never used the framework before and it was a nice quick little app to implement and get a feel for things. It&#8217;s not quite worthy of competing with <a href="http://bit.ly">Bit.ly</a> or <a href="http://tinyurl.com">Tinyurl.com</a>, there&#8217;s no checking for spam urls etc, but if you want to take a look, the <a href="http://github.com/davedevelopment/lnkd.in/tree/master">source code is available</a>, as is a live demo at <a href="http://lnkd.in" title="Shorten your urls">lnkd.in</a>.  </p>




	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F10%2Furl-shortener-in-codeigniter%2F&amp;title=Url%20Shortener%20in%20CodeIgniter&amp;bodytext=After%20seeing%20a%20response%20to%20a%20thread%20on%20Hacker%20News%2C%20I%20thought%20I%27d%20have%20a%20crack%20at%20making%20a%20simple%20little%20URL%20shortener%20with%20CodeIgniter.%20I%27ve%20never%20used%20the%20framework%20before%20and%20it%20was%20a%20nice%20quick%20little%20app%20to%20implement%20and%20get%20a%20feel%20for%20things.%20I" title="Digg"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://delicious.com/post?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F10%2Furl-shortener-in-codeigniter%2F&amp;title=Url%20Shortener%20in%20CodeIgniter&amp;notes=After%20seeing%20a%20response%20to%20a%20thread%20on%20Hacker%20News%2C%20I%20thought%20I%27d%20have%20a%20crack%20at%20making%20a%20simple%20little%20URL%20shortener%20with%20CodeIgniter.%20I%27ve%20never%20used%20the%20framework%20before%20and%20it%20was%20a%20nice%20quick%20little%20app%20to%20implement%20and%20get%20a%20feel%20for%20things.%20I" title="del.icio.us"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F10%2Furl-shortener-in-codeigniter%2F&amp;h=Url%20Shortener%20in%20CodeIgniter" title="NewsVine"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F10%2Furl-shortener-in-codeigniter%2F&amp;title=Url%20Shortener%20in%20CodeIgniter" title="Reddit"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="" title="Furl"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F10%2Furl-shortener-in-codeigniter%2F&amp;title=Url%20Shortener%20in%20CodeIgniter" title="DZone"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F10%2Furl-shortener-in-codeigniter%2F&amp;title=Url%20Shortener%20in%20CodeIgniter" title="StumbleUpon"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F10%2Furl-shortener-in-codeigniter%2F" title="Technorati"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/Davedevelopment/~4/SlCWq770x3k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.davedevelopment.co.uk/2009/04/10/url-shortener-in-codeigniter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ZFSnippets.com update</title>
		<link>http://www.davedevelopment.co.uk/2009/04/06/zfsnippetscom-update/</link>
		<comments>http://www.davedevelopment.co.uk/2009/04/06/zfsnippetscom-update/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 21:17:13 +0000</pubDate>
		<dc:creator>davedevelopment</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[zend search lucene]]></category>
		<category><![CDATA[zf]]></category>
		<category><![CDATA[zfsnippets.com]]></category>

		<guid isPermaLink="false">http://www.davedevelopment.co.uk/?p=369</guid>
		<description><![CDATA[It&#8217;s been just over a month since I launched zfsnippets.com and I&#8217;m very pleased with the reception it got, which spurred me on to try and improve it. 
Since then, following suggestions on the feedback forum I&#8217;ve implemented a few new features. What I&#8217;ve noticed is the ease at which these features where added, thanks [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been just <a href="http://www.davedevelopment.co.uk/2009/03/04/zfsnippetscom-zend-framework-code-snippets/">over a month</a> since I launched <a href="http://www.zfsnippets.com" title="Zend Framework Snippets">zfsnippets.com</a> and I&#8217;m very pleased with the reception it got, which spurred me on to try and improve it. </p>
<p>Since then, following suggestions on the <a href="http://zfsnippets.uservoice.com/pages/general">feedback forum</a> I&#8217;ve implemented a few new features. What I&#8217;ve noticed is the ease at which these features where added, thanks to the quality of the Zend Framework.</p>
<h4>Favourites</h4>
<p>Along with adding icons for up votes, there&#8217;s now a little star icon to add snippets to your favourites, easily accessible from your user page. A little sprinkling of <a href="http://www.dojotoolkit.org/">dojo</a> and these are added via AJAX.</p>
<p><a href="http://www.davedevelopment.co.uk/wp-content/uploads/2009/04/screenshot2.png"><img src="http://www.davedevelopment.co.uk/wp-content/uploads/2009/04/screenshot2.png" alt="screenshot2" title="screenshot2" width="129" height="43" class="alignnone size-full wp-image-370" /></a></p>
<h4>Revision History</h4>
<p>Snippets can now be edited by the creator and a revision history is kept.</p>
<p><a href="http://www.davedevelopment.co.uk/wp-content/uploads/2009/04/screenshot3.png"><img src="http://www.davedevelopment.co.uk/wp-content/uploads/2009/04/screenshot3-300x167.png" alt="screenshot3" title="screenshot3" width="300" height="167" class="alignnone size-medium wp-image-371" /></a></p>
<p>Using a simple implementation of the <a href="http://en.wikipedia.org/wiki/Longest_common_subsequence_problem">Longest common subsequence problem</a>, you can also view diffs of the revisions.</p>
<p><a href="http://www.davedevelopment.co.uk/wp-content/uploads/2009/04/screenshot4.png"><img src="http://www.davedevelopment.co.uk/wp-content/uploads/2009/04/screenshot4-300x102.png" alt="screenshot4" title="screenshot4" width="300" height="102" class="alignnone size-medium wp-image-372" /></a></p>
<h4>Search</h4>
<p>Lastly there&#8217;s the <a href="http://www.zfsnippets.com/snippets/search">search engine</a>, built on top of <a href="http://framework.zend.com/manual/en/zend.search.lucene.html">Zend_Search_Lucene</a>. This took a little more work, but the results were worth it. I hadn&#8217;t realised how powerful the Lucene query language was until now and I&#8217;m very impressed with the implementation.</p>
<p><a href="http://www.davedevelopment.co.uk/wp-content/uploads/2009/04/screenshot1.png"><img src="http://www.davedevelopment.co.uk/wp-content/uploads/2009/04/screenshot1-300x173.png" alt="screenshot1" title="screenshot1" width="300" height="173" class="alignnone size-medium wp-image-373" /></a></p>
<p>As you would expect, traffic has slowed down considerably since the initial burst, but there&#8217;s still a bit of steady traffic there and I hope people keep coming back to visit now and then. As for going forward, I think I&#8217;ll add a field to allow contributors to <a href="http://zfsnippets.uservoice.com/pages/general/suggestions/134574-add-zend-framework-version-number-snippet-was-tested-with-">specify which zend framework version</a> their snippet was tested or is compatible with, then look a little more at the scoring system. </p>




	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F06%2Fzfsnippetscom-update%2F&amp;title=ZFSnippets.com%20update&amp;bodytext=It%27s%20been%20just%20over%20a%20month%20since%20I%20launched%20zfsnippets.com%20and%20I%27m%20very%20pleased%20with%20the%20reception%20it%20got%2C%20which%20spurred%20me%20on%20to%20try%20and%20improve%20it.%20%20%0D%0A%0D%0ASince%20then%2C%20following%20suggestions%20on%20the%20feedback%20forum%20I%27ve%20implemented%20a%20few%20new%20features.%20W" title="Digg"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://delicious.com/post?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F06%2Fzfsnippetscom-update%2F&amp;title=ZFSnippets.com%20update&amp;notes=It%27s%20been%20just%20over%20a%20month%20since%20I%20launched%20zfsnippets.com%20and%20I%27m%20very%20pleased%20with%20the%20reception%20it%20got%2C%20which%20spurred%20me%20on%20to%20try%20and%20improve%20it.%20%20%0D%0A%0D%0ASince%20then%2C%20following%20suggestions%20on%20the%20feedback%20forum%20I%27ve%20implemented%20a%20few%20new%20features.%20W" title="del.icio.us"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F06%2Fzfsnippetscom-update%2F&amp;h=ZFSnippets.com%20update" title="NewsVine"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F06%2Fzfsnippetscom-update%2F&amp;title=ZFSnippets.com%20update" title="Reddit"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="" title="Furl"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F06%2Fzfsnippetscom-update%2F&amp;title=ZFSnippets.com%20update" title="DZone"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F06%2Fzfsnippetscom-update%2F&amp;title=ZFSnippets.com%20update" title="StumbleUpon"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F04%2F06%2Fzfsnippetscom-update%2F" title="Technorati"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/Davedevelopment/~4/DcaFWio-bfQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.davedevelopment.co.uk/2009/04/06/zfsnippetscom-update/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Code Complete by Steve McConnell</title>
		<link>http://www.davedevelopment.co.uk/2009/03/25/code-complete-by-steve-mcconnell/</link>
		<comments>http://www.davedevelopment.co.uk/2009/03/25/code-complete-by-steve-mcconnell/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 10:00:06 +0000</pubDate>
		<dc:creator>davedevelopment</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[code complete]]></category>
		<category><![CDATA[desk]]></category>

		<guid isPermaLink="false">http://www.davedevelopment.co.uk/?p=362</guid>
		<description><![CDATA[The only programming book I use without fail every working day ;)

Seriously though, this book is great.




	
	
	
	
	
	
	
	


]]></description>
			<content:encoded><![CDATA[<p>The only programming book I use without fail every working day ;)</p>
<p><a href="http://www.davedevelopment.co.uk/wp-content/uploads/2009/03/dsc00185.jpg"><img src="http://www.davedevelopment.co.uk/wp-content/uploads/2009/03/dsc00185-300x225.jpg" alt="My Monitor" title="My Monitor" width="300" height="225" class="alignnone size-medium wp-image-360" /></a></p>
<p>Seriously though, this book is great.</p>




	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F03%2F25%2Fcode-complete-by-steve-mcconnell%2F&amp;title=Code%20Complete%20by%20Steve%20McConnell&amp;bodytext=The%20only%20programming%20book%20I%20use%20without%20fail%20every%20working%20day%20%3B%29%0D%0A%0D%0A%0D%0A%0D%0ASeriously%20though%2C%20this%20book%20is%20great." title="Digg"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://delicious.com/post?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F03%2F25%2Fcode-complete-by-steve-mcconnell%2F&amp;title=Code%20Complete%20by%20Steve%20McConnell&amp;notes=The%20only%20programming%20book%20I%20use%20without%20fail%20every%20working%20day%20%3B%29%0D%0A%0D%0A%0D%0A%0D%0ASeriously%20though%2C%20this%20book%20is%20great." title="del.icio.us"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F03%2F25%2Fcode-complete-by-steve-mcconnell%2F&amp;h=Code%20Complete%20by%20Steve%20McConnell" title="NewsVine"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F03%2F25%2Fcode-complete-by-steve-mcconnell%2F&amp;title=Code%20Complete%20by%20Steve%20McConnell" title="Reddit"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="" title="Furl"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F03%2F25%2Fcode-complete-by-steve-mcconnell%2F&amp;title=Code%20Complete%20by%20Steve%20McConnell" title="DZone"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F03%2F25%2Fcode-complete-by-steve-mcconnell%2F&amp;title=Code%20Complete%20by%20Steve%20McConnell" title="StumbleUpon"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F03%2F25%2Fcode-complete-by-steve-mcconnell%2F" title="Technorati"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/Davedevelopment/~4/PR9mW_1ozQE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.davedevelopment.co.uk/2009/03/25/code-complete-by-steve-mcconnell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ZFSnippets.com – Zend Framework Code Snippets</title>
		<link>http://www.davedevelopment.co.uk/2009/03/04/zfsnippetscom-zend-framework-code-snippets/</link>
		<comments>http://www.davedevelopment.co.uk/2009/03/04/zfsnippetscom-zend-framework-code-snippets/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 12:25:04 +0000</pubDate>
		<dc:creator>davedevelopment</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[code snippets]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[zfsnippets]]></category>

		<guid isPermaLink="false">http://www.davedevelopment.co.uk/?p=320</guid>
		<description><![CDATA[
Not so long ago I was working on a little project using the django framework and was looking for a simple nested set implementation, I found one that was good enough for my needs on djangosnippets.org. I thought this was pretty cool, and realised we didn&#8217;t have a one stop shop for  Zend Framework [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.zfsnippets.com"><img style="float:left;margin-right:10px; margin-bottom:10px" src="http://www.davedevelopment.co.uk/wp-content/uploads/2009/03/screenshot1.png" alt="ZFSnippets Logo" title="screenshot1" width="329" height="72" class="alignnone size-full wp-image-324" /></a></p>
<p>Not so long ago I was working on a little project using the <a href="http://www.djangoproject.com/">django framework</a> and was looking for a simple <a href="http://en.wikipedia.org/wiki/Nested_set_model">nested set</a> implementation, I found <a href="http://www.djangosnippets.org/snippets/440/">one</a> that was good enough for my needs on <a href=" http://www.djangosnippets.org/">djangosnippets.org</a>. I thought this was pretty cool, and realised we didn&#8217;t have a one stop shop for  <a href="http://framework.zend.com/">Zend Framework</a> code snippets. <a href="http://snippets.symfony-project.org/">Symfony</a> and <a href="http://cakeforge.org/snippet/">CakePHP</a> also have dedicated sites for this. I&#8217;m aware of generic <a href="http://snippets.dzone.com">snippets sites</a> and <a href="http://gist.github.com/">pastebin</a> <a href="http://pastie.org">sites</a>, but I thought it&#8217;d be <a href="http://www.davedevelopment.co.uk/2008/09/29/phppositions-genuine-php-jobs-at-genuine-companies/">another</a> good learning opportunity to build my own with the Zend Framework, for the Zend Framework.</p>
<p>I&#8217;ve ended up implementing a pretty simple site, <a href="http://www.zfsnippets.com" title="Zend Framework Code Snippets">ZFSnippets</a>. The current basic implementation makes use of:</p>
<ul style="float:left;margin-bottom:1.5em">
<li><a href="http://framework.zend.com/manual/en/zend.auth.html">Zend_Auth</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.config.html">Zend_Config</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.controller.html">Zend_Controller</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.db.html">Zend_Db</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.feed.html">Zend_Feed</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.form.html">Zend_Form</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.layout.html">Zend_Layout</a></li>
</ul>
<ul style="float:left">
<li><a href="http://framework.zend.com/manual/en/zend.mail.html">Zend_Mail</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.openid.html">Zend_OpenId</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.paginator.html">Zend_Paginator</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.registry.html">Zend_Registry</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.session.html">Zend_Session</a></li>
<li><a href="http://framework.zend.com/manual/en/zend.view.html">Zend_View</a></li>
</ul>
<p style="clear:left;">There are plenty of things I&#8217;d like to implement (and fix;)), but will have to see if I find anytime:</p>
<ul>
<li>A site search engine using <a href="http://framework.zend.com/manual/en/zend.search.lucene.html">Zend_Search_Lucene</a></li>
<li>More flexible posting, probably using wiki style <a href="http://framework.zend.com/wiki/display/ZFPROP/Zend_Markup+-+Pieter+Kokx">markup</a></li>
<li>Version history for all snippets</li>
<li>Moving to a <a href="http://stackoverflow.com">stackoverflow.com</a> style, trust model, allowing regular users to collaborate, edit and update snippets.</li>
<li>Forgot my password link</li>
<li>Contextual error handling and descriptions</li>
<li>Accurate scoring/ranking, based on <a href="http://www.evanmiller.org/how-not-to-sort-by-average-rating.html"> complex calculations.</a></li>
</ul>
<p>I did actually spend quite a bit of time looking at markup libraries, coupled with <a href="http://htmlpurifier.org/">HTMLPurifier</a>, but it seemed like too much effort to start with, so I opted for a method of splitting the source code using hashes like pastie.</p>
<p>I like the idea of having a go with Zend_Search_Lucene, probably adding particular snippets to a queue for indexing whenever somebody posts one or comments on one.</p>
<p>Having built the site, I&#8217;m actually struggling to think of what might go on there. Helpers seem like an obvious one, but without building large, complex Zend Framework application, I don&#8217;t have much need for custom code, the framework does the leg work for me. Nevermind, if you think it might be any use to you, head on over there and have a browse around, although it&#8217;s a little low on content at the minute, or maybe <a href="http://feeds2.feedburner.com/Zfsnippets">subscribe to the feed</a> and keep your eye out for anything interesting.</p>
<p><strong><em>Advertisement</em></strong>:  <a href="http://www.phppositions.co.uk">PHPPositions UK</a><em> </em>- Genuine PHP jobs, at Genuine companies</p>




	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F03%2F04%2Fzfsnippetscom-zend-framework-code-snippets%2F&amp;title=ZFSnippets.com%20-%20Zend%20Framework%20Code%20Snippets&amp;bodytext=%0D%0A%0D%0ANot%20so%20long%20ago%20I%20was%20working%20on%20a%20little%20project%20using%20the%20django%20framework%20and%20was%20looking%20for%20a%20simple%20nested%20set%20implementation%2C%20I%20found%20one%20that%20was%20good%20enough%20for%20my%20needs%20on%20djangosnippets.org.%20I%20thought%20this%20was%20pretty%20cool%2C%20and%20realised" title="Digg"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://delicious.com/post?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F03%2F04%2Fzfsnippetscom-zend-framework-code-snippets%2F&amp;title=ZFSnippets.com%20-%20Zend%20Framework%20Code%20Snippets&amp;notes=%0D%0A%0D%0ANot%20so%20long%20ago%20I%20was%20working%20on%20a%20little%20project%20using%20the%20django%20framework%20and%20was%20looking%20for%20a%20simple%20nested%20set%20implementation%2C%20I%20found%20one%20that%20was%20good%20enough%20for%20my%20needs%20on%20djangosnippets.org.%20I%20thought%20this%20was%20pretty%20cool%2C%20and%20realised" title="del.icio.us"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F03%2F04%2Fzfsnippetscom-zend-framework-code-snippets%2F&amp;h=ZFSnippets.com%20-%20Zend%20Framework%20Code%20Snippets" title="NewsVine"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F03%2F04%2Fzfsnippetscom-zend-framework-code-snippets%2F&amp;title=ZFSnippets.com%20-%20Zend%20Framework%20Code%20Snippets" title="Reddit"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="" title="Furl"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F03%2F04%2Fzfsnippetscom-zend-framework-code-snippets%2F&amp;title=ZFSnippets.com%20-%20Zend%20Framework%20Code%20Snippets" title="DZone"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F03%2F04%2Fzfsnippetscom-zend-framework-code-snippets%2F&amp;title=ZFSnippets.com%20-%20Zend%20Framework%20Code%20Snippets" title="StumbleUpon"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F03%2F04%2Fzfsnippetscom-zend-framework-code-snippets%2F" title="Technorati"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/Davedevelopment/~4/0zbzO7_4UgI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.davedevelopment.co.uk/2009/03/04/zfsnippetscom-zend-framework-code-snippets/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>How protected is protected?</title>
		<link>http://www.davedevelopment.co.uk/2009/02/25/how-protected-is-protected/</link>
		<comments>http://www.davedevelopment.co.uk/2009/02/25/how-protected-is-protected/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 21:18:21 +0000</pubDate>
		<dc:creator>davedevelopment</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[object oriented]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.davedevelopment.co.uk/2009/02/23/of-visibility-encapsulation-and-inheritance/</guid>
		<description><![CDATA[Before my much needed Holiday, a colleague of mine asked for my input on a funny issue he was having. The root of the problem was that our production server is still running PHP 5.1.2, where as most of us run 5.2.x on our development and test machines. My problem was that what I was [...]]]></description>
			<content:encoded><![CDATA[<p>Before my much needed Holiday, <a href="http://blog.chaddyonline.co.uk">a colleague</a> of mine asked for my input on a funny issue he was having. The root of the problem was that our production server is still running PHP 5.1.2, where as most of us run 5.2.x on our development and test machines. My problem was that what I was seeing didn&#8217;t make sense. The following portion of code is a simple reproduction of the code my colleague was using, running fine on PHP 5.2.x, but causing a fatal error on the production server running 5.1.2, an attribute access violation. </p>
<pre name="code" class="php">
&lt;?php
class BankAccount
{
    protected $balance;

    public function __construct($balance)
    {
        $this-&gt;balance = $balance;
    }

    public function __toString()
    {
        return 'Balance: ' . $this-&gt;balance;
    }

    public function debit($debit)
    {
        $this-&gt;balance -= $credit;
    }

    public function credit($credit)
    {
        $this-&gt;balance += $credit;
    }
}

class SavingsAccount extends BankAccount
{
    public function __construct(BankAccount $parent)
    {
        $this-&gt;balance = $parent-&gt;balance;
    }
}

$first = new BankAccount(1.00);
$second = new SavingsAccount($first);

echo $second, PHP_EOL; // Balance: 1
</pre>
<p>It turns out that <a href="http://uk2.php.net/public">PHP&#8217;s visibility</a> restrictions are on a class level, rather than an instance level, and the fatal error was actually due to a bug in 5.1.x.</p>
<blockquote><p>The visibility of a property or method can be defined by prefixing the declaration with the keywords: public, protected or private. Public declared items can be accessed everywhere. Protected limits access to inherited and parent <strong>classes</strong> (and to the <strong>class</strong> that defines the item). Private limits visibility only to the class that defines the item. </p>
</blockquote>
<p>This bemused me, as it would appear to me there is no point having a protected operator at all. Suppose I am a lowly programmer given the BankAccount Class above as an API I can use but not change. I have a <a href="http://en.wikipedia.org/wiki/Data_Access_Object">data access object</a> that returns BankAccount objects too, which I also can&#8217;t touch. For reasons unknown to me, but probably to try and create some <a href="http://en.wikipedia.org/wiki/Encapsulation_(computer_science)">encapsulation</a> so they can log transactions via the credit and debit methods, the original developer decided that I shouldn&#8217;t be able to directly access the balance attribute, but I want to. </p>
<pre name="code" class="php">
&lt;?php

//$myAccount = $dao-&gt;getAccount(123);
$myAccount = new BankAccount(1.00);
echo $myAccount, PHP_EOL; // Balance: 1

class WorkAround extends BankAccount
{
    public static function setBalance(BankAccount $acc, $balance)
    {
        $acc-&gt;balance = $balance;
    }
}

WorkAround::setBalance($myAccount, 1000000.00);
echo $myAccount, PHP_EOL; // Balance: 1000000
</pre>
<p>This just doesn&#8217;t seem right to me. Don&#8217;t get me wrong, I appreciate there needs to be some level of responsibility taken by developers to not do this kind of thing. My colleague writes a lot of <a href="http://en.wikipedia.org/wiki/Java_(programming_language)">Java</a>, in which this is also the expected behaviour with the protected visibility, hence why he set out on this path, so it seemed right to him. Because of this I embarked on a little research to determine how other languages implement visibility. </p>
<p>A very quick and non-extensive bit of research led me to believe that Python doesn&#8217;t have visibility as I know it, and C# has protected and internal, but neither work the way I&#8217;d like. Ruby has the closest to what I desire in the form of <a href="http://www.rubyist.net/~slagell/ruby/instancevars.html">instance variables</a>, but I&#8217;m sure there&#8217;s plenty I&#8217;ve missed.</p>
<pre name="code" class="ruby">
class BankAccount
    def initialize(bal)
        @balance = bal
    end

    def debit(debit)
        @balance -= debit
    end

    def credit(credit)
        @balance += credit
    end

    def to_s
        "Balance: %d" % @balance
    end
end

class SavingsAccount &lt; BankAccount
    def setBalance(acc, bal)
        # This wont work - we cant access acc.balance
        # acc.balance = balance;
    end

    def bonusCredit(credit)
        # just to prove a sub class can access
        # the instance variable
        @balance += credit + 1
    end
end

first = BankAccount.new(42);
second = SavingsAccount.new(1);

second.setBalance(first, 5000000);
second.bonusCredit(10);

print first  # Balance: 42
print second # Balance: 12 
</pre>
<p>It worries me sometimes when I come across things like this that I blatantly should know and understand properly. Cheers JC.</p>
<p><strong><em>Advertisement</em></strong>:  <a href="http://www.daveproxy.co.uk">DaveProxy</a><em> </em>- Free CGIProxy, bypass company and school browsing restrictions</p>




	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F02%2F25%2Fhow-protected-is-protected%2F&amp;title=How%20protected%20is%20protected%3F&amp;bodytext=Before%20my%20much%20needed%20Holiday%2C%20a%20colleague%20of%20mine%20asked%20for%20my%20input%20on%20a%20funny%20issue%20he%20was%20having.%20The%20root%20of%20the%20problem%20was%20that%20our%20production%20server%20is%20still%20running%20PHP%205.1.2%2C%20where%20as%20most%20of%20us%20run%205.2.x%20on%20our%20development%20and%20test%20machine" title="Digg"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://delicious.com/post?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F02%2F25%2Fhow-protected-is-protected%2F&amp;title=How%20protected%20is%20protected%3F&amp;notes=Before%20my%20much%20needed%20Holiday%2C%20a%20colleague%20of%20mine%20asked%20for%20my%20input%20on%20a%20funny%20issue%20he%20was%20having.%20The%20root%20of%20the%20problem%20was%20that%20our%20production%20server%20is%20still%20running%20PHP%205.1.2%2C%20where%20as%20most%20of%20us%20run%205.2.x%20on%20our%20development%20and%20test%20machine" title="del.icio.us"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F02%2F25%2Fhow-protected-is-protected%2F&amp;h=How%20protected%20is%20protected%3F" title="NewsVine"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F02%2F25%2Fhow-protected-is-protected%2F&amp;title=How%20protected%20is%20protected%3F" title="Reddit"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="" title="Furl"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F02%2F25%2Fhow-protected-is-protected%2F&amp;title=How%20protected%20is%20protected%3F" title="DZone"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F02%2F25%2Fhow-protected-is-protected%2F&amp;title=How%20protected%20is%20protected%3F" title="StumbleUpon"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F02%2F25%2Fhow-protected-is-protected%2F" title="Technorati"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/Davedevelopment/~4/XGyZNZNHB2c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.davedevelopment.co.uk/2009/02/25/how-protected-is-protected/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Competition: PHP Job Hunters Handbook up for grabs</title>
		<link>http://www.davedevelopment.co.uk/2009/01/05/competition-php-job-hunters-handbook-up-for-grabs/</link>
		<comments>http://www.davedevelopment.co.uk/2009/01/05/competition-php-job-hunters-handbook-up-for-grabs/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 17:03:25 +0000</pubDate>
		<dc:creator>davedevelopment</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[competitions]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[php job hunters]]></category>
		<category><![CDATA[php jobs]]></category>

		<guid isPermaLink="false">http://www.davedevelopment.co.uk/?p=227</guid>
		<description><![CDATA[I&#8217;ve got a couple of copies of Php&#124;architect&#8217;s PHP Job Hunter&#8217;s Handbook to give away, the only catch is you have to sign up to PHPPositions&#8217; feed via email. It&#8217;s managed by Feedburner, so it can be trusted and you wont get any spam, just super smashing great php jobs in the UK. 

Enter your [...]]]></description>
			<content:encoded><![CDATA[<p><a style="float:left;margin:0px 10px 10px 0px;" href="http://www.amazon.co.uk/gp/product/0973862165?ie=UTF8&#038;tag=davedvd-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0973862165"><img src="http://www.davedevelopment.co.uk/wp-content/uploads/2009/01/51jp8ktz0l_sl500_aa240_.jpg" alt="PHP Job Hunter&#039;s Handbook" title="PHP Job Hunter&#039;s Handbook" width="240" height="240" class="alignnone size-full wp-image-283" /></a>I&#8217;ve got a couple of copies of <a href="http://www.amazon.co.uk/gp/product/0973862165?ie=UTF8&#038;tag=davedvd-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0973862165">Php|architect&#8217;s PHP Job Hunter&#8217;s Handbook</a> to give away, the only catch is you have to sign up to <a href="http://www.phppositions.co.uk" title="PHP Jobs">PHPPositions&#8217;</a> feed via email. It&#8217;s managed by <a href="http://feedburner.com">Feedburner</a>, so it can be trusted and you wont get any spam, just super smashing great php jobs in the UK. </p>
<form action="http://www.feedburner.com/fb/a/emailverify" method="post" target="popupwindow" onsubmit="window.open('http://www.feedburner.com/fb/a/emailverifySubmit?feedId=2474733', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">
<p>Enter your email address:</p>
<input type="text" style="width:140px" name="email"/>
<input type="hidden" value="http://feeds.feedburner.com/~e?ffid=2474733" name="url"/>
<input type="hidden" value="PHP Positions" name="title"/>
<input type="hidden" name="loc" value="en_US"/>
<input type="submit" value="Subscribe" /></form>
<p>I&#8217;ll pick two email addresses at random this time next week and get the books posted out.</p>




	<a rel="nofollow" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F01%2F05%2Fcompetition-php-job-hunters-handbook-up-for-grabs%2F&amp;title=Competition%3A%20PHP%20Job%20Hunters%20Handbook%20up%20for%20grabs&amp;bodytext=I%27ve%20got%20a%20couple%20of%20copies%20of%20Php%7Carchitect%27s%20PHP%20Job%20Hunter%27s%20Handbook%20to%20give%20away%2C%20the%20only%20catch%20is%20you%20have%20to%20sign%20up%20to%20PHPPositions%27%20feed%20via%20email.%20It%27s%20managed%20by%20Feedburner%2C%20so%20it%20can%20be%20trusted%20and%20you%20wont%20get%20any%20spam%2C%20just%20super%20smash" title="Digg"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://delicious.com/post?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F01%2F05%2Fcompetition-php-job-hunters-handbook-up-for-grabs%2F&amp;title=Competition%3A%20PHP%20Job%20Hunters%20Handbook%20up%20for%20grabs&amp;notes=I%27ve%20got%20a%20couple%20of%20copies%20of%20Php%7Carchitect%27s%20PHP%20Job%20Hunter%27s%20Handbook%20to%20give%20away%2C%20the%20only%20catch%20is%20you%20have%20to%20sign%20up%20to%20PHPPositions%27%20feed%20via%20email.%20It%27s%20managed%20by%20Feedburner%2C%20so%20it%20can%20be%20trusted%20and%20you%20wont%20get%20any%20spam%2C%20just%20super%20smash" title="del.icio.us"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F01%2F05%2Fcompetition-php-job-hunters-handbook-up-for-grabs%2F&amp;h=Competition%3A%20PHP%20Job%20Hunters%20Handbook%20up%20for%20grabs" title="NewsVine"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F01%2F05%2Fcompetition-php-job-hunters-handbook-up-for-grabs%2F&amp;title=Competition%3A%20PHP%20Job%20Hunters%20Handbook%20up%20for%20grabs" title="Reddit"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow" href="" title="Furl"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/" title="Furl" alt="Furl" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F01%2F05%2Fcompetition-php-job-hunters-handbook-up-for-grabs%2F&amp;title=Competition%3A%20PHP%20Job%20Hunters%20Handbook%20up%20for%20grabs" title="DZone"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F01%2F05%2Fcompetition-php-job-hunters-handbook-up-for-grabs%2F&amp;title=Competition%3A%20PHP%20Job%20Hunters%20Handbook%20up%20for%20grabs" title="StumbleUpon"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.davedevelopment.co.uk%2F2009%2F01%2F05%2Fcompetition-php-job-hunters-handbook-up-for-grabs%2F" title="Technorati"><img src="http://www.davedevelopment.co.uk/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>


<br/><br/><img src="http://feeds.feedburner.com/~r/Davedevelopment/~4/SB52N4ouUGE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.davedevelopment.co.uk/2009/01/05/competition-php-job-hunters-handbook-up-for-grabs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss><!-- Dynamic page generated in 1.160 seconds. --><!-- Cached page generated by WP-Super-Cache on 2009-07-11 00:04:53 -->
