<?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>Phil Bayfield &#187; Software Development</title>
	<atom:link href="http://www.philbayfield.com/category/dev/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.philbayfield.com</link>
	<description>A little about me, my photos and some general geeky stuff!</description>
	<lastBuildDate>Wed, 02 Nov 2011 01:59:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>New features in PHP 5.4</title>
		<link>http://www.philbayfield.com/2011/11/02/new-features-in-php-5-4/</link>
		<comments>http://www.philbayfield.com/2011/11/02/new-features-in-php-5-4/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 01:59:36 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.philbayfield.com/?p=585</guid>
		<description><![CDATA[The next iteration of 5.4 looks like it&#8217;s more focused on cleaning up the language than features. It appears many of the previously deprecated functions are now, as promised, removed completely. As this article is about features, here is a quick summary of the other changes: Removed: break/continue $var syntax Removed: register_globals, allow_call_time_pass_reference, and register_long_arrays [...]]]></description>
			<content:encoded><![CDATA[<p>The next iteration of 5.4 looks like it&#8217;s more focused on cleaning up the language than features.</p>
<p>It appears many of the previously deprecated functions are now, as promised, removed completely. As this article is about features, here is a quick summary of the other changes:</p>
<ul>
<li>Removed: break/continue $var syntax</li>
<li>Removed: register_globals, allow_call_time_pass_reference, and register_long_arrays ini options</li>
<li>Removed: session_is_registered(), session_registered(), and session_unregister()</li>
</ul>
<p>This information is based on alpha/beta releases and is subject to change.</p>
<p>Onwards to the new features&#8230;</p>
<p><strong>Traits support</strong></p>
<p>PHP 5.4 includes traits which allow reusable groups of methods to be used from any class.</p>
<p>Here is an example:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">trait someMethods<br />
<span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> doSomething<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> doSomethingElse<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></div>
<p>We can then use the above trait in an class using the use statement:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">class</span> someClass <span style="color: #000000; font-weight: bold;">extends</span> someParent<br />
<span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">use</span> someMethods<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> doSomethingLocaly<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></div>
<p>More information about traits can be found in the manual: <div style="float: left; text-align: center">
			    <a href="http://php.net/manual/en/language.oop5.traits.php" target="_blank"><img src="http://simple.thumbshots.com/image.aspx?cid=1508&v=1&w=200&h=150&url=http://php.net/manual/en/language.oop5.traits.php" /></a><br /><a href="http://php.net/manual/en/language.oop5.traits.php" target="_blank">http://php.net/manual/en/language.oop...</a></div><br style="clear: both" /></p>
<p><strong>Array dereferencing</strong></p>
<p>As PHP has had object dereferencing for ages, this is something that is really long overdue and addresses the inconsistency between object and array return values.</p>
<p>A quick/common example of the existing object dereferencing:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">class</span> someClass<br />
<span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$_someVar</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$_someOtherVar</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setSomeVar<span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_someVar <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setSomeOtherVar<span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_someOtherVar <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> someClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$class</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setSomeVar</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setSomeOtherVar</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>Now we can do the same with arrays, without the current need to assign the array return value to a variable before we can access it&#8217;s contents:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">class</span> someOtherClass<br />
<span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getArray<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> someOtherClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$third</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$class</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getArray</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></div></div>
<p>This is a rather pointless example, but demonstrates the new functionality.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.philbayfield.com%2F2011%2F11%2F02%2Fnew-features-in-php-5-4%2F&amp;title=New%20features%20in%20PHP%205.4" id="wpa2a_2"><img src="http://www.philbayfield.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.philbayfield.com/2011/11/02/new-features-in-php-5-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing sqlite on a rooted Android phone.</title>
		<link>http://www.philbayfield.com/2011/04/08/installing-sqlite-on-a-rooted-android-phone/</link>
		<comments>http://www.philbayfield.com/2011/04/08/installing-sqlite-on-a-rooted-android-phone/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 10:16:23 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.philbayfield.com/?p=575</guid>
		<description><![CDATA[Many rooting tools install the sqlite3 binary by default, but the pre-rooted rom on my SGS seems to be an exception, so here is a guide to install it manually. You will need the SDK tools on your computer for this to work! Connect the phone, bring up a shell and get root permissions: $ [...]]]></description>
			<content:encoded><![CDATA[<p>Many rooting tools install the sqlite3 binary by default, but the pre-rooted rom on my SGS seems to be an exception, so here is a guide to install it manually.</p>
<p><strong>You will need the SDK tools on your computer for this to work!</strong></p>
<p>Connect the phone, bring up a shell and get root permissions:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ adb shell<br />
/ $ su<br />
#</div></div>
<p>Find the device for the system partition:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># mount &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
rootfs / rootfs ro,relatime 0 0<br />
proc /proc proc rw,relatime 0 0<br />
sys /sys sysfs rw,relatime 0 0<br />
/dev/block/stl11 /cache ext4 rw,noatime,barrier=0,data=writeback,noauto_da_alloc 0 0<br />
/dev/block/stl10 /dbdata ext4 rw,noatime,barrier=0,nodelalloc,data=ordered,noauto_da_alloc 0 0<br />
/dev/block/mmcblk0p2 /data ext4 rw,noatime,barrier=1,data=ordered,noauto_da_alloc 0 0<br />
tmpfs /dev tmpfs rw,relatime,mode=755 0 0<br />
devpts /dev/pts devpts rw,relatime,mode=600 0 0<br />
none /acct cgroup rw,relatime,cpuacct 0 0<br />
/dev/block/stl6 /mnt/.lfs j4fs rw,relatime 0 0<br />
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0<br />
none /dev/cpuctl cgroup rw,relatime,cpu 0 0<br />
/dev/block/stl9 /system rfs ro,relatime,vfat,log_off,check=no,gid/uid/rwx,iocharset=utf8 0 0<br />
/dev/block/stl3 /efs rfs rw,nosuid,nodev,relatime,vfat,llw,check=no,gid/uid/rwx,iocharset=utf8 0 0<br />
/dev/block/vold/179:1 /mnt/sdcard vfat rw,dirsync,nosuid,nodev,noexec,noatime,nodiratime,uid=1000,gid=1015,fmask=0002,dmask=0002,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0<br />
/dev/block/vold/179:9 /mnt/sdcard/external_sd vfat rw,dirsync,nosuid,nodev,noexec,noatime,nodiratime,uid=1000,gid=1015,fmask=0002,dmask=0002,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0<br />
/dev/block/vold/179:9 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,noatime,nodiratime,uid=1000,gid=1015,fmask=0002,dmask=0002,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0<br />
tmpfs /mnt/sdcard/external_sd/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0</div></div>
<p>The important bit here is <strong>/dev/block/stl9 /system rfs</strong> which is needed for the next step.</p>
<p>Remount the file system rw (replace rfs and /dev/block/stl9 with the values from the output of mount):</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># mount -o remount,rw -t rfs /dev/block/stl9 /system</div></div>
<p>Next, in a separate terminal copy the sqlite3 binary to the phone (can be obtained from the Super One Click package http://www.shortfuse.org/):</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ adb push sqlite3 /sdcard/<br />
42 KB/s (24120 bytes in 0.557s)</div></div>
<p>Back in the original terminal, move the binary to /system/bin and set permissions:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># cp /sdcard/sqlite3 /system/bin<br />
# chmod 4755 /system/bin/sqlite3</div></div>
<p>Finally, remount the /system filesystem read only again:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># mount -o remount,ro -t rfs /dev/block/stl9 /system</div></div>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.philbayfield.com%2F2011%2F04%2F08%2Finstalling-sqlite-on-a-rooted-android-phone%2F&amp;title=Installing%20sqlite%20on%20a%20rooted%20Android%20phone." id="wpa2a_4"><img src="http://www.philbayfield.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.philbayfield.com/2011/04/08/installing-sqlite-on-a-rooted-android-phone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The most awesomest design pattern, ever to exist and that ever will exist!</title>
		<link>http://www.philbayfield.com/2011/01/28/the-most-awesomest-design-pattern-ever-to-exist-and-that-ever-will-exist/</link>
		<comments>http://www.philbayfield.com/2011/01/28/the-most-awesomest-design-pattern-ever-to-exist-and-that-ever-will-exist/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 09:24:32 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.philbayfield.com/?p=565</guid>
		<description><![CDATA[At my current day job, someone came up with this design pattern and has implemented it in almost every class throughout the entire application, there are probably close to 100 implementations of this &#8220;pattern&#8221;. I had to post it because it&#8217;s just so awesome! Firstly let&#8217;s late a look at the traditional factory method, it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>At my current day job, someone came up with this design pattern and has implemented it in almost every class throughout the entire application, there are probably close to 100 implementations of this &#8220;pattern&#8221;. I had to post it because it&#8217;s just so awesome!</p>
<p>Firstly let&#8217;s late a look at the traditional factory method, it&#8217;s usually a static method that instantiates 1 or more objects and returns you the object.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">class</span> MyClass<br />
<span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> factory<span style="color: #009900;">&#40;</span><span style="color: #000088;">$some</span><span style="color: #339933;">,</span> <span style="color: #000088;">$params</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$it</span> <span style="color: #339933;">=</span> create_some_object<span style="color: #009900;">&#40;</span><span style="color: #000088;">$some</span><span style="color: #339933;">,</span> <span style="color: #000088;">$params</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$it</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Simple and effective.</p>
<p>Behold! The tri-class factory method, 3 times more awesome than the normal factory method!</p>
<p>Firstly create your class as normal:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">class</span> MyClass<br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #339933;">...</span>code<span style="color: #339933;">...</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Then create a factory class, (you&#8217;re thinking, &#8220;what???&#8221;, but don&#8217;t think, just do):</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">class</span> MyClassFactory<br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000088;">$factory</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #339933;">...</span>static methods<span style="color: #339933;">...</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Note, some very important features, you must have the public static $factory variable, and it must be initialised to null, despite this being the default behaviour of PHP. The methods also follow a very important structure too, but we&#8217;ll get to this in a moment.</p>
<p>Finally, the 3rd and final class, the &#8220;Factory Impl&#8221; class:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">class</span> MyClassFactoryImpl<br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #339933;">...</span>non<span style="color: #339933;">-</span>static methods<span style="color: #339933;">...</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Then to put everything together we need to assign an instance of &#8220;Factory Impl&#8221; to the static $factory variable in the Factory class, this should be down outside of all the object structures, for added coolness:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">MyClassFactory<span style="color: #339933;">::</span><span style="color: #000088;">$factory</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MyClassFactoryImpl<span style="color: #339933;">;</span></div></div>
<p>Confused? You should be. But this is just the start of the awesomeness.</p>
<p>Next, you need to implement the factory methods, they should be implemented as normal public methods in the &#8220;Factory Impl&#8221; class, e.g.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getById<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> object<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>For each method you create, you also need a static function to call this method in the factory class:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> getById<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #000088;">$factory</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getById</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Repeat for all your factory methods, and you&#8217;re done!</p>
<p>I would recommend that to make it as helpful as possible for other developers, make sure you put everything in one file and try and call the file something different from any of the class names you&#8217;ve used, this will ensure that they will probably have to use a require_once each time they use it as it&#8217;ll confuse most autoloaders.</p>
<p>You should end up with something like this:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">class</span> MyClass<br />
<span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> someMethod<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> someOtherMethod<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">class</span> MyClassFactoryImpl<br />
<span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getEmpty<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> MyClass<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getById<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> MyClass<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">class</span> MyClassFactory<br />
<span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000088;">$factory</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> getEmpty<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #000088;">$factory</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getEmpty</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> getById<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #000088;">$factory</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getById</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span><br />
<br />
MyClassFactory<span style="color: #339933;">::</span><span style="color: #000088;">$factory</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MyClassFactoryImpl<span style="color: #339933;">;</span></div></div>
<p>There is no denying the awesomeness of this pattern, 3 times more objects, 3 times more memory, 3 times bigger stack, 10 times more code, god knows how many times more inefficient, but infinitely more fun! <img src='http://www.philbayfield.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Next week, stay tuned for the &#8220;super god&#8221; class!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.philbayfield.com%2F2011%2F01%2F28%2Fthe-most-awesomest-design-pattern-ever-to-exist-and-that-ever-will-exist%2F&amp;title=The%20most%20awesomest%20design%20pattern%2C%20ever%20to%20exist%20and%20that%20ever%20will%20exist%21" id="wpa2a_6"><img src="http://www.philbayfield.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.philbayfield.com/2011/01/28/the-most-awesomest-design-pattern-ever-to-exist-and-that-ever-will-exist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web server benchmark PHP &#8211; Apache vs Nginx vs Lighttpd</title>
		<link>http://www.philbayfield.com/2010/10/02/web-server-benchmark-php-apache-vs-nginx-vs-lighttpd/</link>
		<comments>http://www.philbayfield.com/2010/10/02/web-server-benchmark-php-apache-vs-nginx-vs-lighttpd/#comments</comments>
		<pubDate>Sat, 02 Oct 2010 15:52:01 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Servers]]></category>

		<guid isPermaLink="false">http://www.philbayfield.com/?p=519</guid>
		<description><![CDATA[This is a quick benchmark of the 3 major *nix web servers, to see which gives the best performance. Test system: Hardware: vps247 cloud VPS node, 512Mb ram. Software: Ubuntu 10.10 RC (kernel 2.6.35-22), Apache 2.2.16 (mod_php), Nginx 0.7.67 (php-fpm), Lighttpd 1.4.26 (php-cgi), PHP 5.3.3 with Xcache. Site: LiteMVC 0.1 Hello World. Test process: Using [...]]]></description>
			<content:encoded><![CDATA[<p>This is a quick benchmark of the 3 major *nix web servers, to see which gives the best performance.</p>
<p><strong>Test system:</strong></p>
<p>Hardware: vps247 cloud VPS node, 512Mb ram.<br />
Software: Ubuntu 10.10 RC (kernel 2.6.35-22), Apache 2.2.16 (mod_php), Nginx 0.7.67 (php-fpm), Lighttpd 1.4.26 (php-cgi), PHP 5.3.3 with Xcache.<br />
Site: LiteMVC 0.1 Hello World.</p>
<p><strong>Test process:</strong></p>
<p>Using ab with 10,000 requests, 10 concurrent requests.<br />
Monitoring load/memory usage with htop.<br />
All web servers with default configuration, 1 site enabled.<br />
All tests were repeated 3 times.</p>
<p><strong>Apache 2.2.16:</strong></p>
<table>
<tr>
<th>Test 1</th>
<th>Test 2</th>
<th>Test 3</th>
</tr>
<tr>
<td>Load at start: 0.03<br />
Memory usage at start: 130 Mb<br />
Load average max: 15.88<br />
Memory usage max: 290 Mb<br />
Requests per second: 400.04<br />
Time per request: 2.5 ms<br />
Longest request: 806 ms</td>
<td>Load at start: 0.07<br />
Memory usage at start: 130 Mb<br />
Load average max: 21.73<br />
Memory usage max: 332 Mb<br />
Requests per second: 395.49<br />
Time per request: 2.529 ms<br />
Longest request: 728 ms</td>
<td>Load at start: 0.06<br />
Memory usage at start: 121 Mb<br />
Load average max: 20.95<br />
Memory usage max: 253 Mb<br />
Requests per second: 385.82<br />
Time per request: 2.592 ms<br />
Longest request: 937 ms</td>
</tr>
</table>
<p><strong>Nginx 0.7.67:</strong></p>
<table>
<tr>
<th>Test 1</th>
<th>Test 2</th>
<th>Test 3</th>
</tr>
<tr>
<td>Load at start: 0.05<br />
Memory usage at start: 129 Mb<br />
Load average max: 0.77<br />
Memory usage max: 157 Mb<br />
Requests per second: 413.40<br />
Time per request: 2.419 ms<br />
Longest request: 239 ms</td>
<td>Load at start: 0.05<br />
Memory usage at start: 152 Mb<br />
Load average max: 0.93<br />
Memory usage max: 169 Mb<br />
Requests per second: 409.15<br />
Time per request: 2.444 ms<br />
Longest request: 232 ms</td>
<td>Load at start: 0.00<br />
Memory usage at start: 163 Mb<br />
Load average max: 0.61<br />
Memory usage max: 169 Mb<br />
Requests per second: 415.28<br />
Time per request: 2.408 ms<br />
Longest request: 250 ms</td>
</tr>
</table>
<p><strong>Lighttpd 1.4.26:</strong></p>
<table>
<tr>
<th>Test 1</th>
<th>Test 2</th>
<th>Test 3</th>
</tr>
<tr>
<td>Load at start: 0.00<br />
Memory usage at start: 115 Mb<br />
Load average max: 0.81<br />
Memory usage max: 139 Mb<br />
Requests per second: 427.92<br />
Time per request: 2.337 ms<br />
Longest request: 120 ms</td>
<td>Load at start: 0.09<br />
Memory usage at start: 136 Mb<br />
Load average max: 0.73<br />
Memory usage max: 143 Mb<br />
Requests per second: 447.10<br />
Time per request: 2.237 ms<br />
Longest request: 111 ms</td>
<td>Load at start: 0.03<br />
Memory usage at start: 140 Mb<br />
Load average max: 0.69<br />
Memory usage max: 159 Mb<br />
Requests per second: 454.13<br />
Time per request: 2.202 ms<br />
Longest request: 178 ms</td>
</tr>
</table>
<p><strong>Conclusions:</strong></p>
<p>Lighttpd was the fastest overall in this test, however what probably stands out the most is the inefficiency of Apache with both server load and memory usage increasing considerably during the test. The reason for this may be down to Apache spawning additional processes when it is receiving a large volume of requests, which results in the higher memory usage. The memory usage with Nginx and Lighttpd increases by a much smaller amount because each of them runs a fixed number of PHP CGI processes (20 in this case).</p>
<p>Apache is definitely the winner in terms of module support and ease of configuration, but I may have a somewhat biased view as I&#8217;ve worked with Apache for years. Nginx is probably the hardest to setup and configure, however after switching from PHP-CGI to PHP-FPM this made things easier and it does seam there are more configuration examples floating around on the net than for Lighttpd. Lighttpd is notorious for memory leaks, I&#8217;m not sure if this is still an issue with current versions.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.philbayfield.com%2F2010%2F10%2F02%2Fweb-server-benchmark-php-apache-vs-nginx-vs-lighttpd%2F&amp;title=Web%20server%20benchmark%20PHP%20%26%238211%3B%20Apache%20vs%20Nginx%20vs%20Lighttpd" id="wpa2a_8"><img src="http://www.philbayfield.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.philbayfield.com/2010/10/02/web-server-benchmark-php-apache-vs-nginx-vs-lighttpd/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>First Android app completed.</title>
		<link>http://www.philbayfield.com/2010/09/29/first-android-app-completed/</link>
		<comments>http://www.philbayfield.com/2010/09/29/first-android-app-completed/#comments</comments>
		<pubDate>Wed, 29 Sep 2010 19:52:00 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.philbayfield.com/?p=497</guid>
		<description><![CDATA[My first Android app has now been completed and is available on the Android Marketplace, it&#8217;s not going to be any use to anyone who is not using the vps247 cloud service, but for anyone is it&#8217;s a very handy app. Here is quick overview of the features available in the app: 1. Resource viewer, [...]]]></description>
			<content:encoded><![CDATA[<p>My first Android app has now been completed and is available on the Android Marketplace, it&#8217;s not going to be any use to anyone who is not using the vps247 cloud service, but for anyone is it&#8217;s a very handy app.</p>
<p>Here is quick overview of the features available in the app:</p>
<p>1. Resource viewer, displays current memory, disk, IP and bandwidth usage:</p>
<p><a href="http://www.philbayfield.com/wp-content/uploads/2010/09/vps247-Manager-1.png"><img src="http://www.philbayfield.com/wp-content/uploads/2010/09/vps247-Manager-1-192x320.png" alt="" title="vps247 Manager - Resource Usage" width="192" height="320" class="alignleft size-medium wp-image-498" /></a><br />
<br style="clear:both"/></p>
<p>2. Server viewer, displaying all servers and a traffic light to indicate the server status, servers can be tapped to show detailed information and access start/stop controls:</p>
<p><a href="http://www.philbayfield.com/wp-content/uploads/2010/09/vps247-Manager-2.png"><img src="http://www.philbayfield.com/wp-content/uploads/2010/09/vps247-Manager-2-192x320.png" alt="" title="vps247 Manager - Server List" width="192" height="320" class="alignleft size-medium wp-image-501" /></a><a href="http://www.philbayfield.com/wp-content/uploads/2010/09/vps247-Manager-4.png"><img src="http://www.philbayfield.com/wp-content/uploads/2010/09/vps247-Manager-4-192x320.png" alt="" title="vps247 Manager - Server Details" width="192" height="320" class="alignleft size-medium wp-image-505" /></a><br />
<br style="clear:both"/></p>
<p>3. IP address viewer:</p>
<p><a href="http://www.philbayfield.com/wp-content/uploads/2010/09/vps247-Manager-3.png"><img src="http://www.philbayfield.com/wp-content/uploads/2010/09/vps247-Manager-3-192x320.png" alt="" title="vps247 Manager - IP Addresses" width="192" height="320" class="alignleft size-medium wp-image-506" /></a><br />
<br style="clear:both"/></p>
<p>4. Create new servers, which has a nice interface with sliders and drop downs to make it easy to configure a new server. The available resources are used to dynamically generate the creation interface:</p>
<p><a href="http://www.philbayfield.com/wp-content/uploads/2010/09/vps247-Manager-5.png"><img src="http://www.philbayfield.com/wp-content/uploads/2010/09/vps247-Manager-5-192x320.png" alt="" title="vps247 Manager - Create new server" width="192" height="320" class="alignleft size-medium wp-image-509" /></a><a href="http://www.philbayfield.com/wp-content/uploads/2010/09/vps247-Manager-6.png"><img src="http://www.philbayfield.com/wp-content/uploads/2010/09/vps247-Manager-6-192x320.png" alt="" title="vps247 Manager - Create completed" width="192" height="320" class="alignleft size-medium wp-image-510" /></a><a href="http://www.philbayfield.com/wp-content/uploads/2010/09/vps247-Manager-7.png"><img src="http://www.philbayfield.com/wp-content/uploads/2010/09/vps247-Manager-7-192x320.png" alt="" title="vps247 Manager - Server provisioning" width="192" height="320" class="alignleft size-medium wp-image-511" /></a><br />
<br style="clear:both"/></p>
<p>To download the app, just search for &#8216;vps247&#8242; in the Android Marketplace and it should show up!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.philbayfield.com%2F2010%2F09%2F29%2Ffirst-android-app-completed%2F&amp;title=First%20Android%20app%20completed." id="wpa2a_10"><img src="http://www.philbayfield.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.philbayfield.com/2010/09/29/first-android-app-completed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Today is a confusing day for 32 bit PHP</title>
		<link>http://www.philbayfield.com/2010/09/23/today-is-a-confusing-day-for-32-bit-php/</link>
		<comments>http://www.philbayfield.com/2010/09/23/today-is-a-confusing-day-for-32-bit-php/#comments</comments>
		<pubDate>Thu, 23 Sep 2010 10:13:49 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Servers]]></category>

		<guid isPermaLink="false">http://www.philbayfield.com/?p=495</guid>
		<description><![CDATA[As many people probable know, there are some glaring inconsistencies between 32 bit and 64 bit PHP, especially when it comes to large numbers and floats. For some reason, best known to the PHP developers, 32 bit PHP is limited to the maximum signed 32 bit integer size of 2147483647, while 64 bit PHP uses [...]]]></description>
			<content:encoded><![CDATA[<p>As many people probable know, there are some glaring inconsistencies between 32 bit and 64 bit PHP, especially when it comes to large numbers and floats.</p>
<p>For some reason, best known to the PHP developers, 32 bit PHP is limited to the maximum signed 32 bit integer size of 2147483647, while 64 bit PHP uses the 64 bit equivalent of 9223372036854775807. Many languages overcome the 32 bit / 64 bit differences by storing 64 bit ints as 2 32 bit ints to allow the usage of 64 bit integers on 32 bit systems, hence providing complete consistency between the two platforms.</p>
<p>These inconsistencies similarly apply to floating point precession, presumably a float in 32 bit PHP is equivalent to a 32 bit float in C, whereas it appears that in 64 bit PHP it&#8217;s actually a double.</p>
<p>Here is a nice example of the inconsistency, today&#8217;s unix timestamp in float form:</p>
<p>32 bit:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">php &gt; echo (float) 1285200000;<br />
1.2852E+9</div></div>
<p>64 bit:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">php &gt; echo (float) 1285200000;<br />
1285200000</div></div>
<p>This is an important thing to remember with PHP, despite the fact it is a loosely typed language, they behaviour is equivalent to the C behaviour for the particular architecture of your server.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.philbayfield.com%2F2010%2F09%2F23%2Ftoday-is-a-confusing-day-for-32-bit-php%2F&amp;title=Today%20is%20a%20confusing%20day%20for%2032%20bit%20PHP" id="wpa2a_12"><img src="http://www.philbayfield.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.philbayfield.com/2010/09/23/today-is-a-confusing-day-for-32-bit-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First attempt at a (useful) Android app</title>
		<link>http://www.philbayfield.com/2010/09/05/first-attempt-at-an-android-app/</link>
		<comments>http://www.philbayfield.com/2010/09/05/first-attempt-at-an-android-app/#comments</comments>
		<pubDate>Sun, 05 Sep 2010 15:25:28 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.philbayfield.com/?p=482</guid>
		<description><![CDATA[I&#8217;ve had the Android SDK installed for a few months, but down to lack of ideas and time I&#8217;ve not really done anything with it. One of the hosting companies (VPS247) I am using at the moment have just released an iPhone app, as well as an API, they&#8217;re exposing almost the full functionality of [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had the Android SDK installed for a few months, but down to lack of ideas and time I&#8217;ve not really done anything with it.</p>
<p>One of the hosting companies (<a href="http://www.vps247.com" target="_blank">VPS247</a>) I am using at the moment have just released an iPhone app, as well as an API, they&#8217;re exposing almost the full functionality of their cloud hosting admin area via the API which is quite a nice idea. With lack the lack of an Android app I decided to have a go.</p>
<p>So far I&#8217;ve created a &#8216;login&#8217; which just requires the API key of your account:</p>
<p><a href="http://www.philbayfield.com/wp-content/uploads/2010/09/login.png"><img src="http://www.philbayfield.com/wp-content/uploads/2010/09/login.png" alt="" title="VPS247 Monitor Login" width="480" height="800" class="aligncenter size-full wp-image-483" /></a></p>
<p>Once you&#8217;ve entered a valid 40 character API key, the API is then queried twice for your account resource info and details of virtual servers that are currently setup (I&#8217;ve blurred my host names as I don&#8217;t think anyone really needs to know these):</p>
<p><a href="http://www.philbayfield.com/wp-content/uploads/2010/09/info_blurred.png"><img src="http://www.philbayfield.com/wp-content/uploads/2010/09/info_blurred.png" alt="" title="VPS247 Monitor Info" width="480" height="800" class="aligncenter size-full wp-image-484" /></a></p>
<p>Here is the package file if anyone want&#8217;s to give it a try: <a href='http://www.philbayfield.com/wp-content/uploads/2010/09/VPS247Monitor.zip'>VPS247Monitor</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.philbayfield.com%2F2010%2F09%2F05%2Ffirst-attempt-at-an-android-app%2F&amp;title=First%20attempt%20at%20a%20%28useful%29%20Android%20app" id="wpa2a_14"><img src="http://www.philbayfield.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.philbayfield.com/2010/09/05/first-attempt-at-an-android-app/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>GoMySQL 0.2</title>
		<link>http://www.philbayfield.com/2010/05/27/gomysql-0-2/</link>
		<comments>http://www.philbayfield.com/2010/05/27/gomysql-0-2/#comments</comments>
		<pubDate>Thu, 27 May 2010 17:48:30 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Go]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.philbayfield.com/?p=437</guid>
		<description><![CDATA[Today the latest version of GoMySQL is available from the Github repository. This is a beta version and can be obtained by checking out the master branch. This version includes bug fixes and standardisation of function format, it will also include some new features which will be added over the next few days.]]></description>
			<content:encoded><![CDATA[<p>Today the latest version of GoMySQL is available from the <a href="http://github.com/Philio/GoMySQL/">Github repository</a>.</p>
<p>This is a <strong>beta</strong> version and can be obtained by checking out the master branch.</p>
<p>This version includes bug fixes and standardisation of function format, it will also include some new features which will be added over the next few days.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.philbayfield.com%2F2010%2F05%2F27%2Fgomysql-0-2%2F&amp;title=GoMySQL%200.2" id="wpa2a_16"><img src="http://www.philbayfield.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.philbayfield.com/2010/05/27/gomysql-0-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First Go Library</title>
		<link>http://www.philbayfield.com/2010/05/05/first-go-library/</link>
		<comments>http://www.philbayfield.com/2010/05/05/first-go-library/#comments</comments>
		<pubDate>Wed, 05 May 2010 05:55:31 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Go]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.philbayfield.com/?p=423</guid>
		<description><![CDATA[My first library written in the Go programming language, GoMySQL, is now complete and available to download from my projects pages. The library fully implements the MySQL protocol and supports the majority of the common features found in other libraries, including: Single queries Multiple queries Change database Prepared statements There are a number of other [...]]]></description>
			<content:encoded><![CDATA[<p>My first library written in the Go programming language, GoMySQL, is now complete and available to download from my projects pages.</p>
<p>The library fully implements the MySQL protocol and supports the majority of the common features found in other libraries, including:</p>
<ul>
<li>Single queries</li>
<li>Multiple queries</li>
<li>Change database</li>
<li>Prepared statements</li>
</ul>
<p>There are a number of other libraries available for Go, but none of them (as yet) implement the full protocol.</p>
<p>To download visit the <a href="http://www.philbayfield.com/projects/gomysql/">GoMySQL project page</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.philbayfield.com%2F2010%2F05%2F05%2Ffirst-go-library%2F&amp;title=First%20Go%20Library" id="wpa2a_18"><img src="http://www.philbayfield.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.philbayfield.com/2010/05/05/first-go-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress plugin for Thumbshots.org/Thumbshots.com website previews</title>
		<link>http://www.philbayfield.com/2010/02/18/wp-thumbshots-preview/</link>
		<comments>http://www.philbayfield.com/2010/02/18/wp-thumbshots-preview/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 20:09:50 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.philbayfield.com/?p=283</guid>
		<description><![CDATA[I have now published my Thumbshots plugin for WordPress which is available here.]]></description>
			<content:encoded><![CDATA[<p>I have now published my Thumbshots plugin for WordPress which is available <a href="http://www.philbayfield.com/projects/wp-thumbshots-preview/">here</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.philbayfield.com%2F2010%2F02%2F18%2Fwp-thumbshots-preview%2F&amp;title=WordPress%20plugin%20for%20Thumbshots.org%2FThumbshots.com%20website%20previews" id="wpa2a_20"><img src="http://www.philbayfield.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.philbayfield.com/2010/02/18/wp-thumbshots-preview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

