<?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>Whomwah.com &#187; sinatra</title>
	<atom:link href="http://whomwah.com/tag/sinatra/feed/" rel="self" type="application/rss+xml" />
	<link>http://whomwah.com</link>
	<description>The website of Duncan Robertson, currently working for the BBC in London, Uk</description>
	<lastBuildDate>Thu, 29 Jul 2010 19:51:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Creating shopping lists from BBC Recipes using Sinatra</title>
		<link>http://whomwah.com/2009/10/28/creating-shopping-lists-from-bbc-recipes-using-sinatra/</link>
		<comments>http://whomwah.com/2009/10/28/creating-shopping-lists-from-bbc-recipes-using-sinatra/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 12:44:06 +0000</pubDate>
		<dc:creator>Duncan</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[BBC]]></category>
		<category><![CDATA[food]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[sinatra]]></category>

		<guid isPermaLink="false">http://whomwah.com/?p=1738</guid>
		<description><![CDATA[This is another case of looking at a BBC site I use frequently, and extending it. Here&#8217;s my use case. I found a recipe I&#8217;d like to make from the BBC Recipes site, so I first need to buy the ingredients. The ingredients by default are part of the recipe page, and even if I [...]]]></description>
			<content:encoded><![CDATA[<p>This is <a href="http://whomwah.com/2009/10/15/subscribe-to-the-bbc-garden-planner-with-the-help-of-sinatra/">another case</a> of looking at a <a href="http://www.bbc.co.uk">BBC site</a> I use frequently, and extending it. Here&#8217;s my use case. I found a recipe I&#8217;d like to make from the <a href="http://www.bbc.co.uk/food/recipes">BBC Recipes site</a>, so I first need to buy the ingredients. The ingredients by default are part of the recipe page, and even if I print out the recipe, it&#8217;s still got stuff I don&#8217;t need. It would be nice if I could just turn that recipe information into this:</p>
<p><a href="http://www.flickr.com/photos/duncanponting/4051983397/"><img src="http://farm3.static.flickr.com/2711/4051983397_8f8f71f692.jpg" alt="Ingredients" /></a></p>
<p>It&#8217;s a simple list of ingredients, that have a checkbox next to each item to mark when I have put it in my basket.</p>
<p>So I have built myself a simple <a href="http://www.sinatrarb.com/">Sinatra</a> app that does just this:</p>
<ul>
<li><a href="http://sl.whomwah.com">http://sl.whomwah.com</a></li>
<li><a href="http://github.com/whomwah/shoppinglist">Source Code</a></li>
</ul>
<p>If you look at it on your iphone it will look styled, whereas on other devices it will just look simple and standard.</p>
<p>From the site you just need to post the url of a recipe you want the ingredients listed, for example the screenshot above is what happened when I posted this url into it:</p>
<ul>
<li><a href="http://www.bbc.co.uk/food/recipes/database/spicychorizopennepas_84044.shtml">http://www.bbc.co.uk/food/recipes/database/spicychorizopennepas_84044.shtml</a></li>
</ul>
<p>It&#8217;s very simple, give it a try, see what you think.</p>
<p>Ok, one thing I should note, is that I can&#8217;t be sure it will be 100% correct every time. This is a real pain, but out of may hands. The BBC recipe pages look very nice and all, but the most important part of the page &#8220;<em>The Recipe</em>&#8221; is not only terribly marked up, but it&#8217;s not consistent. I suspect this is due to being a free text field in a legacy CMS? but it means that when I get my application to try to look at it, and turn it into a list of ingredients, I can&#8217;t be sure of the structure and have to make a bunch of assumptions, which are sometimes wrong.</p>
<p>It would be great if this could be rectified, as we could then see lots of experiments like this out there.  In fact with well marked up recipes, and there does appear to be a recipe markup spec:</p>
<ul>
<li><a href="http://www.formatdata.com/recipeml/spec/recipeml-spec.html">http://www.formatdata.com/recipeml/spec/recipeml-spec.html</a></li>
</ul>
<p>People could build some great application around all this information.</p>
]]></content:encoded>
			<wfw:commentRss>http://whomwah.com/2009/10/28/creating-shopping-lists-from-bbc-recipes-using-sinatra/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>BBC Gardeners&#8217; Planner in your calendar part deux</title>
		<link>http://whomwah.com/2009/10/20/bbc-gardeners-planner-in-your-calendar-part-deux/</link>
		<comments>http://whomwah.com/2009/10/20/bbc-gardeners-planner-in-your-calendar-part-deux/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 13:01:24 +0000</pubDate>
		<dc:creator>Duncan</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[BBC]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[sinatra]]></category>

		<guid isPermaLink="false">http://whomwah.com/?p=1713</guid>
		<description><![CDATA[This is just a small extension to the original post: Subscribe to the BBC Gardeners’ Planner with the help of Sinatra. I mentioned there that I needed to add some caching to the application, and also that it didn&#8217;t live anywhere. Well it now has caching (a feeds cached for a day) thanks to rack/cache [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a small extension to the original post: <a href="http://whomwah.com/2009/10/15/subscribe-to-the-bbc-garden-planner-with-the-help-of-sinatra/">Subscribe to the BBC Gardeners’ Planner with the help of Sinatra</a>.</p>
<p>I mentioned there that I needed to add some caching to <a href="http://github.com/whomwah/gwplanner">the application</a>, and also that it didn&#8217;t live anywhere. Well it now has caching (a feeds cached for a day) thanks to <a href="http://tomayko.com/src/rack-cache/">rack/cache</a> and it now has a url:</p>
<ul>
<li><a href="http://gw.whomwah.com">http://gw.whomwah.com</a></li>
</ul>
<p>Which you can now use in your iCal enabled calendar, one of which is <a href="http://www.google.com/calendar/">Google Calendar</a>, which is used in the photo below where I have subscriber to:</p>
<ul>
<li><a href="http://gw.whomwah.com/planner.ics?s=houseplants,greenhouse">http://gw.whomwah.com/planner.ics?s=houseplants,greenhouse</a></li>
<li><a href="http://gw.whomwah.com/planner.ics?s=hedges">http://gw.whomwah.com/planner.ics?s=hedges</a></li>
</ul>
<p><a href="http://www.flickr.com/photos/duncanponting/4029389908/"><img src="http://farm3.static.flickr.com/2489/4029389908_b184d826df.jpg" alt="Google Calendar" /></a></p>
<p>I was having some strange problems the other day, where Google Calendar was showing the calendar titles as long email addresses. I think this may be a Google Calendar index thing (anyone know?), as it appears to fix itself over time so ignore it.</p>
]]></content:encoded>
			<wfw:commentRss>http://whomwah.com/2009/10/20/bbc-gardeners-planner-in-your-calendar-part-deux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Subscribe to the BBC Gardeners&#8217; Planner with the help of Sinatra</title>
		<link>http://whomwah.com/2009/10/15/subscribe-to-the-bbc-garden-planner-with-the-help-of-sinatra/</link>
		<comments>http://whomwah.com/2009/10/15/subscribe-to-the-bbc-garden-planner-with-the-help-of-sinatra/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 09:45:50 +0000</pubDate>
		<dc:creator>Duncan</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[BBC]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[sinatra]]></category>

		<guid isPermaLink="false">http://whomwah.com/?p=1685</guid>
		<description><![CDATA[[UPDATE] I have posted an update with a url you can use I really like being in my garden, so I was looking at the BBC Gardening site the other day for some gardening tips. The hardest part for me, is the lack of experience I have in knowing what needs to be done and [...]]]></description>
			<content:encoded><![CDATA[<p class="update">[UPDATE] I have <a href="http://whomwah.com/2009/10/20/bbc-gardeners-planner-in-your-calendar-part-deux/">posted an update</a> with a url you can use</p>
<p>I really like being in my garden, so I was looking at the <a href="http://www.bbc.co.uk/gardening">BBC Gardening site</a> the other day for <a href="http://www.bbc.co.uk/gardening/calendar/">some gardening tips</a>. The hardest part for me, is the lack of experience I have in knowing what needs to be done and when.</p>
<p>The BBC Gardening website solves this by having <a href="http://www.bbc.co.uk/gardening/calendar/calendar.shtml">a gardeners&#8217; planner</a>. Great I thought, there&#8217;s loads of really useful stuff in there. The problem is I have to keep going back to the site, to check what I&#8217;m suppose to be doing. As it&#8217;s a planner, it would be great of I could have this information to put in <a href="http://calendar.google.com">my own calendar</a>, so I could see it along with other jobs I have to do. Even better if I could subscribe to this information, so if it ever changes, I&#8217;m kept up-to-date. Maybe they will provide this one day (I really think they should), but in the mean time I decided to roll my own:</p>
<p><a href="http://www.flickr.com/photos/duncanponting/4012776724/"><img src="http://farm3.static.flickr.com/2609/4012776724_9a7b594374.jpg" alt="Subscribing to the BBC Garden planner" /></a></p>
<p>I&#8217;ve <a href="http://github.com/whomwah/gwplanner">created a web app</a> that reads this planner data, and converts it into the <a href="http://en.wikipedia.org/wiki/ICalendar">iCal format</a> that you can now subscribe to. It&#8217;s written using <a href="http://www.sinatrarb.com/">Sinatra</a>, and I choose to run it under the awesome <a href="http://www.modrails.com/">Passenger</a> via mod_passenger. It&#8217;s currently not hosted anywhere (other than on my laptop), so you&#8217;ll have to run it on your own server. Maybe that will change if I can find somewhere to stick it, I&#8217;ll keep you posted. I think some caching may be needed before that happens though.</p>
<p>Once running on your computer of choice, you only really have one uri to stick in your calendar of choice. You can extend this uri by passing in section names to filter the information displayed in the calendar. Here&#8217;s a few examples:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># to subscribe to a calendar of everything ( quite big! )</span>
http:<span style="color:#006600; font-weight:bold;">//</span>mydomain.<span style="color:#9900CC;">local</span><span style="color:#006600; font-weight:bold;">/</span>planner.<span style="color:#9900CC;">ics</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># to subscribe to a calendar of tips on just trees, ponds and wildlife</span>
http:<span style="color:#006600; font-weight:bold;">//</span>mydomain.<span style="color:#9900CC;">local</span><span style="color:#006600; font-weight:bold;">/</span>planner.<span style="color:#9900CC;">ics</span>?s=trees,ponds,wildlife
&nbsp;
<span style="color:#008000; font-style:italic;"># to view all the available sections</span>
http:<span style="color:#006600; font-weight:bold;">//</span>mydomain.<span style="color:#9900CC;">local</span><span style="color:#006600; font-weight:bold;">/</span></pre></div></div>

<p>And here&#8217;s what it looks like in <a href="http://www.apple.com/">Apple&#8217;s</a> iCal once you have subscibed:</p>
<p><a href="http://www.flickr.com/photos/duncanponting/4012776834/"><img src="http://farm3.static.flickr.com/2616/4012776834_8e3c7d9a54.jpg" alt="BBC Garden planner in iCal" /></a></p>
<p>Get your own copy of the app from <a href="http://github.com/">github</a>. You <a href="http://www.modrails.com/documentation/Users%20guide%20Apache.html#_sinatra">get up and running</a> in the same way you would with any Sinatra/Passenger app. The structure and config file is already written, so you really just need to do the vhost and symlinking :</p>
<ul>
<li><a href="http://github.com/whomwah/gwplanner/raw/master/README">Check the apps README file</a></li>
<li><a href="http://github.com/whomwah/gwplanner">Get a copy of GWPlanner</a></li>
</ul>
<p>Happy Gardening!</p>
]]></content:encoded>
			<wfw:commentRss>http://whomwah.com/2009/10/15/subscribe-to-the-bbc-garden-planner-with-the-help-of-sinatra/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Controlling the spotlights at work with Sinatra and OSC</title>
		<link>http://whomwah.com/2009/04/24/controlling-the-spotlights-at-work-with-sinatra-and-osc/</link>
		<comments>http://whomwah.com/2009/04/24/controlling-the-spotlights-at-work-with-sinatra-and-osc/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 20:47:58 +0000</pubDate>
		<dc:creator>Duncan</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[BBC]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[sinatra]]></category>

		<guid isPermaLink="false">http://whomwah.com/?p=1470</guid>
		<description><![CDATA[Nic bought some spotlights the other week for work, so we could hook them up to our continuous integration server, and they would let us know using the medium of colour, when things had failed! Before we did that, I thought I&#8217;d have a little play. Tristan and Chris having been building a fun new [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.aelius.com/njh/">Nic</a> bought some <a href="http://www.soundsavers.com/catalog/all-lighting-177/led-par-cans-231/ledj-eco-led-56-can-black-10mm-led-2985.html">spotlights</a> the other week for work, so we could hook them up to our <a href="http://en.wikipedia.org/wiki/Continuous_Integration">continuous integration server</a>, and they would let us know using the medium of colour, when things had failed!</p>
<p>Before we did that, I thought I&#8217;d have a little play. <a href="http://www.cookinrelaxin.com">Tristan</a> and <a href="http://www.fridayforward.com/">Chris</a> having been building a fun new game (Read more via the <a href="http://www.bbc.co.uk/blogs/radiolabs/">Radio Labs blog</a> soon) which uses <em>nowplaying</em> data from <a href="http://bbc.co.uk/6music">BBC 6 Music</a> to power it. Knowing when a track is starting and ending is also useful, so as a bit of fun, I wrote a little <a href="http://ruby-lang.org/en/">Ruby</a> script that made the spotlights behave like traffic lights:</p>
<ol>
<li>Green &#8211; when a track started playing</li>
<li>Flashing Amber &#8211; when a track was about to finish</li>
<li>Red &#8211; when the track finally finished</li>
</ol>
<p><img src="http://farm4.static.flickr.com/3586/3465581068_67c13f1132.jpg?v=0" alt="spotlight" /><span class="caption">Photo by <a href="http://www.cookinrelaxin.com/">Tristan</a></span></p>
<p>To control the lights we&#8217;re using <a href="http://hans.fugal.net/src/rosc/doc/">ROSC</a> open sound control for <a href="http://ruby-lang.org/en/">Ruby</a>. It&#8217;s very good, but required building to install, and the interface is nice, but not simple enough if all you&#8217;re doing is turning a light on or off and changing it&#8217;s colour. So in order to make the script even more simple, I thought I&#8217;d write a little http proxy so that your could control the lights by just going to a url. It meant even the non-programmers could have fun replicating disco lighting. The urls look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">http://spotlights.local/all/green
http://spotlights.local/all/rgb120-12-200
http://spotlights.local/all/off
http://spotlights.local/all/random</pre></div></div>

<p>The proxy is written using <a href="http://www.sinatrarb.com/">Sinatra</a>. I love <a href="http://www.sinatrarb.com/">Sinatra</a>. If you thought prototyping was simple with <a href="http://rubyonrails.org/">Rails</a>, well with Sinatra + <a href="http://www.modrails.com/">Passenger</a> it takes simplicity to a whole new level.</p>
<p>You can <a href="http://github.com/whomwah/light-controller">download the lightcontroller source</a> from <a href="http://github.com/">Github</a> as normal, you&#8217;ll have to tweak a few settings for your needs. You may even find it a useful template for controlling something else. </p>
]]></content:encoded>
			<wfw:commentRss>http://whomwah.com/2009/04/24/controlling-the-spotlights-at-work-with-sinatra-and-osc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
