<?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>The Code Train &#187; hack</title>
	<atom:link href="http://thecodetrain.co.uk/tag/hack/feed/" rel="self" type="application/rss+xml" />
	<link>http://thecodetrain.co.uk</link>
	<description>Where Neil Crosby talks about coding on the train...</description>
	<lastBuildDate>Sun, 03 Apr 2011 18:15:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Packratius, and the inevitable overwhelming of del.icio.us</title>
		<link>http://thecodetrain.co.uk/2010/06/packratius-and-the-inevitable-overwhelming-of-del-icio-us/</link>
		<comments>http://thecodetrain.co.uk/2010/06/packratius-and-the-inevitable-overwhelming-of-del-icio-us/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 20:22:32 +0000</pubDate>
		<dc:creator>Neil Crosby</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[del.icio.us]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[packrati.us]]></category>
		<category><![CDATA[pipes]]></category>
		<category><![CDATA[yahoo pipes]]></category>

		<guid isPermaLink="false">http://thecodetrain.co.uk/?p=455</guid>
		<description><![CDATA[<p>I&#8217;ve been using <a href="http://delicious.com">del.icio.us</a> for years. I started using it well before it was bought up by Yahoo!, and for a long time my primary use for it was to store my bookmarks in an always available location &#8211; I used many computers, and not having my bookmarks tied to a single machine always seemed like a good idea.</p>

<p>As time went on, I started paying attention to the &#8220;Most Popular&#8221; feeds on the homepage, and even managed to get on there myself a few times.  It was a good way to find interesting techy links.  Then, when the friends network facility was introduced I started following the links that my friends were saving as well.  All was well.</p>

<p>However, I never really saved as many of the links that I found interesting as I could have done.  There were plenty of occasions when I remembered telling people about particular pages because they were useful, but not being able to find them again myself.  Oh, how I wished I&#8217;d added them to del.icio.us.</p>

<p>The problem is that I&#8217;m lazy.  So, I was really happy when <a href="http://packrati.us">Packratius</a> peeked its nose up to the cage bars.  The idea behind Packratius is that it&#8217;ll keep an eye on your twitter activity and automagically add any links you tweet to del.icio.us (by default with a <code>via:packrati.us</code> tag).  It&#8217;s deceptively simple, and something that deeply interested me &#8211; I immediately signed up.</p>

<h2>A good idea gone overwhelming</h2>

<p>As it turns out, so did quite a few of my friends.  Overnight, my del.icio.us network feed went from being a carefully curated list of links to a mishmash of <a href="http://www.bbc.co.uk/food/recipes/carrotsglazedwithcum_80467">Carrots Glazed with Cum</a>, gowalla updates and twitpics.</p>

<p>Now, to its credit, Packratius has <a href="http://packrati.us/preferences">options</a> to allow you to not auto-delish links tweeted by any twitter clients that you define.  This allows you to not auto tweet twitpics and the like.  Of course, telling it to stop tweeting those things from your own twitter account is great, but it doesn&#8217;t stop you from seeing those updates from other people (/me looks pointedly at <a href="http://simonjobling.com">Simon Jobling</a>).  So, I needed to find a way to split these auto-delished URLs off from the main list.</p>

<p>As it turns out, whilst del.icio.us&#8217; searching abilities are pretty powerful, you can&#8217;t do a simply negative search.  So whilst you could say &#8220;Show me everything in my network feed tagged with &#8216;kittens&#8217; but not &#8216;via:packrati.us&#8217;&#8221; you can&#8217;t say &#8220;Show me everything in my network feed not tagged with &#8216;via:packrati.us&#8217;&#8221;.  Thankfully I came up with a solution to this &#8211; I created a Yahoo! Pipe called &#8220;<a href="http://pipes.yahoo.com/pipes/pipe.info?_id=537a07fd888c1c38dedcb59f6b5f8101">del.icio.us network feed minus packratius</a>&#8220;. (Catchy, huh?)</p>

<p>It&#8217;s a fairly simple pipe, with the following aims:</p>

<ul>
<li>Provide a feed of your del.icio.us network with items tagged with <code>via:packrati.us</code> removed.</li>
<li>Easily customisable to show different peoples&#8217; network feeds.  </li>
</ul>

<p>If you&#8217;ve been having similar problems with Packratius overwhelming your del.icio.us network feed, then give it a go.  I know <a href="http://kulor.com/">James Broad</a> has been finding Packratius overwhelming &#8211; it was his <a href="http://twitter.com/kulor/status/15596311122">tweet</a> that inspired me to finally write this post up, in the hope of benefitting a few more people.</p>

<h2>How does the pipe work?</h2>

<p>Like I said, the pipe&#8217;s fairly simple &#8211; most of the complexity comes from generating the URL to load a given user&#8217;s del.icio.us network feed.</p>

<p>Once we&#8217;ve obtained the network feed, the only thing we need to do is discard all the feed items that contain <code>via:packrati.us</code> as a tag.  Handily, del.icio.us provides us this information in its feeds:</p>

<pre><code>&lt;item&gt;
  …
  &lt;link&gt;

http://wwp.greenwichmeantime.com/time-zone/africa/south-africa/

  &lt;/link&gt;
  &lt;description&gt;
    South Africa is in Southern Africa, 
    at the southern tip of the continent of Africa.
    http:// bit.ly/am78yK
    #statingthebleedingobvious
  &lt;/description&gt;
  &lt;category domain="http://delicious.com/simey_j/"&gt;
    statingthebleedingobvious
  &lt;/category&gt;
  &lt;category domain="http://delicious.com/simey_j/"&gt;
    via:packrati.us
  &lt;/category&gt;
&lt;/item&gt;
</code></pre>

<p>In the feed item above (cut down for space), we can see that as well as <code>via:packrati.us</code>, a <code>statingthebleedingobvious</code> tag has been automatically generated from the hashtag in the original tweet.  This is a great feature of Packratius, but it did mean that I ended up having to do more than a very simple filter to filter out the <code>via:packrati.us</code> tagged feed items.</p>

<p>Instead what I did was create a <code>Filter</code> block in pipes with rules that looked at the first 6 tags on each feed item (the idea being that there isn&#8217;t enough space in a tweet for more than 6 or so tags). If any of them matched <code>via:packrati.us</code> then they&#8217;re discarded from the feed.</p>

<p>The filter I created looked something a little like this:</p>

<blockquote>
  <p>Filter</p>
  
  <p>Block items that match any of the following:</p>
  
  <ul>
  <li>item.category.0.content is via:packrati.us</li>
  <li>item.category.1.content is via:packrati.us</li>
  <li>item.category.2.content is via:packrati.us</li>
  <li>item.category.3.content is via:packrati.us</li>
  <li>item.category.4.content is via:packrati.us</li>
  <li>item.category.5.content is via:packrati.us</li>
  <li>item.category.content is via:packrati.us</li>
  </ul>
</blockquote>

<p>Those first six filter rules cover the instance of more than one tag being applied to the item, and the final filter covers the intances where only a single tag exists.  Simple.</p>

<p>And that&#8217;s all there is to it.  Of course, writing this Pipe wouldn&#8217;t be necessary if del.icio.us allowed us to do a simple negative search. Still, it&#8217;s good that it&#8217;s nice and easy to generate <a href="http://pipes.yahoo.com/pipes/pipe.info?_id=537a07fd888c1c38dedcb59f6b5f8101">this new feed</a> using Pipes.</p>

<p>Hopefully it&#8217;ll be useful to a couple of you.</p>
<div style="display:block"><small><em><a href="http://neilcrosby.com">Neil Crosby</a> also blogs at about t-shirts at <a href="http://iwearcotton.com">I Wear Cotton</a>, writes <a href="http://thetenwordreview.com/users/workingwithme">Ten Word Reviews</a>, and uploads <a href="http://www.flickr.com/photos/thevoicewithin/">photos</a> to flickr.  You can follow a combined feed of posts at <a href="http://neilcrosby.com/">NeilCrosby.com</a>.</em></small></div>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using <a href="http://delicious.com">del.icio.us</a> for years. I started using it well before it was bought up by Yahoo!, and for a long time my primary use for it was to store my bookmarks in an always available location &#8211; I used many computers, and not having my bookmarks tied to a single machine always seemed like a good idea.</p>

<p>As time went on, I started paying attention to the &#8220;Most Popular&#8221; feeds on the homepage, and even managed to get on there myself a few times.  It was a good way to find interesting techy links.  Then, when the friends network facility was introduced I started following the links that my friends were saving as well.  All was well.</p>

<p>However, I never really saved as many of the links that I found interesting as I could have done.  There were plenty of occasions when I remembered telling people about particular pages because they were useful, but not being able to find them again myself.  Oh, how I wished I&#8217;d added them to del.icio.us.</p>

<p>The problem is that I&#8217;m lazy.  So, I was really happy when <a href="http://packrati.us">Packratius</a> peeked its nose up to the cage bars.  The idea behind Packratius is that it&#8217;ll keep an eye on your twitter activity and automagically add any links you tweet to del.icio.us (by default with a <code>via:packrati.us</code> tag).  It&#8217;s deceptively simple, and something that deeply interested me &#8211; I immediately signed up.</p>

<h2>A good idea gone overwhelming</h2>

<p>As it turns out, so did quite a few of my friends.  Overnight, my del.icio.us network feed went from being a carefully curated list of links to a mishmash of <a href="http://www.bbc.co.uk/food/recipes/carrotsglazedwithcum_80467">Carrots Glazed with Cum</a>, gowalla updates and twitpics.</p>

<p>Now, to its credit, Packratius has <a href="http://packrati.us/preferences">options</a> to allow you to not auto-delish links tweeted by any twitter clients that you define.  This allows you to not auto tweet twitpics and the like.  Of course, telling it to stop tweeting those things from your own twitter account is great, but it doesn&#8217;t stop you from seeing those updates from other people (/me looks pointedly at <a href="http://simonjobling.com">Simon Jobling</a>).  So, I needed to find a way to split these auto-delished URLs off from the main list.</p>

<p>As it turns out, whilst del.icio.us&#8217; searching abilities are pretty powerful, you can&#8217;t do a simply negative search.  So whilst you could say &#8220;Show me everything in my network feed tagged with &#8216;kittens&#8217; but not &#8216;via:packrati.us&#8217;&#8221; you can&#8217;t say &#8220;Show me everything in my network feed not tagged with &#8216;via:packrati.us&#8217;&#8221;.  Thankfully I came up with a solution to this &#8211; I created a Yahoo! Pipe called &#8220;<a href="http://pipes.yahoo.com/pipes/pipe.info?_id=537a07fd888c1c38dedcb59f6b5f8101">del.icio.us network feed minus packratius</a>&#8220;. (Catchy, huh?)</p>

<p>It&#8217;s a fairly simple pipe, with the following aims:</p>

<ul>
<li>Provide a feed of your del.icio.us network with items tagged with <code>via:packrati.us</code> removed.</li>
<li>Easily customisable to show different peoples&#8217; network feeds.  </li>
</ul>

<p>If you&#8217;ve been having similar problems with Packratius overwhelming your del.icio.us network feed, then give it a go.  I know <a href="http://kulor.com/">James Broad</a> has been finding Packratius overwhelming &#8211; it was his <a href="http://twitter.com/kulor/status/15596311122">tweet</a> that inspired me to finally write this post up, in the hope of benefitting a few more people.</p>

<h2>How does the pipe work?</h2>

<p>Like I said, the pipe&#8217;s fairly simple &#8211; most of the complexity comes from generating the URL to load a given user&#8217;s del.icio.us network feed.</p>

<p>Once we&#8217;ve obtained the network feed, the only thing we need to do is discard all the feed items that contain <code>via:packrati.us</code> as a tag.  Handily, del.icio.us provides us this information in its feeds:</p>

<pre><code>&lt;item&gt;
  …
  &lt;link&gt;

http://wwp.greenwichmeantime.com/time-zone/africa/south-africa/

  &lt;/link&gt;
  &lt;description&gt;
    South Africa is in Southern Africa, 
    at the southern tip of the continent of Africa.
    http:// bit.ly/am78yK
    #statingthebleedingobvious
  &lt;/description&gt;
  &lt;category domain="http://delicious.com/simey_j/"&gt;
    statingthebleedingobvious
  &lt;/category&gt;
  &lt;category domain="http://delicious.com/simey_j/"&gt;
    via:packrati.us
  &lt;/category&gt;
&lt;/item&gt;
</code></pre>

<p>In the feed item above (cut down for space), we can see that as well as <code>via:packrati.us</code>, a <code>statingthebleedingobvious</code> tag has been automatically generated from the hashtag in the original tweet.  This is a great feature of Packratius, but it did mean that I ended up having to do more than a very simple filter to filter out the <code>via:packrati.us</code> tagged feed items.</p>

<p>Instead what I did was create a <code>Filter</code> block in pipes with rules that looked at the first 6 tags on each feed item (the idea being that there isn&#8217;t enough space in a tweet for more than 6 or so tags). If any of them matched <code>via:packrati.us</code> then they&#8217;re discarded from the feed.</p>

<p>The filter I created looked something a little like this:</p>

<blockquote>
  <p>Filter</p>
  
  <p>Block items that match any of the following:</p>
  
  <ul>
  <li>item.category.0.content is via:packrati.us</li>
  <li>item.category.1.content is via:packrati.us</li>
  <li>item.category.2.content is via:packrati.us</li>
  <li>item.category.3.content is via:packrati.us</li>
  <li>item.category.4.content is via:packrati.us</li>
  <li>item.category.5.content is via:packrati.us</li>
  <li>item.category.content is via:packrati.us</li>
  </ul>
</blockquote>

<p>Those first six filter rules cover the instance of more than one tag being applied to the item, and the final filter covers the intances where only a single tag exists.  Simple.</p>

<p>And that&#8217;s all there is to it.  Of course, writing this Pipe wouldn&#8217;t be necessary if del.icio.us allowed us to do a simple negative search. Still, it&#8217;s good that it&#8217;s nice and easy to generate <a href="http://pipes.yahoo.com/pipes/pipe.info?_id=537a07fd888c1c38dedcb59f6b5f8101">this new feed</a> using Pipes.</p>

<p>Hopefully it&#8217;ll be useful to a couple of you.</p>
]]></content:encoded>
			<wfw:commentRss>http://thecodetrain.co.uk/2010/06/packratius-and-the-inevitable-overwhelming-of-del-icio-us/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adding a vCard to your iPhone Address Book from a web page</title>
		<link>http://thecodetrain.co.uk/2009/11/adding-a-vcard-to-your-iphone-address-book-from-a-web-page/</link>
		<comments>http://thecodetrain.co.uk/2009/11/adding-a-vcard-to-your-iphone-address-book-from-a-web-page/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 00:43:52 +0000</pubDate>
		<dc:creator>Neil Crosby</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[addressbook]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[mobilesafari]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[scratching an itch]]></category>
		<category><![CDATA[vcard]]></category>

		<guid isPermaLink="false">http://thecodetrain.co.uk/?p=334</guid>
		<description><![CDATA[<p>It can&#8217;t be done. Well, not obviously anyway.</p>

<p>A couple of weeks ago, I realised that <a href="http://neilcrosby.com/vcard">my public vCard</a> was less useful than it might be.  One of the specific reasons that I created it was to make it easy for people to add a bunch of my contact information to their address books when I met them, rather than them having to manually type in a whole load of stuff that was on a business card.  It turns out that this is great when that person&#8217;s sat at their own computer, but if they&#8217;re (for example) using an iPhone then things become a little more difficult.</p>

<p>You see, the iPhone doesn&#8217;t like to use MobileSafari to download files.  That&#8217;s fine in general &#8211; you don&#8217;t get a filesystem to peruse on the iPhone, so the only way that downloads would be useful is if the iPhone already knows what to do with them.  That&#8217;s why applications are allowed to register their own custom URL schemes. </p>

<p>Unfortunately, by default the iPhone only registers <a href="http://developer.apple.com/safari/library/featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html">a few URL schemes</a> for use within web pages &#8211; <code>mailto:</code>, <code>tel:</code> and <code>sms:</code> as pseudo protocols, as well as specific URL structures for Google Maps, YouTube and iTunes links.  This makes it impossible to do things like adding an address to the Address Book or an event to the Calendar with a single click on a link in a webpage &#8211; you just get a message that reads &#8220;Download failed. Safari cannot download this file&#8221;.</p>

<p>This is clearly a pain. As a phone, it seems reasonable that you should be able to easily add contacts to your Address Book. Unfortunately, either Apple thinks you shouldn&#8217;t be able to do this from a webpage or they just didn&#8217;t consider it as a usecase.</p>

<p>It turns out that they did consider that you might like to open email attachments though. If someone sends you an email that contains a VCF file then you <em>are</em> able to open it and see its contents. If you then scroll down to the bottom of the file you&#8217;re greeted with two options, allowing you to &#8220;Create New Contact&#8221; or &#8220;Add to Existing Contact&#8221;.  Suddenly a world full of contact adding goodness is opened up to you.</p>

<p>So, what I&#8217;ve decided to do with my vCard is a little bit of user agent sniffing in my PHP. Currently I assume that every other device in the world other than the iPhone will do something sensible with the normal VCF file (or the microformatted data that&#8217;s on the page itself), so I listen out for the iPhone&#8217;s user agent. If I see it then I swap out the link to download the VCF file with one that takes the user to a page containing a form allowing them to enter their email address. Once they do, the VCF file is immediately emailed to them and they can add my card to their address book.</p>

<p>Right now the look and feel of the <a href="http://neilcrosby.com/vcard/via-email/">the email form</a> that iPhone users are directed to could be described as rudimentary at best, but it works.  At some point in the future I&#8217;ll get round to making it look a bit more pretty.</p>

<p>As a solution, I&#8217;m fairly happy with this.  Whilst it&#8217;s nowhere near as nice as being able to simply click on a link and add a contact to your address book, it does at least mean that it becomes possible to add a contact from a web page.  Certainly it&#8217;s a better solution than not allowing users access to the content at all.  It&#8217;s also entirely possible that this solution would work for other filetypes, such as calendar events.</p>

<p>My only concern is that this problem may be in existence in other devices other than the iPhone as well.  It would almost certainly make sense to make the email option available to users of other devices as well.</p>

<p>So there you have it &#8211; to allow a user to add a contact to their Address Book from a webpage on the iPhone don&#8217;t try and get them to download it, let them receive it via email instead. </p>
<div style="display:block"><small><em><a href="http://neilcrosby.com">Neil Crosby</a> also blogs at about t-shirts at <a href="http://iwearcotton.com">I Wear Cotton</a>, writes <a href="http://thetenwordreview.com/users/workingwithme">Ten Word Reviews</a>, and uploads <a href="http://www.flickr.com/photos/thevoicewithin/">photos</a> to flickr.  You can follow a combined feed of posts at <a href="http://neilcrosby.com/">NeilCrosby.com</a>.</em></small></div>]]></description>
			<content:encoded><![CDATA[<p>It can&#8217;t be done. Well, not obviously anyway.</p>

<p>A couple of weeks ago, I realised that <a href="http://neilcrosby.com/vcard">my public vCard</a> was less useful than it might be.  One of the specific reasons that I created it was to make it easy for people to add a bunch of my contact information to their address books when I met them, rather than them having to manually type in a whole load of stuff that was on a business card.  It turns out that this is great when that person&#8217;s sat at their own computer, but if they&#8217;re (for example) using an iPhone then things become a little more difficult.</p>

<p>You see, the iPhone doesn&#8217;t like to use MobileSafari to download files.  That&#8217;s fine in general &#8211; you don&#8217;t get a filesystem to peruse on the iPhone, so the only way that downloads would be useful is if the iPhone already knows what to do with them.  That&#8217;s why applications are allowed to register their own custom URL schemes. </p>

<p>Unfortunately, by default the iPhone only registers <a href="http://developer.apple.com/safari/library/featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html">a few URL schemes</a> for use within web pages &#8211; <code>mailto:</code>, <code>tel:</code> and <code>sms:</code> as pseudo protocols, as well as specific URL structures for Google Maps, YouTube and iTunes links.  This makes it impossible to do things like adding an address to the Address Book or an event to the Calendar with a single click on a link in a webpage &#8211; you just get a message that reads &#8220;Download failed. Safari cannot download this file&#8221;.</p>

<p>This is clearly a pain. As a phone, it seems reasonable that you should be able to easily add contacts to your Address Book. Unfortunately, either Apple thinks you shouldn&#8217;t be able to do this from a webpage or they just didn&#8217;t consider it as a usecase.</p>

<p>It turns out that they did consider that you might like to open email attachments though. If someone sends you an email that contains a VCF file then you <em>are</em> able to open it and see its contents. If you then scroll down to the bottom of the file you&#8217;re greeted with two options, allowing you to &#8220;Create New Contact&#8221; or &#8220;Add to Existing Contact&#8221;.  Suddenly a world full of contact adding goodness is opened up to you.</p>

<p>So, what I&#8217;ve decided to do with my vCard is a little bit of user agent sniffing in my PHP. Currently I assume that every other device in the world other than the iPhone will do something sensible with the normal VCF file (or the microformatted data that&#8217;s on the page itself), so I listen out for the iPhone&#8217;s user agent. If I see it then I swap out the link to download the VCF file with one that takes the user to a page containing a form allowing them to enter their email address. Once they do, the VCF file is immediately emailed to them and they can add my card to their address book.</p>

<p>Right now the look and feel of the <a href="http://neilcrosby.com/vcard/via-email/">the email form</a> that iPhone users are directed to could be described as rudimentary at best, but it works.  At some point in the future I&#8217;ll get round to making it look a bit more pretty.</p>

<p>As a solution, I&#8217;m fairly happy with this.  Whilst it&#8217;s nowhere near as nice as being able to simply click on a link and add a contact to your address book, it does at least mean that it becomes possible to add a contact from a web page.  Certainly it&#8217;s a better solution than not allowing users access to the content at all.  It&#8217;s also entirely possible that this solution would work for other filetypes, such as calendar events.</p>

<p>My only concern is that this problem may be in existence in other devices other than the iPhone as well.  It would almost certainly make sense to make the email option available to users of other devices as well.</p>

<p>So there you have it &#8211; to allow a user to add a contact to their Address Book from a webpage on the iPhone don&#8217;t try and get them to download it, let them receive it via email instead. </p>
]]></content:encoded>
			<wfw:commentRss>http://thecodetrain.co.uk/2009/11/adding-a-vcard-to-your-iphone-address-book-from-a-web-page/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Controlling iTunes across multiple computers with the keyboard</title>
		<link>http://thecodetrain.co.uk/2009/10/controlling-itunes-across-multiple-computers-with-the-keyboard/</link>
		<comments>http://thecodetrain.co.uk/2009/10/controlling-itunes-across-multiple-computers-with-the-keyboard/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 12:32:56 +0000</pubDate>
		<dc:creator>Neil Crosby</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[itunes]]></category>
		<category><![CDATA[keyboard control]]></category>
		<category><![CDATA[scratching an itch]]></category>

		<guid isPermaLink="false">http://thecodetrain.co.uk/?p=312</guid>
		<description><![CDATA[<p>Over the last few days on Twitter I&#8217;ve been talking about my peculiar iTunes setup, and a few people have been asking me if I&#8217;ll blog about it.  So, here goes&#8230;</p>

<p>My situation is that my iTunes music library is stored on my MacMini that lives in my living room (connected to and powering my TV experience). However, most of the time I spend using my MacBook Pro, which spends most of its time in the office upstairs a fair way away from the MacMini. Because I spend most of my time at the laptop, it&#8217;s nice to have music available for me to listen to on it.  Of course, if I just wanted to <em>listen</em> to music then this would be a very short blog post &#8211; I could use iTunes to share the library from the MacMini and listen to the music upstairs, or I could use Spotify or Last.fm. The problem with these as solutions are that I make heavy use of Smart and Genius Playlists in iTunes to generate playlists of music to listen to. Using iTunes&#8217; sharing feature doesn&#8217;t allow me to rate tracks in the originating library (even with iTunes 9&#8242;s &#8220;Home Sharing&#8221; feature), and it also doesn&#8217;t generate extra playcount in the originating library for the things I listen to. This means my Smart Playlists don&#8217;t update in the expected way, and I become a sad panda. Likewise, Genius Playlists don&#8217;t work in a usable way when using a shared library, so this doesn&#8217;t really work for me.</p>

<p>What I wanted was a way to play my music using the MacMini downstairs, but have the music erupt from the speakers connected to my MacBook Pro.  As it turns out, there&#8217;s an app for that &#8211; <a href="http://www.rogueamoeba.com/airfoil/mac/">Airfoil</a>. This lovely application hijacks audio from one device and sends it out across the network to multiple other devices of your choice, all in sync. So, immediately I was able to use OSX&#8217;s Screen Sharing app to connect to my MacMini, start some music playing in iTunes and then have Airfoil pipe it out to my MacBook Pro.  It was a solution that was sheer elegance in its simplicity. Yes, you have to wait a second or so after pressing play before you hear anything come out of your speakers, but that&#8217;s down to Airfoil making sure all your devices are in sync before it starts to do anything.  All in all, it&#8217;s brilliant. It costs $25, but that&#8217;s a small price to pay for this functionality for me.</p>

<p>The only problem is that in playing music on a different computer than the one you&#8217;re on, you&#8217;re playing music on a different computer than the one you&#8217;re on.  So various things, like media keys on your keyboard don&#8217;t work in the way you expect. So, whenever I was wanting to do simple things like pause my music I was having to go into Apple&#8217;s Screen Sharing app, log into the MacMini and then press the pause button in iTunes.  Not ideal.  So, I wrote a quick AppleScript in Apple&#8217;s Script Editor:</p>

<pre><code>tell application "iTunes" of machine "eppc://macmini-2.local" to playpause
</code></pre>

<p>Yup, that&#8217;s a really simple AppleScript.  Something I wasn&#8217;t aware of until a couple of days ago is that it&#8217;s possible to run AppleScript that runs AppleScript on a different machine.  All you have to do is go into <code>System Preferences</code>, open the <code>Sharing</code> panel, and enable <code>Remote Apple Events</code>. The first time you try to run an event on the remote machine you&#8217;ll be asked to enter your credentials on the local machine, which you can save to your keychain for auto-use in the future.  Now, if I run that AppleScript then iTunes on the remote machine will toggle its play state, and consequently on my local machine.  Awesome.</p>

<p>It&#8217;s just as easy to write other scripts as well. For example, to advance to the next track, just change <code>playpause</code> to <code>play (next track)</code>.</p>

<p>But we&#8217;re still not controlling iTunes on the remote machine with just a keypress.  If you&#8217;ve got something like Quicksilver installed on your machine then you should be able to simply hook the script up to a key combination of your choice. I don&#8217;t currently have Quicksilver installed on this machine (and wasn&#8217;t about to install it just for this), so I had to find another alternative. What I&#8217;m currently using is <a href="http://www.red-sweater.com/fastscripts/">FastScripts Lite</a>, a free app that adds an icon to your menubar that contains menu items for any AppleScripts you put in a certain directory. The nice thing about FastScripts is that it also allows you to enter a keypress combo for any of these scripts by going into its <code>Preferences</code> pane and double clicking on the Shortcut field next to the relevant script. I&#8217;ve got <code>playpause</code> bound to <code>ctrl-up</code>, <code>next track</code> to <code>ctrl-right</code> and <code>previous track</code> to (you guessed it) <code>ctrl-left</code>. Now I can easily change what I&#8217;m listening to with a quick keypress, and I&#8217;m happy.</p>

<p>Well, I&#8217;m almost happy.  I still need to have Screen Sharing open so that I can see what&#8217;s actually in the playlist that I&#8217;m listening to.  There&#8217;s a solution to that as well though.  All I needed do was create a script that calls some AppleScript on the MacMini, grabs the current playlist info and then outputs it into a web page. I could then use this page as the basis of a Dashboard widget and I&#8217;d only ever have to press F12 to see my current playlist.  And that&#8217;s what I did. To find out how I did it though, you&#8217;ll have to read the <a href="http://thecodetrain.co.uk/2009/11/displaying-your-current-remote-itunes-playlist-on-your-local-macs-dashboard/">next post</a>!</p>
<div style="display:block"><small><em><a href="http://neilcrosby.com">Neil Crosby</a> also blogs at about t-shirts at <a href="http://iwearcotton.com">I Wear Cotton</a>, writes <a href="http://thetenwordreview.com/users/workingwithme">Ten Word Reviews</a>, and uploads <a href="http://www.flickr.com/photos/thevoicewithin/">photos</a> to flickr.  You can follow a combined feed of posts at <a href="http://neilcrosby.com/">NeilCrosby.com</a>.</em></small></div>]]></description>
			<content:encoded><![CDATA[<p>Over the last few days on Twitter I&#8217;ve been talking about my peculiar iTunes setup, and a few people have been asking me if I&#8217;ll blog about it.  So, here goes&#8230;</p>

<p>My situation is that my iTunes music library is stored on my MacMini that lives in my living room (connected to and powering my TV experience). However, most of the time I spend using my MacBook Pro, which spends most of its time in the office upstairs a fair way away from the MacMini. Because I spend most of my time at the laptop, it&#8217;s nice to have music available for me to listen to on it.  Of course, if I just wanted to <em>listen</em> to music then this would be a very short blog post &#8211; I could use iTunes to share the library from the MacMini and listen to the music upstairs, or I could use Spotify or Last.fm. The problem with these as solutions are that I make heavy use of Smart and Genius Playlists in iTunes to generate playlists of music to listen to. Using iTunes&#8217; sharing feature doesn&#8217;t allow me to rate tracks in the originating library (even with iTunes 9&#8242;s &#8220;Home Sharing&#8221; feature), and it also doesn&#8217;t generate extra playcount in the originating library for the things I listen to. This means my Smart Playlists don&#8217;t update in the expected way, and I become a sad panda. Likewise, Genius Playlists don&#8217;t work in a usable way when using a shared library, so this doesn&#8217;t really work for me.</p>

<p>What I wanted was a way to play my music using the MacMini downstairs, but have the music erupt from the speakers connected to my MacBook Pro.  As it turns out, there&#8217;s an app for that &#8211; <a href="http://www.rogueamoeba.com/airfoil/mac/">Airfoil</a>. This lovely application hijacks audio from one device and sends it out across the network to multiple other devices of your choice, all in sync. So, immediately I was able to use OSX&#8217;s Screen Sharing app to connect to my MacMini, start some music playing in iTunes and then have Airfoil pipe it out to my MacBook Pro.  It was a solution that was sheer elegance in its simplicity. Yes, you have to wait a second or so after pressing play before you hear anything come out of your speakers, but that&#8217;s down to Airfoil making sure all your devices are in sync before it starts to do anything.  All in all, it&#8217;s brilliant. It costs $25, but that&#8217;s a small price to pay for this functionality for me.</p>

<p>The only problem is that in playing music on a different computer than the one you&#8217;re on, you&#8217;re playing music on a different computer than the one you&#8217;re on.  So various things, like media keys on your keyboard don&#8217;t work in the way you expect. So, whenever I was wanting to do simple things like pause my music I was having to go into Apple&#8217;s Screen Sharing app, log into the MacMini and then press the pause button in iTunes.  Not ideal.  So, I wrote a quick AppleScript in Apple&#8217;s Script Editor:</p>

<pre><code>tell application "iTunes" of machine "eppc://macmini-2.local" to playpause
</code></pre>

<p>Yup, that&#8217;s a really simple AppleScript.  Something I wasn&#8217;t aware of until a couple of days ago is that it&#8217;s possible to run AppleScript that runs AppleScript on a different machine.  All you have to do is go into <code>System Preferences</code>, open the <code>Sharing</code> panel, and enable <code>Remote Apple Events</code>. The first time you try to run an event on the remote machine you&#8217;ll be asked to enter your credentials on the local machine, which you can save to your keychain for auto-use in the future.  Now, if I run that AppleScript then iTunes on the remote machine will toggle its play state, and consequently on my local machine.  Awesome.</p>

<p>It&#8217;s just as easy to write other scripts as well. For example, to advance to the next track, just change <code>playpause</code> to <code>play (next track)</code>.</p>

<p>But we&#8217;re still not controlling iTunes on the remote machine with just a keypress.  If you&#8217;ve got something like Quicksilver installed on your machine then you should be able to simply hook the script up to a key combination of your choice. I don&#8217;t currently have Quicksilver installed on this machine (and wasn&#8217;t about to install it just for this), so I had to find another alternative. What I&#8217;m currently using is <a href="http://www.red-sweater.com/fastscripts/">FastScripts Lite</a>, a free app that adds an icon to your menubar that contains menu items for any AppleScripts you put in a certain directory. The nice thing about FastScripts is that it also allows you to enter a keypress combo for any of these scripts by going into its <code>Preferences</code> pane and double clicking on the Shortcut field next to the relevant script. I&#8217;ve got <code>playpause</code> bound to <code>ctrl-up</code>, <code>next track</code> to <code>ctrl-right</code> and <code>previous track</code> to (you guessed it) <code>ctrl-left</code>. Now I can easily change what I&#8217;m listening to with a quick keypress, and I&#8217;m happy.</p>

<p>Well, I&#8217;m almost happy.  I still need to have Screen Sharing open so that I can see what&#8217;s actually in the playlist that I&#8217;m listening to.  There&#8217;s a solution to that as well though.  All I needed do was create a script that calls some AppleScript on the MacMini, grabs the current playlist info and then outputs it into a web page. I could then use this page as the basis of a Dashboard widget and I&#8217;d only ever have to press F12 to see my current playlist.  And that&#8217;s what I did. To find out how I did it though, you&#8217;ll have to read the <a href="http://thecodetrain.co.uk/2009/11/displaying-your-current-remote-itunes-playlist-on-your-local-macs-dashboard/">next post</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://thecodetrain.co.uk/2009/10/controlling-itunes-across-multiple-computers-with-the-keyboard/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>How to make Awesome Broken Biscuit Cake</title>
		<link>http://thecodetrain.co.uk/2009/04/how-to-make-awesome-broken-biscuit-cake/</link>
		<comments>http://thecodetrain.co.uk/2009/04/how-to-make-awesome-broken-biscuit-cake/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 18:15:09 +0000</pubDate>
		<dc:creator>Neil Crosby</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[barcamp]]></category>
		<category><![CDATA[biscuit]]></category>
		<category><![CDATA[broken biscuit]]></category>
		<category><![CDATA[butter]]></category>
		<category><![CDATA[cake]]></category>
		<category><![CDATA[chocolate]]></category>
		<category><![CDATA[fridge]]></category>
		<category><![CDATA[golden syrup]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[recipe]]></category>
		<category><![CDATA[social media camp]]></category>
		<category><![CDATA[social media camp london 09]]></category>

		<guid isPermaLink="false">http://thecodetrain.co.uk/?p=229</guid>
		<description><![CDATA[<p>I know, this isn&#8217;t code and it isn&#8217;t anything I&#8217;ve done on the train, but it is something I&#8217;ve made several times over the last few weeks now.  The last time I made it was for yesterday&#8217;s <a href="http://www.socialmediacamp.co.uk/">Social Media Camp</a> in London, organised wonderfully by <a href="http://www.thatcanadiangirl.co.uk/about-me/welcome/">Vero</a>.  But I&#8217;m not going to talk about Social Media Camp — I&#8217;m going to talk about making Broken Biscuit Cake!</p>

<p><a href="http://www.flickr.com/photos/thevoicewithin/3456952008/" title="All ready to take to the office by Neil Crosby, on Flickr"><img src="http://farm4.static.flickr.com/3567/3456952008_581a0dee91.jpg" width="500" height="375" alt="All ready to take to the office" /></a></p>

<p>Some of you might know Broken Biscuit Cake by its alternative name, Fridge Cake (or by its posh name, Tiffin), but whatever you call it you quite probably made it way back when you were at school.  That&#8217;s when I first came across it, and it soon became a favourite to make when we had a few biscuits left over in the biscuit tin that didn&#8217;t seem to be getting eaten.</p>

<p>After my presentation yesterday, lots of people asked me how I made the cake, and whilst there&#8217;s a <a href="http://www.flickr.com/photos/thevoicewithin/sets/72157617052880026/">photo set on flickr</a> with the instructions, I thought it would be nice to condense them all down into a little broken biscuit cake recipe here as well.  So, here goes.</p>

<p>To make Broken Biscuit Cake, you&#8217;ll need the following (but don&#8217;t forget to hack it to make it nommy to your own tastes):</p>

<ol>
<li>250g biscuits.  I like chocolate covered ones, but you can use anything.  It&#8217;s good to have a mix of types and textures.</li>
<li>300g milk chocolate.</li>
<li>150g dark chocolate.</li>
<li>100g unsalted butter.</li>
<li>150g golden syrup.</li>
<li>75g raisins.</li>
</ol>

<p>And that&#8217;s all you need.  Making the cake is as simple as combining the ingredients together like this (and it only takes about 20 minutes all told):</p>

<ol>
<li><p>Put the biscuits in the sandwich bag, seal, and hit with a rolling pin until broken.  It&#8217;s important to <a href="http://www.flickr.com/photos/thevoicewithin/3456824858/">scream whilst you do this</a>.  </p>

<p>Make sure the pieces are broken up nicely — you&#8217;ll want lots of crumbs and a few pieces about half the size of your finger nail.  The crumbs are important to make sure that everything binds together later, and the larger pieces give you a little bit of extra texture in the finished cake.</p>

<p>I find it&#8217;s a good idea to hit the bag on one side for a bit, then turn it over and try the other side too.</p></li>
<li><p>Break up 150g of the milk chocolate and all of the dark chocolate and place it into a mixing bowl.  Chop the butter into pieces and add that to the bowl too.  Finally, take the golden syrup (it&#8217;s about a third of a tin) and add that to the bowl too.  </p>

<p>Run the spoon you use to add the golden syrup under a hot tap first to heat it up and make the golden syrup slide right off it.</p></li>
<li><p>Whack the mixing bowl into your microwave on high for a minute or two.  When it comes out the chocolate and butter will have started to melt and the golden syrup will have degenerated into a thin liquid.  It won&#8217;t look particularly pleasant.  That&#8217;s okay though.</p></li>
<li><p>Use a spoon to mix the chocolatey, buttery, syrupy mixture together.  Just keep stirring it for a couple of minutes.</p>

<p>Don&#8217;t stop once everything&#8217;s combined into a simple liquid though.  If the mixture looks <a href="http://www.flickr.com/photos/thevoicewithin/3456839732/">liquidy</a> then you need to keep stirring.  Once the mixture begins to come together and take on the consistency of a sloppy warm fudge then you&#8217;re done.</p></li>
<li><p>Pour the broken biscuit bits into the mix, along with the raisins.  Mix everything together until you get a nice <a href="http://www.flickr.com/photos/thevoicewithin/3456031059/">gooey chocolatey mess</a>.</p></li>
<li><p>Grab a baking tray and <a href="http://www.flickr.com/photos/thevoicewithin/3456034403/">cover it in clingfilm</a>.</p>

<p>Make sure you get the clingfilm as smooth as possible.  If it&#8217;s a bit kinky then it&#8217;ll get trapped inside the cake and you&#8217;ll have difficulty getting it out when you come to take it out of the fridge later.</p></li>
<li><p>Place the cake mix into the baking tray.</p>

<p>My advice here is to not dump it all into the tray in one go.  Instead, try putting a few blobs of the mixture around the tray.  The less you have to move around when you press it down in a minute, the less the clingfilm will get kinked up.</p></li>
<li><p>Once the cake mix is all in the baking tray, press it down with the back of the spoon.  Make sure the cake is nice and compacted, and that it properly fills the tray.</p></li>
<li><p>Put the cake in the fridge.  It would probably be sensible to cover it so that nothing else contaminates it.</p></li>
<li><p>Break up the remaining 150g of milk chocolate into a bowl, and melt it in the microwave as before.</p></li>
<li><p>Remove the cake from the fridge and pour your melted chocolate on top.  Smooth it over the top to cover everything.  You wouldn&#8217;t want to upset someone by giving them a slice that wasn&#8217;t covered in chocolate, would you?</p></li>
<li><p>Put the cake back in the fridge and walk away.</p></li>
<li><p>Let a couple of hours pass.</p></li>
<li><p>Turn out the cake.  The clingfilm will be stuck to the bottom, so pull it off, making sure none is left behind.</p>

<p>My technique for removing the clingfilm is to pull it vertically, rather than horizontally.  I find this helps to stop it from tearing and leaving bits behind.</p></li>
<li><p>Cut the cake into little pieces.  I find that each cake makes about 30-40 pieces, and that due to its density, a bit heavy knife is preferable for cutting it.</p></li>
<li><p>Put all the slices into a nice tub, and put that back in your fridge for nomming at your leisure.  Reward yourself with a slice now.</p>

<p>Due to the nature of this cake, I advise keeping it in the fridge.  Chocolate, golden syrup and butter melt at low temperatures, and the cake gets pretty sticky if you leave it out in a warm place.</p></li>
</ol>

<p>And that&#8217;s that — it&#8217;s all pretty easy really, and really tasty too.  The scary part though, and probably something that everyone at Social Media Camp won&#8217;t want to hear is the number of calories this cake contains.  An entire cake contains roughly 5800 calories, making each slice 145 calories of awesome chocolatey goodness.</p>

<p>Om nom nom.</p>
<div style="display:block"><small><em><a href="http://neilcrosby.com">Neil Crosby</a> also blogs at about t-shirts at <a href="http://iwearcotton.com">I Wear Cotton</a>, writes <a href="http://thetenwordreview.com/users/workingwithme">Ten Word Reviews</a>, and uploads <a href="http://www.flickr.com/photos/thevoicewithin/">photos</a> to flickr.  You can follow a combined feed of posts at <a href="http://neilcrosby.com/">NeilCrosby.com</a>.</em></small></div>]]></description>
			<content:encoded><![CDATA[<p>I know, this isn&#8217;t code and it isn&#8217;t anything I&#8217;ve done on the train, but it is something I&#8217;ve made several times over the last few weeks now.  The last time I made it was for yesterday&#8217;s <a href="http://www.socialmediacamp.co.uk/">Social Media Camp</a> in London, organised wonderfully by <a href="http://www.thatcanadiangirl.co.uk/about-me/welcome/">Vero</a>.  But I&#8217;m not going to talk about Social Media Camp — I&#8217;m going to talk about making Broken Biscuit Cake!</p>

<p><a href="http://www.flickr.com/photos/thevoicewithin/3456952008/" title="All ready to take to the office by Neil Crosby, on Flickr"><img src="http://farm4.static.flickr.com/3567/3456952008_581a0dee91.jpg" width="500" height="375" alt="All ready to take to the office" /></a></p>

<p>Some of you might know Broken Biscuit Cake by its alternative name, Fridge Cake (or by its posh name, Tiffin), but whatever you call it you quite probably made it way back when you were at school.  That&#8217;s when I first came across it, and it soon became a favourite to make when we had a few biscuits left over in the biscuit tin that didn&#8217;t seem to be getting eaten.</p>

<p>After my presentation yesterday, lots of people asked me how I made the cake, and whilst there&#8217;s a <a href="http://www.flickr.com/photos/thevoicewithin/sets/72157617052880026/">photo set on flickr</a> with the instructions, I thought it would be nice to condense them all down into a little broken biscuit cake recipe here as well.  So, here goes.</p>

<p>To make Broken Biscuit Cake, you&#8217;ll need the following (but don&#8217;t forget to hack it to make it nommy to your own tastes):</p>

<ol>
<li>250g biscuits.  I like chocolate covered ones, but you can use anything.  It&#8217;s good to have a mix of types and textures.</li>
<li>300g milk chocolate.</li>
<li>150g dark chocolate.</li>
<li>100g unsalted butter.</li>
<li>150g golden syrup.</li>
<li>75g raisins.</li>
</ol>

<p>And that&#8217;s all you need.  Making the cake is as simple as combining the ingredients together like this (and it only takes about 20 minutes all told):</p>

<ol>
<li><p>Put the biscuits in the sandwich bag, seal, and hit with a rolling pin until broken.  It&#8217;s important to <a href="http://www.flickr.com/photos/thevoicewithin/3456824858/">scream whilst you do this</a>.  </p>

<p>Make sure the pieces are broken up nicely — you&#8217;ll want lots of crumbs and a few pieces about half the size of your finger nail.  The crumbs are important to make sure that everything binds together later, and the larger pieces give you a little bit of extra texture in the finished cake.</p>

<p>I find it&#8217;s a good idea to hit the bag on one side for a bit, then turn it over and try the other side too.</p></li>
<li><p>Break up 150g of the milk chocolate and all of the dark chocolate and place it into a mixing bowl.  Chop the butter into pieces and add that to the bowl too.  Finally, take the golden syrup (it&#8217;s about a third of a tin) and add that to the bowl too.  </p>

<p>Run the spoon you use to add the golden syrup under a hot tap first to heat it up and make the golden syrup slide right off it.</p></li>
<li><p>Whack the mixing bowl into your microwave on high for a minute or two.  When it comes out the chocolate and butter will have started to melt and the golden syrup will have degenerated into a thin liquid.  It won&#8217;t look particularly pleasant.  That&#8217;s okay though.</p></li>
<li><p>Use a spoon to mix the chocolatey, buttery, syrupy mixture together.  Just keep stirring it for a couple of minutes.</p>

<p>Don&#8217;t stop once everything&#8217;s combined into a simple liquid though.  If the mixture looks <a href="http://www.flickr.com/photos/thevoicewithin/3456839732/">liquidy</a> then you need to keep stirring.  Once the mixture begins to come together and take on the consistency of a sloppy warm fudge then you&#8217;re done.</p></li>
<li><p>Pour the broken biscuit bits into the mix, along with the raisins.  Mix everything together until you get a nice <a href="http://www.flickr.com/photos/thevoicewithin/3456031059/">gooey chocolatey mess</a>.</p></li>
<li><p>Grab a baking tray and <a href="http://www.flickr.com/photos/thevoicewithin/3456034403/">cover it in clingfilm</a>.</p>

<p>Make sure you get the clingfilm as smooth as possible.  If it&#8217;s a bit kinky then it&#8217;ll get trapped inside the cake and you&#8217;ll have difficulty getting it out when you come to take it out of the fridge later.</p></li>
<li><p>Place the cake mix into the baking tray.</p>

<p>My advice here is to not dump it all into the tray in one go.  Instead, try putting a few blobs of the mixture around the tray.  The less you have to move around when you press it down in a minute, the less the clingfilm will get kinked up.</p></li>
<li><p>Once the cake mix is all in the baking tray, press it down with the back of the spoon.  Make sure the cake is nice and compacted, and that it properly fills the tray.</p></li>
<li><p>Put the cake in the fridge.  It would probably be sensible to cover it so that nothing else contaminates it.</p></li>
<li><p>Break up the remaining 150g of milk chocolate into a bowl, and melt it in the microwave as before.</p></li>
<li><p>Remove the cake from the fridge and pour your melted chocolate on top.  Smooth it over the top to cover everything.  You wouldn&#8217;t want to upset someone by giving them a slice that wasn&#8217;t covered in chocolate, would you?</p></li>
<li><p>Put the cake back in the fridge and walk away.</p></li>
<li><p>Let a couple of hours pass.</p></li>
<li><p>Turn out the cake.  The clingfilm will be stuck to the bottom, so pull it off, making sure none is left behind.</p>

<p>My technique for removing the clingfilm is to pull it vertically, rather than horizontally.  I find this helps to stop it from tearing and leaving bits behind.</p></li>
<li><p>Cut the cake into little pieces.  I find that each cake makes about 30-40 pieces, and that due to its density, a bit heavy knife is preferable for cutting it.</p></li>
<li><p>Put all the slices into a nice tub, and put that back in your fridge for nomming at your leisure.  Reward yourself with a slice now.</p>

<p>Due to the nature of this cake, I advise keeping it in the fridge.  Chocolate, golden syrup and butter melt at low temperatures, and the cake gets pretty sticky if you leave it out in a warm place.</p></li>
</ol>

<p>And that&#8217;s that — it&#8217;s all pretty easy really, and really tasty too.  The scary part though, and probably something that everyone at Social Media Camp won&#8217;t want to hear is the number of calories this cake contains.  An entire cake contains roughly 5800 calories, making each slice 145 calories of awesome chocolatey goodness.</p>

<p>Om nom nom.</p>
]]></content:encoded>
			<wfw:commentRss>http://thecodetrain.co.uk/2009/04/how-to-make-awesome-broken-biscuit-cake/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>GitHub Inactive Repository Demoter, a GreaseMonkey Script</title>
		<link>http://thecodetrain.co.uk/2009/03/github-inactive-repository-demoter-a-greasemonkey-script/</link>
		<comments>http://thecodetrain.co.uk/2009/03/github-inactive-repository-demoter-a-greasemonkey-script/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 09:59:12 +0000</pubDate>
		<dc:creator>Neil Crosby</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[scratching an itch]]></category>

		<guid isPermaLink="false">http://thecodetrain.co.uk/?p=217</guid>
		<description><![CDATA[<p>One of the things that&#8217;s been annoying me recently about <a href="http://github.com">GitHub</a> is the way that a user&#8217;s repositories are presented on their profile page.  Take <a href="http://github.com/NeilCrosby">my profile page</a> for example — I have 16 repositories, but only 5 of them have had any active development over the last month.  To my mind those ones are the most important on the page, and  as such should be given pride of place.  The others should be pushed down the page into their own section.</p>

<p>So, using the wonders of <a href="https://addons.mozilla.org/en-US/firefox/addon/748">GreaseMonkey</a>, that&#8217;s what I did with a spare half an hour yesterday evening.  The <a href="http://github.com/NeilCrosby/github-inactive-repository-demoter/tree">demoter script</a> I wrote is very simple — it looks for the first element on the page with a class of &#8220;projects&#8221;, then checks the last changed date of each of the projects contained within.  If any of them contain a date that&#8217;s more than a month old then a quick <code>appendChild</code> of the original node onto the new &#8220;demoted&#8221; list moves it across.  A heading is added before the new &#8220;demoted&#8221; list to explain what this new list contains, and we&#8217;re all done.</p>

<p>So far I&#8217;ve noticed one &#8220;bug&#8221; with this script.  Normally, when GitHub displays information about a project, it&#8217;s the last changed date of the project that&#8217;s displayed.  Unfortunately, if the user has forked a repository, it seems that the date displayed is when the repository was forked rather than the last time it was edited.  Even if the fork happened months ago, and since then the user has made many edits themselves it&#8217;s still the fork date that&#8217;s displayed.  You can see this in action on <a href="http://github.com/bradleywright">Brad&#8217;s profile page</a> on the &#8220;homedir&#8221; project.</p>

<p>Short of GitHub exposing the actual last edited date on the page itself there is one other possible possibility for getting hold of a last edited(ish) date.  For each of the project activity sparklines, GitHub makes a call back to the server to grab a chunk of parseable data.  It might be possible to grab hold of that data using GreaseMonkey, but that&#8217;s a problem I leave to the enterprising reader.  If you do solve the problem, please do fork my code and send a pull request — I&#8217;d love to have this solved in the script.</p>

<p>If you fancy having this &#8220;Inactive Repository Demotion&#8221; functionality on GitHub, all you have to do is <a href="http://github.com/NeilCrosby/github-inactive-repository-demoter/tree">download the script</a>.  Oh, and whilst you&#8217;re at it, don&#8217;t forget to follow the repository so you can be told of any updates or bugfixes.</p>

<p>EDIT:</p>

<p>As it turns out, I should probably be a little more explicit about how to install the script.  First, download the entire repository as a zip or tgz.  Open it up, and then open the script up in Firefox.  The GreaseMonkey script will then install.</p>
<div style="display:block"><small><em><a href="http://neilcrosby.com">Neil Crosby</a> also blogs at about t-shirts at <a href="http://iwearcotton.com">I Wear Cotton</a>, writes <a href="http://thetenwordreview.com/users/workingwithme">Ten Word Reviews</a>, and uploads <a href="http://www.flickr.com/photos/thevoicewithin/">photos</a> to flickr.  You can follow a combined feed of posts at <a href="http://neilcrosby.com/">NeilCrosby.com</a>.</em></small></div>]]></description>
			<content:encoded><![CDATA[<p>One of the things that&#8217;s been annoying me recently about <a href="http://github.com">GitHub</a> is the way that a user&#8217;s repositories are presented on their profile page.  Take <a href="http://github.com/NeilCrosby">my profile page</a> for example — I have 16 repositories, but only 5 of them have had any active development over the last month.  To my mind those ones are the most important on the page, and  as such should be given pride of place.  The others should be pushed down the page into their own section.</p>

<p>So, using the wonders of <a href="https://addons.mozilla.org/en-US/firefox/addon/748">GreaseMonkey</a>, that&#8217;s what I did with a spare half an hour yesterday evening.  The <a href="http://github.com/NeilCrosby/github-inactive-repository-demoter/tree">demoter script</a> I wrote is very simple — it looks for the first element on the page with a class of &#8220;projects&#8221;, then checks the last changed date of each of the projects contained within.  If any of them contain a date that&#8217;s more than a month old then a quick <code>appendChild</code> of the original node onto the new &#8220;demoted&#8221; list moves it across.  A heading is added before the new &#8220;demoted&#8221; list to explain what this new list contains, and we&#8217;re all done.</p>

<p>So far I&#8217;ve noticed one &#8220;bug&#8221; with this script.  Normally, when GitHub displays information about a project, it&#8217;s the last changed date of the project that&#8217;s displayed.  Unfortunately, if the user has forked a repository, it seems that the date displayed is when the repository was forked rather than the last time it was edited.  Even if the fork happened months ago, and since then the user has made many edits themselves it&#8217;s still the fork date that&#8217;s displayed.  You can see this in action on <a href="http://github.com/bradleywright">Brad&#8217;s profile page</a> on the &#8220;homedir&#8221; project.</p>

<p>Short of GitHub exposing the actual last edited date on the page itself there is one other possible possibility for getting hold of a last edited(ish) date.  For each of the project activity sparklines, GitHub makes a call back to the server to grab a chunk of parseable data.  It might be possible to grab hold of that data using GreaseMonkey, but that&#8217;s a problem I leave to the enterprising reader.  If you do solve the problem, please do fork my code and send a pull request — I&#8217;d love to have this solved in the script.</p>

<p>If you fancy having this &#8220;Inactive Repository Demotion&#8221; functionality on GitHub, all you have to do is <a href="http://github.com/NeilCrosby/github-inactive-repository-demoter/tree">download the script</a>.  Oh, and whilst you&#8217;re at it, don&#8217;t forget to follow the repository so you can be told of any updates or bugfixes.</p>

<p>EDIT:</p>

<p>As it turns out, I should probably be a little more explicit about how to install the script.  First, download the entire repository as a zip or tgz.  Open it up, and then open the script up in Firefox.  The GreaseMonkey script will then install.</p>
]]></content:encoded>
			<wfw:commentRss>http://thecodetrain.co.uk/2009/03/github-inactive-repository-demoter-a-greasemonkey-script/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to get more than the last 10 Recently Played Tracks from last.fm</title>
		<link>http://thecodetrain.co.uk/2008/12/how-to-get-more-than-the-last-10-recently-played-tracks-from-lastfm/</link>
		<comments>http://thecodetrain.co.uk/2008/12/how-to-get-more-than-the-last-10-recently-played-tracks-from-lastfm/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 12:07:58 +0000</pubDate>
		<dc:creator>Neil Crosby</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[last.fm]]></category>
		<category><![CDATA[scratching an itch]]></category>

		<guid isPermaLink="false">http://thecodetrain.co.uk/?p=168</guid>
		<description><![CDATA[<p>I don&#8217;t have time for a full entry today, so here&#8217;s a quick tip for <a href="http://last.fm">last.fm</a> users who are making use of their &#8220;Recently Played Tracks&#8221; RSS to do cool things.</p>

<p>It turns out that you can increase the number of tracks returned by the feed simply by adding a <code>limit=somenumber</code> parameter to the URL.  So, for me to grab the last 20 songs that I&#8217;ve scrobbled, I would ask for:</p>

<pre><code>http://ws.audioscrobbler.com/1.0/user/NeilCrosby/recenttracks.rss?limit=20
</code></pre>

<p>I use this as a way of getting a decent sampling of my recent tracks to use on <a href="http://NeilCrosby.com">NeilCrosby.com</a>, as I found the default 10 was too limiting since my &#8220;Stream of Consciousness&#8221; stream normally covers a few days worth of information, whereas my last 10 tracks would only cover an hour or so of data.</p>
<div style="display:block"><small><em><a href="http://neilcrosby.com">Neil Crosby</a> also blogs at about t-shirts at <a href="http://iwearcotton.com">I Wear Cotton</a>, writes <a href="http://thetenwordreview.com/users/workingwithme">Ten Word Reviews</a>, and uploads <a href="http://www.flickr.com/photos/thevoicewithin/">photos</a> to flickr.  You can follow a combined feed of posts at <a href="http://neilcrosby.com/">NeilCrosby.com</a>.</em></small></div>]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t have time for a full entry today, so here&#8217;s a quick tip for <a href="http://last.fm">last.fm</a> users who are making use of their &#8220;Recently Played Tracks&#8221; RSS to do cool things.</p>

<p>It turns out that you can increase the number of tracks returned by the feed simply by adding a <code>limit=somenumber</code> parameter to the URL.  So, for me to grab the last 20 songs that I&#8217;ve scrobbled, I would ask for:</p>

<pre><code>http://ws.audioscrobbler.com/1.0/user/NeilCrosby/recenttracks.rss?limit=20
</code></pre>

<p>I use this as a way of getting a decent sampling of my recent tracks to use on <a href="http://NeilCrosby.com">NeilCrosby.com</a>, as I found the default 10 was too limiting since my &#8220;Stream of Consciousness&#8221; stream normally covers a few days worth of information, whereas my last 10 tracks would only cover an hour or so of data.</p>
]]></content:encoded>
			<wfw:commentRss>http://thecodetrain.co.uk/2008/12/how-to-get-more-than-the-last-10-recently-played-tracks-from-lastfm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

