<?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>woblog &#187; tech</title>
	<atom:link href="http://www.whiteoctober.co.uk/blog/category/tech/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.whiteoctober.co.uk/blog</link>
	<description>great stuff about the web</description>
	<lastBuildDate>Mon, 05 Dec 2011 16:53:15 +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>Sending emails in Silex via Swiftmailer spool</title>
		<link>http://www.whiteoctober.co.uk/blog/2011/08/04/sending-emails-in-silex-via-swiftmailer-spool/</link>
		<comments>http://www.whiteoctober.co.uk/blog/2011/08/04/sending-emails-in-silex-via-swiftmailer-spool/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 14:25:06 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Web technologies]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[Silex]]></category>
		<category><![CDATA[Swiftmailer]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://www.whiteoctober.co.uk/blog/?p=764</guid>
		<description><![CDATA[In Symfony2 it is relatively simple to send emails via a spool file, however in Silex we don&#8217;t have a console. So we&#8217;ll have to make one and it&#8217;s very simple. First you need to have the Symfony2 Console component setup in your Silex project. The following console file is based on the example in [...]]]></description>
			<content:encoded><![CDATA[<p>In Symfony2 it is <a href="http://symfony.com/doc/current/cookbook/email/spool.html">relatively simple</a> to send emails via a spool file, however in <a href="http://silex-project.org/">Silex</a> we don&#8217;t have a console.</p>
<p>So we&#8217;ll have to make one and it&#8217;s very simple.</p>
<p>First you need to have the Symfony2 <a href="https://github.com/symfony/Console">Console component</a> setup in your Silex project.</p>
<p>The following console file is based on the example in <a href="http://beryllium.ca/?p=481">this blog</a> post and the Swiftmailer bundle console.</p>
<p><script src="https://gist.github.com/1125244.js?file=console.php"></script></p>
<p>Make that file executable, or remove the first line and call it through the php cli.</p>
<p>You will also have to do a little change to your current Silex bootstrap file:</p>
<p><script src="https://gist.github.com/1125244.js?file=bootstrap.php"></script></p>
<p>That should be it. This means you can now have a cron running to send emails and to the user they don&#8217;t have the wait while the SMTP server responds.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiteoctober.co.uk/blog/2011/08/04/sending-emails-in-silex-via-swiftmailer-spool/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Functional testing sending emails in Silex</title>
		<link>http://www.whiteoctober.co.uk/blog/2011/08/01/functional-testing-sending-emails-in-silex/</link>
		<comments>http://www.whiteoctober.co.uk/blog/2011/08/01/functional-testing-sending-emails-in-silex/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 11:29:03 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[Test Driven Development]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Silex]]></category>
		<category><![CDATA[Swiftmailer]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://www.whiteoctober.co.uk/blog/?p=760</guid>
		<description><![CDATA[We are slowly starting to fall in love with Silex the Micro Framework built using Symfony2 here at White October towers. Here is a quick code sample which shows how to test emails that are sent using Silex and Swiftmailer. I would recommend using this example app to get Silex and Swiftmailer setup if you [...]]]></description>
			<content:encoded><![CDATA[<p>We are slowly starting to fall in love with <a href="http://silex-project.org/">Silex</a> the Micro Framework built using <a href="http://symfony.com/">Symfony2</a> here at White October towers.</p>
<p>Here is a quick code sample which shows how to test emails that are sent using Silex and Swiftmailer.</p>
<p>I would recommend using <a href="https://github.com/helios-ag/Silex-SwiftMailer-Email-Sending-Example">this example app</a> to get Silex and Swiftmailer setup if you haven&#8217;t got a working setup.</p>
<p>The aim in the code is to stop sending of real email in the test environment and log the messages so we can test them.</p>
<p>Here is a quick gist of the Test class, testing for number of emails sent and the first emails subject.</p>
<p><script src="https://gist.github.com/1117957.js?file=SwiftTest.php"></script></p>
<p>I have copied out the Symfony2 MessageLogger.php class from the SwiftmailerBundle, which I&#8217;ve included in the <a href="https://gist.github.com/1117957">gist</a> for your convenience. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiteoctober.co.uk/blog/2011/08/01/functional-testing-sending-emails-in-silex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A stack of twits</title>
		<link>http://www.whiteoctober.co.uk/blog/2010/06/29/a-stack-of-twits/</link>
		<comments>http://www.whiteoctober.co.uk/blog/2010/06/29/a-stack-of-twits/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 12:57:29 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Web technologies]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.whiteoctober.co.uk/blog/?p=566</guid>
		<description><![CDATA[Here at White October towers we pride ourselves on not knowing everything. This is what the internet was made for. So when we are stumped on a problem we hit the Google. These days however our first point of call for any technical programming problems is Stack Overflow. A quick search of that site usually [...]]]></description>
			<content:encoded><![CDATA[<p>Here at White October towers we pride ourselves on not knowing everything. This is what the internet was made for. So when we are stumped on a problem we hit the <a href="http://google.co.uk">Google</a>. These days however our first point of call for any technical programming problems is <a href="http://stackoverflow.com/">Stack Overflow</a>. A quick search of that site usually turns up someone else with a similar problem and if we are very lucky someone has posted up a solution. If not we post up a question and people will try their best to post an answer.</p>
<p>As we find it a good resource we try and answer questions on things we know about, in turn for answers you get points and sometimes badges.  The badges/points side of things is a little childish but very addictive and a more productive use of time than <a href="http://youtube.com">Youtube</a>.</p>
<p>Recently <a href="http://blog.stackoverflow.com/2010/05/stack-exchange-api-public-beta-starts/">Stack Overflow released an API</a> and I thought that joining Stack Overflow and <a href="http://twitter.com">Twitter</a> together sounded like a fun reason to play with both websites&#8217; APIs.</p>
<p>So <a href="http://stackoftwits.com">Stack of Twits</a> was born and <a href="http://stackapps.com/questions/924/a-stack-of-twits-tweeting-all-over-your-stack">unleashed to the world last night</a>. Simply it sends you a message on <a href="http://twitter.com/">Twitter</a> when a question matches your set of  keywords.</p>
<p><a href="http://www.whiteoctober.co.uk/blog/wp-content/uploads/2010/06/screen_shot.png"><img class="aligncenter size-medium wp-image-571" title="screen_shot" src="http://www.whiteoctober.co.uk/blog/wp-content/uploads/2010/06/screen_shot-300x183.png" alt="" width="300" height="183" /></a></p>
<p>I built the site using our framework of choice <a href="http://www.symfony-project.org/">symfony</a> very quickly. It only took me a few hours over the course of a week or so to get it together. While building it I have made a PHP wrapper for the Stack Overflow API and the plan is to open source this work. Any interest in it pre release please comment below.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiteoctober.co.uk/blog/2010/06/29/a-stack-of-twits/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>woPad</title>
		<link>http://www.whiteoctober.co.uk/blog/2010/04/16/wopad/</link>
		<comments>http://www.whiteoctober.co.uk/blog/2010/04/16/wopad/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 14:27:52 +0000</pubDate>
		<dc:creator>Rich</dc:creator>
				<category><![CDATA[Cool stuff]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[Web technologies]]></category>

		<guid isPermaLink="false">http://www.whiteoctober.co.uk/blog/?p=559</guid>
		<description><![CDATA[Well, not quite, but it was good to check that our site worked without problems on Apple&#8216;s latest offering :-) I took a mini-break to New York last week, and had the chance to pop into the Apple store on 5th Avenue (I love how awesome that sounds). Obviously then I had to try out [...]]]></description>
			<content:encoded><![CDATA[<p>Well, not quite, but it was good to check that our site worked without problems on <a href="http://www.apple.com/">Apple</a>&#8216;s <a href="http://www.apple.com/ipad/">latest offering</a> :-)</p>
<p><a href="http://www.whiteoctober.co.uk/blog/wp-content/uploads/2010/04/IMG_8988.jpg"><img src="http://www.whiteoctober.co.uk/blog/wp-content/uploads/2010/04/IMG_8988-300x225.jpg" alt="The White October site rendered in Safari on the iPad" title="WO site on iPad" width="300" height="225" class="alignleft size-medium wp-image-560" /></a></p>
<p>I took a mini-break to New York last week, and had the chance to pop into the Apple store on 5th Avenue (I love how awesome that sounds).  Obviously then I had to try out the <a href="http://www.apple.com/ipad/">iPad</a> first-hand.  It was clearly the most popular item in-store as the gorgeous MacBook Pros and large iMac demonstration areas were practically empty, with large crowds around the iPad areas.</p>
<p><a href="http://www.whiteoctober.co.uk/blog/wp-content/uploads/2010/04/IMG_8989.jpg"><img src="http://www.whiteoctober.co.uk/blog/wp-content/uploads/2010/04/IMG_8989-e1271428029999-225x300.jpg" alt="Crowds around the iPad demo areas" title="Crowds around the iPad demo areas" width="225" height="300" class="alignleft size-medium wp-image-561" /></a></p>
<p>It&#8217;s a nice device, if a little large for my liking, but very responsive, particularly with regards to the keyboard.  Positioning the iPad horizontally on the provided slanted stand allowed for typing on the on-screen keyboard at the same speed as you would a normal computer keyboard, and was extremely nice.  I was personally quite sceptical back in January when the product was announced, but I did find myself experiencing iPad-envy after playing with the device; travelling back to our hotel on the subway, I noticed about 4 people using them for various activities including reading books and browsing the web.  Suffice to say I restrained myself and didn&#8217;t purchase one sadly!</p>
<p>It&#8217;ll be interesting to see the UK release; by then hopefully all the little niggles will have been ironed out and we&#8217;ll have a solid product.  Watch this space :-)</p>
<p>Oh, and I also came across a stack of paper versions of <a href="http://www.theonion.com/">The Onion</a> hidden in a subway corridor. Very bizarre!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiteoctober.co.uk/blog/2010/04/16/wopad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple shorten url using bit.ly and php</title>
		<link>http://www.whiteoctober.co.uk/blog/2009/11/23/simple-shorten-url-using-bit-ly-and-php/</link>
		<comments>http://www.whiteoctober.co.uk/blog/2009/11/23/simple-shorten-url-using-bit-ly-and-php/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 14:10:11 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[bitly]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.whiteoctober.co.uk/blog/?p=415</guid>
		<description><![CDATA[Inspired by the simple tweet to twitter function by Fabian Potencier I have built a stupidly simple url shorter for bit.ly. Something you are probably going to want to do if you are sending tweets via PHP. function shorten($url, $login, $apikey) { $api_url = "http://api.bit.ly/shorten?version=2.0.1&#38; longUrl=".urlencode($url)."&#38;login=".$login."&#38; apiKey=".$apikey; $ret = file_get_contents($api_url); $data = json_decode($ret); if($data instanceof [...]]]></description>
			<content:encoded><![CDATA[<p>Inspired by the simple <a href="http://fabien.potencier.org/article/20/tweeting-from-php">tweet</a> to <a href="http://twitter.com">twitter</a> function by <a href="http://fabien.potencier.org">Fabian Potencier</a> I have built a stupidly simple url shorter for <a href="http://bit.ly">bit.ly</a>. Something you are probably going to want to do if you are sending tweets via PHP.</p>
<pre><code>function shorten($url, $login, $apikey)
{
  $api_url = "http://api.bit.ly/shorten?version=2.0.1&amp;
                    longUrl=".urlencode($url)."&amp;login=".$login."&amp;
                    apiKey=".$apikey;
  $ret = file_get_contents($api_url);
  $data = json_decode($ret);
  if($data instanceof stdClass &amp;&amp; property_exists($data, "errorCode") &amp;&amp; $data-&gt;errorCode==0)
  {
    foreach($data-&gt;results as $result)
    {
      if(isset($result-&gt;shortUrl))
      {
        return $result-&gt;shortUrl;
      }
    }
  }
  return $url;
}</code></pre>
<p>In the application where I am using this function I have defined the login name and api key as constants, so you can do away with 2 function calls.</p>
<p>Also handily it returns the original url if <a href="http://bit.ly">bit.ly</a> fails.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiteoctober.co.uk/blog/2009/11/23/simple-shorten-url-using-bit-ly-and-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slave out of sync with your master?</title>
		<link>http://www.whiteoctober.co.uk/blog/2009/11/17/slave-out-of-sync-with-your-master/</link>
		<comments>http://www.whiteoctober.co.uk/blog/2009/11/17/slave-out-of-sync-with-your-master/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 12:58:34 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://www.whiteoctober.co.uk/blog/?p=391</guid>
		<description><![CDATA[Hello, I am not growing a Mo. So I have to blog about something technical&#8230; One of our major clients has a Master-Replication setup which we use for failover and backups. However it managed to get itself out of sync. A small example is that it the user table is missing a single user. The [...]]]></description>
			<content:encoded><![CDATA[<p>Hello, I am not growing a <a href="http://www.whiteoctober.co.uk/blog/tag/movember/">Mo</a>. So I have to blog about something technical&#8230;</p>
<p>One of our major clients has a Master-Replication setup which we use for failover and backups. However it managed to get itself out of sync. A small example is that it the user table is missing a single user. The database is so large it is impossible to be sure that this is the only thing missing.</p>
<p>Thankfully there are tools to help in this situation provided by <a href="http://www.maatkit.org">Maatkit</a>, sadly the documentation is a bit vague and lacks direct examples.</p>
<p>Here are my simple steps to get a slave in sync with its master. I would make sure that try this is a demo environment first as during my experiments with these tools it managed to remove data from the master&#8230;which is bad!</p>
<p>Make sure that replication is working before you start this.</p>
<p>1) In the database (<em>mydb</em>) on the <strong>master</strong> I want to create the following table, this stores the checksum data:</p>
<pre><code><span>CREATE TABLE checksum </span><span>(</span><span>
     db         </span><span>char</span><span>(</span><span>64</span><span>)</span><span>     NOT NULL</span><span>,</span><span>
     tbl        </span><span>char</span><span>(</span><span>64</span><span>)</span><span>     NOT NULL</span><span>,</span><span>
     chunk      </span><span>int</span><span>          NOT NULL</span><span>,</span><span>
     boundaries </span><span>char</span><span>(</span><span>100</span><span>)</span><span>    NOT NULL</span><span>,</span><span>
     this_crc   </span><span>char</span><span>(</span><span>40</span><span>)</span><span>     NOT NULL</span><span>,</span><span>
     this_cnt   </span><span>int</span><span>          NOT NULL</span><span>,</span><span>
     master_crc </span><span>char</span><span>(</span><span>40</span><span>)</span><span>         NULL</span><span>,</span><span>
     master_cnt </span><span>int</span><span>              NULL</span><span>,</span><span>
     ts         timestamp    NOT NULL</span><span>,</span><span>
     PRIMARY KEY </span><span>(</span><span>db</span><span>,</span><span> tbl</span><span>,</span><span> chunk</span><span>)</span><span>
</span><span>);</span><span>
</span></code></pre>
<p>2) On the <strong>master</strong> run the following command, which stores the checksum data in the table we just created:</p>
<p><code><span>mk</span><span>-</span><span>table</span><span>-</span><span>checksum </span><span>-</span><span>d mydb </span><span>--</span><span>replicate mydb</span><span>.</span><span>checksum </span><span>127.0</span><span>.</span><span>0.1</span><span><br />
</span></code></p>
<p>3) On the <strong>slave</strong> run the following command, what this does&#8230;I am a touch vague about but it works&#8230;<a href="http://www.maatkit.org/doc/mk-table-sync.html#replicate">read the docs</a> see if you can explain it:</p>
<p><code><span>mk</span><span>-</span><span>table</span><span>-</span><span>sync </span><span>-</span><span>d mydb </span><span>--</span><span>replicate mydb</span><span>.</span><span>checksum </span><span>--</span><span>sync</span><span>-</span><span>to</span><span>-</span><span>master </span><span>--</span><span>no</span><span>-</span><span>foreign</span><span>-</span><span>key</span><span>-</span><span>checks </span><span>--</span><span>execute </span><span>127.0</span><span>.</span><span>0.1</span></code></p>
<p>I hope that this is of some use to someone!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.whiteoctober.co.uk/blog/2009/11/17/slave-out-of-sync-with-your-master/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

