<?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>Easen.co.uk</title>
	<atom:link href="http://www.easen.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.easen.co.uk</link>
	<description>The home of Marc Easen</description>
	<lastBuildDate>Wed, 13 Mar 2013 22:39:33 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Applying some HTTP Varnish</title>
		<link>http://www.easen.co.uk/2013/03/applying-some-http-varnish/</link>
		<comments>http://www.easen.co.uk/2013/03/applying-some-http-varnish/#comments</comments>
		<pubDate>Wed, 13 Mar 2013 22:20:07 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[varnish]]></category>
		<category><![CDATA[VPS]]></category>

		<guid isPermaLink="false">http://www.easen.co.uk/?p=71</guid>
		<description><![CDATA[Recently I have downside my VPS (thanks to www.lowendbox.com - well recommended!). Downsizing has increased the amount of pennies I have in my pocket, but it has also increased the access times by a factor of 5! The access times for this blog have gone from ~40ms to ~200ms. This has led me to play [...]]]></description>
				<content:encoded><![CDATA[<p>Recently I have downside my VPS (thanks to <a href="http://www.lowendbox.com">www.lowendbox.com</a> - well recommended!). Downsizing has increased the amount of pennies I have in my pocket, but it has also increased the access times by a factor of 5! The access times for this blog have gone from ~40ms to ~200ms.</p>
<p>This has led me to play around with <a href="https://www.varnish-cache.org/" target="_blank">Varnish</a>, which has been on my to-do for a while now. With minimum configuration the access times for the front page are now sub 1ms - impressive!</p>
<p><em>(All of these tests have been carried out from my old VPS to avoid any bandwidth related issues with my broadband.)</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.easen.co.uk/2013/03/applying-some-http-varnish/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPad</title>
		<link>http://www.easen.co.uk/2012/03/ipad/</link>
		<comments>http://www.easen.co.uk/2012/03/ipad/#comments</comments>
		<pubDate>Fri, 16 Mar 2012 18:59:51 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[screen]]></category>

		<guid isPermaLink="false">http://www.easen.co.uk/?p=73</guid>
		<description><![CDATA[So it's launch day of the new iPad, and what did I do this morning that's right I've went out and bought one. First impressions, the screen is fantastic - the screen is one the best screens I've ever seen. One of the a cool features is the dictation, so I don't have to type [...]]]></description>
				<content:encoded><![CDATA[<p>So it's launch day of the new iPad, and what did I do this morning that's right I've went out and bought one. First impressions, the screen is fantastic - the screen is one the best screens I've ever seen. </p>
<p><a href="http://www.easen.co.uk/wp-content/uploads/2012/03/20120316-190123.jpg"><img src="http://www.easen.co.uk/wp-content/uploads/2012/03/20120316-190123.jpg" alt="20120316-190123.jpg" class="alignnone size-full" /></a></p>
<p>One of the a cool features is the dictation, so I don't have to type anymore as my iPad will actually convert it back into text. This is in theory, it only seems to work about half the time, the other half I've got to correct it, which is a pain. I guess it will force to me to speak either the queens English or talk like a yank (no offence to any Americans who are reading this of course). </p>
<p>Now I'm just looking for some cool iPad apps, I've found Flipbook, if anyone has many suggestions send them my way</p>
]]></content:encoded>
			<wfw:commentRss>http://www.easen.co.uk/2012/03/ipad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gentoo &#8211; Ecllipse java.lang.UnsatisfiedLinkError: Could not load SWT library</title>
		<link>http://www.easen.co.uk/2012/03/ecllipse-3-7-1-swt/</link>
		<comments>http://www.easen.co.uk/2012/03/ecllipse-3-7-1-swt/#comments</comments>
		<pubDate>Sun, 11 Mar 2012 20:35:58 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[SWT]]></category>

		<guid isPermaLink="false">http://www.easen.co.uk/?p=66</guid>
		<description><![CDATA[Does this error look familiar: java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: no swt-gtk-3738 in java.library.path no swt-gtk in java.library.path Can't load library: /home/marc/.swt/lib/linux/x86_64/libswt-gtk-3738.so Can't load library: /home/marc/.swt/lib/linux/x86_64/libswt-gtk.so The latest version of Eclipse (Version: 3.7.1, Build id: I20110909-1335) requires SWT 3.7.1 and not 3.7.2 that has now been pushed to the Gentoo testing branch. emerge =dev-java/swt-3.7.1 [...]]]></description>
				<content:encoded><![CDATA[<p>Does this error look familiar:</p>
<pre>java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
no swt-gtk-3738 in java.library.path
no swt-gtk in java.library.path
Can't load library: /home/marc/.swt/lib/linux/x86_64/libswt-gtk-3738.so
Can't load library: /home/marc/.swt/lib/linux/x86_64/libswt-gtk.so</pre>
<p>The latest version of Eclipse (Version: 3.7.1, Build id: I20110909-1335) requires SWT 3.7.1 and not 3.7.2 that has now been pushed to the Gentoo testing branch.</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-advanced"><div class="bash"><ol><li class="li1"><div class="de1">emerge =dev-java<span class="sy0">/</span>swt-3.7.1</div></li>
</ol></div></div>
<div class="bwp-syntax-source"><pre class="no-parse">emerge =dev-java/swt-3.7.1</pre></div></div>

<p>Will fix the issue, it may as well be worth updating your masks at the same time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.easen.co.uk/2012/03/ecllipse-3-7-1-swt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>My first Arduino sketch &#8211; Playing about with 8 LEDs</title>
		<link>http://www.easen.co.uk/2011/12/my-first-arduino-sketch-playing-about-with-8-leds/</link>
		<comments>http://www.easen.co.uk/2011/12/my-first-arduino-sketch-playing-about-with-8-leds/#comments</comments>
		<pubDate>Wed, 28 Dec 2011 23:06:10 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.easen.co.uk/?p=60</guid>
		<description><![CDATA[Well it's about time I've got back into electronics, I've spent a bit too long writing software and just ignoring how the underlying technology works. Here's my first Arduino sketch, pretty simple really. It switches on 8 LEDs in a simple counting pattern Were 'X' is a solid LED and the numbers represent the other [...]]]></description>
				<content:encoded><![CDATA[<p>Well it's about time I've got back into electronics, I've spent a bit too long writing software and just ignoring how the underlying technology works. Here's my first Arduino sketch, pretty simple really. It switches on 8 LEDs in a simple counting pattern</p>
<p>Were 'X' is a solid LED and the numbers represent the other LEDs being turned on after a given delay (1  second divided by the remaining LEDs).</p>
<p>&nbsp;</p>
<p>(1) (2) (3) (4) (5) (6) (7) (8)</p>
<p>(x) (1) (2) (3) (4) (5) (6) (7)</p>
<p>(x) (x) (1) (2) (3) (4) (5) (6)</p>
<p>...</p>
<p>(x) (x) (x) (x) (x) (x) (x) (x)</p>
<p>&nbsp;</p>
<p>Code:</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar" style="right: 15px;" ><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-advanced"style=" height: 252px;"><div class="c"><ol><li class="li1"><div class="de1"><span class="kw4">int</span> ledPins<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span><span class="nu0">2</span><span class="sy0">,</span><span class="nu0">3</span><span class="sy0">,</span><span class="nu0">4</span><span class="sy0">,</span><span class="nu0">5</span><span class="sy0">,</span><span class="nu0">6</span><span class="sy0">,</span><span class="nu0">7</span><span class="sy0">,</span><span class="nu0">8</span><span class="sy0">,</span><span class="nu0">9</span><span class="br0">&#125;</span><span class="sy0">;</span> </div></li>
<li class="li2"><div class="de2"><span class="kw4">int</span> numberOfLeds <span class="sy0">=</span> <span class="nu0">8</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li2"><div class="de2"><span class="kw4">void</span> setup<span class="br0">&#40;</span><span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li2"><div class="de2">&nbsp; <span class="kw1">for</span><span class="br0">&#40;</span><span class="kw4">int</span> i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> i <span class="sy0">&lt;</span> <span class="nu0">8</span><span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; pinMode<span class="br0">&#40;</span>ledPins<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="sy0">,</span> OUTPUT<span class="br0">&#41;</span><span class="sy0">;</span> </div></li>
<li class="li2"><div class="de2">&nbsp; <span class="br0">&#125;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li2"><div class="de2">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw4">void</span> loop<span class="br0">&#40;</span><span class="br0">&#41;</span></div></li>
<li class="li2"><div class="de2"><span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw4">int</span> i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> i <span class="sy0">&lt;</span> <span class="nu0">8</span><span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li2"><div class="de2">&nbsp; &nbsp; countLeds<span class="br0">&#40;</span>i<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; <span class="br0">&#125;</span></div></li>
<li class="li2"><div class="de2"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li2"><div class="de2"><span class="kw4">void</span> countLeds<span class="br0">&#40;</span><span class="kw4">int</span> starting<span class="br0">&#41;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#123;</span></div></li>
<li class="li2"><div class="de2">&nbsp; <span class="co1">// Switch them off</span></div></li>
<li class="li1"><div class="de1">&nbsp; <span class="kw1">for</span><span class="br0">&#40;</span><span class="kw4">int</span> i <span class="sy0">=</span> starting<span class="sy0">;</span> i <span class="sy0">&lt;</span> numberOfLeds<span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li2"><div class="de2">&nbsp; &nbsp; digitalWrite<span class="br0">&#40;</span>ledPins<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; <span class="br0">&#125;</span></div></li>
<li class="li2"><div class="de2">&nbsp;</div></li>
<li class="li1"><div class="de1">&nbsp; <span class="co1">// Switch on</span></div></li>
<li class="li2"><div class="de2">&nbsp; <span class="kw1">for</span><span class="br0">&#40;</span><span class="kw4">int</span> i <span class="sy0">=</span> starting<span class="sy0">;</span> i <span class="sy0">&lt;</span> numberOfLeds<span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; digitalWrite<span class="br0">&#40;</span>ledPins<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="sy0">,</span> HIGH<span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li2"><div class="de2">&nbsp; &nbsp; &nbsp; delay<span class="br0">&#40;</span><span class="nu0">1000</span> <span class="sy0">/</span> <span class="br0">&#40;</span>numberOfLeds <span class="sy0">-</span> starting<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; <span class="br0">&#125;</span></div></li>
<li class="li2"><div class="de2"><span class="br0">&#125;</span></div></li>
</ol></div></div>
<div class="bwp-syntax-source"><pre class="no-parse">int ledPins[] = {2,3,4,5,6,7,8,9}; 
int numberOfLeds = 8;

void setup()
{
  for(int i = 0; i &lt; 8; i++){
      pinMode(ledPins[i], OUTPUT); 
  }                                   
}

void loop()
{
  for (int i = 0; i &lt; 8; i++) {
    countLeds(i);
  }
}

void countLeds(int starting)
{
  // Switch them off
  for(int i = starting; i &lt; numberOfLeds; i++) {
    digitalWrite(ledPins[i], LOW);
  }

  // Switch on
  for(int i = starting; i &lt; numberOfLeds; i++) {
      digitalWrite(ledPins[i], HIGH);
      delay(1000 / (numberOfLeds - starting));
  }
}</pre></div></div>

<p>&nbsp;</p>
<p>Nothing special really, but I quite enjoyed getting back to basics. Watch this space for more Arduino hackery.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.easen.co.uk/2011/12/my-first-arduino-sketch-playing-about-with-8-leds/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to restore from a TimeMachine backup that is stored on a NAS</title>
		<link>http://www.easen.co.uk/2011/11/how-to-restore-from-a-timemachine-backup-stored-on-a-nas/</link>
		<comments>http://www.easen.co.uk/2011/11/how-to-restore-from-a-timemachine-backup-stored-on-a-nas/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 22:54:26 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Backup]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.easen.co.uk/?p=45</guid>
		<description><![CDATA[I'm now on my 3rd new MacBook Air (1st suffered creaking noises and the 2nd blew up in a puff of electrical smoke) and having just restored it from a TimeMachine backup, I thought it would be the right time to document how this was done when you're using a NAS running afpd as your backup storage. [...]]]></description>
				<content:encoded><![CDATA[<p>I'm now on my 3rd new MacBook Air (1st suffered creaking noises and the 2nd blew up in a puff of electrical smoke) and having just restored it from a TimeMachine backup, I thought it would be the right time to document how this was done when you're using a NAS running afpd as your backup storage. The NAS in question is a rooted Netgear Stora running a custom build of afpd configured to support OS X Lion login and TimeMachine.</p>
<ol>
<li>Restart and hold down option</li>
<li>Select use Safari and open up this web page and remember the following steps <img src='http://www.easen.co.uk/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </li>
<li>Quit Safari, open up Terminal from the Utilities menu and run</li>
<li>Mount the TimeMachine share

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-advanced"><div class="bash"><ol><li class="li1"><div class="de1"><span class="kw2">mkdir</span> <span class="sy0">/</span>Volumes<span class="sy0">/</span>TimeMachine</div></li>
<li class="li2"><div class="de2">mount_afp aftp:<span class="sy0">//&lt;</span>username<span class="sy0">&gt;</span>:<span class="sy0">&lt;</span>password<span class="sy0">&gt;@&lt;</span>host<span class="sy0">&gt;/</span>TimeMachine <span class="sy0">/</span>Volumes<span class="sy0">/</span>TimeMachine</div></li>
<li class="li1"><div class="de1"><span class="kw2">ls</span> <span class="re5">-l</span> <span class="sy0">/</span>Volumes<span class="sy0">/</span>TimeMachine</div></li>
</ol></div></div>
<div class="bwp-syntax-source"><pre class="no-parse">mkdir /Volumes/TimeMachine
mount_afp aftp://&lt;username&gt;:&lt;password&gt;@&lt;host&gt;/TimeMachine /Volumes/TimeMachine
ls -l /Volumes/TimeMachine</pre></div></div>

</li>
<li>Now run the following to mount the sparsebundle

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-advanced"><div class="bash"><ol><li class="li1"><div class="de1"><span class="kw2">mkdir</span> <span class="sy0">/</span>Volumes<span class="sy0">/</span>Backup</div></li>
<li class="li2"><div class="de2">hdiutil <span class="kw2">mount</span> <span class="re5">-owners</span> on <span class="re5">-mountrandom</span> <span class="sy0">/</span>Volumes<span class="sy0">/</span>Backup <span class="re5">-stdinpass</span> <span class="sy0">/</span>Volumes<span class="sy0">/</span>TimeMachine<span class="sy0">/*</span>.sparsebundle</div></li>
<li class="li1"><div class="de1"><span class="kw2">ls</span> <span class="re5">-l</span> <span class="sy0">/</span>Volumes<span class="sy0">/</span>Backup</div></li>
</ol></div></div>
<div class="bwp-syntax-source"><pre class="no-parse">mkdir /Volumes/Backup
hdiutil mount -owners on -mountrandom /Volumes/Backup -stdinpass /Volumes/TimeMachine/*.sparsebundle
ls -l /Volumes/Backup</pre></div></div>

</li>
<li>Quit Terminal</li>
<li>Select restore and select TimeMachine drive, your TimeMachine backup should be visible</li>
</ol>
<div>After a couple of hours depending on your network, you should be back up and running</div>
]]></content:encoded>
			<wfw:commentRss>http://www.easen.co.uk/2011/11/how-to-restore-from-a-timemachine-backup-stored-on-a-nas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A new addition to the family&#8230;</title>
		<link>http://www.easen.co.uk/2011/11/a-new-addition-to-the-family/</link>
		<comments>http://www.easen.co.uk/2011/11/a-new-addition-to-the-family/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 14:10:33 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[PHP elephpant]]></category>

		<guid isPermaLink="false">http://www.easen.co.uk/2011/11/a-new-addition-to-the-family/</guid>
		<description><![CDATA[Thanks to Zend for sending me an actual Elephpant]]></description>
				<content:encoded><![CDATA[<p>Thanks to Zend for sending me an actual Elephpant </p>
<p><a href="http://www.easen.co.uk/wp-content/uploads/2011/11/20111102-141017.jpg"><img src="http://www.easen.co.uk/wp-content/uploads/2011/11/20111102-141017.jpg" alt="20111102-141017.jpg" class="alignnone size-full" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.easen.co.uk/2011/11/a-new-addition-to-the-family/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Oh WordPress, how you&#8217;ve grown&#8230;</title>
		<link>http://www.easen.co.uk/2011/11/oh-wordpress-how-youve-grown/</link>
		<comments>http://www.easen.co.uk/2011/11/oh-wordpress-how-youve-grown/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 20:02:48 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.easen.co.uk/?p=27</guid>
		<description><![CDATA[Over the past couple of weeks I've been wanting to migrate my website from Django to something more stable and refined. After searching for a while I've come across WordPress and I have got to say it's miles ahead from compared to other blogging CMS web apps and it's written in PHP. Hopefully now I can move [...]]]></description>
				<content:encoded><![CDATA[<p>Over the past couple of weeks I've been wanting to migrate my website from Django to something more stable and refined. After searching for a while I've come across WordPress and I have got to say it's miles ahead from compared to other blogging CMS web apps and it's written in PHP. Hopefully now I can move on and start bloggin' again!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.easen.co.uk/2011/11/oh-wordpress-how-youve-grown/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LAMP on a Mac</title>
		<link>http://www.easen.co.uk/2011/10/lamp-on-a-mac/</link>
		<comments>http://www.easen.co.uk/2011/10/lamp-on-a-mac/#comments</comments>
		<pubDate>Sun, 16 Oct 2011 18:29:38 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[LAMP]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://dev.easen.co.uk/?p=12</guid>
		<description><![CDATA[Recently I’ve been looking at getting back into doing some PHP development outside of work, some R&#38;D and general playing about with new technologies. Something which isn’t possible at where I work, innovation is oddly frown upon, something I blog about later. Anyway back to my home set up, I’ve got a MacBook Air which is main laptop/computer. I [...]]]></description>
				<content:encoded><![CDATA[<p>Recently I’ve been looking at getting back into doing some <strong>PHP</strong> development outside of work, some R&amp;D and general playing about with new technologies. Something which isn’t possible at where I work, innovation is oddly frown upon, something I blog about later. Anyway back to my home set up, I’ve got a<strong> MacBook Air </strong>which is main laptop/computer. I do have a office or sorts but I’ve started to be sat in front the TV more and more,mainly because of my HiFi. My office has kind of turned into a no-mans land at the moment. Anyways I moving off topic here… ahem!</p>
<p>What I used to use was a <strong>VM</strong> copy of my server environment which was preconfigured to be the same as my production environment, this allows me to test my applications before I deploy them in a like-for-like senario. The downside of this on a MBA is the heat is generated, heat from the computations required to run a OS in another OS, not a great solution. If I owned a powerful desktop this would be acceptable but not on portable device which lives on my lap.</p>
<p>Next I tried an app called <strong>MAMP</strong>, an all-in-one out-of-box solution which includes <strong>Apache</strong>, <strong>MySQL</strong> and <strong>PHP</strong>. This is all well and good when you just use these components, but I tend to use <strong>nginx</strong> and <strong>SQLite</strong> now anyways, as they use less resources on my VPS which allows my server to focus more on the meaty part of any PHP application, the <strong>PHP</strong> code itself. At the moment I’m quite interested in the next release of PHP, PHP 5.4 beta 2 which includes it’s <strong>traits</strong> support (if you don’t know what that is go and google it). Using this out-of-box solution is quick but doesn’t include the <strong>PHP</strong> betas, I’ve tried compiling it against the <strong>MAMP</strong> libraries but it’s impossible to compile as the headers aren’t included in the <strong>MAMP</strong> application.</p>
<p>Final and the best solution I have found so far is to kick it old skool, and just compile it all from source using <strong>MacPorts</strong>. Apart from <strong>PHP 5.4 </strong>which you have to configure yourself and build, something I haven’t managed yet – only because I haven’t tried. Hopefully sometime this week I will get able to get a custom port up of PHP 5.4 beta 2 running. If I do I will do post the results of how to do this here first.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.easen.co.uk/2011/10/lamp-on-a-mac/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP &#8211; The Visitor Pattern</title>
		<link>http://www.easen.co.uk/2011/05/php-the-visitor-pattern/</link>
		<comments>http://www.easen.co.uk/2011/05/php-the-visitor-pattern/#comments</comments>
		<pubDate>Tue, 17 May 2011 17:25:48 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[vistor pattern]]></category>

		<guid isPermaLink="false">http://dev.easen.co.uk/?p=6</guid>
		<description><![CDATA[Recently I have come across a wonderful like pattern that I would like to share with you, it's called the Visitor Pattern. If you haven't come across it before it's a object-oriented way of separating your logic/algorithms from your models, therefore allowing your models can do what they do best - store and retrieve data; and your algorithms can focus on [...]]]></description>
				<content:encoded><![CDATA[<p>Recently I have come across a wonderful like pattern that I would like to share with you, it's called the <strong>Visitor Pattern</strong>. If you haven't come across it before it's a object-oriented way of separating your logic/algorithms from your models, therefore allowing your models can do what they do best - store and retrieve data; and your algorithms can focus on being more abstract allowing you to apply to other sets of data in the future.</p>
<p>Where I currently work I'm an Senior Software Engineer in a team which primarily writes PHP code - why? Because it's quick and flexible language which allows us to be reactive to change within the business. Since my first day there we have been focused on using the <strong>MVC</strong> pattern, but with a twist - M<strong>L</strong>VC; the <strong>L</strong> being <strong>Logic</strong>. The purpose being to force you to write your algorithms into a abstract way so other applications/tasks can make use of them. Until recently this was fine... a new application came along (call it App A) and we wrote a new set of models and wrote some logic to populate/manipulate/update/etc. them. The problem came when we want to use these models in another application (App B), the logic we wrote for those models was built with App A in mind, without a few weeks of abstracting, refactoring, testing we wouldn't have been able to make use of these models for App B. This is where the visitor pattern comes in, if we used it from the word go we wouldn't have had such a problem when App B came along. Consider this example...</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-advanced"><div class="php"><ol><li class="li1"><div class="de1"><span class="kw2">class</span> Model_A <span class="br0">&#123;</span></div></li>
<li class="li2"><div class="de2">&nbsp; &nbsp; <span class="kw2">public</span> <span class="re0">$data</span> <span class="sy0">=</span> <span class="kw4">null</span><span class="sy0">;</span> <span class="co1">// Please use accessors, not public vars</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li2"><div class="de2">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw2">class</span> Logic_A <span class="br0">&#123;</span></div></li>
<li class="li2"><div class="de2">&nbsp; &nbsp; <span class="kw2">public</span> static <span class="kw2">function</span> getModelA<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$model</span> <span class="sy0">=</span> <span class="kw2">new</span> Model_A<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li2"><div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$model</span><span class="sy0">-&gt;</span><span class="me1">data</span> <span class="sy0">=</span> DB<span class="sy0">::</span><span class="me2">fetchData</span><span class="br0">&#40;</span><span class="co4">/** Use App A's data source */</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$model</span><span class="sy0">;</span></div></li>
<li class="li2"><div class="de2">&nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li2"><div class="de2">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="re0">$modelA</span> <span class="sy0">=</span> Logic_A<span class="sy0">::</span><span class="me2">getModelA</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
</ol></div></div>
<div class="bwp-syntax-source"><pre class="no-parse">class Model_A {
	public $data = null; // Please use accessors, not public vars
}

class Logic_A {
	public static function getModelA() {
		$model = new Model_A();
		$model-&gt;data = DB::fetchData(/** Use App A's data source */);
		return $model;
	}
}

$modelA = Logic_A::getModelA();</pre></div></div>

<p>There's nothing technically wrong with that (<em>except the public $data, see comment</em>), but if I want to use another data source or I want to expand it to let's say save the data to another data source, like a cache for example, I would expand the Logic_A to do this. What if another application doesn't want to save the model to a cache, or worse, it wants to write the data to a file... expand Logic_A again. Now you should see that's there a problem here, you're putting all of your logic into one class, which has been design to application agnostic and it's going to become <strong>100s</strong>, if not <strong>1000s</strong> of lines code long in no time at all...</p>
<p>Now consider the following instead...</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar" style="right: 15px;" ><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-advanced"style=" height: 252px;"><div class="php"><ol><li class="li1"><div class="de1"><span class="kw2">class</span> Model_A implements Interface_AcceptVisitor <span class="br0">&#123;</span></div></li>
<li class="li2"><div class="de2">&nbsp; &nbsp; <span class="kw2">public</span> <span class="re0">$data</span> <span class="sy0">=</span> <span class="kw4">null</span><span class="sy0">;</span> <span class="co1">// Once again this is bad practise, this is only an example</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li2"><div class="de2">&nbsp; &nbsp; <span class="kw2">public</span> <span class="kw2">function</span> acceptVisitor<span class="br0">&#40;</span>Visitor_Abstract <span class="re0">$visitor</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$visitor</span><span class="sy0">-&gt;</span><span class="me1">visit</span><span class="br0">&#40;</span><span class="re0">$this</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li2"><div class="de2">&nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li2"><div class="de2">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw2">interface</span> Interface_AcceptVisitor <span class="br0">&#123;</span></div></li>
<li class="li2"><div class="de2">&nbsp; &nbsp; <span class="kw2">public</span> <span class="kw2">function</span> acceptVisitor<span class="br0">&#40;</span>Visitor_Abstract <span class="re0">$visitor</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li2"><div class="de2">&nbsp;</div></li>
<li class="li1"><div class="de1">abstract <span class="kw2">class</span> Visitor_Abstract <span class="br0">&#123;</span></div></li>
<li class="li2"><div class="de2">&nbsp; &nbsp; abstract <span class="kw2">public</span> <span class="kw2">function</span> visit<span class="br0">&#40;</span><span class="re0">$instance</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li2"><div class="de2">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="kw2">class</span> Visitor_A <span class="br0">&#123;</span></div></li>
<li class="li2"><div class="de2">&nbsp; &nbsp; <span class="kw2">public</span> <span class="re0">$dataSource</span> <span class="sy0">=</span> <span class="kw4">null</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; <span class="kw2">public</span> <span class="kw2">function</span> visit<span class="br0">&#40;</span><span class="re0">$instance</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li2"><div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span><span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">dataSource</span><span class="br0">&#41;</span> <span class="kw1">return</span><span class="sy0">;</span> <span class="co1">// Visitor requires a data source</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$instance</span><span class="sy0">-&gt;</span><span class="me1">data</span> <span class="sy0">=</span> DB<span class="sy0">::</span><span class="me2">fetchData</span><span class="br0">&#40;</span><span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">dataSource</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li2"><div class="de2">&nbsp; &nbsp; <span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li2"><div class="de2">&nbsp;</div></li>
<li class="li1"><div class="de1"><span class="re0">$loadDataVisitor</span> <span class="sy0">=</span> <span class="kw2">new</span> Visitor_A<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li2"><div class="de2"><span class="re0">$loadDataVisitor</span><span class="sy0">-&gt;</span><span class="me1">dataSource</span> <span class="sy0">=</span> <span class="co4">/** Use App X's data source */</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1">&nbsp;</div></li>
<li class="li2"><div class="de2"><span class="re0">$modelA</span> <span class="sy0">=</span> <span class="kw2">new</span> Model_A<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
<li class="li1"><div class="de1"><span class="re0">$modelA</span><span class="sy0">-&gt;</span><span class="me1">acceptVisitor</span><span class="br0">&#40;</span><span class="re0">$loadDataVisitor</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li>
</ol></div></div>
<div class="bwp-syntax-source"><pre class="no-parse">class Model_A implements Interface_AcceptVisitor {
	public $data = null; // Once again this is bad practise, this is only an example

	public function acceptVisitor(Visitor_Abstract $visitor) {
		$visitor-&gt;visit($this);
	}
}

interface Interface_AcceptVisitor {
	public function acceptVisitor(Visitor_Abstract $visitor);
}

abstract class Visitor_Abstract {
	abstract public function visit($instance);
}

class Visitor_A {
	public $dataSource = null;
	public function visit($instance) {
		if (!$this-&gt;dataSource) return; // Visitor requires a data source
		$instance-&gt;data = DB::fetchData($this-&gt;dataSource);
	}
}

$loadDataVisitor = new Visitor_A();
$loadDataVisitor-&gt;dataSource = /** Use App X's data source */;

$modelA = new Model_A();
$modelA-&gt;acceptVisitor($loadDataVisitor);</pre></div></div>

<p>Well what's different, apart from the use of the visitor pattern, the output is the same, but now I'm able to use another data source and allows the logic and the model to do what they do best. In addition to this, I'm able to re-use this visitor on another model too.</p>
<p>Ok what if I wanted to expand the second example to save the model to a cache then, how would I do that - easy, write another visitor to save the model. What if another application wants to save the data to a file - easy, write another visitor to-do that. Now here's the another nice feature of this pattern, another developer can come along and pick and chose which visitors they want to apply to their models, without getting stuck by reading <strong>1000's</strong> of code to find the one function that does what they want. If a visitor doesn't exist, then they can write a new one, instead of try to hack in some custom logic into monster of a logic class.</p>
<p>From my own point of view this allows me break down really complex logic into manageable algorithms, which I don't have to worry about trying to force into one huge class and at the same time make it abstract enough that someone else can use it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.easen.co.uk/2011/05/php-the-visitor-pattern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gearman &#8211; Distributed processing</title>
		<link>http://www.easen.co.uk/2011/04/hello-world/</link>
		<comments>http://www.easen.co.uk/2011/04/hello-world/#comments</comments>
		<pubDate>Thu, 28 Apr 2011 20:55:55 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Gearman]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gearman]]></category>
		<category><![CDATA[MOM]]></category>
		<category><![CDATA[scaling]]></category>

		<guid isPermaLink="false">http://dev.easen.co.uk/?p=1</guid>
		<description><![CDATA[How do you scale a web site/application? Or any application for that matter? Well you can bury you head in the sand and throw more hardware resources to the problem (faster hardware, more memory, etc.) ... or make it horizontally scalable of course! I'm really hate using this phrase but it is technically correct ... "to the cloud" (sorry Chris). What [...]]]></description>
				<content:encoded><![CDATA[<div>
<p>How do you <strong>scale</strong> a web site/application? Or any application for that matter? Well you can bury you head in the sand and throw more hardware resources to the problem (faster hardware, more memory, etc.) ... or make it <strong>horizontally scalable</strong> of course!</p>
<p>I'm really hate using this phrase but it is technically correct ... <em>"to the cloud" (sorry Chris)</em>. What I hate about it the most is the fact that people in marketing (<em>Microsoft's latest advert campaign</em>) tend to use it without actually knowing what the cloud is. <strong>Cloud</strong> computing is just a fancy word someone coined for the <strong>Internet</strong> - the Internet being a vast collection of servers. That's what I mean when I say <strong>horizontally scalable</strong>, use a collection of servers to do your work for you and not one really powerful machine.</p>
<p>Now let's get a bit technical. The popular way of distributing your work I know is to use a<strong> Message-Oriented Middleware</strong>, where messages are passed between two or more processors via a message broker. The brokers job is to accept incoming messages, save them to a queue and then dispatch them to an available process. This all well and good, but in my experience the broker can become the <strong>single point of failure</strong>, unless you use a cluster of them. MOM's tend to be quite CPU and memory intensive, meaning it has to live on it's own hardware. This is where Gearman comes in...</p>
<p><strong>Gearman</strong>...</p>
<p>"...allows you to do work in <strong>parallel</strong>, to load balance processing, and to call functions between languages. It can be used in a variety of applications, from <strong>high-availability </strong>web sites to the transport of database replication events. In other words, it is the <strong>nervous system</strong> for how <strong>distributed</strong> processing communicates." (<a href="http://gearman.org/">http://gearman.org/</a>).</p>
<p>The main difference for me is the fact you can have multiple <strong>Gearman</strong> job servers running on your platform, compared a MOM platform where you have one message broker being your have a single point of failure - meaning less headaches for everyone.</p>
<p>One way I see it adding benefit a <strong>scalable</strong> project if is to configure your boxes which are going to processing work a single Gearman job server and have all the workers on that box pointing to that server. Next load balance these boxes via virtual IP (<strong>VIP</strong>). Now all you do is send your jobs to this VIP which will be sent a job server and then be picked up by one of the workers. To scale your application add more boxes to your little Gearman <strong>cluster</strong>. This solution not only scales your throughput, it also scales the application which is handling your jobs. Another difference which is quite interesting, you can run processes in <strong>parallel</strong> and wait for them to completed before continuing, e.g. computing basic statistics for group of users and then combining the results (see <strong><a href="http://en.wikipedia.org/wiki/MapReduce">MapReduce</a></strong>).</p>
<p>Gearman is still quite young and still in <strong>beta</strong> so expect the somethings to change as it develops and <strong>matures</strong>. Saying that it's currently being used by some really large websites - <a href="http://wanderr.com/jay/how-grooveshark-uses-gearman/2011/03/27/">Grooveshark</a>, Yahoo and Digg. As <strong>Gearman</strong> is written by the same people who write and maintain <strong>Memcache</strong>, I'm expecting it to stay around for quite a while.</p>
<p>&nbsp;</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.easen.co.uk/2011/04/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 3/11 queries in 0.004 seconds using memcached
Object Caching 784/813 objects using memcached

 Served from: _ @ 2013-05-24 07:54:37 by W3 Total Cache -->