<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>deferred until inspiration hits</title>
    <link>http://chrisroos.co.uk/</link>
    <language>en-us</language>
    <ttl>40</ttl>

    <description />
    
      <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/DeferredUntilInspirationHits" type="application/rss+xml" /><feedburner:browserFriendly>(Enter a personal message you would like to have appear at the top of your feed.)</feedburner:browserFriendly><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
        <title>Down for Everyone or Just Me Greasemonkey Script</title>
        <description>&lt;p&gt;I hacked on this simple &lt;a href="http://en.wikipedia.org/wiki/Greasemonkey"&gt;greasemonkey&lt;/a&gt; script a while ago but never got around to writing about it.  It&amp;#8217;s probably easiest explained with a screenshot.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.flickr.com/photos/chrisjroos/3658162176/"&gt;&lt;img src="http://farm4.static.flickr.com/3653/3658162176_d6819a620d.jpg" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If the webpage you&amp;#8217;re trying to access can&amp;#8217;t be loaded then you&amp;#8217;ll see that the standard &amp;#8216;page not found&amp;#8217; firefox error page but with an additional link to the useful &lt;a href="http://downforeveryoneorjustme.com/"&gt;Down for everyone or just me&lt;/a&gt; service.&lt;/p&gt;
&lt;p&gt;Get the script from &lt;a href="http://userscripts.org/scripts/show/50164"&gt;userscripts&lt;/a&gt;.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?a=YNaOjIXSsvo:aG5eWTFavXo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeferredUntilInspirationHits/~4/YNaOjIXSsvo" height="1" width="1"/&gt;</description>

        <pubDate>Wed, 24 Jun 2009 21:07:18 +0100</pubDate>
        <guid isPermaLink="false">urn:uuid:4b5dd513-0c10-4892-8c84-1aa29aeac4c5</guid>
        <author>Chris Roos</author>
        <link>http://chrisroos.co.uk/blog/2009-06-24-down-for-everyone-or-just-me-greasemonkey-script</link>
      </item>
    
      <item>
        <title>Apacherb Is Now Hostess</title>
        <description>&lt;p&gt;A little while ago I wrote about a utility called &lt;a href="/blog/2008-12-15-a-utility-to-manage-apache-virtual-hosts-on-a-mac-like-the-passenger-pref-pane-but-for-simple-static-sites"&gt;apacherb&lt;/a&gt;.  It took the concept of the &lt;a href="http://www.fngtps.com/2008/06/putting-the-pane-back-into-deployment"&gt;passenger preference pane&lt;/a&gt; and applied it to any local directory (rather than specifically rails apps).  I&amp;#8217;d always meant to turn the utility into a &lt;a href="http://rubygems.org/"&gt;gem&lt;/a&gt; but never quite got round to it.  Luckily, &lt;a href="http://interblah.net/"&gt;James Adam&lt;/a&gt; moved the code to &lt;a href="http://github.com/lazyatom/hostess/tree/master"&gt;github&lt;/a&gt;, tidied it a little (notably making it restart apache after a change), renamed it and gemifimibulated it.&lt;/p&gt;
&lt;p&gt;Install it with:&lt;/p&gt;
&lt;pre class="code shell"&gt;&amp;#x000A;$ gem install hostess&lt;/pre&gt;
&lt;p&gt;Executing it without any arguments will display some simple instructions.&lt;/p&gt;
&lt;pre class="code shell"&gt;&amp;#x000A;$ hostess&amp;#x000A;  Usage:&amp;#x000A;    hostess create domain directory - create a new virtual host&amp;#x000A;    hostess delete domain           - delete a virtual host&amp;#x000A;    hostess list                    - list hostess virtual hosts&amp;#x000A;    hostess help                    - this info&lt;/pre&gt;

&lt;p&gt;You&amp;#8217;ll need to run it as &lt;a href="http://en.wikipedia.org/wiki/Sudo"&gt;sudo&lt;/a&gt; as it writes the configuration into /etc/apache2 and restarts apache.&lt;/p&gt;
&lt;p&gt;To create a domain pointing at a local directory, you&amp;#8217;d do something like:&lt;/p&gt;
&lt;pre class="code shell"&gt;&amp;#x000A;$ sudo hostess create example.local ~/Sites/example.local/&lt;/pre&gt;
&lt;p&gt;This will register the local domain (the .local suffix is a convention rather than a rule) using &lt;a href="http://developer.apple.com/opensource/dirservices/"&gt;directory services&lt;/a&gt; and add the &lt;a href="http://httpd.apache.org/"&gt;apache&lt;/a&gt; &lt;a href="http://httpd.apache.org/docs/1.3/vhosts/"&gt;virtual host&lt;/a&gt;.  Open your browser and visit example.local to see your local site.  Good huh.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?a=ARht2bdK7Qo:cxdW2AeQ0Y8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeferredUntilInspirationHits/~4/ARht2bdK7Qo" height="1" width="1"/&gt;</description>

        <pubDate>Tue, 23 Jun 2009 21:41:27 +0100</pubDate>
        <guid isPermaLink="false">urn:uuid:b37f5463-b2b5-4f07-b17e-6e014700ce80</guid>
        <author>Chris Roos</author>
        <link>http://chrisroos.co.uk/blog/2009-06-23-apacherb-is-now-hostess</link>
      </item>
    
      <item>
        <title>Introducing Deliciolytics</title>
        <description>&lt;p&gt;I&amp;#8217;ve been playing around with this for a little while and although it doesn&amp;#8217;t do most of the stuff I&amp;#8217;d like I figure it&amp;#8217;s still worth allowing other people to use it: &lt;a href="http://deliciolytics.co.uk"&gt;deliciolytics&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Its main purpose in life at the moment is to provide an aggregated feed of every bookmark in delicious for pages within your domain.  Feel free to go ahead and &lt;a href="http://deliciolytics.co.uk/domains/new"&gt;add your own domain&lt;/a&gt;.  You&amp;#8217;ll need to have a &lt;a href="http://sitemaps.org"&gt;sitemap&lt;/a&gt; and that sitemap will currently need to be at /sitemap.xml (it can be an index to actual sitemaps though).  After you add a domain it&amp;#8217;ll be in a pending state for up to five minutes before a task runs to &amp;#8216;normalise&amp;#8217; it.  After that you just have to wait until the task runs to download your urls (from the sitemap) and query delicious for any bookmarks against each of them.  This currently happens once every 24 hours.  Your best bet would be to subscribe to the bookmarks feed (click through to your domain and then through to bookmarks) and wait for the task to populate it with bookmarking goodness.&lt;/p&gt;
&lt;p&gt;You could easily launch a DoS attack by automating the process of adding domains but it be great if you didn&amp;#8217;t.  Thanks.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?a=gOX5oCd8-J4:33H4TbRkXtM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeferredUntilInspirationHits/~4/gOX5oCd8-J4" height="1" width="1"/&gt;</description>

        <pubDate>Tue, 23 Jun 2009 21:03:47 +0100</pubDate>
        <guid isPermaLink="false">urn:uuid:42cacda7-e207-40b2-b618-bc643a320ec7</guid>
        <author>Chris Roos</author>
        <link>http://chrisroos.co.uk/blog/2009-06-23-introducing-deliciolytics</link>
      </item>
    
      <item>
        <title>A Greasemonkey Script that inserts a Google Site Search form into every page</title>
        <description>&lt;p&gt;I often find myself wanting to use &lt;a href="http://google.com"&gt;google&lt;/a&gt; to search within a site I&amp;#8217;m visiting.  My current method is to navigate to the search box in &lt;a href="http://firefox.com"&gt;firefox&lt;/a&gt; (cmd-k) and type &amp;#8220;site:domain-of-site search-term&amp;#8221;.  That&amp;#8217;s a bit painful so I finally got around to creating a &lt;a href="http://en.wikipedia.org/wiki/Greasemonkey"&gt;greasemonkey&lt;/a&gt; script to make it easier.  &lt;a href="http://userscripts.org/scripts/show/47192"&gt;Install the script&lt;/a&gt; from the &lt;a href="http://userscripts.org"&gt;userscripts&lt;/a&gt; site.&lt;/p&gt;
&lt;p&gt;Once installed, you can hit ctrl-9 on any page (except google, that&amp;#8217;d be crazy) and a search form will appear at the top of the page ready for you to type into.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.flickr.com/photos/chrisjroos/3470172619/"&gt;&lt;img src="http://farm4.static.flickr.com/3536/3470172619_99f12d3ca9.jpg" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The simplest thing is to type your search term and tap enter to view the google results.  However, it&amp;#8217;s often useful to restrict your search to more than just the domain of the site (I might want to search for things I&amp;#8217;ve said in twitter, site:twitter.com/chrisroos, for example) so there&amp;#8217;s a drop down list of url components that you can use to restrict which areas of the site you want to search.  Pressing escape within any of the fields in the search form will hide it again.&lt;/p&gt;
&lt;p&gt;A previous version of this script would display the search form at the top of each page all the time.  That didn&amp;#8217;t play nice with absolutely positioned elements already in the page though, hence my decision to only show it when you actually need it.  There&amp;#8217;s still work to do (one of the main problems is that the search form will currently be inserted into every frame on a page, including iframes) but I think it&amp;#8217;s useful enough to get out there.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?a=Qwthc98QvLY:a9ETneeyB2Q:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeferredUntilInspirationHits/~4/Qwthc98QvLY" height="1" width="1"/&gt;</description>

        <pubDate>Fri, 24 Apr 2009 14:09:30 +0100</pubDate>
        <guid isPermaLink="false">urn:uuid:bdb63bd0-cf82-404b-9b48-83b10fa27195</guid>
        <author>Chris Roos</author>
        <link>http://chrisroos.co.uk/blog/2009-04-24-a-greasemonkey-script-that-inserts-a-google-site-search-form-into-every-page</link>
      </item>
    
      <item>
        <title>Rails 2.3 and the ability to update created_at, created_on, updated_at and updated_on timestamps</title>
        <description>&lt;p&gt;The timing of the &lt;a href="http://groups.google.com/group/rubyonrails-security/browse_thread/thread/1d2fb5dc524f9ff4"&gt;automatically generated timestamps and attribute assignment in rails 2.3 security note&lt;/a&gt; &lt;sup class="footnote"&gt;&lt;a href="#fn1"&gt;1&lt;/a&gt;&lt;/sup&gt; was interesting to me because I&amp;#8217;d just spent a while really trying to get my head around &lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M002226"&gt;attr_accessible&lt;/a&gt; and  &lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M002225"&gt;attr_protected&lt;/a&gt; and the best way to test their effects in an app I was working on.  Although I intend to write about the testing separately, the conclusion I came to was that I wanted to test the behaviour (more specifically, I was interested in what I could/couldn&amp;#8217;t assign) of my objects and not that I was specifically using attr_accessible or attr_protected.&lt;/p&gt;
&lt;p&gt;Reading Alex&amp;#8217;s post made me wonder whether the &lt;a href="http://rubyonrails.org/"&gt;rails&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/API"&gt;&lt;span class="caps"&gt;API&lt;/span&gt;&lt;/a&gt; ever guaranteed that the timestamps would be readonly: If that was the case then I can see arguments for not wanting to test the behaviour of your objects (because you&amp;#8217;re essentially testing the framework itself).  I couldn&amp;#8217;t find any mention of whether they&amp;#8217;d specifically be readonly so chose to do a bit of digging.  I created a &lt;a href="http://chrisroos.googlecode.com/svn/trunk/scratch/rails_timestamps_test/"&gt;script&lt;/a&gt; that allowed me to, with relative ease, run tests against rails apps created with different versions of rails.  Using this I was able to test the mass assignment of timestamps (created_at, created_on, updated_at and updated_on) against multiple versions of rails.  The conclusion I came to (and I&amp;#8217;d love for other people to replicate my experiment and prove/disprove my results) was that the created_at and created_on pair of attributes have always (at least as far back as rails 1.0.0) been assignable, while the updated_at and updated_on attributes have only recently become assignable.  While digging I managed to find the &lt;a href="https://rails.lighthouseapp.com/projects/8994/tickets/1612-cant-create-ar-models-with-custom-updated_xx-timestamp"&gt;lighthouse ticket&lt;/a&gt; (#1612) that requested the ability to set the updated_* timestamps and the &lt;a href="http://github.com/rails/rails/commit/63aac338332a06d3c9e28dde7954679703ec7620"&gt;rails commit&lt;/a&gt; that closed that ticket.&lt;/p&gt;
&lt;h2 id="replicating-my-experiment"&gt;Replicating my experiment&lt;/h2&gt;
&lt;ul&gt;
	&lt;li&gt;Get a copy of rails&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="code shell"&gt;&amp;#x000A;  $ cd /path/to/code&amp;#x000A;  $ git clone git://github.com/rails/rails.git&lt;/pre&gt;
&lt;ul&gt;
	&lt;li&gt;Create a &lt;a href="http://www.mysql.com/"&gt;mysql&lt;/a&gt; database called rails_timestamps_test, and create a table within that database called people.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="code sql"&gt;&amp;#x000A;  mysql&amp;gt; CREATE DATABASE rails_timestamps_test;&amp;#x000A;  mysql&amp;gt; USE rails_timestamps_test;&amp;#x000A;  mysql&amp;gt; CREATE TABLE people (id INTEGER AUTO_INCREMENT, created_on DATE, created_at DATETIME, updated_on DATE, updated_at DATETIME, PRIMARY KEY (id));&lt;/pre&gt;
&lt;ul&gt;
	&lt;li&gt;Get a copy of my test script&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="code shell"&gt;&amp;#x000A;  $ cd /path/to/code&amp;#x000A;  $ svn co http://chrisroos.googlecode.com/svn/trunk/scratch/rails_timestamps_test&lt;/pre&gt;
&lt;ul&gt;
	&lt;li&gt;Run my script against rails 2.3 (run setup_rails_project.rb without any arguments to see the options) and hopefully see output similar to below (which means that the tests passed as expected).&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="code shell"&gt;&amp;#x000A;  $ cd /path/to/code/rails_timestamps_test&amp;#x000A;  $ ruby setup_rails_project.rb 2.3.0 /path/to/code/rails&amp;#x000A;  &amp;#x000A;  *** Removing the rails app at /path/to/code/rails_timestamps_test/projects/rails-app-2-3-0&amp;#x000A;  *** Checking out the rails version tagged v2.3.0&amp;#x000A;  HEAD is now at beca1f2... Template#mime_type should not use Mime::Type when Action Controller is not included&amp;#x000A;  *** Creating the rails app at /path/to/code/rails_timestamps_test/projects/rails-app-2-3-0&amp;#x000A;  *** Vendorising rails from /path/to/code/rails to /path/to/code/rails_timestamps_test/projects/rails-app-2-3-0&amp;#x000A;  *** Generating rails_version_test.rb in /path/to/code/rails_timestamps_test/projects/rails-app-2-3-0/test/unit to ensure we are testing against the correct version of rails&amp;#x000A;  *** Copying assets to the new rails app&amp;#x000A;  ****** Linking /path/to/code/rails_timestamps_test/assets/person_test.rb to /path/to/code/rails_timestamps_test/projects/rails-app-2-3-0/test/unit/person_test.rb&amp;#x000A;  ****** Linking /path/to/code/rails_timestamps_test/assets/person.rb to /path/to/code/rails_timestamps_test/projects/rails-app-2-3-0/app/models/person.rb&amp;#x000A;  ****** Linking /path/to/code/rails_timestamps_test/assets/database.yml to /path/to/code/rails_timestamps_test/projects/rails-app-2-3-0/config/database.yml&amp;#x000A;  *** Running the rails version test to ensure that we're testing against the correct version of rails&amp;#x000A;  Loaded suite test/unit/rails_version_test&amp;#x000A;  Started&amp;#x000A;  .&amp;#x000A;  Finished in 0.000327 seconds.&amp;#x000A;&amp;#x000A;  1 tests, 1 assertions, 0 failures, 0 errors&amp;#x000A;  *** Running the timestamps test&amp;#x000A;  Loaded suite test/unit/person_test&amp;#x000A;  Started&amp;#x000A;  ....&amp;#x000A;  Finished in 0.078819 seconds.&amp;#x000A;&amp;#x000A;  4 tests, 8 assertions, 0 failures, 0 errors&lt;/pre&gt;
&lt;ul&gt;
	&lt;li&gt;Re-run the script against rails 2.2.2 (the last tag before 2.3) and you should see the same as above except for the last test which should now contain two failures.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="code shell"&gt;&amp;#x000A;  $ cd /path/to/code/rails_timestamps_test&amp;#x000A;  $ ruby setup_rails_project.rb 2.2.2 /path/to/code/rails&amp;#x000A;  &amp;#x000A;  ... some lines snipped ...&amp;#x000A;  *** Running the timestamps test&amp;#x000A;  Loaded suite test/unit/person_test&amp;#x000A;  Started&amp;#x000A;  ..FF&amp;#x000A;  Finished in 0.069429 seconds.&amp;#x000A;&amp;#x000A;    1) Failure:&amp;#x000A;  test_should_be_able_to_set_updated_at(PersonTest)&amp;#x000A;      [test/unit/person_test.rb:35:in `test_should_be_able_to_set_updated_at'&amp;#x000A;       /path/to/code/rails_timestamps_test/projects/rails-app-2-2-2/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:94:in `__send__'&amp;#x000A;       /path/to/code/rails_timestamps_test/projects/rails-app-2-2-2/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:94:in `run']:&amp;#x000A;  FAIL: Couldn't persist the mass assigned updated_at attribute.&amp;#x000A;  &amp;lt;Thu Jan 01 00:00:00 +0000 2009&amp;gt; expected but was&amp;#x000A;  &amp;lt;Sun, 19 Apr 2009 09:23:46 UTC +00:00&amp;gt;.&amp;#x000A;&amp;#x000A;    2) Failure:&amp;#x000A;  test_should_be_able_to_set_updated_on(PersonTest)&amp;#x000A;      [test/unit/person_test.rb:28:in `test_should_be_able_to_set_updated_on'&amp;#x000A;       /path/to/code/rails_timestamps_test/projects/rails-app-2-2-2/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:94:in `__send__'&amp;#x000A;       /path/to/code/rails_timestamps_test/projects/rails-app-2-2-2/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:94:in `run']:&amp;#x000A;  FAIL: Couldn't persist the mass assigned updated_on attribute.&amp;#x000A;  &amp;lt;Thu, 01 Jan 2009&amp;gt; expected but was&amp;#x000A;  &amp;lt;Sun Apr 19 09:23:46 UTC 2009&amp;gt;.&amp;#x000A;&amp;#x000A;  4 tests, 8 assertions, 2 failures, 0 errors&lt;/pre&gt;
&lt;ul&gt;
	&lt;li&gt;Re-run the script against any other tagged version of rails you wish.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="notes-about-the-script"&gt;A couple of notes about the script&lt;/h2&gt;
&lt;ul&gt;
	&lt;li&gt;If you specify an invalid tag (i.e. a tag that doesn&amp;#8217;t exist in the rails repository) then the rails_version_test.rb will fail.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="code shell"&gt;&amp;#x000A;  $ cd /path/to/code/rails_timestamps_test&amp;#x000A;  $ ruby setup_rails_project.rb made.up.tag /path/to/code/rails&amp;#x000A;  &amp;#x000A;  ... some lines snipped ...&amp;#x000A;  Loaded suite test/unit/rails_version_test&amp;#x000A;  Started&amp;#x000A;  F&amp;#x000A;  Finished in 0.045543 seconds.&amp;#x000A;&amp;#x000A;    1) Failure:&amp;#x000A;  test_should_be_using_rails_made_up_tag(RailsVersionTest)&amp;#x000A;      [test/unit/rails_version_test.rb:6:in `test_should_be_using_rails_made_up_tag'&amp;#x000A;       /path/to/code/rails_timestamps_test/projects/rails-app-made-up-tag/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:94:in `__send__'&amp;#x000A;       /path/to/code/rails_timestamps_test/projects/rails-app-made-up-tag/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:94:in `run']:&amp;#x000A;  &amp;lt;"made.up.tag"&amp;gt; expected but was&amp;#x000A;  &amp;lt;"2.2.2"&amp;gt;.&amp;#x000A;&amp;#x000A;  1 tests, 1 assertions, 1 failures, 0 errors&lt;/pre&gt;
&lt;ul&gt;
	&lt;li&gt;If you specify a tag of rails that is anything other than a 3 part version number (e.g. the four part version 2.3.2.1, or the release candidate 2.1.0_RC1) then the version test will fail because the Rails::&lt;span class="caps"&gt;VERSION&lt;/span&gt; constant only contains the &lt;span class="caps"&gt;MAJOR&lt;/span&gt;, &lt;span class="caps"&gt;MINOR&lt;/span&gt; and &lt;span class="caps"&gt;TINY&lt;/span&gt; components and that&amp;#8217;s what we use to check the version our app uses.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
	&lt;li&gt;The supplied database.yml file assumes a mysql database running on localhost that has a root user with no password.  You can update this to reflect your actual environment.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
	&lt;li&gt;The projects are created in /path/to/code/rails_timestamps_test/projects/ with a name like rails-app-x-x-x (major, minor, tiny).&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
	&lt;li&gt;In order to ensure we are testing against the correct version of rails, I symlink rails from /path/to/code/rails (after changing to the requested tag) into rails-app-x-x-x/vendor/rails.  The problem here is that if you re-run the script with a different rails version and then attempt to run a test from your first project that it will be using the recently specified version of rails.  Luckily, the rails_version_test will fail fast which means you shouldn&amp;#8217;t have to waste time wondering why something is not working as expected.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
	&lt;li&gt;I wonder whether it&amp;#8217;d be useful to extract the &amp;#8216;create a rails app from a specific version of rails&amp;#8217; functionality out of this script?&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="footnote" id="fn1"&gt;&lt;sup&gt;1&lt;/sup&gt; &lt;a href="http://www.eribium.org/"&gt;Alex MacCaw&lt;/a&gt; &lt;a href="http://www.madebymany.co.uk/a-rails-security-flaw-destroying-the-audit-trail-00820"&gt;raised the issue&lt;/a&gt; in reference to number eight in the list of &lt;a href="http://railspikes.com/2009/3/30/10-cool-things-in-rails-23"&gt;10 cools things in Rails 2.3&lt;/a&gt;.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?a=LUIbrh3-11A:izJImGqnJWc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeferredUntilInspirationHits/~4/LUIbrh3-11A" height="1" width="1"/&gt;</description>

        <pubDate>Sun, 19 Apr 2009 08:39:23 +0100</pubDate>
        <guid isPermaLink="false">urn:uuid:866f3fd0-a5dd-4b6a-8800-9ff58940fd3d</guid>
        <author>Chris Roos</author>
        <link>http://chrisroos.co.uk/blog/2009-04-19-rails-2-3-and-the-ability-to-update-created_at-created_on-updated_at-and-updated_on-timestamps</link>
      </item>
    
      <item>
        <title>Generating and Inserting a Rel=Canonical Link Into Pages With Firefox and Greasemonkey</title>
        <description>&lt;p&gt;I&amp;#8217;ve been &lt;a href="/blog/2007-12-14-web-pages-should-specify-their-canonical-url-permalink"&gt;thinking about this for over a year&lt;/a&gt; but have only recently got around to doing something about it.  I&amp;#8217;ve also chosen to use &lt;a href="http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html"&gt;rel=canonical&lt;/a&gt; rather than rel=bookmark.&lt;/p&gt;
&lt;p&gt;The magic is all in &lt;a href="http://userscripts.org/scripts/show/46797"&gt;this&lt;/a&gt; &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/748"&gt;greasemonkey&lt;/a&gt; script.  It uses little rule objects to generate the canonical urls for, at the moment, &lt;a href="http://ebay.co.uk"&gt;ebay&lt;/a&gt;, &lt;a href="http://google.co.uk"&gt;google&lt;/a&gt; and &lt;a href="http://theyworkforyou.com"&gt;theyworkforyou&lt;/a&gt; and insert those urls into the page as a link element with rel=canonical.  Combining my script with the &lt;a href="http://www.facesaerch.com/widget/showcanonical.user.js"&gt;show canonical&lt;/a&gt; greasemonkey script (found on the &lt;a href="http://www.tripwolf.com/en/blog/2009/03/17/offtopic-canonical-a-powerful-seo-concept/"&gt;tripwolf blog&lt;/a&gt;) allows me to easily visit and use the canonical url in emails and the like.&lt;/p&gt;
&lt;p&gt;You should just about be able to see the relatively short canonical url compared to the large url generated by my searching from the firefox search box.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.flickr.com/photos/chrisjroos/3440988983/"&gt;&lt;img src="http://farm4.static.flickr.com/3627/3440988983_1fe7b0518a_o.jpg" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I hope to expand the set of rules (if you wanted to create one right now I&amp;#8217;d suggest looking at the source of the script, the rules are defined towards the end of the script, and the &lt;a href="http://chrisroos.googlecode.com/svn/trunk/scratch/javascript-permalinks/test/rules/"&gt;rule tests&lt;/a&gt;) and possible have some central repository of rules that the script could use.  If you know of some sites that you&amp;#8217;d like to see canonical urls for, but don&amp;#8217;t want to create the rule, then let me know and I&amp;#8217;ll see if I can create it for you.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?a=ImlluPOv9Fg:i7Dg9ya93bQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeferredUntilInspirationHits/~4/ImlluPOv9Fg" height="1" width="1"/&gt;</description>

        <pubDate>Tue, 14 Apr 2009 14:14:00 +0100</pubDate>
        <guid isPermaLink="false">urn:uuid:fca91c96-2df9-4112-b7b7-8902fed60a6d</guid>
        <author>Chris Roos</author>
        <link>http://chrisroos.co.uk/blog/2009-04-14-generating-and-inserting-a-rel=canonical-link-into-pages-with-firefox-and-greasemonkey</link>
      </item>
    
      <item>
        <title>CruiseControlrb With Passenger and Launchd on a Mac</title>
        <description>&lt;p&gt;This has taken me ages, is quite fiddly and I&amp;#8217;m still not 100% happy with it but it seems to work well enough to document here.&lt;/p&gt;
&lt;h2&gt;Configuring the server to run under Passenger&lt;/h2&gt;
&lt;ul&gt;
	&lt;li&gt;Buy a Mac.  Hmm, maybe that&amp;#8217;s starting a little too early in the process&amp;#8230;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
	&lt;li&gt;Install &lt;a href="http://www.modrails.com/"&gt;Passenger&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
	&lt;li&gt;Download &lt;a href="http://cruisecontrolrb.thoughtworks.com/"&gt;cruisecontrol.rb&lt;/a&gt; (from &lt;a href="http://github.com/thoughtworks/cruisecontrol.rb/tree/master"&gt;github&lt;/a&gt; or &lt;a href="http://rubyforge.org/projects/cruisecontrolrb/"&gt;rubyforge&lt;/a&gt;).  We&amp;#8217;re using the version from &lt;a href="http://github.com/"&gt;github&lt;/a&gt; as it has &lt;a href="http://git-scm.com/"&gt;git&lt;/a&gt; support built in.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
	&lt;li&gt;Edit the cruisecontrol.rb production environment (cc.rb/config/environments/production.rb) so that we can disable the builders by setting an environment variable.  By default, starting the server (even through Passenger) starts the builders too.  This doesn&amp;#8217;t work by default because the &lt;span class="caps"&gt;PATH&lt;/span&gt; environment variable isn&amp;#8217;t set which means the builders can&amp;#8217;t find git.  Although it doesn&amp;#8217;t feel like entirely the right approach I actually wonder if I could use the ruby-wrapper-approach (detailed below) to have these builders work correctly.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="code diff"&gt;&amp;#x000A;   config.after_initialize do&amp;#x000A;     require CRUISE_DATA_ROOT + '/site_config' if File.exists?(CRUISE_DATA_ROOT + "/site_config.rb")&amp;#x000A;     require RAILS_ROOT + '/config/dashboard_initialize' &amp;#x000A;  -  BuilderStarter.start_builders &amp;#x000A;  +  BuilderStarter.start_builders unless ENV['CCRB_WITHOUT_BUILDERS']&amp;#x000A;   end&lt;/pre&gt;
&lt;ul&gt;
	&lt;li&gt;Create a wrapper around &lt;a href="http://www.ruby-lang.org/"&gt;ruby&lt;/a&gt; that allows us to pass environment variables to our Passenger apps.  I actually made the amendment to the code above before realising that it&amp;#8217;s not entirely trivial to pass environment variables from &lt;a href="http://httpd.apache.org/"&gt;Apache&lt;/a&gt; to a Passenger app (&lt;a href="http://code.google.com/p/phusion-passenger/issues/detail?id=81"&gt;this ticket&lt;/a&gt; details the problem).  I wasn&amp;#8217;t keen on the idea of this wrapper (&lt;a href="http://blog.phusion.nl/2008/12/16/passing-environment-variables-to-ruby-from-phusion-passenger/"&gt;explanation on the phusion blog&lt;/a&gt;) at first but I ended up thinking it was the neatest solution.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="code shell"&gt;&amp;#x000A;  $ cat &amp;gt; ~/ruby_for_passenger&amp;#x000A;  #!/bin/sh&amp;#x000A;&amp;#x000A;  export CCRB_WITHOUT_BUILDERS=true&amp;#x000A;&amp;#x000A;  exec "/usr/bin/ruby" "$@"&amp;#x000A;&amp;#x000A;  $ sudo mv ~/ruby_for_passenger /usr/local/bin/&amp;#x000A;  $ sudo chmod +x /usr/local/bin/ruby_for_passenger&lt;/pre&gt;
&lt;ul&gt;
	&lt;li&gt;Change the value of the PassengerRuby configuration option in your apache httpd config.  We need to tell Passenger to use our wrapper script instead of the default ruby binary it found during installation.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="code shell"&gt;&amp;#x000A;  $ sudo vi /etc/apache2/httpd.conf&amp;#x000A;  #PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby&amp;#x000A;  PassengerRuby /usr/local/bin/ruby_for_passenger&lt;/pre&gt;
&lt;ul&gt;
	&lt;li&gt;Configure the passenger virtual host for your cruise instance.  I strongly recommend using the &lt;a href="http://www.fngtps.com/passenger-preference-pane"&gt;Passenger preference pane&lt;/a&gt; to do this (remember to set it to use the production environment).&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
	&lt;li&gt;Navigate to your chosen local domain and you should be presented with the default cruise web interface.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Configuring the builders to start under launchd&lt;/h2&gt;
&lt;ul&gt;
	&lt;li&gt;Edit the cc.rb/script/builder file to set the default log directory to a path relative to the project root.  This is so that we can run the builders from a location other than within cc.rb and still have them log correctly (the default behaviour is that we receive a warning about a missing log directory and the log output is redirected to stdout).&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="code diff"&gt;&amp;#x000A;  -  CRUISE_OPTIONS[:log_file_name] = "log/#{CRUISE_OPTIONS[:project_name]}_builder.log"&amp;#x000A;  +  CRUISE_OPTIONS[:log_file_name] = File.join(RAILS_ROOT, 'log', "#{CRUISE_OPTIONS[:project_name]}_builder.log")&lt;/pre&gt;
&lt;ul&gt;
	&lt;li&gt;Create a &lt;a href="http://en.wikipedia.org/wiki/Launchd"&gt;launchd&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/Property_list"&gt;property list&lt;/a&gt; for each task.  I&amp;#8217;ve got mine in ~/Library/LaunchAgents/label-from-plist in the home directory of a user that has public key access to the git repository.  This is my one annoyance with this current solution: It requires the user mentioned above to be logged in.  I spent a very long time trying to get the builders working as &lt;a href="http://developer.apple.com/technotes/tn2005/tn2083.html#SECDAEMONS"&gt;launch daemons&lt;/a&gt;, rather than &lt;a href="http://developer.apple.com/technotes/tn2005/tn2083.html#SECAGENTS"&gt;agents&lt;/a&gt;, so that they would build without a user having to be logged in.  I was hoping to find an environment variable I could set so that git or &lt;a href="http://en.wikipedia.org/wiki/Secure_Shell"&gt;&lt;span class="caps"&gt;SSH&lt;/span&gt;&lt;/a&gt; knew to use the public key from a user other than root (who the launch daemons run as) but didn&amp;#8217;t have any such luck.  If anyone has any ideas about this I&amp;#8217;d love to hear them.  &lt;strong&gt;Note&lt;/strong&gt; Although I haven&amp;#8217;t tried it, I suspect that it&amp;#8217;d be trivial to get non-public-key subversion builders to run as daemons.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="code xml"&gt;&amp;#x000A;  &amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&amp;#x000A;  &amp;lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&amp;gt;&amp;#x000A;  &amp;lt;plist version="1.0"&amp;gt;&amp;#x000A;    &amp;lt;dict&amp;gt;&amp;#x000A;      &amp;lt;key&amp;gt;EnvironmentVariables&amp;lt;/key&amp;gt;&amp;#x000A;      &amp;lt;dict&amp;gt;&amp;#x000A;        &amp;lt;key&amp;gt;PATH&amp;lt;/key&amp;gt;&amp;#x000A;        &amp;lt;string&amp;gt;/usr/bin:/opt/local/bin&amp;lt;/string&amp;gt;&amp;#x000A;      &amp;lt;/dict&amp;gt;&amp;#x000A;      &amp;lt;key&amp;gt;Label&amp;lt;/key&amp;gt;&amp;#x000A;      &amp;lt;string&amp;gt;label-describing-your-builder&amp;lt;/string&amp;gt;&amp;#x000A;      &amp;lt;key&amp;gt;ProgramArguments&amp;lt;/key&amp;gt;&amp;#x000A;      &amp;lt;array&amp;gt;&amp;#x000A;        &amp;lt;string&amp;gt;/Users/chrisroos/cruisecontrol.rb/cruise&amp;lt;/string&amp;gt;&amp;#x000A;        &amp;lt;string&amp;gt;build&amp;lt;/string&amp;gt;&amp;#x000A;        &amp;lt;string&amp;gt;name-of-project-to-build&amp;lt;/string&amp;gt;&amp;#x000A;      &amp;lt;/array&amp;gt;&amp;#x000A;      &amp;lt;key&amp;gt;RunAtLoad&amp;lt;/key&amp;gt;&amp;#x000A;      &amp;lt;true/&amp;gt;&amp;#x000A;    &amp;lt;/dict&amp;gt;&amp;#x000A;  &amp;lt;/plist&amp;gt;&amp;#x000A;  &amp;#x000A;  # Notes:&amp;#x000A;  # We set the PATH environment variable so that both git and ruby can be found.&amp;#x000A;  # We set RunAtLoad so that as soon as the plist is loaded by launchctl it will start to run.&lt;/pre&gt;
&lt;ul&gt;
	&lt;li&gt;Load the agent using &lt;a href="http://developer.apple.com/DOCUMENTATION/DARWIN/Reference/ManPages/man1/launchctl.1.html"&gt;launchctl&lt;/a&gt; as the user named above (i.e. not root).&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="code shell"&gt;&amp;#x000A;  $ launchctl load ~/Library/LaunchAgents/label-from-plist&lt;/pre&gt;
&lt;p&gt;And that should be about it.  I&amp;#8217;d appreciate any feedback anyone has about this approach and to hear about alternative approaches of getting cruise running automatically on system boot.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?a=ree4EO-P7gQ:rCi3wCp7PYM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeferredUntilInspirationHits/~4/ree4EO-P7gQ" height="1" width="1"/&gt;</description>

        <pubDate>Tue, 31 Mar 2009 18:27:25 +0100</pubDate>
        <guid isPermaLink="false">urn:uuid:7442682a-92a4-4d9e-91ef-49e6143e8854</guid>
        <author>Chris Roos</author>
        <link>http://chrisroos.co.uk/blog/2009-03-31-cruisecontrolrb-with-passenger-and-launchd-on-a-mac</link>
      </item>
    
      <item>
        <title>Installing Passenger 2.1.2 on CentOS 5.2</title>
        <description>&lt;p&gt;I needed to upgrade &lt;a href="http://www.modrails.com/"&gt;Passenger&lt;/a&gt; on our web server last week (so that we could run &lt;a href="http://rubyonrails.org/"&gt;Rails&lt;/a&gt; 2.3 apps) but ran into a little problem getting it installed.&lt;/p&gt;
&lt;p&gt;We&amp;#8217;re running &lt;a href="http://www.centos.org/"&gt;CentOS&lt;/a&gt; 5.2 on our staging server.&lt;/p&gt;
&lt;pre class="code shell"&gt;&amp;#x000A;  [root@rails-staging0 ~]# cat /etc/redhat-release &amp;#x000A;  CentOS release 5.2 (Final)&lt;/pre&gt;
&lt;p&gt;The passenger gem installed OK but when I ran passenger-install-apache2-module I got the following error.&lt;/p&gt;
&lt;pre class="code shell"&gt;&amp;#x000A;  ... other lines snipped ...&amp;#x000A;  &amp;#x000A;  /usr/bin/ld: skipping incompatible /usr/lib/libaprutil-1.so when searching for -laprutil-1&amp;#x000A;  /usr/bin/ld: cannot find -laprutil-1&amp;#x000A;  collect2: ld returned 1 exit status&amp;#x000A;  rake aborted!&amp;#x000A;  Command failed with status (1): [g++ -shared SystemTime.o Utils.o Bucket.o ...]&amp;#x000A;  /var/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/passenger-2.1.2/Rakefile:157&amp;#x000A;  (See full trace by running task with --trace)&amp;#x000A;&amp;#x000A;  --------------------------------------------&amp;#x000A;  It looks like something went wrong&lt;/pre&gt;
&lt;p&gt;Searching for this error didn&amp;#8217;t yield any definite fixes but a couple of posts mentioned re-installing the apr-devel packages.  I tried apr-devel to begin with but was told that it was already up-to-date.&lt;/p&gt;
&lt;pre class="code shell"&gt;&amp;#x000A;  [root@rails-staging0 ~]# yum install apr-devel&amp;#x000A;  ... other lines snipped ...&amp;#x000A;  Nothing to do&lt;/pre&gt;
&lt;p&gt;I can&amp;#8217;t remember why but I tried apr-util-devel next which did result in the package being installed.&lt;/p&gt;
&lt;pre class="code shell"&gt;&amp;#x000A;  [root@rails-staging0 ~]# yum install apr-util-devel&amp;#x000A;  ... other lines snipped ...&amp;#x000A;  Installed: apr-util-devel.x86_64 0:1.2.7-7.el5&amp;#x000A;  Complete!&lt;/pre&gt;
&lt;p&gt;With this package re-installed I was able to go ahead and install the passenger apache module (i.e. passenger-install-apache2-module succeeded).&lt;/p&gt;
&lt;p&gt;One slightly interesting/odd thing was that &lt;a href="http://en.wikipedia.org/wiki/Yellow_dog_Updater,_Modified"&gt;yum&lt;/a&gt; reported that the same version (1.2.7-7.el5) of apr-util-dev was already installed.  The only difference after the re-install was that its status changed from &amp;#8216;base&amp;#8217; to &amp;#8216;installed&amp;#8217;.&lt;/p&gt;
&lt;pre class="code shell"&gt;&amp;#x000A;  # before the re-install&amp;#x000A;  [root@rails-staging0 ~]# yum list | grep apr-util-devel&amp;#x000A;  apr-util-devel.x86_64                    1.2.7-7.el5            base&amp;#x000A;  &amp;#x000A;  # after the re-install&amp;#x000A;  [root@rails-staging0 ~]# yum list | grep apr-util-devel&amp;#x000A;  apr-util-devel.x86_64                    1.2.7-7.el5            installed&lt;/pre&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?a=CzoQ4oaPLQw:Y8d4XKvaXSA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeferredUntilInspirationHits/~4/CzoQ4oaPLQw" height="1" width="1"/&gt;</description>

        <pubDate>Mon, 30 Mar 2009 08:24:00 +0100</pubDate>
        <guid isPermaLink="false">urn:uuid:7a9d1abe-ec9c-4752-ae4d-0f973c51de12</guid>
        <author>Chris Roos</author>
        <link>http://chrisroos.co.uk/blog/2009-03-30-installing-passenger-2-1-2-on-centos-5-2</link>
      </item>
    
      <item>
        <title>Hack the Government Day (Rewired State)</title>
        <description>&lt;p&gt;&lt;a href="http://coupde.com/"&gt;James Darling&lt;/a&gt;, &lt;a href="http://www.memespring.co.uk/"&gt;Richard Pope&lt;/a&gt; and &lt;a href="http://www.emmamulqueeny.com/"&gt;Emma Mulqueeny&lt;/a&gt; organised the excellent &lt;a href="http://rewiredstate.org/"&gt;Rewired State&lt;/a&gt; on Saturday (7th March) at the new &lt;a href="http://www.guardian.co.uk/"&gt;Guardian&lt;/a&gt; offices in Kings Cross.  The idea behind rewiredstate was pretty simple (from rewiredstate.org):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Government isn&amp;#8217;t very good at computers.&lt;br /&gt;
  They spend millions to produce mediocre websites, hide away really useful public information and generally get it wrong. Which is a shame.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I had a plan for the day.  It&amp;#8217;s a plan I&amp;#8217;d had for about a year or so and it involved the atrocity that is &lt;a href="http://activeplaces.com/"&gt;Active Places&lt;/a&gt; (a &lt;a href="http://www.sportengland.org/"&gt;Sport England&lt;/a&gt; funded project).  It&amp;#8217;s really hard to find information about sports facilities (I was specifically interested in public swimming pools) in the UK.  I know this because I&amp;#8217;ve tried to find public swimming pools that are either near where I stay (when in London), easily accessible from a station on the commute, or near work.  At the moment that involves finding and searching the websites of each of the councils whose boundaries I cross or am near.  This is certainly not ideal.  It&amp;#8217;s more frustrating because the government have this information locked up (the entire site requires cookies so there&amp;#8217;s no chance of it appearing in google) in activeplaces.  Oh, and there&amp;#8217;s another little gem of information: &lt;a href="http://www.theyworkforyou.com/wrans/?id=2005-06-13b.3605.h"&gt;activeplaces cost £5.2 million over three years&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Before the event on Saturday, I spent quite a while scraping the data out of activeplaces.  This involved issuing a search for each of the postcode outcodes in England (I thought I had this postcode data for the UK but apparently didn&amp;#8217;t) and parsing the search results to get a unique list of sports centres.  I could then download the relevant site, and facility (which is in separate pages and displayed through an iframe on the main site page), information for each centre.&lt;/p&gt;
&lt;p&gt;On the day I was lucky enough to get help from &lt;a href="http://lazyatom.com/"&gt;James Adam&lt;/a&gt;, &lt;a href="http://jamesandre.ws/"&gt;James Andrews&lt;/a&gt; and &lt;a href="http://tomtaylor.co.uk/"&gt;Tom Taylor&lt;/a&gt; to work on the &lt;a href="http://projects.rewiredstate.org/projects/active-places"&gt;active places project&lt;/a&gt;.  I had a rough plan to &lt;a href="http://en.wikipedia.org/wiki/Geocoding"&gt;geocode&lt;/a&gt; the sports facility data we had, parse the downloaded site data to extract the access type of the facility (i.e. private membership or publicly accessible) and create a simple alternative to activeplaces.  Tom helped me geocode the data (using &lt;a href="http://graticule.rubyforge.org/graticule/"&gt;graticule&lt;/a&gt; and the &lt;a href="http://www.multimap.com/openapi/"&gt;multimap api&lt;/a&gt;), while James Adam parsed the access type and James Andrews worked on the &lt;a href="http://github.com/ja/activeplaces/tree/master"&gt;site&lt;/a&gt;.  The geocoded data made it incredibly easy to produce a &lt;a href="http://en.wikipedia.org/wiki/Keyhole_Markup_Language"&gt;&lt;span class="caps"&gt;KML&lt;/span&gt;&lt;/a&gt; file of sites that Tom could consume in his excellent &lt;a href="http://www.iamnear.net/"&gt;I am near&lt;/a&gt; service (&lt;a href="http://swimmingpools.iamnear.net/"&gt;swimming pools I am near&lt;/a&gt;).  At the last minute I put together a very simple &lt;a href="http://www.sinatrarb.com/"&gt;sinatra&lt;/a&gt; webservice that allows for the querying of the activeplaces data (by facility and access type) and returns the data in kml (&lt;a href="http://chrisroos.googlecode.com/svn/trunk/scratch/public-swimming-pools.co.uk"&gt;source&lt;/a&gt;).  You can plug the url of this kml file directly into &lt;a href="http://maps.google.co.uk"&gt;google maps&lt;/a&gt; or download it and plug it into &lt;a href="http://earth.google.com/"&gt;google earth&lt;/a&gt;.  All that was left was to present (&amp;#8216;slides&amp;#8217; are on &lt;a href="http://www.flickr.com/photos/chrisjroos/sets/72157614969161427/"&gt;flickr&lt;/a&gt;) what we&amp;#8217;d done (in just two minutes) and go to the pub.&lt;/p&gt;
&lt;p&gt;&lt;embed src="http://blip.tv/play/AfHWWAA" type="application/x-shockwave-flash" width="640" height="510" allowscriptaccess="always" allowfullscreen="true"&gt;&lt;/embed&gt;&lt;/p&gt;
&lt;p&gt;There was a chap from &lt;a href="http://www.direct.gov.uk"&gt;DirectGov&lt;/a&gt; at the event and he mentioned that he was interested in us continuing the work we&amp;#8217;d started.  I&amp;#8217;ve also spoken to someone from &lt;a href="http://www.london2012.com/"&gt;London 2012&lt;/a&gt; as it sounds like they&amp;#8217;re aiming to do something similar.  So, not only was it a great day but there&amp;#8217;s a chance that we might be able to help shape some of the stuff that the government plans to work on.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?a=H0Qw9OtS3v4:ImCputNEC0E:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeferredUntilInspirationHits/~4/H0Qw9OtS3v4" height="1" width="1"/&gt;</description>

        <pubDate>Mon, 09 Mar 2009 22:14:51 +0000</pubDate>
        <guid isPermaLink="false">urn:uuid:b1db873b-4bf0-4d35-bfa1-7eba23bc9cbc</guid>
        <author>Chris Roos</author>
        <link>http://chrisroos.co.uk/blog/2009-03-09-hack-the-government-day-rewired-state</link>
      </item>
    
      <item>
        <title>Posting Bookmarks to Delicious From My Android G1</title>
        <description>&lt;p&gt;For a while I&amp;#8217;ve wanted the ability to bookmark pages in &lt;a href="http://delicious.com"&gt;delicious&lt;/a&gt; from my &lt;a href="http://code.google.com/android/"&gt;Android&lt;/a&gt; &lt;a href="http://www.t-mobileg1.com/"&gt;G1&lt;/a&gt;.  After a few weeks of occasionally looking to see if anyone had done the work for me I started to investigate building an Android app.  I got about as far as reading through some of the tutorials but never seemed to find the time to really get stuck in.  In the meantime, to get around the limitations of the client side only bookmarks on the G1, I would save a draft email containing the &lt;a href="http://en.wikipedia.org/wiki/Uniform_Resource_Locator"&gt;&lt;span class="caps"&gt;URL&lt;/span&gt;&lt;/a&gt; of the page I was interested in and later open it on a desktop machine and post to delicious.  Saving a draft is fairly trivial in that you visit a page in the browser, hit the share menu item, choose &lt;a href="http://mail.google.com"&gt;gmail&lt;/a&gt; and hit save draft (sharing via gmail pastes the &lt;span class="caps"&gt;URL&lt;/span&gt; of the current page into the body of the email) but the whole process was a bit cumbersome.  I think it was about a week ago when I realised that I should just be able to email my bookmarks to delicious directly.  A little searching appeared to suggest that there was nothing to let me do this&lt;sup class="footnote"&gt;&lt;a href="#fn1"&gt;1&lt;/a&gt;&lt;/sup&gt; so I went about hooking a few things together in order to get the functionality I was after.&lt;/p&gt;
&lt;p&gt;I have recently discovered just how simple and powerful &lt;a href="http://rack.rubyforge.org/"&gt;rack&lt;/a&gt; is, especially when combined with &lt;a href="http://www.modrails.com/"&gt;Phusion Passenger&lt;/a&gt; (which makes it stupidly easy to deploy rack apps).  It seemed ideal for the job.  Combine that with &lt;a href="http://smtp2web.com/"&gt;smtp2web&lt;/a&gt; (I recently rediscovered this after catching up on all the &lt;a href="http://blog.webhooks.org/"&gt;webhook&lt;/a&gt; buzz that seems to be doing the rounds) and a little bit of &lt;a href="http://www.ruby-lang.org/en/"&gt;ruby&lt;/a&gt; to talk to delicious and I had everything I needed.  So, I spent an hour or so last night getting a little end to end proof of concept up and running.  Happy that I could hook all the components together I spent a further two or three hours tidying everything up and getting an app together (&lt;a href="http://chrisroos.googlecode.com/svn/trunk/scratch/mail-to-delicious/"&gt;source in google code&lt;/a&gt;) that I could deploy to my &lt;a href="http://www.exonetric.com/"&gt;exonetric&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/Virtual_private_server"&gt;&lt;span class="caps"&gt;VPS&lt;/span&gt;&lt;/a&gt;.  I was even able to use the service for real on the train this morning.&lt;/p&gt;
&lt;p&gt;Feel free to deploy the code to your own server (or the awesome &lt;a href="http://heroku.com/"&gt;heroku&lt;/a&gt;) if you wish to post bookmarks to your own account.  You&amp;#8217;ll need to copy config/delicious.yml.example to config/delicious.yml and enter your delicious credentials.  The email parser expects to get the bookmark title in the subject line of the email (required), the &lt;span class="caps"&gt;URL&lt;/span&gt; on the first line of the email body (required) and tags on a line in the body beginning with T (i.e. /^T (.*)/).  The rest of the body is treated as the notes.  I was originally going to see if there was any interest in a hosted service whereby you register your delicious credentials and receive a secret email address to use in order to post to delicious.  It seems that ping.fm already has this covered so I&amp;#8217;m not going to worry about hosting it for anyone but me.&lt;/p&gt;
&lt;p&gt;I love how relatively easy it is to hook these things together, in a short period of time, to produce something useful.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;.  I searched again for android delicious clients just before I started writing this post and was slightly surprised to see that there are now two apps that offer this functionality: &lt;a href="http://code.google.com/p/android-delicious-bookmarks/"&gt;Android delicious bookmarks&lt;/a&gt; and Beelicious (for which I couldn&amp;#8217;t find a link).&lt;/p&gt;
&lt;p class="footnote" id="fn1"&gt;&lt;sup&gt;1&lt;/sup&gt; Having just repeated the search I found &lt;a href="http://www.labnol.org/internet/post-links-to-delicious-via-email-mobile/4470/"&gt;this post&lt;/a&gt; that suggests using &lt;a href="http://ping.fm"&gt;ping.fm&lt;/a&gt; to do exactly what I&amp;#8217;m after.  Oh well.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?a=BEdK9CwOqog:nW7eWAfgOFU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeferredUntilInspirationHits?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeferredUntilInspirationHits/~4/BEdK9CwOqog" height="1" width="1"/&gt;</description>

        <pubDate>Wed, 04 Mar 2009 23:09:41 +0000</pubDate>
        <guid isPermaLink="false">urn:uuid:583b9942-cc0e-41e1-924f-f5b6d7c522b9</guid>
        <author>Chris Roos</author>
        <link>http://chrisroos.co.uk/blog/2009-03-04-posting-bookmarks-to-delicious-from-my-android-g1</link>
      </item>
    
  </channel>
</rss>
