<?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>blog.andrewbruce.net</title>
	<atom:link href="http://blog.andrewbruce.net/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.andrewbruce.net</link>
	<description>Ruby on Rails for breakfast lunch and dinner, with some Amazon AWS snacks and lots of RSI</description>
	<lastBuildDate>Fri, 30 Sep 2011 06:44:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Last night&#8217;s dream</title>
		<link>http://blog.andrewbruce.net/last-nights-dream</link>
		<comments>http://blog.andrewbruce.net/last-nights-dream#comments</comments>
		<pubDate>Fri, 30 Sep 2011 06:44:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.andrewbruce.net/?p=299</guid>
		<description><![CDATA[I got off the tube and all of the walkways were drifting around, because they were suspended from the ceiling by rusty chains. I was the only person who had to lie down and crawl to the exit. I was &#8230; <a href="http://blog.andrewbruce.net/last-nights-dream">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I got off the tube and all of the walkways were drifting around, because they were suspended from the ceiling by rusty chains. I was the only person who had to lie down and crawl to the exit.<br />
<span id="more-299"></span><br />
I was in such a hurry to leave, I left by the wrong exit, which was the lobby of a posh hotel. To leave I had to run a gauntlet of greasy English breakfast-style food that was being kept warm, and was unappetising.</p>
<p>Once outside, I realised I&#8217;d left my friends in another city as I stubbornly wanted to see this one, even though it was pretty run down. It was a small Indian town, it was raining, and there was a fish stall allowing you to sponsor parts of the fish that were labelled with different prices. Some people had apparently already sponsored parts of it for as much as £200.</p>
<p>Realising I was carrying a bag of cement in a large woman&#8217;s handbag slung over my shoulder, I had to consolidate that with my backpack to avoid looking feminine.</p>
<p>I found my way to a hardware store, a chain of which I&#8217;d previously visited in my own country. It was mostly second hand junk. I was also carrying a camera on a piece of shower flex, and it had a light on the other end.</p>
<p>Browsing around the store, I found a similar item being demonstrated by a woman, and there was a crowd gathering around the demo, watching a screen displaying what the camera saw. I pushed to the front of the crowd and put my eye against the lens, then put my camera&#8217;s lens against hers. To try to entertain the crowd, I turned the light on and shone it into the demo lens. I thanked her, because I&#8217;d finally found a use for the junk I&#8217;d bought.</p>
<p>Answers on a postcard, I suppose.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewbruce.net/last-nights-dream/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>respond_to ordering still causing havoc with Internet Explorer 7</title>
		<link>http://blog.andrewbruce.net/respond_to-ordering-still-causing-havoc-with-internet-explorer-7</link>
		<comments>http://blog.andrewbruce.net/respond_to-ordering-still-causing-havoc-with-internet-explorer-7#comments</comments>
		<pubDate>Mon, 11 Jul 2011 22:50:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.andrewbruce.net/?p=291</guid>
		<description><![CDATA[At least a year ago, I ran into this guy&#8217;s problem. Today, I just ran into a similar situation with Rails 3&#8242;s class-level respond_to / instance-level respond_with pattern. I had the following declarations at the controller&#8217;s class level: I only &#8230; <a href="http://blog.andrewbruce.net/respond_to-ordering-still-causing-havoc-with-internet-explorer-7">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>At least a year ago, I ran into <a href="http://www.brentmc79.com/posts/ie7-accept-header-and-rails-respon-to-bug">this guy&#8217;s problem</a>. Today, I just ran into a similar situation with Rails 3&#8242;s class-level respond_to / instance-level respond_with pattern.<br />
<span id="more-291"></span><br />
I had the following declarations at the controller&#8217;s class level:</p>
<p><script src="https://gist.github.com/1076988.js?file=class_level.rb"></script></p>
<p>I only wanted the JSON format for the create action, so I thought this would be pretty harmless. It isn&#8217;t. In Internet Explorer 7, the first declaration causes refreshes of the DesignsController#index action to return the JSON representation, whereas initial page loads show the HTML version. Swapping the first and second declarations fixed this issue.</p>
<p>I presume that the cause is the same as the linked article?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewbruce.net/respond_to-ordering-still-causing-havoc-with-internet-explorer-7/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why is serving YUI3 over HTTPS so hard?</title>
		<link>http://blog.andrewbruce.net/why-is-serving-yui3-over-https-so-hard</link>
		<comments>http://blog.andrewbruce.net/why-is-serving-yui3-over-https-so-hard#comments</comments>
		<pubDate>Fri, 27 May 2011 18:15:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[HTTPS]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://blog.andrewbruce.net/?p=275</guid>
		<description><![CDATA[Yahoo! don&#8217;t have a HTTPS YUI3 endpoint. This means that you have to do some work to serve YUI3 if you want to avoid Internet Explorer users from getting warnings about mixed content (and you do). That work, for me &#8230; <a href="http://blog.andrewbruce.net/why-is-serving-yui3-over-https-so-hard">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Yahoo! don&#8217;t have a HTTPS YUI3 endpoint. This means that you have to do some work to serve YUI3 if you want to avoid Internet Explorer users from getting warnings about mixed content (and you do). That work, for me at least, was particularly troublesome. However, I eventually found a simple method for solving the majority of the issues I was having.<br />
<span id="more-275"></span></p>
<h2>The royal paths</h2>
<p>There are a few semi-official options for running YUI3 over SSL:</p>
<ul>
<li>Using the <a href="http://developer.yahoo.com/yui/phploader/">PHP Loader</a> and hosting your own combo service</li>
<li>Using a custom combo service like <a href="https://github.com/rgrove/combohandler">Combo Handler for Node</a></li>
<li>Using <a href="http://developer.yahoo.com/yui/3/configurator/">the dependency configurator</a></li>
</ul>
<p><strong>None of the above worked for me.</strong></p>
<p>Firstly, the PHP Loader is buggy and requires some code changing to make it work anyway. After a day or two of playing with that I gave up on it.</p>
<p>Secondly, I got distracted by some efforts to do combo services in node.js. This was silly, introducing an enormous new set of dependencies to my Rails app would have been torture.</p>
<p>Thirdly, the dependency configurator is great, but you need to know what you depend on. The chances are, though, you don&#8217;t. YUI&#8217;s clever loader only loads the bits it needs for the browser it&#8217;s running on. If you customise a rollup that works with Chrome, the chances are that it won&#8217;t work on Internet Explorer 7 (for example) because you won&#8217;t have included the compatibility modules.</p>
<h2>The peasant&#8217;s path</h2>
<p>So how did I solve this horrible problem? I wanted to know exactly which modules were being loaded by the lowest-common-denominator browser to be supported by the project, which was Internet Explorer 7. On a more modern browser, you&#8217;d have a nice developer console. Getting such a thing for IE7 is like self harm.</p>
<p>As it happens, I&#8217;d installed <a href="http://www.fiddler2.com/fiddler2/">Fiddler</a> on my IE7 VM to track down some other rogue SSL requests (it later turned out to be <a href="https://github.com/Modernizr/Modernizr/issues/214">a Modernizr bug</a>). Using Fiddler whilst browsing around the site I could find the modules being loaded by YUI. Happily, the compatibility modules don&#8217;t negatively impact modern browsers (apart from being an extra download).</p>
<p>Once I&#8217;d found the modules being loaded, I curl&#8217;d the official YUI3 combo URL into a file (without minification, as this is done in the project in a deployment step). This file could then be served on my project&#8217;s own CDN. Sorted.</p>
<p>I should note that the process above sounds really easy. Conversely, it was one of the most frustrating development problems I&#8217;ve come across in my career. If you&#8217;re listening, Yahoo!, please host your combo service for SSL. Please.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewbruce.net/why-is-serving-yui3-over-https-so-hard/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Resolving Cucumber step ambiguities</title>
		<link>http://blog.andrewbruce.net/resolving-cucumber-step-ambiguities</link>
		<comments>http://blog.andrewbruce.net/resolving-cucumber-step-ambiguities#comments</comments>
		<pubDate>Sat, 26 Mar 2011 12:54:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[BDD]]></category>
		<category><![CDATA[Cucumber]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.andrewbruce.net/?p=248</guid>
		<description><![CDATA[Following the latest campaign against imperative Cucumber stories in favour of declarative stories (see especially Dan North&#8217;s great article on domain languages), I&#8217;ve been trying to get more naturalistic language into my stories. However, it becomes very easy to run &#8230; <a href="http://blog.andrewbruce.net/resolving-cucumber-step-ambiguities">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Following the latest campaign against imperative <a href="http://cukes.info/">Cucumber</a> stories in favour of declarative stories (see especially <a href="http://dannorth.net/2011/01/31/whose-domain-is-it-anyway/">Dan North&#8217;s great article on domain languages</a>), I&#8217;ve been trying to get more naturalistic language into my stories. However, it becomes very easy to run into step ambiguities, something that Cucumber can try to handle on its own with <code>--guess</code>, but that I&#8217;d rather just resolve for it instead.<br />
<span id="more-248"></span><br />
I&#8217;ve been trying to reuse human descriptions for page elements in selectors.rb to say that those elements described can themselves be seen. I want to be able to say any of the following:</p>
<blockquote><p>I should see &#8220;blah&#8221; within the cart summary<br />
I should see the 1st design within the cart summary<br />
I should see the cart summary
</p></blockquote>
<p>&#8220;the cart summary&#8221; here is defined in selectors.rb as, for example:</p>
<p><script src="https://gist.github.com/888252.js?file=area_selector.rb"></script></p>
<p>However, when adding a simple implementation of a &#8220;I should see&#8221; step that used selectors, I ran into an ambiguity. Here are the ambiguous steps:</p>
<p><script src="https://gist.github.com/888252.js?file=ambiguous_steps.rb"></script></p>
<p>And here&#8217;s the type of error you&#8217;ll get:</p>
<p><script src="https://gist.github.com/888252.js?file=error.txt"></script></p>
<p>I resolved the ambiguity with some use of negative look-ahead:</p>
<p><script src="https://gist.github.com/888252.js?file=unambiguous_step.rb"></script></p>
<p>This says that the step should match &#8220;I should see &#8230;&#8221; steps, so long as they don&#8217;t contain the string &#8220;within&#8221; or have quotation marks. The &#8220;(?:&#8221; designates a non-capturing group, whereas the &#8220;(?!&#8221; designates a negative look-ahead.</p>
<p>While I&#8217;m on the subject, I think that the antipathy towards <a href="https://github.com/ianwhite/pickle">Pickle</a> is misplaced. Pickle is great for keeping state about models in stories. However, using only the built-in steps is quite foolish, and will definitely end up in some unreadable stories.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewbruce.net/resolving-cucumber-step-ambiguities/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make Solr / sunspot_rails, Cucumber and VCR bestest buddies</title>
		<link>http://blog.andrewbruce.net/make-solr-sunspot_rails-cucumber-and-vcr-bestest-buddies</link>
		<comments>http://blog.andrewbruce.net/make-solr-sunspot_rails-cucumber-and-vcr-bestest-buddies#comments</comments>
		<pubDate>Fri, 28 Jan 2011 22:14:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.andrewbruce.net/?p=224</guid>
		<description><![CDATA[After spending the morning banging my head against another Cucumber problem, I thought the best way to spend an afternoon would be to run into another hilarious jape that Rails 3 threw at me. Since acts_as_ferret is basically dead for &#8230; <a href="http://blog.andrewbruce.net/make-solr-sunspot_rails-cucumber-and-vcr-bestest-buddies">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After spending the morning banging my head against <a href="/always-define-controller-action-methods-in-rails-3">another Cucumber problem</a>, I thought the best way to spend an afternoon would be to run into another hilarious jape that Rails 3 threw at me.<br />
<span id="more-224"></span><br />
Since <a href="http://j-k.lighthouseapp.com/projects/45560-acts-as-ferret/tickets/176-aaf-051-undefined-method-includes_values-for-conditionssymbol">acts_as_ferret is basically dead for Rails 3</a>, I decided to move a project to <a href="http://lucene.apache.org/solr/">Solr</a>. <a href="https://github.com/outoftime/sunspot_rails">sunspot_rails</a> works brilliantly, until you start using Cucumber. For a few hours that felt like days, I couldn&#8217;t understand why in the development environment my Solr searches were working, while in cucumber nothing came back at all.</p>
<p>I spent a while trying to implement <a href="http://blog.trydionel.com/2010/02/06/testing-sunspot-with-cucumber/">this fix</a> for our project, to no avail.</p>
<p>The solution: for a reason I&#8217;m yet to fathom to do with the way / frequency that Solr indexes stuff, you must do an explicit <code>Sunspot.commit</code> to ensure any database changes have been stored in the index. I added this to the end of a step definition that set up some data before a search step, and hey presto!</p>
<p><strong>UPDATE:</strong> commits normally occur when a controller action finishes, hence why you need to do them manually when creating records outside of controller actions. <a href="http://outoftime.github.com/sunspot/rails/docs/classes/Sunspot/Rails/RequestLifecycle.html">sunspot_rails inserts an after_filter to do this</a>. </p>
<p>To get to this point, I added some debug lines to net/http in the get and post methods, just to dump out the bodies of the requests and responses. They were initially showing POSTs like:</p>
<p><script src="https://gist.github.com/801108.js?file=gistfile1.xml"></script></p>
<p>But after the change, the all-important commit element is added to the end as a separate request:</p>
<p><script src="https://gist.github.com/801110.js?file=gistfile1.xml"></script></p>
<p>After I&#8217;d discovered this little bastard, VCR worked fine, and now I&#8217;ve recorded the responses from Solr I&#8217;ll no longer need to faff with a separate search server.</p>
<p><strong>UPDATE 2:</strong> adding an AfterStep hook with <code>Sunspot.commit_if_dirty</code> helped DRY up my step definitions.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewbruce.net/make-solr-sunspot_rails-cucumber-and-vcr-bestest-buddies/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Always define controller action methods in Rails 3</title>
		<link>http://blog.andrewbruce.net/always-define-controller-action-methods-in-rails-3</link>
		<comments>http://blog.andrewbruce.net/always-define-controller-action-methods-in-rails-3#comments</comments>
		<pubDate>Fri, 28 Jan 2011 15:19:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.andrewbruce.net/?p=221</guid>
		<description><![CDATA[This morning was spent puzzling over a strange hard-to-reproduce Cucumber test failure in a project I have been upgrading from Rails 2.3.x to 3.0.3. It was only occurring after certain steps had been taken in previous Scenarios, and not when &#8230; <a href="http://blog.andrewbruce.net/always-define-controller-action-methods-in-rails-3">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This morning was spent puzzling over a strange hard-to-reproduce Cucumber test failure in a project I have been upgrading from Rails 2.3.x to 3.0.3. It was only occurring after certain steps had been taken in previous Scenarios, and not when the failing Scenario was run on its own.</p>
<p>The solution was to explicitly define the controller action&#8217;s method in the controller. So the question to the world is: what changed, ActionController or something in the Cucumber chain?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewbruce.net/always-define-controller-action-methods-in-rails-3/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ActiveRecord errors full_messages i18n incompatibility</title>
		<link>http://blog.andrewbruce.net/activerecord-errors-full_messages-i18n-incompatibility</link>
		<comments>http://blog.andrewbruce.net/activerecord-errors-full_messages-i18n-incompatibility#comments</comments>
		<pubDate>Mon, 03 Jan 2011 01:30:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.andrewbruce.net/?p=216</guid>
		<description><![CDATA[If you&#8217;re running a Rails 2 app on a system with the latest i18n gem, ActiveRecord&#8217;s object.errors.full_messages spits out the string &#8220;{{attribute}} {{message}}&#8221;. You might notice that this is the old interpolation syntax for internationalisation in Rails 2. The latest &#8230; <a href="http://blog.andrewbruce.net/activerecord-errors-full_messages-i18n-incompatibility">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re running a Rails 2 app on a system with the latest i18n gem, ActiveRecord&#8217;s object.errors.full_messages spits out the string &#8220;{{attribute}} {{message}}&#8221;. You might notice that this is the old interpolation syntax for internationalisation in Rails 2. The latest i18n gem requires the %{} syntax. Sticking this into config/locales/en.yml fixed the problem for me, and future-proofs an app for when you accidentally upgrade the i18n gem on your production server:</p>
<p><script src="https://gist.github.com/763019.js?file=gistfile1.yml"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewbruce.net/activerecord-errors-full_messages-i18n-incompatibility/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Notes on a Rails 3 upgrade</title>
		<link>http://blog.andrewbruce.net/notes-on-a-rails-3-upgrade</link>
		<comments>http://blog.andrewbruce.net/notes-on-a-rails-3-upgrade#comments</comments>
		<pubDate>Tue, 14 Dec 2010 10:28:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[JRuby]]></category>

		<guid isPermaLink="false">http://blog.andrewbruce.net/?p=202</guid>
		<description><![CDATA[Most scary output from console is warning rather than error. RSpec 2 doesn&#8217;t have have_tag method. Now using webrat&#8217;s have_selector. Plugin to help with upgrade only relevant to Rails 2 project, which seems silly. Should use &#8216;extend ActiveModel::Naming&#8217; in non-ActiveRecord &#8230; <a href="http://blog.andrewbruce.net/notes-on-a-rails-3-upgrade">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Most scary output from console is warning rather than error.</p>
<p>RSpec 2 doesn&#8217;t have have_tag method. Now using webrat&#8217;s have_selector.</p>
<p>Plugin to help with upgrade only relevant to Rails 2 project, which seems silly.</p>
<p>Should use &#8216;extend ActiveModel::Naming&#8217; in non-ActiveRecord classes used with view helpers that do record introspection e.g. form_for.</p>
<p>right_aws gem clobbers ActiveSupport 3, must use <a href="https://github.com/mikel/right_aws">mikel fork</a></p>
<p>cucumber wasn&#8217;t following redirects. used <a href="https://github.com/ryanmoran/webrat.git">this fork of webrat</a>. </p>
<p>Builder needed requiring in application_helper, as I was using it to build markup.</p>
<p>Machinist 2 is a big change, but probably worth it. Cucumber needs database<br />
cleaner.</p>
<p>Strange problem with matcher. I&#8217;d written matcher to allow &#8216;blah.should save&#8217;,<br />
which clobbered ActiveRecord&#8217;s actual save method! Very specific, but worth<br />
checking if you&#8217;re doing anything funky like that.</p>
<p>Routes were a breeze.</p>
<p>Array#sample rather than Array#rand</p>
<p>spec.opts now .rspec in Rails.root or ~/</p>
<p>Liking the enforced declarative style for validations.</p>
<p>email_spec had changed, features needed upgrading</p>
<p>#fullpath instead of #request_uri</p>
<p>Write more blog posts in shorthand!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewbruce.net/notes-on-a-rails-3-upgrade/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pong in HTML5 Canvas and YUI3, with tests!</title>
		<link>http://blog.andrewbruce.net/pong-in-html5-canvas-yui3-test</link>
		<comments>http://blog.andrewbruce.net/pong-in-html5-canvas-yui3-test#comments</comments>
		<pubDate>Wed, 20 Oct 2010 20:04:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Releases]]></category>
		<category><![CDATA[BDD]]></category>
		<category><![CDATA[Canvas]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://blog.andrewbruce.net/?p=183</guid>
		<description><![CDATA[In case you&#8217;re one of my clients, you might be wondering why I&#8217;ve been slacking off recently. Here&#8217;s why: I&#8217;ve been teaching myself &#8216;grown up&#8217; JavaScript under instruction of Douglas Crockford (in book and video form, obviously). Crockford never mentions &#8230; <a href="http://blog.andrewbruce.net/pong-in-html5-canvas-yui3-test">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In case you&#8217;re one of my clients, you might be wondering why I&#8217;ve been slacking off recently. Here&#8217;s why: I&#8217;ve been teaching myself &#8216;grown up&#8217; JavaScript under instruction of Douglas Crockford (in <a href="http://www.amazon.co.uk/JavaScript-Good-Parts-D-Crockford/dp/0596517742/ref=sr_1_1?ie=UTF8&#038;s=books&#038;qid=1287604036&#038;sr=8-1">book</a> and <a href="http://developer.yahoo.com/yui/theater/">video</a> form, obviously). Crockford never mentions Test Driven Development, probably because he doesn&#8217;t do it. But I do, so I&#8217;ve been learning to do that in JavaScript too.</p>
<p>So here it is, <a href="http://pong.andrewbruce.net/">HTML5 Canvas Pong</a>.<br />
<span id="more-183"></span><br />
Pong is <a href="http://twitter.com/chrislowis/statuses/27854948346">effectively a Hello, World! application</a> for game developers. It&#8217;s not particularly fun, and my version is full of amusing bugs. It&#8217;s currently single-player only, and mouse-driven. There&#8217;s also no scoring or any game over: the ball just keeps travelling off-screen.</p>
<p>By the time you read this, however, all of these bugs could be fixed, and it could have amazing features you never thought possible in a computer game, let alone in a browser. But I doubt it. You can follow its progress <a href="http://github.com/camelpunch/pong">over on Github</a>.</p>
<p>My intention is to write a well-tested, JSLinted 2D game library for JavaScript that I can understand. Yes, I know someone else has probably done it. Humour me.</p>
<p>I was inspired by <a href="http://github.com/chrislo/Pong5">Chris Lowis&#8217; version</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewbruce.net/pong-in-html5-canvas-yui3-test/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Setting 503 response code for Apache default virtual host</title>
		<link>http://blog.andrewbruce.net/setting-503-response-code-for-apache-default-virtual-host</link>
		<comments>http://blog.andrewbruce.net/setting-503-response-code-for-apache-default-virtual-host#comments</comments>
		<pubDate>Mon, 20 Sep 2010 00:43:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[DevOps]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[deployment]]></category>

		<guid isPermaLink="false">http://blog.andrewbruce.net/?p=173</guid>
		<description><![CDATA[I know I promised my next post would be a tutorial on Chef, but this is kinda related. When new Rails servers are spinning up, I want Apache to respond to any requests with 503, both for SEO purposes in &#8230; <a href="http://blog.andrewbruce.net/setting-503-response-code-for-apache-default-virtual-host">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I know I promised my next post would be a tutorial on Chef, but this is kinda related. When new Rails servers are spinning up, I want Apache to respond to any requests with 503, both for SEO purposes in case I get my DNS wrong, and to tell load balancers that the node isn&#8217;t ready yet. It took me a while to grok the <a href="http://httpd.apache.org/docs/current/mod/mod_rewrite.html#RewriteRule">Apache docs</a> to understand how to do this, as it is a bit counterintuitive (see the bit headed &#8220;&#8216;redirect|R [=code]&#8216; (force redirect)&#8221;). Please let me know if there&#8217;s a better way that perhaps doesn&#8217;t involve turning on RewriteEngine.<br />
<span id="more-173"></span><br />
I changed my <code>/etc/apache2/sites-available/000-default</code> to be the following. This acts as the fallback when no other virtual hosts match the hostname used in the request. It gives the default Apache page, which is horrible. I&#8217;m sure you could fix it to point at something nice by using some more directives.</p>
<p><script src="http://gist.github.com/587271.js?file=000-default.conf"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewbruce.net/setting-503-response-code-for-apache-default-virtual-host/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

