<?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>Aching Brain &#187; Technology</title>
	<atom:link href="http://www.achingbrain.net/category/technology/feed" rel="self" type="application/rss+xml" />
	<link>http://www.achingbrain.net</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sat, 01 Jan 2011 15:01:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Uniqueness</title>
		<link>http://www.achingbrain.net/alex/uniqueness</link>
		<comments>http://www.achingbrain.net/alex/uniqueness#comments</comments>
		<pubDate>Wed, 23 Jun 2010 15:56:04 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.achingbrain.net/?p=183</guid>
		<description><![CDATA[Something we&#8217;ve been ruminating on at work recently is uniqueness.  We&#8217;d quite like everything in our system to have a unique identifier, usually referred to as a GUID or Globally Unique IDentifier.  This way you can access any entity from any place, and the display method of said entity is determined by the place of [...]]]></description>
			<content:encoded><![CDATA[<p>Something we&#8217;ve been ruminating on at work recently is uniqueness.  We&#8217;d quite like everything in our system to have a unique identifier, usually referred to as a GUID or Globally Unique IDentifier.  This way you can access any entity from any place, and the display method of said entity is determined by the place of access.  By way of example, if you were to access an email, you&#8217;d see the email, but if you were looking at a folder full of emails, you&#8217;d see the email in the context of the folder that contains it.</p>
<p>Back to uniqueness though.  We don&#8217;t really need our GUIDs to be truly globally unique, only unique within our system.  Ideally we&#8217;d also like them to be short so if you email someone a url their client won&#8217;t wrap the line in the middle of our GUID.</p>
<p>The simplest way to ensure this would be with a number.  This is easy to maintain as they can be sequential, generated by a database and don&#8217;t need any special rules.  The only problem is the namespace is not very big.  If you allow five characters for your GUID in the familiar base 10 number system, you have 10,000 potential values, or 10<sup>5</sup>.</p>
<p>10,000 is a good start but what if you&#8217;ve got entities in different tables?  Entity#1 in table A is not the same as entity#1 in table B.  Perhaps we can do better.</p>
<p>The canonical GUID implementation is the <a href="http://en.wikipedia.org/wiki/Universally_Unique_Identifier">Universally Unique Identifier</a> or UUID.  UUID has been standardised as <a href="http://www.ietf.org/rfc/rfc4122.txt">RFC4122</a> by people a lot cleverer than me so let&#8217;s assume it&#8217;s pretty good.  A UUID takes the following form:</p>
<p>550e8400-e29b-41d4-a716-446655440000</p>
<p>Right away we can see that it&#8217;s going to result in a much larger namespace than using numbers as it incorporates letters as well.  This expands the value each character can be from 10 to (26 + 10), giving us a base 36 namespace.  A five character GUID in base 36 has 60,466,176 possible values, or 36<sup>5</sup>.</p>
<p>Version 5 UUIDs are calculated by taking an existing source of uniqueness (a URL is recommended) and hashing it using the SHA-1 algorithm.  This is not fantastic for us as we&#8217;re trying to create a GUID which will be used in the creation of a URL, so we&#8217;re going to have to look elsewhere.</p>
<p>The simple thing to do would be to generate them randomly.  This is not as bad as it sounds and appears to be a <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/UUID.html#randomUUID()">standard</a> way of doing it.  We&#8217;ve just introduced a subtle problem though.  As we are now randomly generating the GUID we become vulnerable to the <a href="http://en.wikipedia.org/wiki/Birthday_problem">birthday paradox</a>.  From this <a href="http://my.instacalc.com/calc/91ca9ae67a434f82be1b84d85ea9e065">rather nifty calculator</a>, we can deduce that we&#8217;ll reach a 99.9% probability of a collision (eg. two items with the same GUID) with a five character GUID in base 36 after 29,903 items.  Although this means we are fairly likely to have collisions with randomly generated GUIDs, it&#8217;s still much better than using integers which reach 99.9% after just 372 items.</p>
<p>Clearly the way to increase the namespace is to increase the base of the number system we are using.  There&#8217;s easy thing we can do here &#8211; include capital and lower case letters.  YouTube do this to great effect, even including punctuation:</p>
<p><a href="http://www.youtube.com/watch?v=ZOU8GIRUd_g">http://www.youtube.com/watch?v=ZOU8GIRUd_g</a></p>
<p>So lower case (26), upper case (26), integers (10) and underscores (1) gives us base 56 &#8211; 550,731,776 potential values at five characters, or 56<sup>5</sup>.  No need to stop at underscores though &#8211; <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC2396</a> tells us that the only restricted characters for URLs are ; / ? : @ &amp; = + $ ,.  That leaves !@£%^*()[]{}&#8221;&#8216;\|&gt;&lt;. etc etc.</p>
<p>At 11 base 56 characters, YouTube can accommodate nearly 17,000,000,000,000,000,000 videos (or 1.7 x 10<sup>-8</sup> <a href="http://www.facebook.com/pages/The-Official-Petition-to-Establish-Hella-as-the-SI-Prefix-for-1027/277479937276?v=info">hella</a> videos) before running out of GUIDs.  When they do, they can just add another character on to literally increase the namespace exponentially or simply allow additional punctuation marks.  Taking the birthday paradox into account, they can have 15,325,262,787 videos before a 99.9% probability of collision occurs.  If <a href="http://wiki.answers.com/Q/How_many_videos_are_there_on_YouTube">they currently have 120,000,000</a> they are still a long way off needing to extend their namespace.</p>
<p>So there you have it.  Increase your number base to reduce the chance of GUID collision and make your life easy when trying to make everything in your database have a unique, email friendly identifier.</p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=183&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/uniqueness/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Register&#8217;s guide to Linux Distributions</title>
		<link>http://www.achingbrain.net/alex/the-registers-guide-to-linux-distributions</link>
		<comments>http://www.achingbrain.net/alex/the-registers-guide-to-linux-distributions#comments</comments>
		<pubDate>Mon, 21 Jun 2010 19:06:13 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.achingbrain.net/?p=180</guid>
		<description><![CDATA[Tomorrow, we&#8217;ll tell you how to get them, burn them and set them up to dual-boot with Windows and on Wednesday there will be a guide to tweaking your new setup and getting it ready for use. Three days to set up and have a Linux desktop ready to use.  Yep, that about tallies with [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Tomorrow, we&#8217;ll tell you how to get them, burn them and set them up to dual-boot with Windows and on Wednesday there will be a guide to tweaking your new setup and getting it ready for use.</p></blockquote>
<p>Three days to set up and have a Linux desktop ready to use.  Yep, that about tallies with my memory of it.</p>
<p><a href="http://www.theregister.co.uk/2010/06/21/reg_linux_guide_1">http://www.theregister.co.uk/2010/06/21/reg_linux_guide_1</a></p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=180&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/the-registers-guide-to-linux-distributions/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updates</title>
		<link>http://www.achingbrain.net/alex/updates</link>
		<comments>http://www.achingbrain.net/alex/updates#comments</comments>
		<pubDate>Sun, 02 Aug 2009 11:20:14 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.achingbrain.net/?p=174</guid>
		<description><![CDATA[I&#8217;d forgotten what a time consuming, involving and generally ill thought through process updating a copy of Windows is.  On the Mac you use a desktop application, on Windows a flaky looking web app.  On the Mac you select things like &#8220;QuickTime Update 7.6.2&#8243; which kind of makes sense, on Windows you select &#8220;Critical Update [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d forgotten what a time consuming, involving and generally ill thought through process updating a copy of Windows is.  On the Mac you use a desktop application, on Windows a flaky looking web app.  On the Mac you select things like &#8220;QuickTime Update 7.6.2&#8243; which kind of makes sense, on Windows you select &#8220;Critical Update for Windows XP (KB9832082)&#8221; which might as well be in Esperanto.</p>
<p>Operating system updates on the Mac are all rolled together, so if you are on 10.5.3, updating to 10.5.7 is one step (and a big download).  On Windows you need to repeatedly visit Windows Update to ensure that no new updates have been unlocked by installing the last set.</p>
<p>After selecting your desired updates, on the Mac any further interaction is done right at the start of the process &#8211; EULA clicking, etc.  On Windows the process is constantly interrupted with wizard after wizard after wizard, meaning that you can&#8217;t just click &#8220;go&#8221;, put the kettle on and come back half an hour later.  No, you have to constantly hand hold the process like some it&#8217;s some sort of attention seeking toddler.</p>
<p>It also offered me the option of installing something called Microsoft Genuine Windows Notifications which promised, if my copy of windows was not &#8220;Genuine&#8221;, to constantly bombard me with nagging reminders to &#8220;solve&#8221; this problem.</p>
<p>Who in their right mind would actually choose to install such a piece of software?  If your copy is legit you don&#8217;t need it and if it&#8217;s not, you don&#8217;t want it.</p>
<p>It then prompted me to follow a link to a list of benefits of using &#8220;Genuine&#8221; Windows software.  I didn&#8217;t follow the link, but presumably it&#8217;s just a picture of Steve Balmer in a bath of money.</p>
<p>Sorry that this post is so unashamedly pro Mac.  I&#8217;d have mentioned the Linux update process as these days it&#8217;s pretty painless.  The update process itself is painless, I mean.  The pain comes after the update when you find that half of your shit doesn&#8217;t work any more.</p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=174&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/updates/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running FMS 3 on Gentoo Linux</title>
		<link>http://www.achingbrain.net/alex/running-fms-3-on-gentoo-linux</link>
		<comments>http://www.achingbrain.net/alex/running-fms-3-on-gentoo-linux#comments</comments>
		<pubDate>Thu, 24 Apr 2008 13:22:47 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.achingbrain.net/?p=169</guid>
		<description><![CDATA[I&#8217;ve been trying to install Macromedia Adobe Flash Media Server 3 on my local development box and have run into some problems. To help out anyone else trying to do the same thing, here&#8217;s how I did it. First you need to install nspr emerge -uDv dev-libs/nspr Add a user/group for it to run under: [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been trying to install <span style="text-decoration: line-through;">Macromedia</span> Adobe Flash Media Server 3 on my local development box and have run into some problems.</p>
<p>To help out anyone else trying to do the same thing, here&#8217;s how I did it.</p>
<p>First you need to install nspr</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">emerge -uDv dev-libs/nspr</div>
</li>
</ol>
</div>
<p>Add a user/group for it to run under:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">groupadd fms</div>
</li>
<li class="li1">
<div class="de1">useradd -g fms -d /dev/null -s /bin/bash fms</div>
</li>
</ol>
</div>
<p>Then download and extract the media server as per usual.  Before installing it, you need to fiddle the install script so that it will install on your &#8220;unsupported&#8221; platform.  Open installFMS in your favourite text editor and find the line that reads</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re2">DISTRO=</span>`check_distro`</div>
</li>
</ol>
</div>
<p>Change it to something appropriate like</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re2">DISTRO=</span>redhat-RHEL4-i686</div>
</li>
</ol>
</div>
<p>Then start the installation script as normal.  Tell it that you don&#8217;t want it to run as a daemon (as it requires the Red Hat only chkconfig command) and that you don&#8217;t want it to start the server when done.</p>
<p>After you&#8217;ve installed the server, you&#8217;ll need to make the bundled <code>libasneu.so.1</code> library available for use:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">ln</span> -s /opt/fms/libasneu.so<span class="nu0">.1</span> /lib/libasneu.so<span class="nu0">.1</span></div>
</li>
</ol>
</div>
<p>For some reason the install messed up the configuration files, adding things like the administrative user name twice.  Check conf/fms.ini to make sure this hasn&#8217;t happened to you.</p>
<p>The installer creates init scripts at <code>/etc/init.d</code> but in order to use them you first need to create a file called <code>.autostart</code> in the installation directory:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">touch</span> .autostart</div>
</li>
</ol>
</div>
<p>You should then be able to start and stop the server normally:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">/etc/init.d/fms start</div>
</li>
<li class="li1">
<div class="de1">/etc/init.d/fms stop</div>
</li>
</ol>
</div>
<p>And use <code>rc-update</code> to have the server start on boot:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">rc-update add fms default</div>
</li>
</ol>
</div>
<p>Good luck.</p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=169&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/running-fms-3-on-gentoo-linux/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Prototype String.toQueryParams() weirdness</title>
		<link>http://www.achingbrain.net/alex/prototype-stringtoqueryparams-weirdness</link>
		<comments>http://www.achingbrain.net/alex/prototype-stringtoqueryparams-weirdness#comments</comments>
		<pubDate>Tue, 15 Apr 2008 14:34:46 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.achingbrain.net/?p=167</guid>
		<description><![CDATA[I just came across this while using Prototype: &#34;section=blo%g&#38;id=45&#34;.toQueryParams&#40;&#41;; To save you the trouble of running it yourself, I&#8217;ll tell you what happens &#8211; the unescaped percent symbol causes a URI malformed error to be thrown. Very odd. The Prototype documentation for toQueryParams says: Parses a URI-like query string and returns an object composed of [...]]]></description>
			<content:encoded><![CDATA[<p>I just came across this while using <a href="http://www.prototypejs.org">Prototype</a>:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="st0">&quot;section=blo%g&amp;id=45&quot;</span>.<span class="me1">toQueryParams</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>To save you the trouble of running it yourself, I&#8217;ll tell you what happens &#8211; the unescaped percent symbol causes a URI malformed error to be thrown.</p>
<p>Very odd.  The Prototype documentation for <a href="http://www.prototypejs.org/api/string#method-toqueryparams">toQueryParams</a> says:</p>
<blockquote><p>Parses a URI-like query string and returns an object composed of parameter/value pairs.</p></blockquote>
<p>Since it&#8217;s a URI-like query string and not an actual query string (by which I mean one that&#8217;s been through the browser address bar and as such subject to whatever text munging the browser does), my example above should be a legal use case.</p>
<p>After a little digging around in prototype.js, it seems that the problem is caused by the JavaScript function decodeURIComponent() not enjoying being given a string that contains an unescaped percent symbol.  Usually percent symbols are used in conjunction with a number to represent a non-alphanumeric character in a URL &#8211; %20 for space, etc, but in the above it&#8217;s a literal percent symbol.</p>
<p>My first attempt to fix it changed lines 98 and 100 of string.js in the Prototype source to use the built in <a href="http://www.w3schools.com/jsref/jsref_escape.asp">escape</a> function:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> key = decodeURIComponent<span class="br0">&#40;</span>pair.<span class="me1">shift</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&#8230;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>value != undefined<span class="br0">&#41;</span> value = decodeURIComponent<span class="br0">&#40;</span>value<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">to</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> key = decodeURIComponent<span class="br0">&#40;</span>escape<span class="br0">&#40;</span>pair.<span class="me1">shift</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&#8230;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>value != undefined<span class="br0">&#41;</span> value = decodeURIComponent<span class="br0">&#40;</span>escape<span class="br0">&#40;</span>value<span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>This worked for my use case but caused Prototype to fail a different unit test.  Changing them to the following worked out okay:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> key = unescape<span class="br0">&#40;</span>decodeURIComponent<span class="br0">&#40;</span>escape<span class="br0">&#40;</span>pair.<span class="me1">shift</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&#8230;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>value != undefined<span class="br0">&#41;</span> value = unescape<span class="br0">&#40;</span>decodeURIComponent<span class="br0">&#40;</span>escape<span class="br0">&#40;</span>value<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>Granted the unescape(&#8230;(escape(&#8230;)) is a little clumsy, but it seems to get the job done.</p>
<p>Adding the following unit test to string.html allows to test for the above:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">this</span>.<span class="me1">assertHashEqual</span><span class="br0">&#40;</span><span class="br0">&#123;</span><span class="st0">&#8216;key1&#8242;</span>: <span class="st0">&#8216;va%lue1&#8242;</span><span class="br0">&#125;</span>, <span class="st0">&#8216;key1=va%lue1&#8242;</span>.<span class="me1">toQueryParams</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, <span class="st0">&#8216;rogue percent symbol test&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>I&#8217;ve created some <a href="http://www.achingbrain.net/files/prototype_toQueryParams_bug/">test pages</a> which demonstrate the problem.</p>
<p>There is also a <a href="http://www.achingbrain.net/files/prototype_toQueryParams_bug/string.js.patch">patch file</a> available.  Apply it to /src/string.js in your Prototype source tree.</p>
<p><strong>Update</strong></p>
<p>I&#8217;ve also <a href="http://prototype.lighthouseapp.com/projects/8886/tickets/15-patch-test-string-toqueryparams-not-handling-properly">filed a bug</a>.</p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=167&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/prototype-stringtoqueryparams-weirdness/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code</title>
		<link>http://www.achingbrain.net/alex/code</link>
		<comments>http://www.achingbrain.net/alex/code#comments</comments>
		<pubDate>Fri, 11 Apr 2008 14:40:45 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.achingbrain.net/?p=166</guid>
		<description><![CDATA[I haven&#8217;t posted here for a while, mainly due to the time sink that is Facebook, but I have been writing code in my spare time, honest.  I thought I&#8217;d have a little skim through what&#8217;s on my machine and share a few choice nuggets. Recently I&#8217;ve been trying to get into programming applications for [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t posted here for a while, mainly due to the time sink that is Facebook, but I have been writing code in my spare time, honest.  I thought I&#8217;d have a little skim through what&#8217;s on my machine and share a few choice nuggets.</p>
<p>Recently I&#8217;ve been trying to get into programming applications for Mac OS X &#8211; I use it on a day to day basis so thought it would be best to get involved.  I&#8217;ve put some new things on the <a href="http://www.achingbrain.net/stuff">Stuff</a> page for your perusal.  They are:</p>
<h3><a href="http://www.achingbrain.net/stuff/cocoa/applications/backgrounderer">Backgrounderer</a></h3>
<p>A little app to download desktop wallpapers from veer.com.  If you wish to build from source, you&#8217;ll need to install <a href="http://regexkit.sourceforge.net/">RegexKit</a> first.</p>
<h3><a href="http://www.achingbrain.net/stuff/cocoa/applications/mail-rss-exporter">Mail RSS Exporter</a></h3>
<p>An application that exports your RSS feeds from Apple Mail and stores them in either OPML format or Safari Bookmarks.</p>
<h3><a href="http://www.achingbrain.net/stuff/cocoa/applications/touch-me">TouchMe</a></h3>
<p>A program to run AppleScripts on a computer on your local network from your iPhone or iPod Touch &#8211; I use this to control a Mac mini attached to a projector.  The projector is not always switched on so Front Row was insufficient.  It also allows you to force quit applications that have hung.</p>
<h3><a href="http://www.achingbrain.net/stuff/cocoa/frameworks/simplehttpd">SimpleHTTPd</a></h3>
<p>A Cocoa native web server packaged as a framework so you can use it in your own projects.  Based on Jurgen Schwiezer&#8217;s <a href="http://www.oreilly.com/pub/a/mac/2006/11/14/how-to-write-a-cocoa-web-server.html">SimpleHTTPServer</a>.</p>
<p>All of the above require OS X 10.5 Leopard as coming from a Java/PHP background I have a strange fetish for garbage collectors and consequently find manual memory management tedious.</p>
<p>They are all BSD licensed and source is included with each program so go crazy.</p>
<p>I&#8217;ll get round to posting about each one in more depth in the near future.</p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=166&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/code/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Button, button, who&#8217;s got the button?</title>
		<link>http://www.achingbrain.net/alex/button-button-whos-got-the-button</link>
		<comments>http://www.achingbrain.net/alex/button-button-whos-got-the-button#comments</comments>
		<pubDate>Thu, 26 Jul 2007 07:44:14 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://wordpress/blog/alex/button-button-whos-got-the-button</guid>
		<description><![CDATA[From an article on the Wall Street Journal about Steve Job&#8217;s button phobia. When the company introduced the iPod in late 2001, the most common calls to Apple&#8217;s technical support lines for a time were about how to turn the device, which lacked a clearly defined power button, off and on, says a former Apple [...]]]></description>
			<content:encoded><![CDATA[<p>From an article on the Wall Street Journal about <a href="http://online.wsj.com/public/article/SB118532502435077009.html?mod=blog">Steve Job&#8217;s button phobia</a>.</p>
<blockquote><p> When the company introduced the iPod in late 2001, the most common calls to Apple&#8217;s technical support lines for a time were about how to turn the device, which lacked a clearly defined power button, off and on, says a former Apple executive.</p></blockquote>
<p>Wow, I&#8217;d forgotten all about that.  Years ago Will left his iPod at our house for a week or two and I had such trouble trying to figure out how to turn the damn thing on.</p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=149&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/button-button-whos-got-the-button/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache2 and OS X</title>
		<link>http://www.achingbrain.net/alex/apache2-and-os-x</link>
		<comments>http://www.achingbrain.net/alex/apache2-and-os-x#comments</comments>
		<pubDate>Fri, 20 Jul 2007 11:20:45 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://wordpress/blog/alex/apache2-and-os-x</guid>
		<description><![CDATA[This is more a note to myself than anyone else, but to compile Apache2 on OS X, use the following configure: ./configure &#8211;with-included-apr &#8211;enable-so &#8211;enable-mods-shared=most When Apache starts whinging about &#8220;dlname not found, assuming libtool archive&#8221; and shit, and refuses to produce .so modules instead kicking out a bunch of .a and .la files in [...]]]></description>
			<content:encoded><![CDATA[<p>This is more a note to myself than anyone else, but to compile Apache2 on OS X, use the following configure:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">./configure &#8211;with-included-apr &#8211;enable-so &#8211;enable-mods-<span class="re2">shared=</span>most</div>
</li>
</ol>
</div>
<p>When Apache starts whinging about &#8220;dlname not found, assuming libtool archive&#8221; and shit, and refuses to produce .so modules instead kicking out a bunch of .a and .la files in their place, it means you&#8217;ve fucked up somewhere along the line, probably because this isn&#8217;t the first time you&#8217;ve tried to run the configure script.</p>
<p>Delete the entire Apache source directory and start again.  If you are lucky you&#8217;ll even get a nice copy of libexpat.0.dylib at the end of it all.</p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=148&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/apache2-and-os-x/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Orwellian</title>
		<link>http://www.achingbrain.net/alex/orwellian</link>
		<comments>http://www.achingbrain.net/alex/orwellian#comments</comments>
		<pubDate>Tue, 26 Jun 2007 19:04:08 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://wordpress/blog/alex/orwellian</guid>
		<description><![CDATA[The BBC &#8230; has always taken a platform agnostic approach to its internet services. And then a little later: It is not possible to put an exact timeframe on when BBC iPlayer will be available for Mac users. &#8211;bad, indeed. The corporation&#8217;s governing body asked the BBC to ensure that the iPlayer could run on [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>The BBC &#8230; has always taken a platform agnostic approach to its internet services.</p></blockquote>
<p>And then a little later:</p>
<blockquote><p>It is not possible to put an exact timeframe on when BBC iPlayer will be available for Mac users.</p></blockquote>
<p>&#8211;bad, indeed.</p>
<blockquote><p>The corporation&#8217;s governing body asked the BBC to ensure that the iPlayer could run on different systems &#8211; such as Apple Macs &#8211; within &#8220;a reasonable time frame&#8221;, initially twenty-four months.</p></blockquote>
<p>Twenty four months for porting to Mac OS X is reasonable?!  I dread to think about the poor old Linux users out there.</p>
<blockquote><p>The BBC has previously said it cannot commit to a two-year time frame as many decisions would have to be made by third parties.</p></blockquote>
<p>i.e. Either Microsoft decide to port their DRM software or someone else will have to decide to write some.</p>
<blockquote><p>A statement from the BBC read: &#8220;Our ability to deliver this open approach will be influenced by the availability of alternative DRM systems on the market.</p></blockquote>
<p>i.e. Microsoft have no plans to port their DRM software to any other operating system so the BBC will have to find some other system to use and so far haven&#8217;t so we&#8217;ll just have to wait.</p>
<p>What a load of rubbish.  I&#8217;ve always been a strong supporter of the BBC but this is utterly unacceptable.</p>
<p><a href="http://news.bbc.co.uk/1/hi/technology/6236612.stm">http://news.bbc.co.uk/1/hi/technology/6236612.stm</a></p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=147&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/orwellian/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glastonbury tickets</title>
		<link>http://www.achingbrain.net/alex/glastonbury-tickets</link>
		<comments>http://www.achingbrain.net/alex/glastonbury-tickets#comments</comments>
		<pubDate>Sun, 01 Apr 2007 08:15:48 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://wordpress/blog/alex/glastonbury-tickets</guid>
		<description><![CDATA[Alex is currently wondering if the Glastonbury ticket website is run off of a beige box in the corner of someone&#8217;s flat with a cat chewing on the network cable. Honestly, what with all the pre-registering bollocks it&#8217;s not like they were unaware of the demand. Why can&#8217;t they design a server infrastructure that can [...]]]></description>
			<content:encoded><![CDATA[<p>Alex is currently wondering if the Glastonbury ticket website is run off of a beige box in the corner of someone&#8217;s flat with a cat chewing on the network cable.</p>
<p>Honestly, what with all the pre-registering bollocks it&#8217;s not like they were unaware of the demand.  Why can&#8217;t they design a server infrastructure that can handle enough requests?</p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=144&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/glastonbury-tickets/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>svn:externals and different usernames</title>
		<link>http://www.achingbrain.net/alex/svnexternals-and-different-usernames</link>
		<comments>http://www.achingbrain.net/alex/svnexternals-and-different-usernames#comments</comments>
		<pubDate>Wed, 03 Jan 2007 15:08:12 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://wordpress/blog/alex/svnexternals-and-different-usernames</guid>
		<description><![CDATA[How to use a different username with svn:externals. Genius. Well, almost. Close enough.]]></description>
			<content:encoded><![CDATA[<p>How to <a href="http://www.dribin.org/dave/blog/archives/2006/10/11/svn_ssh/">use a different username with svn:externals</a>.</p>
<p>Genius. Well, almost. Close enough.</p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=141&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/svnexternals-and-different-usernames/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pink Zune</title>
		<link>http://www.achingbrain.net/alex/pink-zune</link>
		<comments>http://www.achingbrain.net/alex/pink-zune#comments</comments>
		<pubDate>Tue, 28 Nov 2006 08:11:49 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://wordpress/blog/alex/pink-zune</guid>
		<description><![CDATA[Me: Oh look, they&#8217;ve released a pink Zune. Would you like one for Christmas? Her: I&#8217;d rather stick my head on a pike. Although on closer reading of the article, it seems that the pink Zunes are a very rare limited edition and they are not marked as such. Consequently the guy who bought it [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Me:  Oh look, they&#8217;ve <a href="http://www.gizmodo.com/gadgets/portable-media/limited-edition-pink-zunes-in-the-wild-and-on-ebay-217508.php">released a pink Zune</a>.  Would you like one for Christmas?</p>
<p>Her:  I&#8217;d rather stick my head on a pike.</p></blockquote>
<p>Although on closer reading of the article, it seems that the pink Zunes are a very rare limited edition and they are not marked as such.  Consequently the guy who bought it thought he was getting a white one, didn&#8217;t like the pink, saw an opportunity and promptly put it on eBay.</p>
<p>Honestly, that&#8217;s a stroke of genius only matched by releasing a brown Zune in the first place.</p>
<p>You can just see little Jimmy&#8217;s parents in some electronics shop going:</p>
<blockquote><p>Parent:  Oh look, there&#8217;s one of those Zune things Jimmy wants.  Excuse me, Mr Shop Assistant, we&#8217;d like to buy a Zune.</p>
<p>Shop Assistant:  Wonderful, here you go.</p>
<p>Parent:  Excellent, he&#8217;s going to be so pleased.</p></blockquote>
<p>Of course, the parents left it to the last minute and the black/white Zunes sold out a long time ago &#8211; something the shop assistant neglects to mention lest it should damage his chances of making a commission and/or missing his sales target.</p>
<p>Little Jimmy then spends the next six months being bullied at school for having a poo coloured Zune before it&#8217;s finally stolen and destroyed by muggers on the bus who can&#8217;t bear to suffer it&#8217;s existence any longer.  Little Jimmy is secretly thankful.</p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=138&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/pink-zune/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vista</title>
		<link>http://www.achingbrain.net/alex/vista</link>
		<comments>http://www.achingbrain.net/alex/vista#comments</comments>
		<pubDate>Fri, 24 Nov 2006 14:58:00 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://wordpress/blog/alex/vista</guid>
		<description><![CDATA[I downloaded the release version of Vista today via my work MSDN account and my first impressions were: Hmm. I can&#8217;t quite focus on the text on this screen. Either my hangover is really, really bad or I need to get my eyes tested. Oh, wait, it&#8217;s just ClearType. Aside from that, I&#8217;m amazed at [...]]]></description>
			<content:encoded><![CDATA[<p>I downloaded the release version of Vista today via my work MSDN account and my first impressions were:</p>
<blockquote><p>Hmm.  I can&#8217;t quite focus on the text on this screen.  Either my hangover is really, really bad or I need to get my eyes tested.</p>
<p>Oh, wait, it&#8217;s just ClearType.</p></blockquote>
<p>Aside from that, I&#8217;m amazed at how complicated they&#8217;ve made everything.  For example, when downloading files through IE7, you now have a &#8220;Downloads&#8221; folder in your home directory.  Can you get to this via the start menu?  No.  Is it a sub-folder of your Documents folder?  No.  What&#8217;s wrong with just putting them on the Desktop?  Isn&#8217;t it what it&#8217;s there for &#8211; files you are currently working on and/or might not want to keep?</p>
<p>The Windows Explorer seems to have become a maze of semi-coherent short cuts and file system abstractions &#8211; see the address bar for what I mean.  Even the Control Panel has succumbed to this mess.  It seems they&#8217;ve sat around a table and gone &#8220;What are the most popular things people do with the Control Panel&#8221; and made shortcuts to them all, rather than organising the different areas in a logical manner in the first place.</p>
<p>And then there&#8217;s the whole <a href="http://www.joelonsoftware.com/items/2006/11/21.html">off button</a> thing.</p>
<p>Never mind the hundreds of pop ups &#8220;This program wants to do this&#8221; &#8220;Do you know this program?&#8221; &#8220;Do you want to let this program do this?&#8221; &#8220;Are you sure you want to let this program do this?&#8221;.  And the really obnoxious one that greys out your entire screen and puts the dialogue box right in the middle.  &#8220;LOOK AT ME&#8221;, it screams.  &#8220;FUCK OFF&#8221;, I think.</p>
<p>And what happened to the File/Edit/etc menus?  It took me a good twenty minutes to work out how to show hidden files and folders.  In the end I had to ask Google for the answer.</p>
<p>Ugh.  Maybe I&#8217;m just getting old, but does it really have to be this way?.</p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=136&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/vista/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magic bullet</title>
		<link>http://www.achingbrain.net/alex/magic-bullet</link>
		<comments>http://www.achingbrain.net/alex/magic-bullet#comments</comments>
		<pubDate>Fri, 17 Nov 2006 08:20:28 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://wordpress/blog/alex/magic-bullet</guid>
		<description><![CDATA[Biometric passports cloned. It seems all it takes is 174 quids worth of hardware and 48 hours of a programmer&#8217;s time to write the software. Given the government&#8217;s track record for IT, is anyone really surprised by this?]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.guardian.co.uk/idcards/story/0,,1950229,00.html">Biometric passports cloned</a>.  It seems all it takes is 174 quids worth of hardware and 48 hours of a programmer&#8217;s time to write the software.</p>
<p>Given the government&#8217;s track record for IT, is anyone really surprised by this?</p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=135&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/magic-bullet/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Beta software</title>
		<link>http://www.achingbrain.net/alex/beta-software</link>
		<comments>http://www.achingbrain.net/alex/beta-software#comments</comments>
		<pubDate>Tue, 14 Nov 2006 13:18:26 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://wordpress/blog/alex/beta-software</guid>
		<description><![CDATA[John Gruber has a go at shonky software hiding behind the &#8220;Beta&#8221; label (so hot right now). Too bloody right.]]></description>
			<content:encoded><![CDATA[<p>John Gruber has a go at <a href="http://daringfireball.net/2006/11/beta_excuse">shonky software hiding behind the &#8220;Beta&#8221; label</a> (so hot right now).</p>
<p>Too bloody right.</p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=134&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/beta-software/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>eBay infrastructure</title>
		<link>http://www.achingbrain.net/alex/ebay-infrastructure</link>
		<comments>http://www.achingbrain.net/alex/ebay-infrastructure#comments</comments>
		<pubDate>Wed, 01 Nov 2006 11:55:58 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://wordpress/blog/alex/ebayinfrastructure</guid>
		<description><![CDATA[There&#8217;s an article on eWeek.com about the storage requirements of eBay.com. It&#8217;s mostly large number willy waving, but this quote from the third page caught my eye: eBay&#8217;s application servers, according to Strong: * use monolithic two-tier architecture * boast 3.3 million line C++ ISAPI DLL (150MB binary) * have hundreds of developers, all working [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s an article on eWeek.com about the <a href="http://www.eweek.com/article2/0,1895,2041437,00.asp">storage requirements of eBay.com</a>.  It&#8217;s mostly large number willy waving, but this quote from the third page caught my eye:</p>
<blockquote><p>eBay&#8217;s application servers, according to Strong:</p>
<p>* use monolithic two-tier architecture<br />
* boast 3.3 million line C++ ISAPI DLL (150MB binary)<br />
* have hundreds of developers, all working on the same code<br />
* are hitting compiler limits on number of methods per class.</p></blockquote>
<p>Now, I could be wrong, but the last three points don&#8217;t really strike me as much to be proud of, not to mention <a href="http://www.sun.com/service/about/success/ebay5.html">possibly inaccurate</a> in the case of the first two.</p>
<p>In other news, this morning I did something that some people might find a little odd.  I cleaned my bike.</p>
<p>Truly, I am entering into the realm of the unwell.</p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=133&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/ebay-infrastructure/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ClassLoader</title>
		<link>http://www.achingbrain.net/alex/classloader</link>
		<comments>http://www.achingbrain.net/alex/classloader#comments</comments>
		<pubDate>Mon, 30 Oct 2006 17:30:35 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://wordpress/blog/alex/classloader</guid>
		<description><![CDATA[I have a sort of love hate relationship with OO support in PHP. On one hand it looks like a dirty hack due to a combination of the duck typing, lack of function overloading, no proper namespaces and the way everyone talks about object methods when the code itself calls them functions. On the other [...]]]></description>
			<content:encoded><![CDATA[<p>I have a sort of love hate relationship with OO support in PHP.  On one hand it looks like a dirty hack due to a combination of the duck typing, lack of function overloading, no proper namespaces and the way everyone talks about object methods when the code itself calls them functions.  On the other hand it just feels right (although I&#8217;m told this kind of wooly thinking is my degree showing) and if you are putting anything together where scripts run to more than a hundred lines or so it&#8217;s really the only way to do it and keep it all manageable.  One of the major problems I have with the whole thing is that there is no standardised way to store your class definitions and consequently no way to import them in a neat and tidy way.  I personally favour having each class and interface in it&#8217;s own file, named thus:</p>
<p><pre><pre>
DatabaseConnection.class.php
SQLQuery.class.php
JSONableItem.interface.php
etc..</pre></pre></p>
<p>This way you can identify what is in each file just by reading the name and you can order them in directories like so:</p>
<p><pre><pre>
ajax
JSONableItem.interface.php
database
DatabaseConnection.class.php
SQLQuery.class.php
etc..</pre></pre></p>
<p>Even giving you a sort of memetic namespace of</p>
<p><pre><pre>
ajax.JSONableItem
database.DatabaseConnection
database.SQLQuery
etc..</pre></pre></p>
<p>Which encourages code re-use by making it very easy to transfer classes between projects.  This brings me on to the next problem in that there is no standardised way of importing these classes into your script files.  I normally have one file that imports all the class definitions into the project, somewhere high up on the bootstrap page but this means that every single class in the project is being loaded for each request to the server that is answered by PHP &#8211; not exactly ideal.  I found a little class on the Pure PHP website called <a href="http://www.pure-php.de/node/19">Include_once</a> which is based on an interesting little idea &#8211; keep a list of imported files and only import a requested file if it is not in the list.  Inspired by this I&#8217;ve written a little utility class rather unimaginatively named <a href="/stuff/classloader/">ClassLoader</a> which does the above but via a sort of namespace that allows for nice structuring of class definition files in the file system and also the importing of whole folders of class files (packages).  An example of it&#8217;s use is as follows:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">ClassLoader::<span class="me2">import</span><span class="br0">&#40;</span><span class="st0">&#8216;database.DatabaseConnection&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">ClassLoader::<span class="me2">import</span><span class="br0">&#40;</span><span class="st0">&#8216;database.SQLQuery&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>or even</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">ClassLoader::<span class="me2">import</span><span class="br0">&#40;</span><span class="st0">&#8216;database.*&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>There are also a couple of other fun methods</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">ClassLoader::<span class="me2">getClassesLoaded</span><span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
</ol>
</div>
<p>tells you how many classes have been loaded and</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">ClassLoader::<span class="me2">getLoadAttempts</span><span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
</ol>
</div>
<p>tells you how many times ClassLoader has been asked to load class definition files.  The reason that these may be different is because you can use ClassLoader to include class definition files at the top of other class definition files much in the same way you&#8217;d use the import statement in Java.  So for a trite example, with the following file structure:</p>
<p><pre><pre>
classes
&nbsp;&nbsp;pretend
&nbsp;&nbsp;&nbsp;&nbsp;InterfaceA.interface.php
&nbsp;&nbsp;&nbsp;&nbsp;ClassA.abstract.php
&nbsp;&nbsp;&nbsp;&nbsp;ClassB.class.php
&nbsp;&nbsp;&nbsp;&nbsp;ClassC.class.php
&nbsp;&nbsp;util
&nbsp;&nbsp;&nbsp;&nbsp;ClassLoader.class.php
index.php</pre></pre></p>
<p>InterfaceA.interface.php</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">interface</span> InterfaceA <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw2">function</span> someMethod<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>ClassA.abstract.php</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">ClassLoader::<span class="me2">import</span><span class="br0">&#40;</span><span class="st0">&#8216;pretend.InterfaceA&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">abstract <span class="kw2">class</span> ClassA implements InterfaceA <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>ClassB.class.php</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">ClassLoader::<span class="me2">import</span><span class="br0">&#40;</span><span class="st0">&#8216;pretend.ClassA&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">class</span> ClassB <span class="kw2">extends</span> ClassA <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">public</span> <span class="kw2">function</span> someMethod<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>ClassC.class.php</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">ClassLoader::<span class="me2">import</span><span class="br0">&#40;</span><span class="st0">&#8216;pretend.ClassB&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">class</span> ClassC <span class="kw2">extends</span> ClassB <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>index.php</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">require</span><span class="br0">&#40;</span><span class="st0">&#8216;classes/util/ClassLoader.class.php&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">ClassLoader::<span class="me2">import</span><span class="br0">&#40;</span><span class="st0">&#8216;pretend.ClassC&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2"><span class="re0">$foo</span> = <span class="kw2">new</span> ClassC<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>Neat.  Of course, you don&#8217;t have to follow my file naming convention, feel free to do whatever you want, as long as the file has the name of the contained class before the first &#8216;.&#8217; and the last four characters are &#8216;.php&#8217;  Configuration of the class is pretty simple &#8211; just change the static member variable ClassLoader::$classPath to suit your set up.  Just make sure it&#8217;s readable by PHP.   So, for example:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">require</span><span class="br0">&#40;</span><span class="st0">&#8216;classes/util/ClassLoader.class.php&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">ClassLoader::<span class="re0">$classPath</span> = <span class="re0">$_SERVER</span><span class="br0">&#91;</span><span class="st0">&#8216;DOCUMENT_ROOT&#8217;</span><span class="br0">&#93;</span> . <span class="st0">&#8216;/includes/myclasses/&#8217;</span>;</div>
</li>
</ol>
</div>
<p>or</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">require</span><span class="br0">&#40;</span><span class="st0">&#8216;classes/util/ClassLoader.class.php&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">ClassLoader::<span class="re0">$classPath</span> = <span class="st0">&#8216;/usr/local/share/php5/myclasses/&#8217;</span>;</div>
</li>
</ol>
</div>
<p>or similar.  Given the above, there&#8217;s a really tiny part of me that says I should start using proper stuff like J2EE or something.  I try not to listen to it.</p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=132&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/classloader/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Colourblind</title>
		<link>http://www.achingbrain.net/alex/colourblind</link>
		<comments>http://www.achingbrain.net/alex/colourblind#comments</comments>
		<pubDate>Thu, 31 Aug 2006 17:30:59 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://wordpress/blog/alex/colourblind</guid>
		<description><![CDATA[I&#8217;ve just been reading this presentation paper on colourblindness while trying to be a back seat designer as the actual designer in the office chooses colours for buttons. An amusing statistic from the paper is that 8% of caucasians have difficulty distinguishing between red and green. From the perspective of a web designer, it&#8217;s more [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just been reading <a href="http://jfly.iam.u-tokyo.ac.jp/html/color_blind/index.html">this presentation paper on colourblindness</a> while trying to be a back seat designer as the actual designer in the office chooses colours for buttons.</p>
<p>An amusing statistic from the paper is that 8% of caucasians have difficulty distinguishing between red and green.  From the perspective of a web designer, it&#8217;s more worthwhile designing for their needs than the entire macintosh user base (even after accounting for the 8% of red/green colourblind mac users).</p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=128&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/colourblind/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web 2.0 phones home</title>
		<link>http://www.achingbrain.net/alex/web-20-phones-home</link>
		<comments>http://www.achingbrain.net/alex/web-20-phones-home#comments</comments>
		<pubDate>Thu, 24 Aug 2006 16:06:54 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://wordpress/blog/alex/web-20-phones-home</guid>
		<description><![CDATA[Just picked up a Sony Ericsson K800i. It&#8217;s a bona fide Web 2.0 (tm) telephone complete with rounded corners, drop shadows, an RSS reader and photo blogging tools. I briefly had this phone on a contract with 3, but their network is so restrictive that I had to send it back &#8211; for example, you [...]]]></description>
			<content:encoded><![CDATA[<p>Just picked up a <a href="http://www.reghardware.co.uk/2006/08/03/review_sonyericsson_cyber-shot_k800i/">Sony Ericsson K800i</a>.  It&#8217;s a bona fide Web 2.0 (<a href="http://news.com.com/2061-11199_3-6077295.html?part=rss&amp;tag=6077295&amp;subj=news">tm</a>) telephone complete with rounded corners, drop shadows, an RSS reader and <a href="http://achingbrain.blogspot.com">photo blogging tools</a>.</p>
<p>I briefly had this phone on a contract with <a href="http://www.three.co.uk">3</a>, but their network is so restrictive that I had to send it back &#8211; for example, you can&#8217;t access any websites that haven&#8217;t been &#8220;specially formatted for 3 Mobiles&#8221; (e.g. vetted to make sure they aren&#8217;t selling any mobile content) and you can&#8217;t use the built in email client unless you a) pay through the nose and b) have some huge pre-specified smart phone.  No thanks.</p>
<p>Then I noticed that <a href="http://www.t-mobile.co.uk">T-Mobile</a> are currently being foolish enough to offer unlimited (okay, 2GB) mobile Internet access for a mere seven pounds fifty a month, even with 3G phones.  Bwahaha.  I will show them the error of their ways.</p>
<p>Now all I need to do is actually <i>call</i> someone with it.</p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=127&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/web-20-phones-home/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Time machine</title>
		<link>http://www.achingbrain.net/alex/time-machine</link>
		<comments>http://www.achingbrain.net/alex/time-machine#comments</comments>
		<pubDate>Tue, 08 Aug 2006 07:40:02 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://wordpress/blog/alex/time-machine</guid>
		<description><![CDATA[Is it just me, or does anyone else think that the Time Machine UI is just a tad excessive? It&#8217;s a neat idea though, sort of like having a single user Subversion repository for your whole computer.]]></description>
			<content:encoded><![CDATA[<p>Is it just me, or does anyone else think that the <a href="http://www.apple.com/macosx/leopard/timemachine.html">Time Machine</a> UI is just a tad excessive?</p>
<p>It&#8217;s a neat idea though, sort of like having a single user Subversion repository for your whole computer.</p>
<img src="http://www.achingbrain.net/?ak_action=api_record_view&id=125&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.achingbrain.net/alex/time-machine/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

