<?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>Jamie Hurst - Web Developer</title>
	<atom:link href="http://www.jamiehurst.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jamiehurst.co.uk</link>
	<description>Specialising in PHP, MySQL, Zend Framework, HTML, CSS, Javascript, jQuery and more!</description>
	<lastBuildDate>Sun, 23 Jan 2011 14:47:26 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Migrating from Mercurial to Git, and Why</title>
		<link>http://www.jamiehurst.co.uk/migrating-mercurial-git/</link>
		<comments>http://www.jamiehurst.co.uk/migrating-mercurial-git/#comments</comments>
		<pubDate>Sun, 23 Jan 2011 14:47:26 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[bitbucket]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[features]]></category>
		<category><![CDATA[fluxbox]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[hg]]></category>
		<category><![CDATA[issues]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[mercurial]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[source control]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[support]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[tcl/tk]]></category>
		<category><![CDATA[tower]]></category>
		<category><![CDATA[version control]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[wikis]]></category>

		<guid isPermaLink="false">http://www.jamiehurst.co.uk/?p=267</guid>
		<description><![CDATA[Mercurial has been my version and source control system of choice for some time. I migrated from using Subversion after using it for a project a long time ago with a couple of collaborators, and working with a distributed source made development a lot easier when we were all working on it at the same [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://mercurial.selenic.com/" target="_blank"><img class="alignleft size-thumbnail wp-image-191" title="Mercurial Logo" src="http://www.jamiehurst.co.uk/wp-content/uploads/mercurial-logo-125x150.png" alt="Migrating from Mercurial to Git, and Why" width="125" height="150" /></a><a href="http://mercurial.selenic.com" target="_blank">Mercurial</a> has been my version and source control system of choice for some time. I migrated from using <a href="http://subversion.apache.org" target="_blank">Subversion</a> after using it for a project a long time ago with a couple of collaborators, and working with a distributed source made development a lot easier when we were all working on it at the same time from varying different sources. It&#8217;s not too different from Subversion, except for the obvious pushing and pulling from various repositories, and was pretty easy to pick up and get to grips with. Because I&#8217;d been using it for so long, I didn&#8217;t really understand where <a href="http://git-scm.com">Git</a> came from and always assumed it was harder to use and get to grips with than Mercurial, so I avoided it completely.</p>
<h3>Self-Hosted Repositories</h3>
<p>One of the benefits of Mercurial, so I thought, was that it was easy to get self-hosted repositories up and running, and I&#8217;d been privately hosting repositories on my VPS for some time, since I used to host Subversion ones on there too, I assumed this was something that was what everyone did. I had about 10 private repos stored on my server and developed on each one of them on-and-off on various machines, so having the central repository and multiple local clones meant even if I forgot to push from one machine, I could still get on with some development. What I didn&#8217;t realise I was missing out on was all the project management tools I really needed, such as issue tracking, wiki entries, commit tracking and so on. This is when I started looking for an alternative solution&#8230;</p>
<h3>Using Bitbucket</h3>
<p><a href="http://bitbucket.org/" target="_blank"><img class="alignright size-thumbnail wp-image-270" title="Bitbucket (by Atlassian)" src="http://www.jamiehurst.co.uk/wp-content/uploads/bitbucket-logo-150x75.png" alt="Migrating from Mercurial to Git, and Why" width="150" height="75" /></a>This is when I found <a href="http://bitbucket.org/" target="_blank">Bitbucket</a>, a project hosting service provided by <a href="http://www.atlassian.com" target="_blank">Atlassian</a>, that ran using Mercurial as it&#8217;s source control. This was the perfect setup, being able to manage my projects online using their tools, and delegating the responsibility of my repositories to a third-party service. Better yet, by this point, Bitbucket was completely free for unlimited private repos, so it really was the best choice. It gave me easily editable wikis, issue tracking, basically everything I needed.</p>
<h3>Problems</h3>
<p>Or so I thought. I did wonder if, by being a free service, Bitbucket&#8217;s support and stability was going to be lacking a little bit, since I knew it used to be a private service that charged. Turns out my fears were not completely unfounded. When trying to migrate all of my repositories over by creating new repositories on Bitbucket, something that should&#8217;ve taken a few seconds took a few hours. Of course, a support email later and a 24 hour wait and the problem was completely rectified, but I was a bit worried that I&#8217;d had to wait 24 hours, and that the problem happened in the first place, especially since the support staff quoted that &#8220;this happens sometimes, we just need to create them manually&#8221;. Dismissing a problem so casually tends not to be in my nature, so I tweeted in case anyone had any suggestions&#8230;</p>
<h3>Migrating to Git</h3>
<p><a href="http://git-scm.com" target="_blank"><img class="alignleft size-thumbnail wp-image-271" title="git" src="http://www.jamiehurst.co.uk/wp-content/uploads/git-logo-77x150.png" alt="Migrating from Mercurial to Git, and Why" width="77" height="150" /></a>Of course, the first suggestion was moving to Git and trying out <a href="http://github.com" target="_blank">github</a>. I was still a bit sceptical, but decided to give a go anyway, all I had to lose was a couple of hours in trying it out. It turned out there was a wonderful plugin for Mercurial, called hg-git, that would allow Mercurial repos to be pushed to Git servers, meaning I didn&#8217;t even have to lose any of my commits if I moved over! This cheered me up, and by creating a testing a couple of repos I found that Git wasn&#8217;t that hard to use at all, and was pretty much the same as Mercurial, with just a couple of subtle differences. By this time I&#8217;d signed up to github on their smallest paid-for package and started to migrate my most active repositories over, having no trouble at all.</p>
<h3>Using Github</h3>
<p><a href="http://github.com/" target="_blank"><img class="alignright size-thumbnail wp-image-272" title="github" src="http://www.jamiehurst.co.uk/wp-content/uploads/github-logo-150x69.png" alt="Migrating from Mercurial to Git, and Why" width="150" height="69" /></a>I still compare github to Bitbucket, and I apologise for that, because they are completely different services, but it&#8217;s a natural habit. Github has very similar features to Bitbucket, such as wiki entries and issue-tracking, but the subtle differences make life a lot easier. For example, github has labels for issue tracking, which lets you create your own management for these problems, instead of relying on the priorities and constrained problem types like on Bitbucket. It also uses live-loading a lot more often in it&#8217;s interfaces, which means navigating the website is a lot quicker and simpler. I&#8217;ve even started using branches to keep track of changes more conveniently!</p>
<h3>Git GUI Clients</h3>
<p><a href="http://www.git-tower.com/" target="_blank"><img class="alignleft size-full wp-image-273" title="Git Tower" src="http://www.jamiehurst.co.uk/wp-content/uploads/git-tower-logo.jpg" alt="Migrating from Mercurial to Git, and Why" width="120" height="120" /></a>MacHg had been my client of choice for Mercurial for a good while, and I didn&#8217;t fancy venturing back to the command-line for my day-to-day source control, I just can&#8217;t stomach it. So I needed a nice GUI to sit on my Macs for Git too.Git has it&#8217;s own GUI, <a href="http://gitk.sourceforge.net" target="_blank">gitk</a>, which comes with it and runs in <a href="http://www.tcl.tk/" target="_blank">Tcl/Tk</a>. I have never been a fan of Tcl/Tk, it looks like something from 1992, and only seems to fit in on minimal Linux desktops like <a href="http://blackboxwm.sourceforge.net" target="_blank">Blackbox</a> and the like, so I wasn&#8217;t going to put up with that on the Mac. Luckily, I don&#8217;t have to. <a href="http://www.git-tower.com/" target="_blank">Tower</a> is a fantastic free GUI that, despite still being in the beta testing phase, feels very polished and very well thought out. The interface is superb, and the features, such as using Git&#8217;s stashing feature, and staging, link in wonderfully, so I&#8217;ll be happily sticking with it for a good long while. If you use Git with a Mac, I strongly urge you to give it a try, it&#8217;s a beautiful client.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamiehurst.co.uk/migrating-mercurial-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Happy 2011!</title>
		<link>http://www.jamiehurst.co.uk/happy-2011/</link>
		<comments>http://www.jamiehurst.co.uk/happy-2011/#comments</comments>
		<pubDate>Sun, 09 Jan 2011 16:00:15 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[dblib]]></category>
		<category><![CDATA[ford capri]]></category>
		<category><![CDATA[lingscars]]></category>
		<category><![CDATA[monkey boards]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[new year]]></category>
		<category><![CDATA[organisation]]></category>
		<category><![CDATA[projects]]></category>

		<guid isPermaLink="false">http://www.jamiehurst.co.uk/?p=263</guid>
		<description><![CDATA[Firstly, I realise this post is a little bit late. New Year posts generally tend to come out on New Year&#8217;s Day, but as usual, I&#8217;m not one to stick to traditions like that&#8230; This year is going to be a big one, I can feel it. I have a lot of plans for a [...]]]></description>
				<content:encoded><![CDATA[<p>Firstly, I realise this post is a little bit late. New Year posts generally tend to come out on New Year&#8217;s Day, but as usual, I&#8217;m not one to stick to traditions like that&#8230;</p>
<p>This year is going to be a big one, I can feel it. I have a lot of plans for a lot of projects, and think I&#8217;m finally going to be able to enact my plan of organising things for the better a certain company. A big part of the New Year is making sure I keep on top of this blog, and to make sure I keep posting what I consider to be semi-interesting topics (I doubt you&#8217;ll agree).</p>
<p>These are a few of the things I&#8217;m looking forward to this year:</p>
<ul>
<li><strong>LINGsCARS</strong> -<strong> </strong>As ever, I love working at LINGsCARS, and love all the different places it seems to take me to, but I&#8217;m hoping this year is going to be better than ever. We have a lot of plans for various projects, which I&#8217;m looking forward to being able to plan, implement and deliver. I&#8217;ve done a lot of learning in the years I&#8217;ve been in the company, and I&#8217;m hoping it&#8217;s all going to pay off very soon.</li>
<li><strong>DBlib<span style="font-weight: normal;"> -</span></strong> I&#8217;ve been planning a release of this lightweight MySQL-driven database library for quite a while now, but haven&#8217;t devoted as much time to it as I would have liked to. I&#8217;m hoping to add a few more features to make it usable to a wider audience, and get a proper version released very very soon.</li>
<li><strong>Monkey Boards<span style="font-weight: normal;"> &#8211; </span></strong>This is another MASSIVE project that I&#8217;ve put on the sidelines for one too many times&#8230; I&#8217;ll be devoting more time to Monkey Boards to make sure it&#8217;s all cleaned up and ready for a 1.0 release, while still keeping with it&#8217;s small stature and lightweight principles.</li>
<li><strong>And More&#8230;</strong> &#8211; I&#8217;ve also got an idea for a massive project, that might see me branching out on my own a bit more, but I&#8217;m not sure whether the time is right just yet&#8230; It certainly isn&#8217;t the time to reveal it!</li>
</ul>
<p>So I wish you all the best to everything you put your mind to this year, and hope you&#8217;ve got a year as fully-planned and ambitious as mine! I&#8217;ll leave you with a small photo of a toy Ford Capri I got for Christmas, which cheered me up immensely and now has pride of place on my desk <img src='http://www.jamiehurst.co.uk/wp-includes/images/smilies/icon_smile.gif' alt="Happy 2011!" class='wp-smiley' title="Happy 2011! Photo" /> </p>
<p><a href="http://www.jamiehurst.co.uk/wp-content/uploads/capri.jpg"><img class="aligncenter size-medium wp-image-264" title="Ford Capri" src="http://www.jamiehurst.co.uk/wp-content/uploads/capri-400x300.jpg" alt="Happy 2011!" width="400" height="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamiehurst.co.uk/happy-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stack Overflow &#8211; a New Experience</title>
		<link>http://www.jamiehurst.co.uk/stack-overflow-experience/</link>
		<comments>http://www.jamiehurst.co.uk/stack-overflow-experience/#comments</comments>
		<pubDate>Mon, 27 Dec 2010 20:46:16 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[answer]]></category>
		<category><![CDATA[experince]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[first look]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google reader]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[openid]]></category>
		<category><![CDATA[question]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[so]]></category>
		<category><![CDATA[stack overflow]]></category>
		<category><![CDATA[tinymce]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[web developer]]></category>
		<category><![CDATA[websockets]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[zf]]></category>

		<guid isPermaLink="false">http://www.jamiehurst.co.uk/?p=253</guid>
		<description><![CDATA[You&#8217;d think as a professional (in some capacity) web developer, I&#8217;d be one of these people who kept up with the trends and all the new tools out there that try and make my life that little bit easier. Well you&#8217;d be wrong. I still don&#8217;t use Google Reader, despite the fact I think it&#8217;s [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.jamiehurst.co.uk/wp-content/uploads/stack-overflow.jpg"><img class="alignleft size-full wp-image-254" title="Stack Overflow Error" src="http://www.jamiehurst.co.uk/wp-content/uploads/stack-overflow.jpg" alt="Stack Overflow   a New Experience" width="209" height="126" /></a>You&#8217;d think as a professional (in some capacity) web developer, I&#8217;d be one of these people who kept up with the trends and all the new tools out there that try and make my life that little bit easier. Well you&#8217;d be wrong. I still don&#8217;t use <a href="http://www.google.com/reader" target="_blank">Google Reader</a>, despite the fact I think it&#8217;s quite useful, I&#8217;m constantly missing out on little bits of useful information (I was quite looking forward to using <a href="http://dev.w3.org/html5/websockets/" target="_blank">WebSockets</a> before that security flaw) and for some reason, I&#8217;ve never used <a href="http://stackoverflow.com/" target="_blank">Stack Overflow</a>.</p>
<p>There are a lot of folk on Twitter and such I know that use Stack Overflow, and who find it very useful, but I&#8217;ve just never given it a try, I&#8217;ve always avoided it. So what I thought might be a neat idea is to document my experiences with Stack Overflow from the point of view as a new user, and see how I get on with using it and whether it comes across as being any use to me.</p>
<h3>First Impressions</h3>
<p>Firstly, the main interface. I absolutely love websites that don&#8217;t force you to sign up before they let you use them, and Stack Overflow fits that category very nicely. The first page is nicely designed. It&#8217;s very easy to understand with clear tags for each question, and a simplistic but effective interface with clear buttons and choices for what to do next. Despite the fact that SO doesn&#8217;t require a user account, I feel I should have one since I&#8217;m going to be using it more and more, so I want to sign up. There isn&#8217;t an obvious place to do this, but trying the &#8220;Log In&#8221; link at the top of the page leads me to where I want to be.</p>
<p>So, instead of signing up with an individual SO account, I can instead create one from one of the other services I probably already use, such as <a href="http://www.google.com/account" target="_blank">Google</a>, <a href="http://www.facebook.com/" target="_blank">Facebook</a> or <a href="http://www.openid.com/" target="_blank">OpenID</a>. I use all three of these, but decide to use Google, because it&#8217;s the most focused and already holds all of the information I&#8217;d want to pass over. I love the choice of using an existing service to register with SO, because having multiple accounts on multiple sites is tricky at the best of times; I&#8217;m always forgetting with email address or username I used to sign up to things, but never the password, strangely. So now I&#8217;m registered with Google and have an account, what&#8217;s next?</p>
<p><a href="http://www.jamiehurst.co.uk/wp-content/uploads/stack-overflow-ss1.png"><img class="aligncenter size-medium wp-image-255" title="Stack Overflow Screenshot" src="http://www.jamiehurst.co.uk/wp-content/uploads/stack-overflow-ss1-400x262.png" alt="Stack Overflow   a New Experience" width="400" height="262" /></a>So now I have a very basic profile, with a username of &#8220;<a href="http://stackoverflow.com/users/555182/jamie-hurst" target="_blank">user555182</a>&#8220;, probably about time I changed that. After setting up a bit of a better profile with my name and very quick and brutally honest &#8220;About Me&#8221; section, it&#8217;s about time I got on with trying to find some questions to answer!</p>
<h3>Answering</h3>
<p>After browsing some PHP questions for a few minutes, one of the first things that grasps me is the sheer size of the SO community. How did I miss this? Every question seems to get a very quick and very reasonable response. After searching through the new PHP questions for a bit, I managed to post a couple of answers, which I hope were helpful, although I haven&#8217;t quite found that out yet. I&#8217;ll have to wait and see if I get any response for them.</p>
<p>Some of the questions are very simplistic, like asking about foreach loops, nesting MySQL queries and the like, but a lot of the questions are far more advanced, and looking at those I do feel a little bit out of my depth. My limited PHP experience with only a tiny bit of Zend Framework programming is starting to show. Maybe this is the boot up the arse I need to start advancing my abilities a bit&#8230;</p>
<p>Anyway, I digress. What I&#8217;m trying to do now is think of a question I can ask on SO that will actually help me in some way, and help to solve a problem I&#8217;ve been having while coding. That one might have to wait for another day though, since nothing is immediately coming to mind, and I&#8217;m not back at work in the office until next week.</p>
<h3>One Last Point&#8230;</h3>
<p>After a bit of searching and use, I just found <a href="http://stackoverflow.com/questions/2695731/how-to-make-tinymce-paste-in-plain-text-by-default" target="_blank">this question</a>, specifically on the problems with forcing plain text pasting in TinyMCE, which I think so far I&#8217;ve spent half my coding life trying to solve, and someone has very kindly posted the answer to this ridiculous problem on SO. If I&#8217;d been using SO when I had this problem, I would&#8217;ve had it solved in two minutes, instead of two years. That pretty much illustrates this entire idea of trying these new services. I didn&#8217;t know I needed SO until I started using it. From now on, I&#8217;ll be continuing to use SO to get answers to questions I need, and helping those in need by trying my best to provide a solution to their woes.</p>
<p>In short, Stack Overflow is a fantastic service for ANY programmer who occasionally gets stuck on a piece of code, or who feels they can contribute by making the lives of other coders that little bit easier.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamiehurst.co.uk/stack-overflow-experience/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pasting in TinyMCE</title>
		<link>http://www.jamiehurst.co.uk/pasting-tinymce/</link>
		<comments>http://www.jamiehurst.co.uk/pasting-tinymce/#comments</comments>
		<pubDate>Wed, 15 Dec 2010 07:43:12 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[bbcode]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[ckeditor]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[lingo]]></category>
		<category><![CDATA[lingscars]]></category>
		<category><![CDATA[markdown]]></category>
		<category><![CDATA[outlook]]></category>
		<category><![CDATA[paste]]></category>
		<category><![CDATA[plain-text]]></category>
		<category><![CDATA[style]]></category>
		<category><![CDATA[tags]]></category>
		<category><![CDATA[tinymce]]></category>
		<category><![CDATA[upgrade]]></category>
		<category><![CDATA[wysiwyg]]></category>

		<guid isPermaLink="false">http://www.jamiehurst.co.uk/?p=223</guid>
		<description><![CDATA[Now first of all, I&#8217;ll be honest, I love TinyMCE. It&#8217;s a brilliant example of a JavaScript WYSIWYG editor, and has pretty much become the de-facto standard, too. We&#8217;ve all used it at one time or another, I&#8217;m using it right now to write this blog post, and it makes our lives a lot easier [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.jamiehurst.co.uk/wp-content/uploads/tinymce_script.png"><img class="alignleft size-thumbnail wp-image-238" title="TinyMCE Script" src="http://www.jamiehurst.co.uk/wp-content/uploads/tinymce_script-150x73.png" alt="Pasting in TinyMCE" width="150" height="73" /></a>Now first of all, I&#8217;ll be honest, I love <a href="http://tinymce.moxiecode.com/" target="_blank">TinyMCE</a>. It&#8217;s a brilliant example of a JavaScript <a href="http://en.wikipedia.org/wiki/WYSIWYG" target="_blank">WYSIWYG</a> editor, and has pretty much become the de-facto standard, too. We&#8217;ve all used it at one time or another, I&#8217;m using it right now to write this blog post, and it makes our lives a lot easier when we&#8217;re using it to see exactly how what we&#8217;re writing is going to look like (or thereabouts). However, trying to integrate it into a custom system that requires a lot of specific features and browser support can be a flipping nightmare, as I&#8217;m about to explain&#8230;</p>
<p>At <a href="http://www.lingscars.com/">LINGsCARS</a>, we use TinyMCE for composing messages in the LINGO system, on both sides, admin and customer, so it gets used fairly heavily each day. On the old system (LINGO v1) we just had a textarea that would end up being filled with tags like &lt;b&gt;, &lt;br /&gt;, etc. Not particularly pretty to look at and not much use either, so we decided to give a WYSIWYG editor a go, to make typing the message look exactly like a message, and I suggested TinyMCE straight away. We ended up building a couple of quick in-house plugins for templates, image uploading and storage and all was going very well initially when we turned the system on. But then, the mysterious bugs started appearing&#8230;</p>
<h3>What was Google Chrome Doing?</h3>
<p><a href="http://www.jamiehurst.co.uk/wp-content/uploads/google-chrome-logo.jpg"><img class="alignleft size-thumbnail wp-image-239" title="Google Chrome Logo" src="http://www.jamiehurst.co.uk/wp-content/uploads/google-chrome-logo-150x107.jpg" alt="Pasting in TinyMCE" width="150" height="107" /></a>Most of the team at LINGsCARS use <a href="http://www.google.com/chrome" target="_blank">Google Chrome</a> for all their admin work, with a few exceptions who use <a href="http://www.mozilla.com/firefox" target="_blank">Firefox</a>, so the first bug we noticed was one that only showed up in Chrome. Every time some plain text content was pasted into Chrome, the content would come in upside-down! Not back-to-front, all the letters were still the right way around, but the bottom line was at the top and so forth! I found it such a strange bug that I couldn&#8217;t believe it at first, it must&#8217;ve been the way that Chrome itself was handling the plain text content before passing it to the paste plugin. I managed to debug it in the paste plugin source code all the way back to the event trigger, so I knew it wasn&#8217;t an easily fixed problem&#8230;</p>
<p>Of course, by the time this bug had cropped up, so had many others. Pasting from Outlook was causing massive problems for some staff, with &lt;style&gt; tags being included, a plethora of various pointless HTML tags being passed through with no explanation or conversion, and random spaces being omitted from the ends of lines when pasting from MS Word! We were using the BBCode plugin to translate any HTML into strict BBCode so that we weren&#8217;t contaminating the database with HTML like we were in the previous system, and to make sure no admin staff or customers could post anything remotely injectable, so a lot of the tags weren&#8217;t going to be used anyway. Trying to ascertain whether TinyMCE was going to return HTML filled with &lt;p&gt;s or &lt;br&gt;s was basically guess-work, as the option for setting either one wasn&#8217;t just in one place&#8230; By this time, I&#8217;d realised the pit of snakes I&#8217;d fallen into and was beginning to regret it&#8230;</p>
<h3>First step: Upgrade</h3>
<p>Of course, after having a system in active development for such a long time, the first thing I noticed was that we were running a version of TinyMCE that was of a fair age. I think we were running version 3.2.x, and version 3.3.x was out at the time. I know that when LINGO development started, Chrome was a fairly new idea, so maybe the upside-down bug had been picked up and eliminated? Yep, correct. Upgrading TinyMCE fixed that particular problem, which was good news! I didn&#8217;t fancy sitting there debugging all the way through a huge library like that, and to be perfectly frank, I didn&#8217;t have the time! This helped me ease my fears over TinyMCE and helped me develop a resolve to get rid of further bugs&#8230;</p>
<h3>Look at the Paste Plugin</h3>
<p>The next step was to get rid of some of the strange HTML pasting problems. I was using the <a href="http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste" target="_blank">paste</a> plugin that comes with TinyMCE to differentiate between plain-text and HTML-formatted text, so this was the code I focused my efforts in. There didn&#8217;t seem to be a consistent way of getting the HTML to work between various browsers, applications and operating systems, so I made the decision early on to abandon HTML support for pasting and merely support plain-text. Looking back on this, I could&#8217;ve made a better decision at this point, as now we&#8217;ve been in situations where being able to paste tables, bulleted lists and the like would be an advantage, but hindsight is a wonderful thing, and I&#8217;m happy with the outcome of the plain-text work.</p>
<p>Modifications needed to be made to the paste plugin source code, trying to get rid of the strange HTML tags and converting all content to plain-text. I even roped in one of the core developers of TinyMCE on Twitter in sorting a bug with &lt;br /&gt; and &lt;p&gt; inconsistency between Webkit-based browsers and others. That pretty much sorted the &lt;p&gt; to &lt;br /&gt; problem I mentioned earlier, and after about a day and a half of debugging and swearing, I had the plain-text isolation sorted, so pasting was finally working in a consistent manner.</p>
<h3>Style Tags?</h3>
<p>Now, even though all content was being pasted as plain-text and forced into the editor in that guise, there were still a few tags slipping through full of content, one of which was a &lt;style&gt; tag. This only ever happened when pasting from MS Outlook, and only when pasting messages into the system from one particular supplier, who happened to include a &lt;style&gt; tag in his message signature above his name. The &lt;style&gt; tag itself was getting removed, but the inner content, including all the CSS definitions and comments, was being pasted every time! This was a very strange bug relating to the way the paste plugin actively searches for and removes special tags such as &lt;style&gt; tags. It must have been an unintentional oversight, but after careful examination of the code, it really does leave the content in! Having discovered this, I quickly removed this problem and finally got the last of the reported bugs ironed out&#8230;</p>
<h3>The Finished Article</h3>
<p>After spending almost a week on TinyMCE, I was very pleased with the results I got. Now I have a very good understanding of how the library works, and have integrated it a lot quicker into subsequent projects, taking the modified plugins and knowledge I&#8217;ve built along the way. A lot of Twitter users have recommended I look into alternative WYSIWYG editors, such as <a href="http://ckeditor.com" target="_blank">CKEditor</a>, or just abandon them altogether in favour of a solution such as <a href="http://daringfireball.net/projects/markdown/" target="_blank">Markdown</a>, but for now I&#8217;m sticking with TinyMCE after putting all that effort in. Plus, when it works, it really does the job.</p>
<p>I do plan on submitting some code examples of what I changed to get the paste plugin to work in plain-text only mode, and am still planning on submitting a couple more patches to the latest TinyMCE builds from these bugs I&#8217;ve found, but I need to make sure I&#8217;ve clearly tested these changes first before I submit anything&#8230;</p>
<p>I hope some of you found this useful, it just shows that even with these massive libraries, they aren&#8217;t always perfect and any developer can make a difference to these projects and help to improve them for their own needs and everyone else&#8217;s.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamiehurst.co.uk/pasting-tinymce/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>London-Bound!</title>
		<link>http://www.jamiehurst.co.uk/londonbound/</link>
		<comments>http://www.jamiehurst.co.uk/londonbound/#comments</comments>
		<pubDate>Sat, 20 Nov 2010 22:15:58 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[awards]]></category>
		<category><![CDATA[bbc news]]></category>
		<category><![CDATA[chris kemper]]></category>
		<category><![CDATA[chrome fastball]]></category>
		<category><![CDATA[craig tweedy]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[dropbox]]></category>
		<category><![CDATA[easyhotel]]></category>
		<category><![CDATA[elephant & castle]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[flipboard]]></category>
		<category><![CDATA[happy cog]]></category>
		<category><![CDATA[hey jude]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[jason santa maria]]></category>
		<category><![CDATA[jeffrey zeldman]]></category>
		<category><![CDATA[kat thompson]]></category>
		<category><![CDATA[lauren thompson]]></category>
		<category><![CDATA[london]]></category>
		<category><![CDATA[magazine]]></category>
		<category><![CDATA[megabus]]></category>
		<category><![CDATA[ministry of sound]]></category>
		<category><![CDATA[modernizr]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[old spice]]></category>
		<category><![CDATA[pacman]]></category>
		<category><![CDATA[ravelry]]></category>
		<category><![CDATA[richard keys]]></category>
		<category><![CDATA[sheffield]]></category>
		<category><![CDATA[sitepoint]]></category>
		<category><![CDATA[smashing magazine]]></category>
		<category><![CDATA[the big web show]]></category>
		<category><![CDATA[typekit]]></category>
		<category><![CDATA[victoria]]></category>

		<guid isPermaLink="false">http://www.jamiehurst.co.uk/?p=243</guid>
		<description><![CDATA[Well, this week I did something I wasn’t entirely expecting&#8230; I attended the .net Magazine awards 2010 at the Ministry of Sound. I didn’t win anything of course. but that’s a moan for another day&#8230; Richard Keys offered to take me as his “+1”, and with me being such an easy date, I accepted without [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.jamiehurst.co.uk/wp-content/uploads/netmag.png"><img class="alignleft size-full wp-image-245" title=".net Magazine" src="http://www.jamiehurst.co.uk/wp-content/uploads/netmag.png" alt="London Bound!" width="240" height="150" /></a>Well, this week I did something I wasn’t entirely expecting&#8230; I attended the <a href="http://www.thenetawards.com" target="_blank">.net Magazine awards 2010</a> at the <a href="http://www.ministryofsound.com/" target="_blank">Ministry of Sound</a>. I didn’t win anything of course. but that’s a moan for another day&#8230; <a href="http://www.richardjkeys.co.uk" target="_blank">Richard Keys</a> offered to take me as his “+1”, and with me being such an easy date, I accepted without much convincing!</p>
<p>Everyone had already sorted out travel by the time I was going, and the <a href="http://www.megabus.com" target="_blank">Megabus</a> was the cheapest and easiest option (note the lack of “comfiest” in that list), so we all went with it; this just meant two seven hour trips with stops at every major city in the north-east. Consequently, we ended up trying to sort out a bit of entertainment for the trip. On the way down, I caught up with the sixth Harry Potter film while everyone else slept, and on the way back, I wrote most of this while <a href="http://twitter.com/chrisdkemper" target="_blank">Chris</a> built some more of his new website while <a href="http://twitter.com/lrnn">Lauren</a> and <a href="http://twitter.com/richardjkeys" target="_blank">Richard</a> seemed to spend the entire trip on Twitter. Craig<a href="http://twitter.com/craigtweedy" target="_blank">#mce_temp_url#</a> built an iPhone app based on Richard’s vocals for “Hey Jude” (we&#8217;re all hoping for App Store submission soon!) and played Scrabble with <a href="http://twitter.com/katskii" target="_blank">Kat</a>.</p>
<p>This was also the first time I’d ventured forth towards the capital city, normally being a typical northerner and never going further south than Sheffield at most, and the sheer size and complexity of London did overwhelm me slightly. I have no idea how anyone navigates the Underground, or how postmen manage to do a serviceable job, when we got lost in a group of six people, five of which own iPhones with GPS and Google Maps capability, and one with an Android just to be safe. The tube seems stupidly expensive to me, we spent £10 each for two-days travel, so how anyone affords it when they’re commuting every day is beyond me. I wasn’t prepared for how many people it was physically possible to cram on a train either, or the fact that personal space is a privileged option unavailable to the users of London’s public transport, nevertheless, it seems to work! We got around easily and without much swearing&#8230;</p>
<p>We were stopping overnight in the <a href="http://www.easyhotel.com" target="_blank">EasyHotel</a> in Victoria, and had little idea what to expect, other than a minimalist room with bright orange walls. Unsurprisingly, that&#8217;s what we got, however this didn&#8217;t prove to be as bad as we all thought. The room was comfortable enough, the facilities all worked, and most of us slept reasonably well after a night of boozing, so I was happy enough.</p>
<p>The actual awards ceremony started at 7pm, so we got the down to Elephant &amp; Castle, stumbled around trying to find the Ministry of Sound, and then went straight in when we found it. Underbelly had pitched up outside with a photo booth that included a wind machine, so after we&#8217;d all messed up our carefully sculpted hair, we went into the main club, where we were greeted by free champagne with strawberries, and free beer. Two hours later, I was quite nicely hammered when the main awards ceremony started, with <a href="http://www.jackwhitehall.com" target="_blank">Jack Whitehall</a> as host. <a href="http://www.zeldman.com/" target="_blank">Jeffrey Zeldman</a> managed to bag three awards! The awards announcements were followed by a trip to a free burger van and some old-skool PacMan gaming, then, when the free beer ran dry, we headed back to hotel in a typically expensive London taxi.</p>
<p>I&#8217;d like to thank the .net Magazine for putting on such a great awards night and being such fantastic hosts, and for providing a night of drunkenness and debauchery for a lot less cost than normal! I&#8217;ve made a quick list of all the award winners below:</p>
<ul>
<li>Web App of the Year &#8211; <a href="http://typekit.com/" target="_blank">Typekit</a></li>
<li>Community Site of the Year &#8211; <a href="http://www.ravelry.com/" target="_blank">Ravelry</a></li>
<li>Best API Use &#8211; <a href="http://www.flipboard.com/" target="_blank">Flipboard</a></li>
<li>Interactive Site of the Year &#8211; <a href="http://www.youtube.com/user/chromefastball" target="_blank">Chrome Fastball</a></li>
<li>Blog of the Year &#8211; <a href="http://www.smashingmagazine.com/" target="_blank">Smashing Magazine</a></li>
<li>Podcast of the Year &#8211; <a href="http://www.sitepoint.com/podcast" target="_blank">SitePoint</a></li>
<li>Video Podcast of the Year &#8211; <a href="http://5by5.tv/bigwebshow" target="_blank">The Big Web Show</a></li>
<li>Design Agency of the Year &#8211; <a href="http://www.happycog.com/" target="_blank">Happy Cog</a></li>
<li>Innovation of the Year  - <a href="http://nodejs.org/" target="_blank">Node.js</a></li>
<li>Web Personality of the Year &#8211; <a href="http://www.jasonsantamaria.com/" target="_blank">Jason Santa Maria</a></li>
<li>Viral Campaign of the Year &#8211; <a href="http://www.oldspice.com/videos/" target="_blank">Old Spice</a></li>
<li>Standards Champion &#8211; <a href="http://www.zeldman.com/" target="_blank">Jeffrey Zeldman</a></li>
<li>Open Source Application of the Year &#8211; <a href="http://www.modernizr.com/" target="_blank">Modernizr</a></li>
<li>Redesign of the Year &#8211; <a href="http://www.bbc.co.uk/news" target="_blank">BBC News</a></li>
<li>Mobile Site of the Year &#8211; <a href="http://m.flickr.com/" target="_blank">Flickr</a></li>
<li>Mobile App of the Year &#8211; <a href="https://www.dropbox.com/anywhere" target="_blank">Dropbox</a></li>
</ul>
<p>Everything else on the <a href="http://www.thenetawards.com/" target="_blank">.net Magazine Awards website</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamiehurst.co.uk/londonbound/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Weekend of Learning in Manchester &#8211; PHPNW 2010</title>
		<link>http://www.jamiehurst.co.uk/php-conference-manchester-phpnw-2010/</link>
		<comments>http://www.jamiehurst.co.uk/php-conference-manchester-phpnw-2010/#comments</comments>
		<pubDate>Sun, 17 Oct 2010 10:02:30 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.jamiehurst.co.uk/?p=226</guid>
		<description><![CDATA[Last weekend, I was lucky enough to attend my first conference as a delegate with Andrew Taylor at the PHPNW conference in Manchester, and had a fantastic time! I met some great new people, learned a great many new things, and even had time for a couple of beers and a curry while I was [...]]]></description>
				<content:encoded><![CDATA[<p>Last weekend, I was lucky enough to attend my first conference as a delegate with <a href="http://twitter.com/ukandrewtaylor" target="_blank">Andrew Taylor</a> at the <a href="http://conference.phpnw.org.uk" target="_blank">PHPNW conference</a> in Manchester, and had a fantastic time! I met some great new people, learned a great many new things, and even had time for a couple of beers and a curry while I was there&#8230; Hopefully one day I&#8217;ll be able to speak at a conference like this, but coming up with a topic is only the beginning&#8230; The guys and girls who were speaking were phenomenal, and all credit to them for standing up and pitching their ideas and experiences in front of everyone!</p>
<p>What I&#8217;ll do is gather together all the notes and topics I took away from each of the sessions I attended, and why I think each one will help me in my day-to-day development duties. Obviously, I didn&#8217;t attend all of the talks, and hand-picked the ones I was interested in, and the ones I thought would help the most; so I ended up going to a lot of <a href="http://framework.zend.com" target="_blank">Zend Framework</a> and integration-based talks, solely for the purpose of furthering my own understanding! Anyway I&#8217;m rambling&#8230; On to the topics.</p>
<h3>Saturday</h3>
<p>First up was <a href="http://twitter.com/lornajane" target="_blank">Lorna Mitchell</a>, who I&#8217;ve seen a talk from before at a <a href="http://www.supermondays.org/" target="_blank">SuperMondays</a>-based PHP event. Her talk was entitled &#8220;Teach a Man to Fish&#8221;, with some tips on improving both your own learning and understanding as a developer, but also those of your team. I was looking forward to this, especially since we&#8217;ve had a recent addition in the office, and communicating across your experiences is not an easy task&#8230; Lorna explained some interesting ideas, such as defining the skills that each team member has, and plugging gaps that were evident. Making sure that the person who knows everything doesn&#8217;t &#8220;go under a bus&#8221; is also pretty important, so I recommend at least one minder for your top developer, rather than spreading the knowledge around, which is clearly far less sensible&#8230;</p>
<p>Next was a look at <a href="http://framework.zend.com" target="_blank">Zend Framework</a> 2.0, and the new features the team have planned to integrate from <a href="http://twitter.com/akrabat" target="_blank">Rob Allen</a>, the author of this very nice Zend Framework tutorial and a ZF contributor. It&#8217;s nice to know that a lot of the problems in the current ZF 1.0 implementation (my goodness, where do I start?) are going to be addressed, and that PHP 5.3 is being used extensively, which will push the advancement of production servers where needed. I could go on and on about why I don&#8217;t use PHP 5.3 yet in production, but I&#8217;d rather save that for another time&#8230; Rob&#8217;s talk included a lot of neat new tricks for ZF, such as HUGE performance increase benchmarks, classmap files, and the use of interfaces over all of the ZF abstract classes. Apparently they&#8217;re looking towards an Easter release for ZF 2.0, but he didn&#8217;t seem particularly optimistic, and neither am I to be perfectly honest&#8230;</p>
<p>ZF was the theme of the next talk too, with <a href="http://twitter.com/bittarman" target="_blank">Ryan Mauger</a> introducing some of the features ZF is best at, and where you need to be careful when beginning with Zend for the first time. It&#8217;s only very recently, in the last year, that I&#8217;ve been using Zend Framework on-and-off myself, and Ryan&#8217;s presentation helped confirm my understanding of some of the aspects I&#8217;ve been learning, and I&#8217;m glad I now know I&#8217;m going in the right direction with things! He also showed off a neat tool, <a href="http://github.com/Bittarman/BeachPHP">BeachPHP</a>, for sandboxing PHP code LIVE in a browser! I might be a bit behind the times, but I&#8217;d never seen anything like this before and was very impressed! I&#8217;ll be using it a lot on the future&#8230;</p>
<p>Continuous Integration was the theme of the next talk, given by <a href="http://twitter.com/proofek" target="_blank">Sebastian Marek</a>, and I have to say, this was just fantastic. I got so many ideas and so much information from this talk on how best to move from a live coding environment into a fully integrated system with automated builds, testing, coding standards checking and tons more. Admittedly, at <a href="http://www.plus.net/">PlusNet</a> they have a HUGE codebase (gigabytes and gigabytes apparently) and need some phenomenal power to drive their TDD environment, but the improvements they&#8217;ve made since undergoing this approach are evident. I&#8217;ll be looking at tools such as <a href="http://www.phpunit.de/" target="_blank">PHPUnit</a>, <a href="http://phpundercontrol.org/" target="_blank">phpUnderControl</a>, <a href="http://pear.php.net/package/PHP_CodeSniffer" target="_blank">PHP_CodeSniffer</a>, <a href="http://pdepend.org" target="_blank">PHP Depend</a>, <a href="http://phpmd.org" target="_blank">PHP Mess Detector</a>, <a href="http://github.com/capistrano/capistrano/wiki/Documentation-v2.x" target="_blank">Capistrano</a> and <a href="http://seleniumhq.org" target="_blank">Selenium</a> all thanks to this talk!</p>
<p>Back to familiarity with another Zend-based talk, this time on <a href="http://framework.zend.com/manual/en/zend.acl.html" target="_blank">Zend_Acl</a> from <a href="http://twitter.com/rowan_m" target="_blank">Rowan Merewood</a>. The ACL is something that&#8217;s always puzzled me, especially since the manual misses out some of it&#8217;s best features and it&#8217;s a bit hard to find any good tutorials for, so Rowan&#8217;s talk was very useful for talking through the implementations of a static and dynamic ACL in Zend, and the pitfalls and problems that can arise too. However, I&#8217;m still not entirely convinced the ACL is a library to be used by THAT many developers, and think that it has been a bit over-engineered to solve a specific set of problems rather than providing a wider solution.</p>
<p>For my final choice on Saturday I went to see <a href="http://twitter.com/harrieverveer" target="_blank">Harrie Verveer</a> introduce his thoughts on database version control, something even he said there wasn&#8217;t a &#8220;silver bullet&#8221; for in terms of a solution. Harrie described a number of approaches, such as patch files, especially with undo files too, creating an install.sql file that will deploy an instantly-working version of the database setup, possibly with some dummy test data too, and he went on to mention tools such as <a href="http://phing.info" target="_blank">Phing</a> and <a href="http://dbdeploy.com" target="_blank">DB Deploy</a>, both of which attempt to solve the version control nightmare surrounding MySQL. I&#8217;m not sure which idea I like best from Harrie&#8217;s talk, but when implementing these solutions I&#8217;ll be going for a hybrid approach I think, making sure all avenues are covered off with patch files, undo files and an overall installation file too.</p>
<p>The final session on Saturday was a framework shootout, a very interesting idea where four advocates of some of the major PHP frameworks, namely <a href="http://www.kohanaphp.com" target="_blank">Kohana</a>, <a href="http://www.agavi.org" target="_blank">Agavi</a>, <a href="http://incubator.apache.org/zetacomponents/" target="_blank">Apache Zeta Components</a> and <a href="http://framework.zend.com" target="_blank">Zend Framework</a>, would first answer some general questions and then any questions put to them. This helped me to get a very good understanding of the major differences between some of the mainstream frameworks, and why there are so many, since each framework has one or more core goals that it attempts to achieve, where others may fall down. I had actually only heard of Zend Framework before this presentation, so this gave me some information on the other frameworks, but still hasn&#8217;t convinced me to change! What I especially took from this session was the sheer passion that the developers have for their particular outlook on framework ideals.</p>
<p>The evening involved a free bar at the conference centre for a while, followed by a swift march into Manchester with <a href="http://twitter.com/paulgeraghty" target="_blank">Paul Geraghty</a> and his wife Dominique, <a href="http://twitter.com/clairs" target="_blank">Clair</a>, <a href="http://twitter.com/ukandrewtaylor">Andrew Taylor</a> and <a href="http://twitter.com/anthonysterling" target="_blank">Anthony Sterling</a> to line our stomachs with delicious curry and a quick stop off at an Irish bar, before heading back to the hotel for a couple more drinks before a well deserved sleep.</p>
<h3>Sunday</h3>
<p>Sunday started off with a group of us missing the obvious sign for the entrance to the conference at the <a href="http://www.mosi.org.uk" target="_blank">MOSI</a>, so after feeling like a set of pillocks, we entered inside and sat ourselves down for another round of slightly quicker talks for those of us who were still around.</p>
<p><a href="http://twitter.com/michaelpeacock" target="_blank">Michael Peacock</a> kicked things off with his talk on abstracting functionality using centralised content, which explained how to design a database for a project in such a way that you can have versioning applied to it easily, and have most, if not all of your different types of content extending from a centralised table. The content would also have designated searchable fields that could easily be integrated into an ORM to continue the theme. I found Michael&#8217;s talk to be very interesting, especially since this is the approach he deploys with client projects at <a href="http://www.peacockcarter.co.uk" target="_blank">Peacock Carter</a>, although it clearly isn&#8217;t applicable to every single situation. Michael&#8217;s example was a simple standard database-driven website that incorporated products, a blog, comments, and ratings.</p>
<p>Another Zend talk, how surprising! This talk involved <a href="http://twitter.com/binarykitten" target="_blank">Kathryn Reeve</a> doing some live demonstrations and basic explanations of the principles and features that Zend_Tool allows you to use, such as easily setting up projects, controllers, actions and modules within a new Zend project. I must admit, I didn&#8217;t find this talk too in-depth, as I&#8217;d already been familiar with Zend_Tool for some time, although I&#8217;m sure it was very useful for those in the audience who were just starting out with Zend and needed to get a grip on it&#8217;s basic features.</p>
<p>Exploring <a href="http://nginx.org" target="_blank">Nginx</a> and the differences and advantages it has over Apache was something I was really looking forward to, as we&#8217;re rolling out Nginx on our new server deployment at LINGsCARS very soon, and there are quite a few aspects of it I&#8217;m still not familiar with at all. <a href="http://twitter.com/errazudin" target="_blank">Errazudin Ishak</a> has travelled over all the way from Malaysia to give his talk, so I made sure I paid particular attention. Nginx runs PHP in a completely different way than Apache, making use of the <a href="http://www.fastcgi.com" target="_blank">FastCGI</a> implementation within PHP, and from v5.3.3 onwards, <a href="http://php-fpm.org" target="_blank">PHP-FPM</a>. The speed increases were instantly noticeable, and Errazudin demonstrated a test on his local laptop that proved it all. The only problem I&#8217;ve found with Nginx are that it&#8217;s Rewrite rules are quite different to how Apache works, so that&#8217;ll take some getting used to.</p>
<p>The final talk we saw before setting off on the long journey back to Newcastle was from <a href="http://twitter.com/thijsferyn" target="_blank">Thijs Feryn</a>, a Belgian PHP Benelux advocate who works at a hosting company managing their PHP clients. Thijs explained some of the security he has to put in place, such as strict memory limits, disallowing override tags within .htaccess files, and the problems he has with both <a href="http://pear.php.net" target="_blank">PEAR</a> and <a href="http://pecl.php.net" target="_blank">PECL</a> implementations. Although this talk wasn&#8217;t too relevant to me, Thijs is a very good speaker, and did explain some very interesting ideas, so I still felt that I took a lot from it.</p>
<h3>Thanks!</h3>
<p>Well, that&#8217;s about it! All I have left to do is thank all the wonderful team who did such a brilliant job organising <a href="http://conference.phpnw.org.uk" target="_blank">PHPNW 2010</a>, especially <a href="http://twitter.com/phpcodemonkey" target="_blank">Jeremy Coates</a> and the team at <a href="http://www.magmadigital.co.uk" target="_blank">Magma Digital</a> (enjoying a cup of coffee from my Magma Digital mug now!), I&#8217;m very sorry we had to leave a talk early, but I look forward to seeing you all again next year at PHPNW 2011! BY then I hope to have taken a lot of the ideas on board and be able to demonstrate how they&#8217;ve helped us at <a href="http://www.lingscars.com/">LINGsCARS</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamiehurst.co.uk/php-conference-manchester-phpnw-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migrating Legacy and Out-of-Date Systems</title>
		<link>http://www.jamiehurst.co.uk/migrating-legacy-outofdate-systems/</link>
		<comments>http://www.jamiehurst.co.uk/migrating-legacy-outofdate-systems/#comments</comments>
		<pubDate>Sun, 12 Sep 2010 18:15:45 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[black-box]]></category>
		<category><![CDATA[building]]></category>
		<category><![CDATA[changes]]></category>
		<category><![CDATA[designing]]></category>
		<category><![CDATA[developing]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[mind map]]></category>
		<category><![CDATA[new system]]></category>
		<category><![CDATA[out-of-date]]></category>
		<category><![CDATA[parallel]]></category>
		<category><![CDATA[planning]]></category>
		<category><![CDATA[software engineer]]></category>
		<category><![CDATA[switchover]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[upgrading]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://www.jamiehurst.co.uk/?p=195</guid>
		<description><![CDATA[Upgrading to a new system is something I&#8217;ve only really had to get to grips with in the last few months. I normally spend my day-today working life either making minor website changes, developing completely new ideas that don&#8217;t tie into anything else, or maintaining our current systems, but never building new ones. This is [...]]]></description>
				<content:encoded><![CDATA[<div id="attachment_211" class="wp-caption alignleft" style="width: 160px"><img class="size-thumbnail wp-image-211 " title="Clapped Out Vauxhall Cavalier" src="http://www.jamiehurst.co.uk/wp-content/uploads/clapped_out_cavalier-150x112.jpg" alt="Migrating Legacy and Out of Date Systems" width="150" height="112" /><p class="wp-caption-text">When your system looks like a knackered Vauxhall Cavalier, it&#39;s time to change...</p></div>
<p>Upgrading to a new system is something I&#8217;ve only really had to get to grips with in the last few months. I normally spend my day-today working life either making minor website changes, developing completely new ideas that don&#8217;t tie into anything else, or maintaining our current systems, but never building new ones. This is pretty rare since the definition of being a software engineer alone carries the fact that most of the time you&#8217;ll be building a replacement system for something or other, even if the current system isn&#8217;t in any way computerised.</p>
<p>So, this article is going to detail my personal experiences with migrating from out-of-date systems. This means that it will contain a lot of opinions, some of which not everyone in the industry my agree with, and some points of view that may be fundamentally wrong. However, I&#8217;m not going to make any apology for this, this is just exactly how I see system migration, so it&#8217;s how I&#8217;ll tell it!</p>
<h3>When is the Best Time to Start Building a New System?</h3>
<p>The first problem is knowing when the time is right to sit down and start planning your new system. If the current system you&#8217;ve got isn&#8217;t throwing up any problems, and there aren&#8217;t any features you or your clients are gagging for, then I would suggest to stick with what you&#8217;ve got. However, if you&#8217;re finding that the bug and feature requests are piling up, and the system has either stopped making money, or worse, has become a money-pit, then it&#8217;s time to get out your pen and start drawing some mind maps. Bear in mind though, that you have to be able to justify the planning, development and migration costs that will be involved with a new system. If you can&#8217;t justify this to yourself, how are you going to justify it to your boss?</p>
<p>With regards to my experiences, we built the first incarnation of our system and turned most of it on in Summer 2008. For a long time, we were very happy with it, but it soon became apparent that a few little problems were going to re-appear as we continued to use the system, and when we identified a whole new side to the system that would be absolutely impossible to bolt-on to the current incarnation, it was time to sit down and start drawing up plans for version 2. When we built version 1, it was more than adequate for what we needed, but as ever, times change and new situations evolve that cause complications and mean that systems need re-evaluating&#8230;</p>
<h3>Planning and Designing the New System</h3>
<p>OK, so you&#8217;ve decided a new system is in the pipeline. Now, you need to sit down and design it, using the flaws and missing bits out of the current system as a foundation. One thing to remember is not to get hung-up on how the current system is designed, you want a version 2, not a version 1.01&#8230; The best way to help this process is to bring people on board who weren&#8217;t involved with the last system. These people will be able to provide a fully independent view of the problems that befell the last system, and how they see the problems as being fixed in the newer version. I know today&#8217;s software engineers are all about agile, but still try and plan as much as you can before beginning development. It&#8217;s one thing to start the first iteration of a build, and then to find out the plan was no good and start again, but how many times are your paymasters going to let you do that?</p>
<p>We used the first system&#8217;s design, or lack of it, as a basis to begin the design for the new system. This time we knew exactly what we wanted from it, so designing a framework and basic architecture wasn&#8217;t too demanding.</p>
<h3>Development</h3>
<p>I like tho think that the actual development of the new system is the easy bit, normally. If you&#8217;ve planned it well and know exactly what you want from the new build, then park yourself in front of an IDE and code away furiously until it&#8217;s done. Occasionally though, it isn&#8217;t that simple. Feature requirements will change throughout development, and you&#8217;ll need to be on your toes to keep up with the demands of your stakeholders!</p>
<p>Feature creep has been a major problem in the development of our new system, and we had to get to the eventual stage of saying &#8220;No more!&#8221; and admitting to developing them after the system has gone live. That&#8217;s the beauty of a web-based system, development doesn&#8217;t end with a final release, it just keeps going and going <img src='http://www.jamiehurst.co.uk/wp-includes/images/smilies/icon_smile.gif' alt="Migrating Legacy and Out of Date Systems" class='wp-smiley' title="Migrating Legacy and Out of Date Systems Photo" /> </p>
<h3>Testing: the Important Bit</h3>
<p>I can&#8217;t stress enough how important testing is for a new system. However you decide to deploy it, everyone, and I mean EVERYONE, is going to expect it to work perfectly straight away. If it doesn&#8217;t, you&#8217;re in for a really hard time. Make sure you right the tests as you&#8217;re developing the system, it&#8217;s no good waiting till the end and planning the tests around the finished system, save that for the basic black-box tests. Test every function and feature as you&#8217;re adding it, and write unit tests that you can run every time you add something new, in case it breaks something old.</p>
<h3>The Final Migration</h3>
<p>Finally, your system is built! Rejoice! You&#8217;ve designed it, built it, and tested it within an inch of it&#8217;s life&#8230;</p>
<p>But now comes the hard part.</p>
<p>The way I&#8217;ve seen it so far in my short time on this world (even shorter as a developer!), there are two approaches to switching your systems over. Both ways have their advantages and disadvantages, and however you do it, something might inevitably go wrong, so I suggest weighing up the two options and choosing based on your current circumstances.</p>
<h3>Approach One: Run Two Systems in Parallel</h3>
<p>This method is the easiest from your point-of-view as a developer. You get to see any problems you&#8217;ve missed out in the new system, and improve on them as you go before the final switchover. The problem is that everyone who actually uses the system has an immediate doubling of their workload. They might not be too happy if it takes you a month to iron out all the bugs before you get the new system fully online by itself. If you go for this approach, make sure you only do it for a short period, otherwise you may end up having no work friends!</p>
<h3>Approach Two: Complete Switchover</h3>
<p>Although you may sweat blood with this approach, you should be fairly confident! You should&#8217;ve already tested the system thoroughly, all that remains is finding a suitable time to switch when the system is either not being used, or being used in a minimal fashion. The pitfalls of this method are bugs: if they creep up now AFTER you&#8217;ve switched over, they can cause a lot of misery.</p>
<p>You need to weigh up the two options and decide which one besets your position at this point, I can only provide the options, not make you choose <img src='http://www.jamiehurst.co.uk/wp-includes/images/smilies/icon_smile.gif' alt="Migrating Legacy and Out of Date Systems" class='wp-smiley' title="Migrating Legacy and Out of Date Systems Photo" /> </p>
<h3><em>Update</em></h3>
<p><em>Read Aidan Garnish&#8217;s comments below on his third method! A hybrid between the two that may just be the best for your situation! <img src='http://www.jamiehurst.co.uk/wp-includes/images/smilies/icon_smile.gif' alt="Migrating Legacy and Out of Date Systems" class='wp-smiley' title="Migrating Legacy and Out of Date Systems Photo" /> </em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamiehurst.co.uk/migrating-legacy-outofdate-systems/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQL Tutorial: Replication</title>
		<link>http://www.jamiehurst.co.uk/mysql-tutorial-replication/</link>
		<comments>http://www.jamiehurst.co.uk/mysql-tutorial-replication/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 20:22:26 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[client]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[diagram]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[dump]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[master]]></category>
		<category><![CDATA[my.cnf]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqli]]></category>
		<category><![CDATA[pdo]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[read]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[slave]]></category>
		<category><![CDATA[status]]></category>
		<category><![CDATA[tables]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[write]]></category>

		<guid isPermaLink="false">http://www.jamiehurst.co.uk/?p=197</guid>
		<description><![CDATA[MySQL&#8217;s Community Server is one of the most popular choices for anything from small-time web hosting all the way up to huge organisations. PHP developers use it because it ties in so nicely with the basic language, with extensions such as mysqli, PDO and third-party frameworks such as Doctrine that maximise it&#8217;s potential. I&#8217;ve been [...]]]></description>
				<content:encoded><![CDATA[<p><img class="alignleft size-thumbnail wp-image-204" title="MySQL Logo" src="http://www.jamiehurst.co.uk/wp-content/uploads/mysql-logo-150x77.png" alt="MySQL Tutorial: Replication" width="150" height="77" /><a href="http://dev.mysql.com/downloads/mysql/" target="_blank">MySQL&#8217;s Community Server</a> is one of the most popular choices for anything from small-time web hosting all the way up to huge organisations. PHP developers use it because it ties in so nicely with the basic language, with extensions such as <a href="http://php.net/manual/en/book.mysqli.php" target="_blank">mysqli</a>, <a href="http://php.net/manual/en/book.pdo.php" target="_blank">PDO</a> and third-party frameworks such as <a href="http://www.doctrine-project.org" target="_blank">Doctrine</a> that maximise it&#8217;s potential. I&#8217;ve been using MySQL for a number of years, and am fairly comfortable trusting it for pretty much any situation that arises.</p>
<p>MySQL works wonderfully as a stand-alone database server, but has the flexibility so that it can be deployed in a multi-database server environment. Commonly, this is with one database server as the &#8220;master&#8221;, which holds the original copy of the data, and one or more &#8220;slaves&#8221;, which the master is responsible for keeping upto date. The following diagram illustrates how a MySQL multi-server setup plays out:</p>
<p><img class="aligncenter size-medium wp-image-203" title="MySQL Replication Diagram" src="http://www.jamiehurst.co.uk/wp-content/uploads/mysql_replication-400x182.png" alt="MySQL Tutorial: Replication" width="400" height="182" /></p>
<p>As shown above, the master server is normally used for all of the client writes to the databases, and the client will normally read from the various slave servers. In this quick tutorial, I&#8217;ll describe how to set-up a MySQL environment with one master server that is already in use, and a brand new single slave server using one database called <em>exampledb</em>. This presumes you&#8217;ve already got MySQL installed and working on both machines, as normally that&#8217;s a simple task of installing a package in Linux, an installation package in Windows, or a disk image in Mac OS X.</p>
<p>MySQL&#8217;s reference manual also some pretty cool info on <a href="http://dev.mysql.com/doc/refman/5.0/en/replication.html" target="_blank">replication</a>.</p>
<h3>Master Configuration</h3>
<p>So first off, you need to make some configuration changes to the MySQL server that will become your master. These changes will be made on the main MySQL configuration file, commonly, on Linux/Mac at <em>/etc/my.cnf</em> or <em>/etc/mysql/my.cnf</em>. Firstly, find the following two lines and comment them out by adding a leading # character:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#skip-networking</span>
<span style="color: #666666; font-style: italic;">#bind-address            = 127.0.0.1</span></pre></td></tr></table></div>

<p>Then add the following lines at the bottom of the file to tell MySQL where to store the log files that will be used to keep the slaves up-to-date:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">server-id=<span style="color: #000000;">1</span>
log-bin = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>mysql-bin.log
binlog-do-db=exampledb</pre></td></tr></table></div>

<p>Now you need to restart MySQL to make sure it recognises itself as a master, and to trigger the new configuration changes. Normally this is done with the following command, but this may vary depending on your system:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>mysql restart</pre></td></tr></table></div>

<p>Next, the slave will need to be able to authenticate with the master as a user to receive the updates it requires. This means you&#8217;ll need to login to MySQL using the client as follows:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-u</span> root <span style="color: #660033;">-p</span></pre></td></tr></table></div>

<p>Make sure to type your root password when prompted. Then create a user with the privileges the slave server will need, and make sure you replace example_password with an actual password, as follows:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">GRANT</span> REPLICATION SLAVE <span style="color: #990099; font-weight: bold;">ON</span> <span style="color: #CC0099;">*</span>.<span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">TO</span> <span style="color: #008000;">'replicate'</span>@<span style="color: #008000;">'<span style="color: #008080; font-weight: bold;">%</span>'</span> IDENTIFIED BY <span style="color: #008000;">'example<span style="color: #008080; font-weight: bold;">_</span>password'</span><span style="color: #000033;">;</span>
FLUSH <span style="color: #990099; font-weight: bold;">PRIVILEGES</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

<p>We&#8217;re finished with the master server for now, but don&#8217;t shut your client because we&#8217;ll need to come back to it later on to extract the data from the master to transport to the slave. We aren&#8217;t dumping the data now because it means locking the database into read-only mode until the slave is up-to-date. It&#8217;s best to finishing setting up the slave first.</p>
<h3>Slave Configuration</h3>
<p>OK, now you need to log into the server that holds the MySQL installation you want to set-up as a slave server. You need to tell the server it is a slave in mostly the same way the master knows it&#8217;s a master, so add the following lines to your MySQL configuration file, changing the IP address, username and password where required:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">server-id=<span style="color: #000000;">2</span>
master-host=192.168.2.1
master-user=replicate
master-password=example_password
master-connect-retry=<span style="color: #000000;">60</span>
replicate-do-db=exampledb</pre></td></tr></table></div>

<p>Then restart the server in the same way you did for the master. That&#8217;s it! The slave is now set-up and ready to receive data from the master.</p>
<h3>Data Synchronisation</h3>
<p>There are a few ways to transfer the initial data from the master to the slave, but I always find the easiest way is to read lock the database and make a dump of the current tables, import it into the slave and start replicating from there. Before you start this, make sure you have a client for both MySQL servers open, ready to input commands, and a separate terminal window on each server too for entering commands not in the MySQL client.</p>
<p>On the master, we need to read lock the tables and get the info ready for replication. To do this, lock the tables using the following commands:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">USE</span> exampledb<span style="color: #000033;">;</span>
FLUSH <span style="color: #990099; font-weight: bold;">TABLES</span> <span style="color: #990099; font-weight: bold;">WITH</span> <span style="color: #990099; font-weight: bold;">READ</span> <span style="color: #990099; font-weight: bold;">LOCK</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">SHOW</span> MASTER <span style="color: #990099; font-weight: bold;">STATUS</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

<p>That will give you some information similar to the following:</p>
<pre>
+---------------+----------+--------------+------------------+
| File          | Position | Binlog_do_db | Binlog_ignore_db |
+---------------+----------+--------------+------------------+
| mysql-bin.002 | 754      | exampledb    |                  |
+---------------+----------+--------------+------------------+
1 row in set (0.00 sec)
</pre>
<p>Make sure you take a note of the log file AND position, as you&#8217;re going to need this info to synchronise the slave! Next, use the terminal on the master to run the following command to create a dump of the current database:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">mysqldump <span style="color: #660033;">-u</span> root -pexample_password <span style="color: #660033;">--opt</span> exampledb <span style="color: #000000; font-weight: bold;">&gt;</span> exampledb.sql</pre></td></tr></table></div>

<p>And then run the following command in the MySQL client:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="mysql" style="font-family:monospace;">UNLOCK <span style="color: #990099; font-weight: bold;">TABLES</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

<p>This will unlock the read lock from the tables meaning your master database will operate normally again. Now, you need to copy the SQL dump file over to the slave. I&#8217;ll leave it up to you how to accomplish this, there are far too many ways to list. Once copied, create the database on the slave&#8217;s MySQL client:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">DATABASE</span> exampledb<span style="color: #000033;">;</span></pre></td></tr></table></div>

<p>And use the terminal to import the dumped master data like this, replacing the password and path as needed:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-u</span> root -pexample_password; exampledb <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>exampledb.sql</pre></td></tr></table></div>

<p>Now, finally, go into the slave&#8217;s MySQL client again, and stop the slave from running to update the config:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="mysql" style="font-family:monospace;">SLAVE STOP<span style="color: #000033;">;</span></pre></td></tr></table></div>

<p>Update the master configuration on the slave to the log file and position you noted above by running the following command in the client, replacing the password, IP, etc. as required:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CHANGE</span> MASTER <span style="color: #990099; font-weight: bold;">TO</span> MASTER_HOST<span style="color: #CC0099;">=</span><span style="color: #008000;">'192.168.2.1'</span><span style="color: #000033;">,</span> MASTER_USER<span style="color: #CC0099;">=</span><span style="color: #008000;">'replicate'</span><span style="color: #000033;">,</span> MASTER_PASSWORD<span style="color: #CC0099;">=</span><span style="color: #008000;">'example<span style="color: #008080; font-weight: bold;">_</span>password'</span><span style="color: #000033;">,</span> MASTER_LOG_FILE<span style="color: #CC0099;">=</span><span style="color: #008000;">'mysql-bin.002'</span><span style="color: #000033;">,</span> MASTER_LOG_POS<span style="color: #CC0099;">=</span><span style="color: #008080;">754</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

<p>Now start the slave again:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="mysql" style="font-family:monospace;">SLAVE <span style="color: #990099; font-weight: bold;">START</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

<p>And that&#8217;s it! Your slave should now be receiving data from the master, and will update whenever a change on the master is pushed to it automatically.</p>
<h3>More Tips</h3>
<p>A very quick tip, use the following command to check how the slave is doing in relation to the master, and to make sure there are no I/O or SQL errors that have propagated:</p>
<p>SHOW SLAVE STATUS\G</p>
<p>The <em>\G</em> forces the client to output the parameters line-by-line instead of in a tabular make-up, making it a lot easier to read.</p>
<p>If you want to add more slaves to the master, simply increment the <em>server-id</em> configuration you set-up, and dump the data from the master in the same format as shown above.</p>
<p>There are more configuration parameters you can give to the slave, such as <em>replicate-do-table</em> which will specify only the tables that are allowed to be replicated, instead of an entire database.</p>
<p>I hope you&#8217;ve found this tutorial helpful, and if, as ever, you have any comments or suggestions, please feel free to leave them! <img src='http://www.jamiehurst.co.uk/wp-includes/images/smilies/icon_smile.gif' alt="MySQL Tutorial: Replication" class='wp-smiley' title="MySQL Tutorial: Replication Photo" /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamiehurst.co.uk/mysql-tutorial-replication/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Version Control with Mercurial</title>
		<link>http://www.jamiehurst.co.uk/version-control-mercurial/</link>
		<comments>http://www.jamiehurst.co.uk/version-control-mercurial/#comments</comments>
		<pubDate>Sun, 01 Aug 2010 11:22:44 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[add]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[binary]]></category>
		<category><![CDATA[bitbucket]]></category>
		<category><![CDATA[clients]]></category>
		<category><![CDATA[clone]]></category>
		<category><![CDATA[commit]]></category>
		<category><![CDATA[configuration management]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[cvs]]></category>
		<category><![CDATA[diff]]></category>
		<category><![CDATA[distribution]]></category>
		<category><![CDATA[hg]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[init]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[local]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[machg]]></category>
		<category><![CDATA[mercurial]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[pull]]></category>
		<category><![CDATA[push]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[remote]]></category>
		<category><![CDATA[remove]]></category>
		<category><![CDATA[repo]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[scm]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[tortoisehg]]></category>
		<category><![CDATA[tortoisesvn]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[version]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.jamiehurst.co.uk/?p=172</guid>
		<description><![CDATA[Three years ago, if someone had asked me what version control was, I would&#8217;ve genuinely had no idea, and I&#8217;m quite ashamed of that. To be quite honest, I would never wish that feeling of simple stupidity on anyone, and so this post will be a quick introduction to the idea behind version control, and [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.jamiehurst.co.uk/wp-content/uploads/mercurial-logo.png"><img class="alignleft size-thumbnail wp-image-191" title="Mercurial Logo" src="http://www.jamiehurst.co.uk/wp-content/uploads/mercurial-logo-125x150.png" alt="Version Control with Mercurial" width="125" height="150" /></a>Three years ago, if someone had asked me what version control was, I would&#8217;ve genuinely had no idea, and I&#8217;m quite ashamed of that. To be quite honest, I would never wish that feeling of simple stupidity on anyone, and so this post will be a quick introduction to the idea behind version control, and how to get to grips with one of the latest SCM (software configuration management) tools, Mercurial, which is my preferred choice at the moment. There are some more traditional SCM tools, such as CVS and Subversion, which still work well in the majority of circumstances, but Mercurial is designed to be a distributed tool, where the source code in its repositories can be worked on from multiple locations at any time, and the merging to the central server handled at a later date.</p>
<h3>Mercurial Basics</h3>
<p>The first thing you&#8217;ll need to do is download the Mercurial binary. As far as I&#8217;m aware, it isn&#8217;t included on any major system distributions, certainly not on Windows or Mac in any case, although it may be packaged up with some Linux offerings. So, your first stop is <a href="http://mercurial.selenic.com/" target="_blank">Mercurial&#8217;s website</a>, which will guide you through the simple installation process. You may also need to install Python if you don&#8217;t already have the language set-up on your system.</p>
<h3>Create a Repository</h3>
<p>Once Mercurial is installed, you&#8217;ll have access to the <strong>hg</strong> command-line tool. This is Mercurial&#8217;s core, and where you&#8217;ll handle all of your version control needs. To create a new repository for a new project, first you need to create a new directory (normally <strong>mkdir</strong> on most systems), then <strong>cd</strong> into that directory and run the following command:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">hg init</pre></td></tr></table></div>

<p>This tells Mercurial to set up the directory as a repository, creating all the hidden files it needs to store the history of the repo and keep track of all the changes. Now create some files that you might want to store in the repo such as some source code, and add them to the repository using this command:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">hg add <span style="color: #7a0874; font-weight: bold;">&#40;</span>files<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></td></tr></table></div>

<p>Finally, you need to commit the changes you&#8217;ve made to the repository, so run this command</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">hg commit <span style="color: #660033;">-m</span> <span style="color: #ff0000;">'My first commit'</span></pre></td></tr></table></div>

<p>Congratulations! Your repository is now at revision 1!</p>
<h3>Managing the Repository</h3>
<p>This is exactly how version control works. You make some changes to the files in the repository, add some new files and possibly remove some old ones, and then commit the changes with a helpful message to remember what you did at a later date. There are just a couple more commands that will help to get you started with your own repository. To remove a file from the repository, use this command:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">hg remove <span style="color: #7a0874; font-weight: bold;">&#40;</span>files<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></td></tr></table></div>

<p>And, to quickly commit all changes, adding and removing any files automatically without using the <strong>hg add</strong> and <strong>hg remove</strong> commands, use the following syntax:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">hg commit <span style="color: #660033;">-Am</span> <span style="color: #ff0000;">'Message'</span></pre></td></tr></table></div>

<h3>Cloning</h3>
<p>Of course, one of Mercurial&#8217;s more powerful abilities is to <strong>clone</strong> other repositories, allowing the user to make changes locally before pushing the changes back to the central server. To clone an existing repository, use the following command:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">hg clone <span style="color: #7a0874; font-weight: bold;">&#40;</span>central-repository<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>destination<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></td></tr></table></div>

<p>Then you can work on the repository as normal. When you&#8217;ve committed some changes and are ready to synchronise with the central server, use the following command:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">hg push</pre></td></tr></table></div>

<p>This pushes all outstanding changes to the server, ensuring it is kept up to date. However, the server could be more up-to-date than your local repository, which would mean you&#8217;d need to <strong>pull</strong> the changes and then update your local repository to the current revision, just like this:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">hg pull
hg update</pre></td></tr></table></div>

<p>And that&#8217;s the basics of using Mercurial&#8217;s cloned repository feature. As ever, I&#8217;m only showing you the very basics here. There are a lot of different circumstances you might want to foresee, such as merging changes between repositories, updating or rolling back to a previous revision, tagging and branching, and more. To read up on these features and how they are jused in the Mercurial tool, the best place is always <a href="http://mecurial.selenic.com/guide" target="_blank">Mercurial&#8217;s website</a>.</p>
<p>Another problem that might arise is how to serve your repositories across the internet. Cloning from a local source works fine, but defeats the purpose of working in a decentralised environment, to clone effectively, you need to be able to do it across the internet. Normally this is done in one of two ways: using SSH as a wrapper for the Mercurial command, or using HTTP to serve the repositories. There are a lot of details to go into with both of these methods, and the best way to do this is search on Google, as I don&#8217;t want to baffle everyone with the details in this simple post. If you&#8217;re not so inclined as to search on Google, here is an example of how to setup <a href="http://malor.se/blog/?p=60" target="_blank">Mercurial to serve using Apache</a>.</p>
<h3>Helpful Clients</h3>
<p>Personally, I hate using the command-line unless I absolutely have to, so if you&#8217;re like me, you&#8217;ll probably want to know if there are any decent clients for Windows, Mac and Linux out there, and luckily, there are!</p>
<p><strong>Windows &#8211; <a href="http://tortoisehg.bitbucket.org/" target="_blank">TortoiseHg</a></strong><br />
Based on the brilliant TortoiseSVN, which integrates nicely with Windows Explorer meaning no nasty gigantic client windows cluttering everything up, TortoiseHg can handle everything from committing and updating, to merging, diff&#8217;ing and more! When I was back using Windows, this was my tool of choice, and did the job very nicely!</p>
<p><strong>Mac &#8211; <a href="http://jasonfharris.com/machg/" target="_blank">MacHg</a></strong><br />
This has only been a recent discovery myself, but MacHg is simply fantastic for managing tons of repos in a GUI environment! The history graphs, simple directory window and helpful icons mean it is really easy to use and live with. It does have a couple of things I would change, such as TextMate integration, but I might have a go at writing a couple of scripts myself to sort out things like that!</p>
<p><strong>Linux</strong><br />
I&#8217;ll be honest, I don&#8217;t use Linux with a desktop very often at all, so I&#8217;m not completely aware of any simple GUI-native interface for Mercurial on this platform. Have a look at <a href="http://mercurial.selenic.com/wiki/OtherTools" target="_blank">Mercurial&#8217;s own list of tools</a> and see whether there is something there that jumps out!</p>
<h3>Bitbucket</h3>
<p>Just one final piece of information. <a href="http://bitbucket.org/" target="_blank">Bitbucket</a> is a fantastic repository centre that will manage projects using Mercurial for you. It only gives you one free private repository currently, but an unlimited number of public ones, so it can be extremely handy for tracking a project and making it available online for others to use. I highly recommend giving this website a look for starting up your Mercurial lifestyle through, as it really does make things a lot easier with wikis, issue tracking, user management and more!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamiehurst.co.uk/version-control-mercurial/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Just a Bit of Local News&#8230;</title>
		<link>http://www.jamiehurst.co.uk/bit-local-news/</link>
		<comments>http://www.jamiehurst.co.uk/bit-local-news/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 12:27:56 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[University]]></category>
		<category><![CDATA[article]]></category>
		<category><![CDATA[echo]]></category>
		<category><![CDATA[future]]></category>
		<category><![CDATA[gazette]]></category>
		<category><![CDATA[jonny scott]]></category>
		<category><![CDATA[lingscars]]></category>
		<category><![CDATA[mark stoddart]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[shields]]></category>
		<category><![CDATA[sunderland]]></category>

		<guid isPermaLink="false">http://www.jamiehurst.co.uk/?p=163</guid>
		<description><![CDATA[Well this is a little bit of news I haven&#8217;t formally written about yet, but last Tuesday, me, Mark and Jonny officially graduated from Sunderland University, all with First class honours degrees in Computing, and needless to say, we&#8217;re all extremely pleased! Having three students at LINGsCARS.com was always a pretty special setup, but the [...]]]></description>
				<content:encoded><![CDATA[<p><img class="alignleft" title="Ling, Jonny, Me and Mark" src="http://www.jamiehurst.co.uk/wp-content/uploads/ling_and_students-150x100.jpg" alt="Just a Bit of Local News..." width="150" height="100" /> Well this is a little bit of news I haven&#8217;t formally written about yet, but last Tuesday, me, Mark and Jonny officially graduated from <a href="http://www.sunderland.ac.uk/" target="_blank">Sunderland University</a>, all with First class honours degrees in Computing, and needless to say, we&#8217;re all extremely pleased! Having three students at <a href="http://www.lingscars.com/" target="_blank">LINGsCARS.com</a> was always a pretty special setup, but the fact that we all graduated at the same time with Firsts was definitely something worth celebrating! So much so, that we decided to contact a local journalist we have had past run-ins with (that&#8217;s a story for another day though&#8230;) and I contacted the university&#8217;s PR department to see if they wanted to make a bit of a story out of it, and as it turns out, they did!</p>
<p>We appeared in the <a href="http://www.sunderlandecho.com/" target="_blank">Sunderland Echo</a> and <a href="http://www.shieldsgazette.com/" target="_blank">Shields Gazette</a> on Thursday, Jonny even seemed to get his own special article in the Gazette, stepping into the limelight and chucking me and Mark behind him! We&#8217;re all extremely pleased, and I&#8217;m personally looking forward to getting recognised all over Tyne and Wear as a local celebrity! I&#8217;ve highlighted the parts of the article that either mention me or mention the specific disasters we seem to create&#8230; (We actually have over 320 database tables now, around 340 at last count, and we&#8217;re always improving the stability, contrary to popular belief!) Ling has put her <a href="http://www.lingscars.com/news.php#sunderlandechouni" target="_blank">own take on the events on her website too</a>.</p>
<p><a href="http://www.jamiehurst.co.uk/wp-content/uploads/sundeland_echo.png"><img class="aligncenter size-medium wp-image-185" title="Article in Sunderland Echo" src="http://www.jamiehurst.co.uk/wp-content/uploads/sundeland_echo-308x400.png" alt="Just a Bit of Local News..." width="308" height="400" /></a></p>
<p><a href="http://www.jamiehurst.co.uk/wp-content/uploads/shields_gazette.png"><img class="aligncenter size-medium wp-image-184" title="Article in Shields Gazette" src="http://www.jamiehurst.co.uk/wp-content/uploads/shields_gazette-233x400.png" alt="Just a Bit of Local News..." width="233" height="400" /></a></p>
<p>Incidentally, I am now a full-time web developer at LINGsCARS.com, and Mark and Jonny are both off to do Masters degrees: Jonny at Southampton and Mark possibly at Newcastle or Bristol! I&#8217;ve decided to bow out of the education system once and for all, I don&#8217;t think I could manage another year of juggling everything doing a Masters degree, and in my opinion I won&#8217;t really learn any more out of it, I&#8217;ll learn much more staying at the wacky company that I&#8217;ve been at for almost three years now!</p>
<p>So here&#8217;s to all of our futures! <img src='http://www.jamiehurst.co.uk/wp-includes/images/smilies/icon_smile.gif' alt="Just a Bit of Local News..." class='wp-smiley' title="Just a Bit of Local News... Photo" /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamiehurst.co.uk/bit-local-news/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->