<?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>FreelancePHP</title>
	<atom:link href="http://www.freelancephp.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.freelancephp.co.uk</link>
	<description></description>
	<lastBuildDate>Wed, 06 Jul 2011 08:22:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Employer Morality</title>
		<link>http://www.freelancephp.co.uk/2011/07/06/employer-morality/</link>
		<comments>http://www.freelancephp.co.uk/2011/07/06/employer-morality/#comments</comments>
		<pubDate>Wed, 06 Jul 2011 07:49:44 +0000</pubDate>
		<dc:creator>Mark Evans</dc:creator>
				<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://www.freelancephp.co.uk/?p=429</guid>
		<description><![CDATA[Something I have been pondering over the last few days whilst studying a course on management is where in the hierarchy of needs does the morality of ones employer fit. For those who haven't heard of the hierarchy of needs, this was a theory proposed in the 1940's by a social psychologist called Abraham Maslow. [...]]]></description>
			<content:encoded><![CDATA[<p>Something I have been pondering over the last few days whilst studying a course on management is where in the hierarchy of needs does the morality of ones employer fit.</p>
<p>For those who haven't heard of the hierarchy of needs, this was a theory proposed in the 1940's by a social psychologist called Abraham Maslow. This theory revolves around the idea that the behaviour of all human beings revolves around 5 basic innate needs and wants. These are:</p>
<ol>
<li>Physical Needs - Food, Warmth, Shade, Shelter etc</li>
<li>Security Needs - Regular food, Warmth, Shade, Shelter etc</li>
<li>Social Needs - Being part of a team, Social events etc</li>
<li>Recognition Needs - Increased responsilbity and status</li>
<li>Self-Fulfilment needs - Personal Interests, Challenges</li>
</ol>
<p>With some of the stories running in the press recently (NoTW I am looking at you) I started to wonder where about the need for an employer to "appear" moral would fit in the above pyramid.</p>
<p>My initial thoughts are that it would come under the social need, as who would want to be known to work for a company who did some pretty despicable things, I then pondered recognition as that is linked to status, which I am sure <a  href="http://en.wikipedia.org/wiki/Andy_Coulson" target="_blank">Andy Coulson</a> would understand is very linked to the morality of ones employer. And then finally self-fulfilment, could I see myself being fulfilled whilst working for a questionably immoral employer? Personally I don't think I could.</p>
<p>I am not sure I know 100% the answer to the question but I would love to hear from people on what their thoughts are on this post as I am sure there are sides to the argument I haven't thought of or idea's that I haven't considered. I have seen some interpretations of Maslow's hierarchy include Morality under security and self-fulfilment, which would tend to back up my points above.</p>
<p>If you want to read more on this theory, the wikipedia page <a  href="http://en.wikipedia.org/wiki/Maslow&#039;s_hierarchy_of_needs" target="_blank">Maslow's hierarchy of needs</a> is a great place to start.</p>
<p><strong>Disclaimer:</strong> This isn't meant to be an attack on anyone who works for NoTW or any other company you may consider morally questionable, its aimed to provoke debate and discussion only. I also understand that there is criticism of Maslow's hierarchy of needs, this post doesn't aim to debate the validity of that theory, only that the theory exists.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freelancephp.co.uk/2011/07/06/employer-morality/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back to Blogging</title>
		<link>http://www.freelancephp.co.uk/2011/07/03/back-to-blogging/</link>
		<comments>http://www.freelancephp.co.uk/2011/07/03/back-to-blogging/#comments</comments>
		<pubDate>Sun, 03 Jul 2011 12:10:36 +0000</pubDate>
		<dc:creator>Mark Evans</dc:creator>
				<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://www.freelancephp.co.uk/?p=422</guid>
		<description><![CDATA[Its been quite a while since I last blogged anything, partly because I have been quite busy and partly because I didn't have anything interesting to say. Well now a challenge has been set by Russell Smithers to blog more frequently and this is a challenge I have accepted, so prepare for a number of [...]]]></description>
			<content:encoded><![CDATA[<p>Its been quite a while since I last blogged anything, partly because I have been quite busy and partly because I didn't have anything interesting to say.</p>
<p>Well now a challenge has been set by <a  href="http://www.rdjs.co.uk/a-midsummers-blogging-resolution/50" target="_blank">Russell Smithers</a> to blog more frequently and this is a challenge I have accepted, so prepare for a number of posts over the next few weeks/months on a wide range of topics.</p>
<p>I'll be writing the first of my real blog posts in the coming days and if anyone has some suggestions on what they would like to see blogged about post them here and I'll be sure to work through them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freelancephp.co.uk/2011/07/03/back-to-blogging/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>osCommerce and PHP 5.3</title>
		<link>http://www.freelancephp.co.uk/2011/04/06/oscommerce-and-php-5-3/</link>
		<comments>http://www.freelancephp.co.uk/2011/04/06/oscommerce-and-php-5-3/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 04:30:42 +0000</pubDate>
		<dc:creator>Mark Evans</dc:creator>
				<category><![CDATA[osCommerce]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP programming language]]></category>

		<guid isPermaLink="false">http://www.freelancephp.co.uk/?p=390</guid>
		<description><![CDATA[To follow up on my previous articles about osCommerce and the BSD Licence and osCommerce and the CLA this article aims to explain some of the reasons behind why osCommerce 3.x has a minimum requirement of PHP 5.3 I had been pondering PHP 5.3 for quite some time towards the end of 2009 and into [...]]]></description>
			<content:encoded><![CDATA[<p>To follow up on my previous articles about <a  href="http://www.freelancephp.co.uk/2011/04/04/oscommerce-and-the-bsd-licence/" target="_blank">osCommerce and the BSD Licence</a> and <a  href="http://www.freelancephp.co.uk/2011/04/05/oscommerce-and-the-cla/" target="_blank">osCommerce and the CLA</a> this article aims to explain some of the reasons behind why osCommerce 3.x has a minimum requirement of PHP 5.3</p>
<p>I had been pondering PHP 5.3 for quite some time towards the end of 2009 and into 2010, and had some discussions with various open source developers during the <a  href="http://www.freelancephp.co.uk/2010/04/18/jump-in-camp-overview/" target="_blank">Jump in Camp</a> about what their plans were for PHP 5.3. We had also been discussing it internally as if we were going to adopt PHP 5.3 then it was best to take full advantage of the new namespace support to ensure the core framework was a clean as possible.</p>
<p>In May 2010 I released a blog post titled <a  href="http://www.freelancephp.co.uk/2010/05/02/php-5-3-and-the-future/" target="_blank">PHP 5.3 and the Future</a> to try and gauge wider community feedback on the issue.</p>
<p>This kicked off a number of discussions in the background about where PHP was heading and how we could best make osCommerce 3.x as flexible as possible to ensure that we wouldn't need to rebuild from the ground up in a few years. From talking with many people from other open source projects who were also all heading towards the PHP 5.3 minimum requirement it seemed like a no-brainer. Once we'd had chance to experiment with the namespace implementation and could see just how much better our framework would be, developing it for PHP 5.2 seemed to be a very costly mistake.</p>
<p>We didn't just jump into this blindly however, we fully understood what this meant in terms of osCommerce 3.x adoption and even last year there were fewer hosting companies offering PHP 5.3 support than there are now. The outcome from all of that was that we decided to jump to PHP 5.3 as the benefits far outweighed the negatives.</p>
<p>One of the concerns that many people from the community have expressed is the lack of support from hosting companies for PHP 5.3, I personally don't think that its a problem when you take the bigger picture into account.</p>
<p>As late as December last year it was announced that PHP 5.2 had reached <a  href="http://www.php.net/archive/2010.php#id2010-12-16-1" target="_blank">End of Life</a>, I had been expecting this to happen at some point so it didn't come as a huge surprise. What this means is that PHP 5.2 would no longer be receiving bug fixes (PHP 5.2.17 aside) or security updates. This would then leave hosting companies with a choice, if they would like to maintain the ability to offer PCI compliant hosting then they would need to move to a version of PHP which was supported and updated. This all pointed to the likelihood that adoption of PHP 5.3 for hosting companies would gain traction at an increasingly rapid pace, of course this wasn't guaranteed so there was an element of risk involved.</p>
<p>It should also be fairly obvious that the landscape of the hosting industry has changed, back in 2001 pretty much everyone was using shared hosting packages as these were really the only ones that were affordable to the average user. The hosting companies were in full control and moving to a different hosting company was incredibly painful experience.</p>
<p>These days however the situation is radically different, Cloud / VPS hosting solutions are now widely available and at a price point that makes them affordable even for the newest of start up online stores. Both of which are able to support PHP 5.3 without affecting any other user. It is now also much easier for hosting companies to offer multiple versions of PHP on the same server, something which also wasn't as easy (if not almost impossible) back in 2001.</p>
<p>The end result is the user now has a lot of choice on where to host their sites and moving between hosts is now incredibly simple (compared to 2001). In my personal opinion any hosting company that won't offer PHP 5.3 will simply get left behind. Users can now vote with their feet and move to a company that offers them the solution they need which has reversed who is really in the driving seat when it comes to adoption.</p>
<p>The reverse option would of been to hold back the whole community just so that we could support users who were using hosting companies that would end up in the minority, I personally think this is a very short-sighted view when you are trying to build a framework that will still hopefully be in use in another 11 years.</p>
<p>Now that the core framework is out there and is being actively worked on, I think deciding to use PHP 5.3 as the minimum requirement was one of the best decisions we ever made.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freelancephp.co.uk/2011/04/06/oscommerce-and-php-5-3/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>osCommerce and the CLA</title>
		<link>http://www.freelancephp.co.uk/2011/04/05/oscommerce-and-the-cla/</link>
		<comments>http://www.freelancephp.co.uk/2011/04/05/oscommerce-and-the-cla/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 19:35:01 +0000</pubDate>
		<dc:creator>Mark Evans</dc:creator>
				<category><![CDATA[osCommerce]]></category>
		<category><![CDATA[BSD licenses]]></category>
		<category><![CDATA[Contributor License Agreement]]></category>
		<category><![CDATA[GNU General Public License]]></category>
		<category><![CDATA[Open source licenses]]></category>

		<guid isPermaLink="false">http://www.freelancephp.co.uk/?p=368</guid>
		<description><![CDATA[To follow-up to my previous posting about osCommerce and the BSD Licence I will now try and answer some of the misconceptions around the new CLA (Contributor License Agreement) which was added as part of the osCommerce 3.x release. I will also aim to make this into an official FAQ document when time allows. The [...]]]></description>
			<content:encoded><![CDATA[<p>To follow-up to my previous posting about <a  href="http://www.freelancephp.co.uk/2011/04/04/oscommerce-and-the-bsd-licence/" target="_blank">osCommerce and the BSD Licence</a> I will now try and answer some of the misconceptions around the new <a  href="http://countdown.oscommerce.com/index.php?Developers&#038;CLA" target="_blank">CLA</a> (Contributor License Agreement) which was added as part of the osCommerce 3.x release. I will also aim to make this into an official FAQ document when time allows.</p>
<p>The reason we have decided to include the need to sign a CLA before contributions can be accepted into the osCommerce core  is to ensure that the entire community can understand the terms under which the code has been contributed to the project. Signing the CLA <strong>does not change your rights to use your own Contributions</strong> for any other purpose and only applies to contributions which you want to be considered for inclusion into the <strong>"Core"</strong> framework. The CLA <strong>does not apply</strong> to community addons which are available from the addons site.</p>
<p>The CLA is here to protect the rights of the community to ensure that any code which is included as part of the core framework is removed from licensing and patent restrictions.</p>
<blockquote><p>Q. Do I need to agree to the CLA to create community addons for osCommerce 3.x?</p>
<p>A. <strong>No</strong>. Only contributions which you would like to be considered for the <strong>"core"</strong> framework require the CLA to be agreed to.</p></blockquote>
<blockquote><p>Q. If my contribution is accepted in the <strong>"core"</strong> framework for osCommerce 3.x what does that mean?</p>
<p>A. By agreeing to the CLA you are providing osCommerce a non-exclusive, irrevocable, worldwide, royalty-free, sublicenseable, transferable license.</p></blockquote>
<blockquote><p>Q. What does this license allow?</p>
<p>A. You agree to let osCommerce use, copy, prepare derivative works of, distribute and publicly perform and display on any licensing terms your contribution to the "core" framework, including without limitation be distributed under open source licenses such the the GNU General Public License / BSD License and also be included in binary only / commercial projects.</p></blockquote>
<blockquote><p>Q. Can I still use any contribution I make to the osCommerce <strong>"core"</strong> framework for other projects?</p>
<p>A. <strong>Yes</strong>. Agreeing to the CLA and allowing your code to be considered for inclusion into the <strong>"core"</strong> framework in no way affects your rights to use your code in any way you like.</p></blockquote>
<p>In summary, the CLA is there to help make clear that any contributions included into the <strong>"core"</strong> framework are without restriction and that anyone contributing code has the right to do so, free of any restriction such as intellectual property or patent and that they have the legal right to agree to the terms of the CLA.</p>
<p>I am sure that we can encourage developers to contribute to the framework and by doing so, they can help us make it as stable and as flexible as possible. Now is the time for community to embrace open source and get involved.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freelancephp.co.uk/2011/04/05/oscommerce-and-the-cla/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>osCommerce and the BSD Licence</title>
		<link>http://www.freelancephp.co.uk/2011/04/04/oscommerce-and-the-bsd-licence/</link>
		<comments>http://www.freelancephp.co.uk/2011/04/04/oscommerce-and-the-bsd-licence/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 21:13:15 +0000</pubDate>
		<dc:creator>Mark Evans</dc:creator>
				<category><![CDATA[osCommerce]]></category>
		<category><![CDATA[Free software licenses]]></category>
		<category><![CDATA[GNU General Public License]]></category>

		<guid isPermaLink="false">http://www.freelancephp.co.uk/?p=337</guid>
		<description><![CDATA[There have been a number of comments made about the license change of osCommerce 3.x to the BSD. This post aims to dispel some of the confusion around the change and will hopefully be the primer for a proper FAQ on www.oscommerce.com when I have some time. If there are any questions you have that [...]]]></description>
			<content:encoded><![CDATA[<p>There have been a number of comments made about the license change of osCommerce 3.x to the <a  href="http://countdown.oscommerce.com/index.php?article=opensourcerocks" target="_blank">BSD</a>. This post aims to dispel some of the confusion around the change and will hopefully be the primer for a proper FAQ on <a  href="http://www.oscommerce.com" target="_blank">www.oscommerce.com</a> when I have some time. If there are any questions you have that you would like answered post them here as comments and I will make sure to include them in the official FAQ.</p>
<blockquote><p>Q. Is the BSD License used compatible with the GNU General Public License?</p>
<p>A. <strong>Yes</strong>. osCommerce 3.x is using the 3-clause BSD license which is fully compatible with the GNU General Public License</p></blockquote>
<blockquote><p>Q. What versions of osCommerce does the BSD License apply to?</p>
<p>A. The BSD License is for osCommerce 3.x</p></blockquote>
<blockquote><p>Q. Will osCommerce 2.x still be released under the GNU General Public License?</p>
<p>A. <strong>Yes</strong>, the license for osCommerce 2.x has not changed</p></blockquote>
<blockquote><p>Q. What licence are addons for osCommerce 3.x released under?</p>
<p>A. Developers now have the choice to release their Add-Ons under a BSD compatible license or to continue using the GNU General Public License.</p></blockquote>
<blockquote><p>Q. Why change the license?</p>
<p>A. The GNU General Public License has served us well for 11 years however we want to create even more business possibilities and opportunities for store owners, developers, and our community. Changing the licence helps make that possible.</p></blockquote>
<blockquote><p>Q. Where can I find out more information about the different licenses?</p>
<p>A. There is an interesting article / video from Redhat which is worth watching <a  href="http://www.redhat.com/magazine/006apr05/features/licenses/" target="_blank">http://www.redhat.com/magazine/006apr05/features/licenses/</a>. You can also check out <a  href="http://en.wikipedia.org/wiki/BSD_licenses" target="_blank">Wikipedia</a></p></blockquote>
<blockquote><p>Q. Can I use osCommerce 3.x addons released under the GNU General Public License in a binary only/commercial closed source project?</p>
<p>A. <strong>No.</strong> The change to using the BSD licence for the core of osCommerce doesn't remove the viral part of the GNU General Public License. If you use GNU General Public Licensed code in your project the source code <strong>must</strong> be provided to comply with the licence. If you want to release a project as binary only then you will not be able to use any addons that are licenced under the GNU General Public License</p></blockquote>
<blockquote><p>Q. Can developers release osCommerce 3.x under the GNU General Public License?</p>
<p>A. No. Only osCommerce has the right to change the licensing of the core framework</p></blockquote>
<blockquote><p>Q. Can developers include BSD licensed community addons in projects released under the GNU General Public License?</p>
<p>A. Yes. However including BSD code in a GNU General Public License project doesn't change the licence of the code. It is still released under the BSD license.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.freelancephp.co.uk/2011/04/04/oscommerce-and-the-bsd-licence/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Secure File Synchronisation with SSH and rsync</title>
		<link>http://www.freelancephp.co.uk/2011/02/06/secure-file-synchroniation-with-ssh-and-rsync/</link>
		<comments>http://www.freelancephp.co.uk/2011/02/06/secure-file-synchroniation-with-ssh-and-rsync/#comments</comments>
		<pubDate>Sun, 06 Feb 2011 01:34:50 +0000</pubDate>
		<dc:creator>Mark Evans</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OpenSSH]]></category>
		<category><![CDATA[Password]]></category>
		<category><![CDATA[private key]]></category>
		<category><![CDATA[public key]]></category>
		<category><![CDATA[remote server]]></category>
		<category><![CDATA[Rsync]]></category>
		<category><![CDATA[Secure Shell]]></category>

		<guid isPermaLink="false">http://www.freelancephp.co.uk/?p=312</guid>
		<description><![CDATA[Quite often I want to be able to do a backup of some files / folders on a remote server. So far I have been doing this quite successfully using public/private key authentication with scp and then entering my passphrase when prompted. This has worked pretty well for me but now I want to automate [...]]]></description>
			<content:encoded><![CDATA[<p>Quite often I want to be able to do a backup of some files / folders on a remote server. So far I have been doing this quite successfully using public/private key authentication with scp and then entering my passphrase when prompted.</p>
<p>This has worked pretty well for me but now I want to automate this with a cron job. Since I am human and quite forgetful automating this will ensure that I never again fail to complete a backup of some critical data. A problem now arises however in how to secure this. I don't want to have to store a password or passphrase in the crontab so I need to find a new way.</p>
<p>After some googling and some experimentation I finally have working something which I am sure real sysadmins have been aware of for a while and that is the ability to restrict a ssh via public/private key to specific commands.</p>
<p>In order to get this to work for myself I did the following steps.</p>
<p>Firstly I created a new passphrase-less rsa key</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="bash"><pre class="de1"><span class="kw2">ssh-keygen</span> <span class="re5">-t</span> rsa
Generating public<span class="sy0">/</span>private rsa key pair.
Enter <span class="kw2">file</span> <span class="kw1">in</span> <span class="kw2">which</span> to save the key <span class="br0">&#40;</span><span class="sy0">/</span>home<span class="sy0">/</span>username<span class="sy0">/</span>.ssh<span class="sy0">/</span>id_rsa<span class="br0">&#41;</span>: <span class="sy0">/</span>home<span class="sy0">/</span>username<span class="sy0">/</span>.ssh<span class="sy0">/</span>rsync_backup
Enter passphrase <span class="br0">&#40;</span>empty <span class="kw1">for</span> no passphrase<span class="br0">&#41;</span>: 
Enter same passphrase again: 
Your identification has been saved <span class="kw1">in</span> <span class="sy0">/</span>home<span class="sy0">/</span>username<span class="sy0">/</span>.ssh<span class="sy0">/</span>rsync_backup.
Your public key has been saved <span class="kw1">in</span> <span class="sy0">/</span>home<span class="sy0">/</span>username<span class="sy0">/</span>.ssh<span class="sy0">/</span>rsync_backup.pub.</pre></div></div></div></div></div></div></div>


<p>Next I copied the public key to the server I wanted to backup and added this to the <em>/home/remoteuser/.ssh/authorized_keys</em></p>
<p>I then tested to make sure that I could login to the remote server using ssh</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="bash"><pre class="de1"><span class="kw2">ssh</span> <span class="re5">-i</span> <span class="sy0">/</span>home<span class="sy0">/</span>username<span class="sy0">/</span>.ssh<span class="sy0">/</span>rsync_backup remoteuser<span class="sy0">@</span>remotehost</pre></div></div></div></div></div></div></div>


<p>Once I had confirmed that it was all working with ssh the next step was to lock down the key to a specific IP address. Since this was an internal system I knew which IP address would be used to connect.</p>
<p>I edited the <em>/home/remoteuser/.ssh/authorized_keys</em> to look like the following</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="bash"><pre class="de1"><span class="re2">from</span>=<span class="st0">&quot;192.168.1.50&quot;</span> ssh-rsa <span class="sy0">&lt;</span>public key<span class="sy0">&gt;</span></pre></div></div></div></div></div></div></div>


<p>I then tested ssh login again to make sure I didn't mess anything up</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="bash"><pre class="de1"><span class="kw2">ssh</span> <span class="re5">-i</span> <span class="sy0">/</span>home<span class="sy0">/</span>username<span class="sy0">/</span>.ssh<span class="sy0">/</span>rsync_backup remoteuser<span class="sy0">@</span>remotehost</pre></div></div></div></div></div></div></div>


<p>All was still working. To play devils advocate I also tried to connect from a different IP and my connection was denied successfully.</p>
<p>Next up I needed to check on connection what command was being called to ensure that only rsync was permitted. After a lot of googling around I came across the following</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="bash"><pre class="de1"><span class="co0">#!/bin/sh</span>
<span class="re2">logfile</span>=<span class="sy0">/</span>var<span class="sy0">/</span>log<span class="sy0">/</span>rsync_backup.log
<span class="kw1">case</span> <span class="st0">&quot;<span class="es2">$SSH_ORIGINAL_COMMAND</span>&quot;</span> <span class="kw1">in</span>
<span class="sy0">*</span>\<span class="sy0">&amp;*</span><span class="br0">&#41;</span>
<span class="kw3">echo</span> <span class="sy0">`</span><span class="kw2">date</span><span class="sy0">`</span> <span class="st0">&quot;- SSH connection rejected&quot;</span> <span class="sy0">&gt;&gt;</span> <span class="re1">$logfile</span>
<span class="sy0">;;</span>
<span class="sy0">*</span>\<span class="br0">&#40;</span><span class="sy0">*</span><span class="br0">&#41;</span>
<span class="kw3">echo</span> <span class="sy0">`</span><span class="kw2">date</span><span class="sy0">`</span> <span class="st0">&quot;- SSH connection rejected&quot;</span> <span class="sy0">&gt;&gt;</span> <span class="re1">$logfile</span>
<span class="sy0">;;</span>
<span class="sy0">*</span>\<span class="br0">&#123;</span><span class="sy0">*</span><span class="br0">&#41;</span>
<span class="kw3">echo</span> <span class="sy0">`</span><span class="kw2">date</span><span class="sy0">`</span> <span class="st0">&quot;- SSH connection rejected&quot;</span> <span class="sy0">&gt;&gt;</span> <span class="re1">$logfile</span>
<span class="sy0">;;</span>
<span class="sy0">*</span>\;<span class="sy0">*</span><span class="br0">&#41;</span>
<span class="kw3">echo</span> <span class="sy0">`</span><span class="kw2">date</span><span class="sy0">`</span> <span class="st0">&quot;- SSH connection rejected&quot;</span> <span class="sy0">&gt;&gt;</span> <span class="re1">$logfile</span>
<span class="sy0">;;</span>
<span class="sy0">*</span>\<span class="sy0">&lt;*</span><span class="br0">&#41;</span>
<span class="kw3">echo</span> <span class="sy0">`</span><span class="kw2">date</span><span class="sy0">`</span> <span class="st0">&quot;- SSH connection rejected&quot;</span> <span class="sy0">&gt;&gt;</span> <span class="re1">$logfile</span>
<span class="sy0">;;</span>
<span class="sy0">*</span>\<span class="sy0">`*</span><span class="br0">&#41;</span>
<span class="kw3">echo</span> <span class="sy0">`</span><span class="kw2">date</span><span class="sy0">`</span> <span class="st0">&quot;- SSH connection rejected&quot;</span> <span class="sy0">&gt;&gt;</span> <span class="re1">$logfile</span>
<span class="sy0">;;</span>
<span class="sy0">*</span>\<span class="sy0">|*</span><span class="br0">&#41;</span>
<span class="kw3">echo</span> <span class="sy0">`</span><span class="kw2">date</span><span class="sy0">`</span> <span class="st0">&quot;- SSH connection rejected&quot;</span> <span class="sy0">&gt;&gt;</span> <span class="re1">$logfile</span>
<span class="sy0">;;</span>
rsync\ --server<span class="sy0">*</span><span class="br0">&#41;</span>
<span class="br0">&#123;</span>
  <span class="kw3">echo</span> <span class="sy0">`</span><span class="kw2">date</span><span class="sy0">`</span> <span class="st0">&quot;- SSH connection accepted&quot;</span> <span class="sy0">&gt;&gt;</span> <span class="re1">$logfile</span>
  <span class="re1">$SSH_ORIGINAL_COMMAND</span>
<span class="br0">&#125;</span>
<span class="sy0">;;</span>
<span class="sy0">*</span><span class="br0">&#41;</span>
<span class="kw3">echo</span> <span class="sy0">`</span><span class="kw2">date</span><span class="sy0">`</span> <span class="st0">&quot;- SSH connection rejected&quot;</span> <span class="sy0">&gt;&gt;</span> <span class="re1">$logfile</span>
<span class="sy0">;;</span>
<span class="kw1">esac</span></pre></div></div></div></div></div></div></div>


<p>This script checks the SSH command to be run and rejects it if anything other than rsync is being used.</p>
<p>I once again edited the <em>/home/remoteuser/.ssh/authorized_keys</em> to add the command restriction so that it looked like the following</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="bash"><pre class="de1"><span class="re2">from</span>=<span class="st0">&quot;192.168.1.50&quot;</span>, <span class="re2">command</span>=<span class="st0">&quot;/home/remoteuser/check-rsync.sh&quot;</span> ssh-rsa <span class="sy0">&lt;</span>public key<span class="sy0">&gt;</span></pre></div></div></div></div></div></div></div>


<p>I then checked to see what would happen if I tried to login using ssh</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="bash"><pre class="de1"><span class="kw2">ssh</span> <span class="re5">-i</span> <span class="sy0">/</span>home<span class="sy0">/</span>username<span class="sy0">/</span>.ssh<span class="sy0">/</span>rsync_backup remoteuser<span class="sy0">@</span>remotehost</pre></div></div></div></div></div></div></div>


<p>This time my connection was denied. Checking my logfile I saw the following entry</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="bash"><pre class="de1">Sun Feb <span class="nu0">6</span> 00:<span class="nu0">51</span>:<span class="nu0">58</span> GMT <span class="nu0">2011</span> - SSH connection rejected</pre></div></div></div></div></div></div></div>


<p>Now the final test... could I use the public/private key to connect and run the rsync command. To do this I ran</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="bash"><pre class="de1">rsync <span class="re5">-avz</span> <span class="re5">-e</span> <span class="st0">&quot;ssh -i /home/username/.ssh/rsync_backup&quot;</span> remoteuser<span class="sy0">@</span>remotehost:<span class="sy0">/</span>home<span class="sy0">/</span>remoteuser<span class="sy0">/</span>datatobackup <span class="sy0">/</span>home<span class="sy0">/</span>username<span class="sy0">/</span>remotehost</pre></div></div></div></div></div></div></div>


<p>And low and behold my files were downloaded</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="bash"><pre class="de1">receiving <span class="kw2">file</span> list ... <span class="kw1">done</span>
home<span class="sy0">/</span>remoteuser<span class="sy0">/</span>datatobackup<span class="sy0">/</span>file1.txt
home<span class="sy0">/</span>remoteuser<span class="sy0">/</span>datatobackup<span class="sy0">/</span>file7.txt
sent <span class="nu0">98</span> bytes  received <span class="nu0">2331</span> bytes  <span class="nu0">1619.33</span> bytes<span class="sy0">/</span>sec
total <span class="kw2">size</span> is <span class="nu0">32663</span>  speedup is <span class="nu0">13.45</span></pre></div></div></div></div></div></div></div>


<p>Job Completed. I can now just set this up as a cron job to run every night and sleep easy in the knowledge that all the valuable data I need is safely backed up.</p>
<p>I would love to hear any feedback on this solution and any tips for ways to improve it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freelancephp.co.uk/2011/02/06/secure-file-synchroniation-with-ssh-and-rsync/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Query Analysis &#8211; Explain Extended</title>
		<link>http://www.freelancephp.co.uk/2011/01/16/mysql-query-analysis-explain-extended/</link>
		<comments>http://www.freelancephp.co.uk/2011/01/16/mysql-query-analysis-explain-extended/#comments</comments>
		<pubDate>Sun, 16 Jan 2011 08:30:18 +0000</pubDate>
		<dc:creator>Mark Evans</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[MySQL Performance]]></category>
		<category><![CDATA[Query plan]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.freelancephp.co.uk/?p=275</guid>
		<description><![CDATA[I have recently discovered a feature in MySQL which is useful in debugging performance issues with queries. We all know about the EXPLAIN statement which looks something like EXPLAIN SELECT statement This is used to display information from the optimizer about the query execution plan for the SELECT statement including information about how tables are [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently discovered a feature in MySQL which is useful in debugging performance issues with queries.</p>
<p>We all know about the EXPLAIN statement which looks something like</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="sql"><pre class="de1"><span class="kw1">EXPLAIN</span> <span class="kw1">SELECT</span> statement</pre></div></div></div></div></div></div></div>


<p>This is used to display information from the optimizer about the query execution plan for the SELECT statement including information about how tables are joined and in which order. There is also a second statement called <em>EXPLAIN EXTENDED</em> which will provide even more information about what is happening under the hood.</p>
<p>To show you how this works lets take a common query from the current development version of osCommerce 3.x</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="sql"><pre class="de1"><span class="kw1">EXPLAIN</span> <span class="kw1">SELECT</span> <span class="kw1">DISTINCT</span> p<span class="sy0">.</span>products_id <span class="kw1">FROM</span> osc_products p <span class="kw1">LEFT</span> <span class="kw1">JOIN</span> osc_product_attributes pa <span class="kw1">ON</span> <span class="br0">&#40;</span>p<span class="sy0">.</span>products_id <span class="sy0">=</span> pa<span class="sy0">.</span>products_id<span class="br0">&#41;</span> <span class="kw1">LEFT</span> <span class="kw1">JOIN</span> osc_templates_boxes tb <span class="kw1">ON</span> <span class="br0">&#40;</span>pa<span class="sy0">.</span>id <span class="sy0">=</span> tb<span class="sy0">.</span>id <span class="kw1">AND</span> tb<span class="sy0">.</span>code <span class="sy0">=</span> <span class="st0">&quot;Manufacturers&quot;</span><span class="br0">&#41;</span><span class="sy0">,</span> osc_products_description pd<span class="sy0">,</span> osc_categories c<span class="sy0">,</span> osc_products_to_categories p2c <span class="kw1">WHERE</span> p<span class="sy0">.</span>products_status <span class="sy0">=</span> <span class="nu0">1</span> <span class="kw1">AND</span> p<span class="sy0">.</span>products_id <span class="sy0">=</span> pd<span class="sy0">.</span>products_id <span class="kw1">AND</span> pd<span class="sy0">.</span>language_id <span class="sy0">=</span> <span class="nu0">1</span> <span class="kw1">AND</span> p<span class="sy0">.</span>products_id <span class="sy0">=</span> p2c<span class="sy0">.</span>products_id <span class="kw1">AND</span> p2c<span class="sy0">.</span>categories_id <span class="sy0">=</span> c<span class="sy0">.</span>categories_id</pre></div></div></div></div></div></div></div>


<p>You should get some output similar to the following</p>
<p><a  href="/wp-content/uploads/2011/01/explain_mysql.png" title="MySQL Explain Example" class="thickbox"><br />
  <img src="/wp-content/uploads/2011/01/explain_mysql-300x45.png" alt="MySQL Explain Example" /><br />
</a></p>
<p>As you can see there is lots of useful information there to help understand just what is happening. But it seems the MySQL engine has some other things it would like to tell us. And we get to this extra information by adding the keyword EXTENDED in combination with SHOW WARNINGS to get information about how query looks after transformation as well as any other notes the optimizer may wish to tell us.</p>
<p>Here is the same query again but with some extra information.</p>
<p><a  href="/wp-content/uploads/2011/01/mysql_explain_extended.png" title="MySQL Explain Extended" class="thickbox"><br />
  <img src="/wp-content/uploads/2011/01/mysql_explain_extended-300x45.png" alt="MySQL Explain Extended" /><br />
</a></p>
<p>You can see there is a new column here called "filtered" which was added in MySQL 5.1.12. This column indicates an estimated percentage of table rows that will be filtered by the table condition. </p>
<p>Now if we send the statement</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="sql"><pre class="de1"><span class="kw1">SHOW</span> WARNINGS \G</pre></div></div></div></div></div></div></div>


<p>We get back exactly how the optimizer has changed the query internally before executing it</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="sql"><pre class="de1"><span class="kw1">SELECT</span> <span class="kw1">DISTINCT</span> <span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`p`</span><span class="sy0">.</span><span class="st0">`products_id`</span> <span class="kw1">AS</span> <span class="st0">`products_id`</span> <span class="kw1">FROM</span> <span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`osc_products`</span> <span class="st0">`p`</span> <span class="kw1">LEFT</span> <span class="kw1">JOIN</span> <span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`osc_product_attributes`</span> <span class="st0">`pa`</span> <span class="kw1">ON</span><span class="br0">&#40;</span><span class="br0">&#40;</span><span class="br0">&#40;</span><span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`p`</span><span class="sy0">.</span><span class="st0">`products_id`</span> <span class="sy0">=</span> <span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`pd`</span><span class="sy0">.</span><span class="st0">`products_id`</span><span class="br0">&#41;</span> <span class="kw1">AND</span> <span class="br0">&#40;</span><span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`p2c`</span><span class="sy0">.</span><span class="st0">`products_id`</span> <span class="sy0">=</span> <span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`pd`</span><span class="sy0">.</span><span class="st0">`products_id`</span><span class="br0">&#41;</span> <span class="kw1">AND</span> <span class="br0">&#40;</span><span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`pa`</span><span class="sy0">.</span><span class="st0">`products_id`</span> <span class="sy0">=</span> <span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`pd`</span><span class="sy0">.</span><span class="st0">`products_id`</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw1">LEFT</span> <span class="kw1">JOIN</span> <span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`osc_templates_boxes`</span> <span class="st0">`tb`</span> <span class="kw1">ON</span><span class="br0">&#40;</span><span class="br0">&#40;</span><span class="br0">&#40;</span><span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`tb`</span><span class="sy0">.</span><span class="st0">`code`</span> <span class="sy0">=</span> <span class="st0">'Manufacturers'</span><span class="br0">&#41;</span> <span class="kw1">AND</span> <span class="br0">&#40;</span><span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`tb`</span><span class="sy0">.</span><span class="st0">`id`</span> <span class="sy0">=</span> <span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`pa`</span><span class="sy0">.</span><span class="st0">`id`</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw1">JOIN</span> <span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`osc_products_description`</span> <span class="st0">`pd`</span> <span class="kw1">JOIN</span> <span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`osc_categories`</span> <span class="st0">`c`</span> <span class="kw1">JOIN</span> <span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`osc_products_to_categories`</span> <span class="st0">`p2c`</span> <span class="kw1">WHERE</span> <span class="br0">&#40;</span><span class="br0">&#40;</span><span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`c`</span><span class="sy0">.</span><span class="st0">`categories_id`</span> <span class="sy0">=</span> <span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`p2c`</span><span class="sy0">.</span><span class="st0">`categories_id`</span><span class="br0">&#41;</span> <span class="kw1">AND</span> <span class="br0">&#40;</span><span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`pd`</span><span class="sy0">.</span><span class="st0">`language_id`</span> <span class="sy0">=</span> <span class="nu0">1</span><span class="br0">&#41;</span> <span class="kw1">AND</span> <span class="br0">&#40;</span><span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`p`</span><span class="sy0">.</span><span class="st0">`products_id`</span> <span class="sy0">=</span> <span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`pd`</span><span class="sy0">.</span><span class="st0">`products_id`</span><span class="br0">&#41;</span> <span class="kw1">AND</span> <span class="br0">&#40;</span><span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`p2c`</span><span class="sy0">.</span><span class="st0">`products_id`</span> <span class="sy0">=</span> <span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`pd`</span><span class="sy0">.</span><span class="st0">`products_id`</span><span class="br0">&#41;</span> <span class="kw1">AND</span> <span class="br0">&#40;</span><span class="st0">`osc3`</span><span class="sy0">.</span><span class="st0">`p`</span><span class="sy0">.</span><span class="st0">`products_status`</span> <span class="sy0">=</span> <span class="nu0">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span></pre></div></div></div></div></div></div></div>


<p>As you can see to get better performance the engine has changed the order of the query. Using this knowledge it is possible for the developer to understand exactly what the optimizer is doing and possibly find a better way to achieve the same results.</p>
<p>Hopefully I am not the only person in the world who didn't know about this EXTENDED option <img src='http://www.freelancephp.co.uk/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.freelancephp.co.uk/2011/01/16/mysql-query-analysis-explain-extended/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jump In Camp – SQL Server Edition – Day 3</title>
		<link>http://www.freelancephp.co.uk/2011/01/15/jump-in-camp-%e2%80%93-sql-server-edition-%e2%80%93-day-3/</link>
		<comments>http://www.freelancephp.co.uk/2011/01/15/jump-in-camp-%e2%80%93-sql-server-edition-%e2%80%93-day-3/#comments</comments>
		<pubDate>Sat, 15 Jan 2011 15:07:14 +0000</pubDate>
		<dc:creator>Mark Evans</dc:creator>
				<category><![CDATA[Jump in Camp]]></category>
		<category><![CDATA[MS SQL Server]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[osCommerce]]></category>
		<category><![CDATA[Seattle]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Management Studio]]></category>
		<category><![CDATA[SQL Server Migration Assistant]]></category>
		<category><![CDATA[Transact-SQL]]></category>

		<guid isPermaLink="false">http://www.freelancephp.co.uk/?p=260</guid>
		<description><![CDATA[Day 3 of Jump in Camp started roughly the same as Day 2 except that I managed to get a few extra hours of sleep before having breakfast at 7.30. The first subject of the day was about porting SQL queries to T-SQL. Transact-SQL (T-SQL) is Microsoft's proprietary extension to SQL and varies from the MySQL version of [...]]]></description>
			<content:encoded><![CDATA[<p>Day 3 of Jump in Camp started roughly the same as Day 2 except that I managed to get a few extra hours of sleep before having breakfast at 7.30.</p>
<p>The first subject of the day was about porting SQL queries to T-SQL. Transact-SQL (<strong>T-SQL</strong>) is Microsoft's proprietary extension to SQL and varies from the MySQL version of SQL which most open-source developers are used too. For information on the differences and how to convert MySQL to T-SQL Microsoft provide a useful guide to the most common issues developers will have.</p>
<p>The guide can be downloaded from <a  href="http://download.microsoft.com/download/7/C/2/7C20B070-BFF8-44B4-BD7D-1B03DF50F924/MigrateMySQLtoSQLServer2008.docx" target="_blank">Guide to Migrating from MySQL to SQL Server 2008</a> and as you can see there are a number of differences which need to be dealt with by the developer. Most issues can be dealt with and both MySQL and SQL Server can supported simultaneously as long as you are prepared to think about how you write SQL statements to take into account the nuances.</p>
<p>The other path open to developers is to use something like <a  href="http://www.doctrine-project.org/" target="_blank">Doctrine</a> which will abstract these differences away from the developer. SQL Server support has also added to <a  href="http://kohanaframework.org/" target="_blank">Kohana</a> and <a  href="http://lithify.me/" target="_blank">Lithium</a> so if you use either of those frameworks, adding support for SQL Server should be much less painful.</p>
<p>Just as I started to have panic attacks on just how much work it would be to get osCommerce to support SQL Server we were shown a rather cool tool which is called SSMA (SQL Server Migration Assistant) this will take a MySQL database and will convert its data structure and also the data itself and convert it into a format which SQL Server can understand. I tested this tool against the current 3.x database structure which is being used in osCommerce and because we hadn't really ever supported any databases apart from MySQL I expected a number of problems to be flagged up.</p>
<p>After running through the tool however I was pleased to see that the entire database structure and all of the sample data we provide was migrated to SQL-Server without a hitch. Kudos to the SSMA team for their hard work in making it light work for me! If you are interested in trying SSMA out you can download it from <a  href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=0e6168b0-2d0c-4076-96c2-60bd25294a8e&#038;displaylang=en" target="_blank">Microsoft SQL Server Migration Assistant 2008 for MySQL</a></p>
<p>Much discussion was had about how we could best support SQL Server in osCommerce and we decided that a new database layer was needed in order to provide support for all of the database platforms osCommerce will officially support and also allow extensibility so that other platforms could be added without needing to re-write large swathes of core code. This work is currently in progress and hopefully the fruits of our labour can be commited into the<a  href="https://github.com/osCommerce/oscommerce" target="_blank"> Github repository</a> soon.</p>
<p>After lunch came a series of interesting talks about how to optimize the T-SQL once you had it working. Most developers these days should know about the EXPLAIN statement in MySQL which will tell you how MySQL has executed a SELECT statement.</p>
<p>SQL Server has a pretty awesome graphical tool which is built into SQL Server Management Studio and provides more than enough information to help developers decipher what is going on under the hood to get the best performance possible out of SQL Server. I won't go into details on how to use the tools I have mentioned here but I will be blogging on the specifically very soon with a walkthrough on converting the current osCommerce 3.x database structure to SQL Server and also how to use the SQL Server Management Studio to discover how your T-SQL is performing.</p>
<p>After an afternoon of discussions and talks about optimisation of T-SQL and SQL Server in general it was time for us to prepare for a small road-trip to the <a  href="http://www.spaceneedle.com/" target="_blank">Space Needle</a> where we would be spending the evening having dinner and relaxing.</p>
<p>I think this had to be one of the highlights of the whole Jump in Camp as the view from the top was amazing. The food and drink in the Restaurant was also top notch and I couldn't find fault with anything apart from the Wind which was absolutely freezing when out on the observation deck.</p>
<p>The evening was rounded off with some good debates in the hotel bar over a few beers about what interoperability really meant and of course some really good banter about getting a Linux version of the SQL Server driver <img src='http://www.freelancephp.co.uk/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Was then time for sleep in readiness for the fun of Day 4</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freelancephp.co.uk/2011/01/15/jump-in-camp-%e2%80%93-sql-server-edition-%e2%80%93-day-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Jump In Camp – SQL Server Edition – Day 2</title>
		<link>http://www.freelancephp.co.uk/2011/01/09/jump-in-camp-%e2%80%93-sql-server-edition-%e2%80%93-day-2/</link>
		<comments>http://www.freelancephp.co.uk/2011/01/09/jump-in-camp-%e2%80%93-sql-server-edition-%e2%80%93-day-2/#comments</comments>
		<pubDate>Sun, 09 Jan 2011 10:00:04 +0000</pubDate>
		<dc:creator>Mark Evans</dc:creator>
				<category><![CDATA[Jump in Camp]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Seattle]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.freelancephp.co.uk/?p=242</guid>
		<description><![CDATA[Despite my initial reservations it seems getting up in time for breakfast at 7.30am was easier than I thought. Due to the timezone difference I actually awoke at about 4am and then had trouble getting back to sleep. Luckily there was free WIFI at the hotel so I spent a few hours checking up what [...]]]></description>
			<content:encoded><![CDATA[<p>Despite my initial reservations it seems getting up in time for breakfast at 7.30am was easier than I thought. Due to the timezone difference I actually awoke at about 4am and then had trouble getting back to sleep. Luckily there was free WIFI at the hotel so I spent a few hours checking up what was happening in the rest of the world.</p>
<p>The first job for the day after breakfast was to head over to the Microsoft Redmond Campus. A short coach ride and we were there. I knew the campus was big but didn't quite realise how big until I was really there.</p>
<p>Our first visit stop was Building 35 which is the home of SQL Server. After getting our security passes organised we where escorted upstairs to a meeting room where we were introduced to <a  href="http://www.microsoft.com/presspass/exec/kummert/" target="_blank">Ted Kummert</a> and <a  href="http://www.microsoft.com/presspass/exec/de/Ellis/default.mspx" target="_blank">Nigel Ellis</a> where an overview of the history of SQL Server was given and also some discussion on <a  href="http://www.microsoft.com/en-us/sqlazure/default.aspx" target="_blank">SQL Azure</a>.</p>
<p>The expected question soon arose of which I am sure Microsoft cringe every time someone asks it... that being "<em>When we there be a *nix version of the SQL Server driver</em>". Much discussion ensued about the many reasons the open-source community and some commercial companies wanted it and the many reasons it wasn't yet available from Microsoft. I sure hope that one day it will be available but at this moment in time I am not expecting anything to be done about it in the near future.</p>
<p>Next up we had chance to visit the Microsoft store and <a  href="http://www.microsoft.com/about/companyinformation/visitorcenter/en/us/default.aspx" target="_blank">Visitor centre</a> where we had chance to see some of the many different products that Microsoft had worked on over the years. After some shopping and playing with the <a  href="http://www.xbox.com/en-GB/kinect" target="_blank">Xbox Kinect</a> it was time to head back to the hotel for some lunch before the afternoons activities.</p>
<p>The first thing up in the afternoon was a surprise session of which we knew nothing about and involved us drumming and playing various musical instruments (and there was even some bad dancing at one-point). The idea being to try and get us to understand how different people working together can contribute in harmony even if the tools they are using are different.</p>
<p>Once we were all loosened up it was time to crack out the laptops and get down to the real reason we were all there... coding!</p>
<p>The first challenge was to work on porting our various applications to either the sqlsvr (native) driver or the PDO_SQLSVR driver. This was obviously easier for some projects that had abstraction layers in place already, for osCommerce however it was a little bit more work so progress was initially slow.</p>
<p>Towards the end of the afternoon my brain was getting pretty fried, the timezone difference and lack of sleep was certainly taking its toll. Luckily the evening didn't involve going too far with dinner in the hotel and then some xbox gaming.</p>
<p>Along with the rest of the hotel the food they provided was always excellent, I think I ate so much I thought I was going to burst! It certainly hindered me for the next part of the evening. Harald's flight had also landed by this time so I was looking forward to catching up with him again.</p>
<p>So onto the gamimg... In one of the various rooms in the hotel had been setup 2 Xbox 360's with the new Kinect controller after spending some time getting them calibrated the game was on.. the winner was to get to take a Kinect controller home with them. As you can imagine there was some frantic competition and the game settled on was "Ralleyball" which is part of the Kinect adventures game.</p>
<p>This short video should give you an idea of the game</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/ncPkaOFdiNc?fs=1&amp;hl=en_US" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="640" height="385" src="http://www.youtube.com/v/ncPkaOFdiNc?fs=1&amp;hl=en_US" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>After numerous rounds and also numerous beers the eventual winner was none other than <a  href="http://blog.preinheimer.com/" target="_blank">Paul Reinheimer</a> by the end I was totally exhausted from all the cheering (and drinking) so it was time to hit the hay and try and do a better job and sleeping through the timezone differences, ready for what was install for Day 3!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freelancephp.co.uk/2011/01/09/jump-in-camp-%e2%80%93-sql-server-edition-%e2%80%93-day-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Jump in Camp &#8211; SQL Server Edition &#8211; The Photos</title>
		<link>http://www.freelancephp.co.uk/2011/01/08/jump-in-camp-sql-server-edition-the-photos/</link>
		<comments>http://www.freelancephp.co.uk/2011/01/08/jump-in-camp-sql-server-edition-the-photos/#comments</comments>
		<pubDate>Sat, 08 Jan 2011 20:15:39 +0000</pubDate>
		<dc:creator>Mark Evans</dc:creator>
				<category><![CDATA[Jump in Camp]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Seattle]]></category>

		<guid isPermaLink="false">http://www.freelancephp.co.uk/?p=226</guid>
		<description><![CDATA[Here is just a selection of the many photo's I took during my time at Jump in Camp.]]></description>
			<content:encoded><![CDATA[<p>Here is just a selection of the many photo's I took during my time at Jump in Camp.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="600" height="500" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="flashvars" value="offsite=true&amp;lang=en-us&amp;page_show_url=%2Fphotos%2F58046893%40N02%2Fsets%2F72157625777675746%2Fshow%2F&amp;page_show_back_url=%2Fphotos%2F58046893%40N02%2Fsets%2F72157625777675746%2F&amp;set_id=72157625777675746&amp;jump_to=" /><param name="allowFullScreen" value="true" /><param name="src" value="http://www.flickr.com/apps/slideshow/show.swf?v=71649" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="600" height="500" src="http://www.flickr.com/apps/slideshow/show.swf?v=71649" allowfullscreen="true" flashvars="offsite=true&amp;lang=en-us&amp;page_show_url=%2Fphotos%2F58046893%40N02%2Fsets%2F72157625777675746%2Fshow%2F&amp;page_show_back_url=%2Fphotos%2F58046893%40N02%2Fsets%2F72157625777675746%2F&amp;set_id=72157625777675746&amp;jump_to="></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.freelancephp.co.uk/2011/01/08/jump-in-camp-sql-server-edition-the-photos/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

