<?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>dev.fuzzee.co.uk &#187; Development</title>
	<atom:link href="http://dev.fuzzee.co.uk/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://dev.fuzzee.co.uk</link>
	<description>stuff that pops into my head ... technical stuff.</description>
	<lastBuildDate>Mon, 23 May 2011 20:43:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Android SDK on 64bit Fedora 14</title>
		<link>http://dev.fuzzee.co.uk/2011/05/android-sdk-on-64bit-fedora-14/</link>
		<comments>http://dev.fuzzee.co.uk/2011/05/android-sdk-on-64bit-fedora-14/#comments</comments>
		<pubDate>Mon, 23 May 2011 20:40:53 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[fedora]]></category>

		<guid isPermaLink="false">http://dev.fuzzee.co.uk/?p=151</guid>
		<description><![CDATA[If you&#8217;re half way through setting up Android SDK on Fedora 14 (and I imagine all other versions apply) on a 64bit install you&#8217;ll get some fairly vague messages back from Ant. Fortunately, they&#8217;re quite easy to fix once you know how. Here&#8217;s the message reported by Ant: Execute failed: java.io.IOException: Cannot run program "/home/adrian/Android/android-sdk-linux_x86/platform-tools/aapt": [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re half way through setting up Android SDK on Fedora 14 (and I imagine all other versions apply) on a 64bit install you&#8217;ll get some fairly vague messages back from Ant. Fortunately, they&#8217;re quite easy to fix once you know how.<br />
<span id="more-151"></span><br />
Here&#8217;s the message reported by Ant:<br />
<code>Execute failed: java.io.IOException: Cannot run program "/home/adrian/Android/android-sdk-linux_x86/platform-tools/aapt": java.io.IOException: error=2, No such file or directory</code></p>
<p>When you actually try and run aapt you might get an even scarier looking error:<br />
<code>bash: /home/adrian/Android/android-sdk-linux_x86/platform-tools/aapt: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory</code></p>
<p>I had a little bit of a panic before I realised that there is officially no 64bit version of the android SDK. After some quick googling, it turns out you need to install some 32bit compat libraries. This process has been documented over on the <a title="HOWTO Setup Android Development" href="https://fedoraproject.org/wiki/User:Hpejakle/Android" target="_blank">Fedora Project Wiki</a>, but I&#8217;ve posted it here in case that page changes:</p>
<p><code>yum install glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i68</code></p>
]]></content:encoded>
			<wfw:commentRss>http://dev.fuzzee.co.uk/2011/05/android-sdk-on-64bit-fedora-14/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wordpress rewrite rules for lighttpd</title>
		<link>http://dev.fuzzee.co.uk/2011/04/wordpress-rewrite-rules-for-lighttpd/</link>
		<comments>http://dev.fuzzee.co.uk/2011/04/wordpress-rewrite-rules-for-lighttpd/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 22:26:23 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://dev.fuzzee.co.uk/?p=140</guid>
		<description><![CDATA[I recently tried to tidy up my hand crafted rewrite rules for wordpress/lighttpd and after a very quick google I was taken to an article titled &#8220;URL rewriting for wordpress and lighttpd&#8220;. Clearly, I thought my search was over. However, I couldn&#8217;t help but notice that one of my previous ramblings PHP was resulting in [...]]]></description>
			<content:encoded><![CDATA[<p>I recently tried to tidy up my hand crafted rewrite rules for wordpress/lighttpd and after a very quick google I was taken to an article titled &#8220;<a href="http://emil.haukeland.name/webservers/2010/url-rewriting-for-wordpress-and-lighttpd/">URL rewriting for wordpress and lighttpd</a>&#8220;. Clearly, I thought my search was over. However, I couldn&#8217;t help but notice that one of my previous ramblings <a href="http://dev.fuzzee.co.uk/2009/09/avoiding-temporary-array-assignment-in-php/">PHP</a> was resulting in a blank page being rendered.</p>
<p><span id="more-140"></span>There was nothing in the error log (although I&#8217;m still twiddling with php-fpm and lighttpd) but I realised that my post title (and URL) ended with &#8220;php&#8221;. Here&#8217;s the rewrite rule:</p>

<div class="wp_syntax"><div class="code"><pre class="lua" style="font-family:monospace;">  url.rewrite-final <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span>
    # Exclude some directories from rewriting
    <span style="color: #ff0000;">&quot;^/(wp-admin|wp-includes|wp-content|gallery2)/(.*)&quot;</span> <span style="color: #66cc66;">=&amp;</span>gt<span style="color: #66cc66;">;</span> <span style="color: #ff0000;">&quot;$0&quot;</span>,
    # Exclude .php files at root from rewriting
    <span style="color: #ff0000;">&quot;^/(.*.php)&quot;</span> <span style="color: #66cc66;">=&amp;</span>gt<span style="color: #66cc66;">;</span> <span style="color: #ff0000;">&quot;$0&quot;</span>,
    # Handle permalinks <span style="color: #b1b100;">and</span> feeds
    <span style="color: #ff0000;">&quot;^/(.*)$&quot;</span> <span style="color: #66cc66;">=&amp;</span>gt<span style="color: #66cc66;">;</span> <span style="color: #ff0000;">&quot;/index.php/$1&quot;</span>
  <span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>But the problem is with:</p>

<div class="wp_syntax"><div class="code"><pre class="lua" style="font-family:monospace;"><span style="color: #ff0000;">&quot;^/(.*.php)&quot;</span> <span style="color: #66cc66;">=&amp;</span>gt<span style="color: #66cc66;">;</span> <span style="color: #ff0000;">&quot;$0&quot;</span>,</pre></div></div>

<p>The single unescaped &#8220;.&#8221; next to &#8220;php&#8221; will translate to &#8220;any character, followed by php&#8221;. What we need is:</p>

<div class="wp_syntax"><div class="code"><pre class="lua" style="font-family:monospace;"><span style="color: #ff0000;">&quot;^/(.*<span style="color: #000099; font-weight: bold;">\.</span>php)&quot;</span> <span style="color: #66cc66;">=&amp;</span>gt<span style="color: #66cc66;">;</span> <span style="color: #ff0000;">&quot;$0&quot;</span>,</pre></div></div>

<p>But, as fate would have it, I only found this out because one of my post titles ended with the word &#8220;php&#8221;. Filed under coincidence.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.fuzzee.co.uk/2011/04/wordpress-rewrite-rules-for-lighttpd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Combining Zend_Db_Select and Propel 1.3</title>
		<link>http://dev.fuzzee.co.uk/2010/04/combining-zend_db_select-and-propel-1-3/</link>
		<comments>http://dev.fuzzee.co.uk/2010/04/combining-zend_db_select-and-propel-1-3/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 13:39:16 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[propel]]></category>
		<category><![CDATA[zend-db]]></category>
		<category><![CDATA[zend-framework]]></category>

		<guid isPermaLink="false">http://dev.fuzzee.co.uk/?p=112</guid>
		<description><![CDATA[Propel 1.3 has served me very well over the past few years and I&#8217;m absolutely confident that recent projects would not have been delivered so quickly without it. However, when stuff gets a little crazy, you need to hydrate your objects using hand-crafted SQL. Building up a SQL in a variable and passing it between [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.propelorm.org">Propel</a> 1.3 has served me very well over the past few years and I&#8217;m absolutely confident that recent projects would not have been delivered so quickly without it.  However, when stuff gets a little crazy, you need to hydrate your objects using hand-crafted SQL. Building up a SQL in a variable and passing it between functions can be a nightmare to get right. Since I was already using Zend Framework, I decided to try and get Propel objects back from a Zend_Db_Select generated query. The <a href="http://www.propelorm.org/wiki/Documentation/1.5/ModelCriteria#RelationalAPI">Relational API</a> in the upcoming 1.5 release of Propel would make this possible without the need for hacks and workarounds&#8230;</p>
<p><span id="more-112"></span></p>
<h2 id="toc-the-quick-fix">The quick fix</h2>
<p>The quickest way to combine the two is to use something like:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">BookPeer<span style="color: #339933;">::</span><span style="color: #004000;">populateObjects</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$select</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">from</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Books'</span><span style="color: #009900;">&#41;</span>
                                 <span style="color: #339933;">-&gt;</span><span style="color: #004000;">where</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'author = ?'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'foo'</span><span style="color: #009900;">&#41;</span>
                                 <span style="color: #339933;">-&gt;</span><span style="color: #004000;">order</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title ASC'</span><span style="color: #009900;">&#41;</span>
                                 <span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
                                 <span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDriverStatement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The magic part is the call to &#8220;getDriverStatement&#8221; which returns the PDOStatement composed by Zend_Db_Statement_Pdo. The only downside to this is that the query will be executed by Zend_Db&#8217;s connection to the database, rather than Propel&#8217;s. If you can live with that then you may stop reading. If, like me, this sort of negligent waste of resources keeps you awake at night, then you need a rather unsightly hack.</p>
<h2 id="toc-sleepless-nights">Sleepless nights</h2>
<p>Zend_Db doesn&#8217;t support any kind of &#8220;setConnection&#8221; method, where you pass in a PDO object. While Propel <strong>does</strong> support this, it only accepts an instance of PropelPDO. Rather than extending Propel, I thought the easiest way around this would be to create a Zend_Db adapter which, upon calling getConnection(), simply delegates back to Propel::getConnection().</p>
<p>The new adapter required a little hacking to get it right. There are a few methods to castrate because, understandably, the abstract adapter does a lot of checking to make sure it&#8217;s configured correctly. Instead, we&#8217;re using a PDO connection, configured elsewhere so any configuration parameters would simply get in the way.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> App_Db_Adapter_Propel_Mysql <span style="color: #000000; font-weight: bold;">extends</span> Zend_Db_Adapter_Pdo_Mysql <span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">// configuration-less construction</span>
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getConnection<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_connect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_connection<span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
   <span style="color: #666666; font-style: italic;">// always use Propel's connection</span>
   <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">function</span> _connect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_connection<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_connection <span style="color: #339933;">=</span> Propel<span style="color: #339933;">::</span><span style="color: #004000;">getConnection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
   <span style="color: #009900;">&#125;</span>
   <span style="color: #666666; font-style: italic;">// allow for no parameters to the constructor</span>
   <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">function</span> __checkRequiredOptions<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span> <span style="color: #000088;">$config</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now we can use the Zend_Db factory (or, because the new adapter does not require any configuration, you could technically just instantiate it directly) to get our new adapter. The select object will use that adapter and we&#8217;ve avoided duplicate db connection attempts.</p>
<h2 id="toc-the-finished-article">The finished article</h2>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'adapterNamespace'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'App_Db_Adapter'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$select</span> <span style="color: #339933;">=</span> Zend_Db<span style="color: #339933;">::</span><span style="color: #004000;">factory</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Propel_Mysql'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$config</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
BookPeer<span style="color: #339933;">::</span><span style="color: #004000;">populateObjects</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$select</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">from</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Books'</span><span style="color: #009900;">&#41;</span>
                                 <span style="color: #339933;">-&gt;</span><span style="color: #004000;">where</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'author = ?'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'foo'</span><span style="color: #009900;">&#41;</span>
                                 <span style="color: #339933;">-&gt;</span><span style="color: #004000;">order</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title ASC'</span><span style="color: #009900;">&#41;</span>
                                 <span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
                                 <span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDriverStatement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://dev.fuzzee.co.uk/2010/04/combining-zend_db_select-and-propel-1-3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Avoiding temporary array assignment in PHP</title>
		<link>http://dev.fuzzee.co.uk/2009/09/avoiding-temporary-array-assignment-in-php/</link>
		<comments>http://dev.fuzzee.co.uk/2009/09/avoiding-temporary-array-assignment-in-php/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 20:09:29 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[brainfart]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zend-framework]]></category>

		<guid isPermaLink="false">http://dev.fuzzee.co.uk/?p=102</guid>
		<description><![CDATA[Even though I&#8217;ve been developing with PHP for a number of years, I still enjoy discovering new ways of working. Even though the stdClass object is about as basic as you can get, it&#8217;s never struck me as being a worthwhile tool. Today, I was storing an associative array of objects in a Zend_Registry. Because [...]]]></description>
			<content:encoded><![CDATA[<p>Even though I&#8217;ve been developing with PHP for a number of years, I still enjoy discovering new ways of working. Even though the stdClass object is about as <strong>basic</strong> as you can get, it&#8217;s never struck me as being a worthwhile tool. <span id="more-102"></span>Today, I was storing an associative array of objects in a <a href="http://framework.zend.com/manual/en/zend.registry.html">Zend_Registry</a>. Because PHP&#8217;s syntax does not support array accessors on method calls, I had to perform a temporary assignation, as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$arrayOfObjects</span> <span style="color: #339933;">=</span> Zend_Registry<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'stuff'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$object</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$arrayOfObjects</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'key'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$object</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">foo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// of course, I could do:</span>
<span style="color: #666666; font-style: italic;">// $arrayOfObjects['key']-&gt;foo();</span>
<span style="color: #666666; font-style: italic;">// but I still need the temporary assignment</span></pre></div></div>

<p>Because I decided to put a <strong>stdClass</strong> object into the Zend_Registry, the code reads a little more fluently:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">Zend_Registry<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'stuff'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">key</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">foo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>As far as I&#8217;m aware, there is no significant penalty for using stdClass, but the results are much nicer.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.fuzzee.co.uk/2009/09/avoiding-temporary-array-assignment-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Replication over SSL</title>
		<link>http://dev.fuzzee.co.uk/2009/06/mysql-replication-over-ssl/</link>
		<comments>http://dev.fuzzee.co.uk/2009/06/mysql-replication-over-ssl/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 17:36:41 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[stunnel]]></category>

		<guid isPermaLink="false">http://dev.fuzzee.co.uk/?p=9</guid>
		<description><![CDATA[A new project requires MySQL replication to be carried out over the internet. My first thought was to use stunnel, which I quickly implemented. This appeared to work perfectly (after some iptables configuration). However, I found out later that MySQL supports replication over SSL natively. I have made the assumption (perhaps mistakenly) that a native [...]]]></description>
			<content:encoded><![CDATA[<p>A new project requires MySQL replication to be carried out over the internet. My first thought was to use <a href="http://www.stunnel.org">stunnel</a>, which I quickly implemented. This appeared to work perfectly (after some iptables configuration). However, I found out later that MySQL supports replication over SSL natively. I have made the assumption (perhaps mistakenly) that a native solution would be better (more reliable?) than a wrapped solution. Getting MySQL replicating over SSL was perhaps about 30 minutes work in total. This could&#8217;ve been cut down to about 10 minutes if it wasn&#8217;t for some documentation-related issues.<br />
<span id="more-9"></span></p>
<ul>
<li>Read MySQL&#8217;s documentation on <a title="Creating SSL Certificates for MySQL" href="http://dev.mysql.com/doc/refman/5.0/en/secure-create-certs.html">creating SSL certificates</a> &#8211; follow <strong>Example 1</strong>, ignoring the bit about client certificates.</li>
<li>Make sure the slave can connect to the master on port 3306. For the security conscious, I don&#8217;t think this is as bad as it sounds &#8211; we restrict access by IP and  our master MySQL server will require SSL credentials.</li>
<li>Modify your master&#8217;s my.cnf file to include the ssl-* configuration options as per the <a href="http://dev.mysql.com/doc/refman/5.1/en/replication-solutions-ssl.html">Replication over SSL document</a></li>
<li>Copy the master&#8217;s new ca-cert.pem, server-cert.pem and server-key.pem files to your slave machine</li>
<li>This is where I fell over &#8211; specify your certificate/key files in CHANGE MASTER TO as demonstrated <a href="http://dev.mysql.com/doc/refman/5.1/en/replication-solutions-ssl.html">here</a> and <strong>not</strong> in the my.cnf. For one reason or another, only the CHANGE MASTER TO method works.
<li><strong>On the DB Master </strong>:<code><br />
GRANT REPLICATION SLAVE ON *.* TO 'slave'@'slave-ip' IDENTIFIED BY 'slavepass' REQUIRE SSL;<br />
FLUSH PRIVILEGES;<br />
</code></li>
<li><strong>On the DB Slave </strong>: <code><br />
START SLAVE;<br />
SHOW SLAVE STATUS;<br />
</code></li>
</ul>
<p>
   By specifying the certificate/key file paths in the <strong>CHANGE MASTER TO</strong> command, we&#8217;ve made sure that the slave tries to connect over SSL &#8211; this is important because without this, the slave would send user/pass information <strong>in plain text</strong>. By specifying <strong>REQUIRES SSL</strong> in our master&#8217;s <strong>GRANT</strong> we&#8217;ve ensured that account can only be used if the client provides the correct SSL details. Similarly, by specifying the slave-ip for the slave user, we&#8217;ve further secured the master mysql server.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.fuzzee.co.uk/2009/06/mysql-replication-over-ssl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wordpress, ahoy</title>
		<link>http://dev.fuzzee.co.uk/2009/06/wordpress-ahoy/</link>
		<comments>http://dev.fuzzee.co.uk/2009/06/wordpress-ahoy/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 12:14:11 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://dev.fuzzee.co.uk/?p=3</guid>
		<description><![CDATA[For the past 7 years I have had good intentions for this domain. All I wanted was to fill it with useful stuff. Unfortunately,  I was always busy playing games with work to actually put in enough time to develop a full CMS with useful tools and a nice user interface. Along comes wordpress and [...]]]></description>
			<content:encoded><![CDATA[<p>For the past 7 years I have had good intentions for this domain. All I wanted was to fill it with useful stuff. Unfortunately,  I was always busy <span style="text-decoration: line-through;">playing games</span> with work to actually put in enough time to develop a full CMS with useful tools and a nice user interface.</p>
<p>Along comes <a href="http://www.wordpress.org" target="_blank">wordpress</a> and very deftly puts to shame any half-baked CMS I ever came up with.</p>
<p>Hopefully, wordpress will bolster my rather stop-start blogging career.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.fuzzee.co.uk/2009/06/wordpress-ahoy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

