<?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>Techbelly &#187; Internet</title>
	<atom:link href="http://www.techbelly.com/category/internet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.techbelly.com</link>
	<description>Ben Griffiths&#039; weblog</description>
	<lastBuildDate>Wed, 01 Sep 2010 15:13:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How I coach programmers.</title>
		<link>http://www.techbelly.com/2010/09/01/how-i-coach-programmers/</link>
		<comments>http://www.techbelly.com/2010/09/01/how-i-coach-programmers/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 14:54:24 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Internet]]></category>

		<guid isPermaLink="false">http://www.techbelly.com/?p=498</guid>
		<description><![CDATA[This scheme comes from Kent Beck, and it&#8217;s an excellent technique to train yourself into writing better code. I use it to teach good programming practice. This is how I coach programmers, and it works. First, write code that you know works. Any moron can write code that works. This is called hacking, and it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>This scheme comes from Kent Beck, and it&#8217;s an excellent technique to train yourself into writing better code. I use it to teach good programming practice. This is how I coach programmers, and it works.</p>
<ol>
<li>
First, write <strong>code that you know works</strong>. </p>
<p>Any moron can write code that works. This is called hacking, and it&#8217;s a pavlovian-conditioned pleasure. &#8220;Hey, it works. Can I have another biscuit now?&#8221; Sometimes, code that works is copied from other code that works. That&#8217;s ok, we&#8217;ll deal with it later. </p>
<p>How do you know it works? You&#8217;ll need tests, of course. Do not go on to the next step until you have tested code that works. </p>
<p>The hard bits are yet to come. You are far from finished.
</li>
<li>
Now, <strong>remove any duplication</strong>. </p>
<p>This is the hardest part of programming and takes years of experience to get passably good at. The programmers I think of as naturally talented have the best noses for sniffing out duplication. Experience gives you a range of techniques by which to remove it. </p>
<p>Do not remove duplication if it stops the code working. Sometimes duplication is easy to spot, othertimes it&#8217;s more subtle; sometimes it&#8217;s easy to remove, sometimes it&#8217;s very tricky. </p>
<p>This is where familiarity with the idioms and features of your chosen language is important. </p>
<p>This is the hardest part. If you want a name for this stage, you can call it abstraction or, if you like, design.
</li>
<li>
Now, make the code <strong>clearly express your intentions</strong>. </p>
<p>Removing duplication has already helped you here. But there&#8217;s likely further to go. Well-named methods, variables, classes. Spend some time here. Aim to concisely express, not to literally describe.</p>
<p>Please don&#8217;t think that this is where you comment your code. Prefer clearly written code over comments. Readable, beautiful, clear code is your aim. Trust that the how and why of the code will take care of itself.</p>
<p>The tricky bit here is that clarity is subjective. But, if you rename and restructure so that a programmer of your level can read the code and understand it, you&#8217;re in the right mindset. </p>
<p>You&#8217;re likely an average programmer. Your own understanding is a good benchmark.</p>
<p>Don&#8217;t introduce duplication and keep the code working. We&#8217;ve been there already, and we don&#8217;t want to slip backwards.
</li>
<li>
<strong>Remove redundant code</strong> and classes. </p>
<p>Just a final chance to tighten the nuts. And if you&#8217;ve got this far, you&#8217;re probably already in good shape, but this is where you have a chance to polish. </p>
<p>The tests you wrote in the first stage keep you in check here. Don&#8217;t regress: keep the code clear and free of duplication.
</li>
</ol>
<p>If you do these things, in this order, you will, with practice, produce better code and become a better programmer. There&#8217;s no magic here. Give it a try.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techbelly.com/2010/09/01/how-i-coach-programmers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Timing out a unix command</title>
		<link>http://www.techbelly.com/2010/07/17/timing-out-a-unix-command/</link>
		<comments>http://www.techbelly.com/2010/07/17/timing-out-a-unix-command/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 22:00:36 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.techbelly.com/?p=466</guid>
		<description><![CDATA[It&#8217;s a while since I wrote a techy article here. Let&#8217;s change that. Last week I was asked how to handle running a shell command from Ruby, with the added requirement that if the command took longer than a certain time it should time out. Running commands from ruby is easy, and you should watch [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a while since I wrote a techy article here. Let&#8217;s change that.</p>
<p>Last week I was asked how to handle running a shell command from Ruby, with the added requirement that if the command took longer than a certain time it should time out.</p>
<p>Running commands from ruby is easy, and you should watch <a href="http://www.rubymanor.org/harder/videos/short_order_ruby/">the video of my Ruby Manor talk</a> for some of the gory details.</p>
<p>But, is there a simple way to time-out a shell script using ruby? Well, you could probably write some heady threaded code that does it. But don&#8217;t. This is what the shell is for.</p>
<p>The usual Unix caveat applies: in the seventies, under the influence of prog rock, speed and the Californian sun, a bearded fellow already wrote the exact tool you want. And that tool has no doubt shipped with every Unix ever since. And everyone but you uses it daily.</p>
<p> But, this time, I couldn&#8217;t find that tool. There must be one. Anyone know of it?</p>
<p>Anyway, this is what I did:</p>
<blockquote>
<pre>
#!/bin/bash

# timeout
# Usage: timeout timeout_in_seconds command [args]
# Example: timeout 120 wget http://www.slowserver.com 

timeout=$1
command=$2
command_args=${@:3} 

$command $command_args &#38;
pid=$!
( sleep $timeout &#38;&#38; kill -9 $pid ) &#38;&gt; /dev/null

wait $pid &#38;&gt; /dev/null
exitcode=$?
exit $exitcode
</pre>
</blockquote>
<p>We launch the main command in the background; then, we launch a second command that sleeps for the requested timeout before attempting to kill the first one; then, we wait for the first command to finish (either of its own accord or thanks to a kill signal), returning its exit code as our own.</p>
<p> It&#8217;s brutish and dumb, but for most cases this simple approach works.</p>
<p>Be careful if your machine is going through PIDs like billy-o -you could end up sending the <span class="caps">TERM</span> signal to the wrong process -, but in general use that shouldn&#8217;t be a problem.</p>
<p>You could make it safer by storing start time and <span class="caps">PID</span> and making sure they both match, or something similar. Left as an exercise to the reader, as us lazy folk say.</p>
<p>A few bash things you may not have seen before: the special parameters <strong>!</strong>, <strong>@</strong> and <strong>?</strong>, <strong>wait</strong> and bash parameter substring expansion. </p>
<p><strong>$!</strong> expands to the PID of the most recently executed background command, and <strong>$?</strong> expands to the exit status of the most recently executed foreground command. </p>
<p><strong>&#8220;$@&#8221;</strong> is equivalent to <strong>&#8220;$1&#8243; &#8220;$2&#8243;</strong>&#8230;  I use the <strong>${parameter:offset}</strong> notation to grab a slice that array. </p>
<p><strong>wait</strong> is a useful shell built-in that takes any PID, waits for it to finish and returns its exit code.</p>
<p>Much more detail, of course, lurks in the bash man page &#8211; I still find I  look up these cryptic characters or copy them from an existing script.</p>
<p>There&#8217;s a standard tool that does this better, right?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techbelly.com/2010/07/17/timing-out-a-unix-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Short back and sides.</title>
		<link>http://www.techbelly.com/2010/06/23/short-back-and-sides/</link>
		<comments>http://www.techbelly.com/2010/06/23/short-back-and-sides/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 15:27:42 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[disney]]></category>
		<category><![CDATA[rights]]></category>

		<guid isPermaLink="false">http://www.techbelly.com/?p=463</guid>
		<description><![CDATA[I took the boy for a haircut on Monday. We didn&#8217;t want him to lose an ear, so I traipsed across London to a special children&#8217;s hairdressers. It was pretty exciting &#8211; the boy got to sit in a pedal-car aeroplane and watch a bit of Cars on a small DVD player, in a room [...]]]></description>
			<content:encoded><![CDATA[<p>I took the boy for a haircut on Monday. We didn&#8217;t want him to lose an ear, so I traipsed across London to a special children&#8217;s hairdressers. It was pretty exciting &#8211; the boy got to sit in a pedal-car aeroplane and watch a bit of Cars on a small DVD player, in a room with a big, bright, friendly Disney mural &#8211; Lion King, Jungle Book, Winnie the Pooh. He left with a bit less hair, and both ears intact.</p>
<p>Being latterly obsessed with rights and culture, I&#8217;m certain that that lovely room was one big rights violation, from the use of trademarked characters to the showing of a film without licence. </p>
<p>I&#8217;m of course guessing here, but I&#8217;d bet that there was no legal permission sought. Should we really care about that? I can&#8217;t bring myself to.</p>
<p>When things become part of our culture, they should transcend the petty rights-squabbling of corporations and their lawyers. </p>
<p>In my moral calculus, the rights of kids to be surrounded by and participate in familiar, comforting culture trump the rights of corporations to squeeze money from ideas they bought from artists.</p>
<p>We should need pretty strong evidence that future culture creation is threatened to mess with that equation. I don&#8217;t think that evidence is anywhere like as strong as rights people contend.</p>
<p>In the digital world, it&#8217;s looking like enforcement and detection is going to be easier, even if the so-called crimes are the same.</p>
<p>Imagine a version of Adobe Photoshop that won&#8217;t let you draw a picture of Mickey Mouse. Somewhere a rights lawyer just exploded with that possibility. Will the next version of Garageband let you record cover songs?</p>
<p>And you can bet it&#8217;ll happen. My paranoia reckons within 5 years it&#8217;ll be seriously proposed by someone, if it hasn&#8217;t been already.</p>
<p>Why are we letting this wholesale denial of folk-culture happen? Remind me again.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techbelly.com/2010/06/23/short-back-and-sides/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Architectures of control</title>
		<link>http://www.techbelly.com/2010/06/19/architectures-of-control/</link>
		<comments>http://www.techbelly.com/2010/06/19/architectures-of-control/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 13:58:58 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[architecture of control]]></category>
		<category><![CDATA[bbc]]></category>
		<category><![CDATA[DRM]]></category>
		<category><![CDATA[train tickets]]></category>

		<guid isPermaLink="false">http://www.techbelly.com/?p=456</guid>
		<description><![CDATA[We should strongly resist building architectures of control in public service. They empower the petty, and promote the bureaucratic over the human. This is why I oppose what the BBC is doing with its content protection. The humane solution is not to regulate these architectures, but to remove them. But, first up, another architecture of [...]]]></description>
			<content:encoded><![CDATA[<p>We should strongly resist building architectures of control in public service. They empower the petty, and promote the bureaucratic over the human. </p>
<p>This is why I oppose what the <a href="http://pjakma.wordpress.com/2010/06/18/more-bbc-iplayer-encryption-foi-materials/">BBC is doing with its content protection</a>.</p>
<p>The humane solution is not to regulate these architectures, but to remove them. </p>
<p>But, first up, another architecture of control: train ticket barriers.</p>
<p>A couple of months ago, I went to Paddington to meet my wife and child off the train. I wanted to help them off the train, with pushchair, luggage and all. But the guard at the ticket barrier prevented me from so doing. </p>
<p>It wasn&#8217;t his fault. He was just doing his job, that&#8217;s just the way things work, no-one is allowed through. Can you just wave me through, I want to help my wife off the train with the pushchair? &#8220;No, I can&#8217;t do that&#8221;. </p>
<p>Not much harm done, but real human moments missed &#8211; waving hello, waving goodbye, being there to carry someone&#8217;s bags. All in the name of fare-protection. All for my benefit.</p>
<p>I don&#8217;t want to overstate what happened. Martin and his family had a much <a href="http://www.currybet.net/cbet_blog/2010/05/national_express_east_anglia_abusive_staff.php">worse experience than I did</a>.  </p>
<p>But, these are not systems that encourage kindness. These are systems that create bureaucrats and pettiness, and all manner of knock-on grief.</p>
<p>Typically, these systems are put in for the benefit of the majority. They&#8217;re well-meaning. That makes it much harder to argue against them. You&#8217;ll be characterised as not having taken seriously a certain issue, in this case fare-dodging, or as trying to promote a minority&#8217;s interest at the expense of the common-sense majority case.</p>
<p>No cost-benefit analysis covers these human stories &#8211; what cost do you attach to waving good-bye to your family as the train pulls out, or to helping an elderly relative find their seat? </p>
<p>But I&#8217;m convinced, these are things that we should be accounting for. Our progress is better judged by its humanity than by the technological prowess of the Oyster card.</p>
<p>Incidentally, I was reminded of another, much worse aspect of this system, reading <a href="http://www.guardian.co.uk/lifeandstyle/2009/apr/11/right-way-to-raise-children">this article about Kids Company</a>:</p>
<blockquote><p>Some of the solutions may strike others as not so much flexible as perverse. For example, when Kids Company clients kept being arrested for assaulting London Transport staff, Batmanghelidjh&#8217;s solution was to issue them with free travel passes. But the arrests ended almost overnight.</p></blockquote>
<p>So, to the BBC&#8217;s content protection shenanigans. Opposing these doesn&#8217;t make me a pirate, any more than I&#8217;m siding with fare-dodgers above.</p>
<p>Again, rational, well-meaning folk think that exercising levers of control (in this case, on copying culture) will provide a net benefit to the majority. And, again, there are real human, and loving, stories to consider.</p>
<p>Here&#8217;s one: my wife&#8217;s cousins moved to Italy when they were young. My wife&#8217;s family set up an shuttle service of video tapes. Every week they&#8217;d video a selection of children&#8217;s TV and send the tapes to Italy; the next week they&#8217;d get the tapes back and record another selection to send &#8211; they couldn&#8217;t afford too many tapes. </p>
<p>This was kindness and contact and real. But, under the cost-benefit analysis, it&#8217;s piracy, too.</p>
<p>My Dad would wheel out a cine-projector at my birthday parties and play copied Woody Woodpecker cartoons to my invited friends. </p>
<p>Again, an awful piratical move, but human and real.</p>
<p>Video-tapes are awful inhuman, revenue-destroying, copying machines. But they&#8217;re also the Will Hay films my grandparents taped from the TV and watched again and again and again. On a twenty-year-old TV that needed no bureaucratic permission to watch them.</p>
<p>Anyway, you get my drift. None of these things show up in cost-benefit analyses of copy-protection. But they must. We should demand that these stories are taken account of. In fact, I would demand that for public service they should be the starting point of decision-making.</p>
<p>Even if the current architecture is mild in effect, it will spawn bureaucratic pettiness; it will serve as an example for anyone who wants to ratchet up the control dial in future; it will ultimately hurt us all, in a million petty little ways that just won&#8217;t show up on the balance sheets.</p>
<p>I can&#8217;t believe that the people asserting this control don&#8217;t have their own, personal examples of sharing culture. Of bootlegging songs from the top 40, or albums from their friends, on to cassette tapes. Of watching a copied video tape so many times that it was a snowstorm of noise. Of being given a mix-tape by a loved one. </p>
<p>The BBC is complicit in rolling out an architecture not based on kindness or on human stories, but on bureaucratic cost-benefit analyses. And we must resist that. We should consider all the kindness these systems kill.</p>
<p><b>If you have any stories of how copying content was a kindness, please leave them in the comments below. I&#8217;d love to be able to submit them the next time Ofcom has a consultation.</b></p>
]]></content:encoded>
			<wfw:commentRss>http://www.techbelly.com/2010/06/19/architectures-of-control/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>§calcwars twitter book.</title>
		<link>http://www.techbelly.com/2010/05/14/449/</link>
		<comments>http://www.techbelly.com/2010/05/14/449/#comments</comments>
		<pubDate>Fri, 14 May 2010 22:00:44 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[calcwars]]></category>
		<category><![CDATA[lulu]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[warblecamp]]></category>

		<guid isPermaLink="false">http://www.techbelly.com/?p=449</guid>
		<description><![CDATA[Another week, another hack-day. And another book made from twitter feeds. I was so pleased with the hardback version of my twitter book that I knew I had to make another book. And quickly. At the Warblecamp hackday last Saturday/Sunday I set about making book from one of the twitter events I&#8217;d been following. The [...]]]></description>
			<content:encoded><![CDATA[<p>Another week, another hack-day. And another book made from twitter feeds.</p>
<p>I was so pleased with the hardback version of my <a href="http://www.techbelly.com/2010/04/12/my-twitter-book-making-project/">twitter book</a> that I knew I had to make another book. And quickly.</p>
<p>At the <a href="http://warblecamp.org/">Warblecamp</a> hackday last Saturday/Sunday I set about making book from one of the twitter events I&#8217;d been following. <a href="http://teachingcollegemath.com/?p=2304">The Twitter Calculus Wars</a> is a fun project where three Algebra students from Michigan replayed the famous Newton/Leibniz rivalry on twitter.</p>
<p>I took their excellent work and turned it, along with some footnotes from wikipedia, into a 60 page book. You can <a href="http://www.techbelly.com/calc.pdf">download the final <span class="caps">PDF</span> here</a>.</p>
<p>That was on Monday. The first printed copy of it arrived today (Friday). That&#8217;s just four days &#8211; some excellent service from <a href="http://www.lulu.com">lulu.com</a>. It looks like it was printed in Eastbourne, whereas the hardback I&#8217;d previously had printed came from the states and took a bit longer.</p>
<p>Here it is:</p>
<p><object type="application/x-shockwave-flash" width="400" height="300" data="http://www.flickr.com/apps/video/stewart.swf?v=71377" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="flashvars" value="intl_lang=en-us&#38;photo_secret=b11f79f145&#38;photo_id=4606910113&#38;flickr_show_info_box=true"></param><param name="movie" value="http://www.flickr.com/apps/video/stewart.swf?v=71377"></param><param name="bgcolor" value="#000000"></param><param name="allowFullScreen" value="true"></param><embed type="application/x-shockwave-flash" src="http://www.flickr.com/apps/video/stewart.swf?v=71377" bgcolor="#000000" allowfullscreen="true" flashvars="intl_lang=en-us&#38;photo_secret=b11f79f145&#38;photo_id=4606910113&#38;flickr_show_info_box=true" height="300" width="400"></embed></object></p>
<p>I&#8217;m very, very happy with it. It feels like a book. I had worried that it wouldn&#8217;t &#8211; that it&#8217;d be too contrived, or there&#8217;d be some terrible flaw in the design that I hadn&#8217;t noticed, or that it just wouldn&#8217;t work in some way. But, it feels like a book.</p>
<p>The fonts work well, and I&#8217;ve learnt lots about the differences between screen and print. Some things that are difficult on the screen, work well in print &#8211; in this case, I was worried that using different fonts for footnotes and body copy would confuse. And on screen, it does somewhat; in print, it actually works well.</p>
<p>One other thing I learnt is that next time I&#8217;m making a twitter book, I&#8217;ll probably need to choose a font that has a hash (#) character. I had to cheat throughout and use the section mark (§) instead.</p>
<p>It&#8217;s a long while since I made something that I&#8217;m really proud of and that I don&#8217;t feel is compromised in some way. I&#8217;m getting back a lot of the confidence I&#8217;ve lacked recently, I think.</p>
<p>Anyhow, it&#8217;s easy and fun to get a book printed, and it&#8217;s pretty cheap too. It cost me $6 or thereabouts to get the copy printed and another $10 in super-express-do-whatever-it-takes-to-get-it-to-me-now postage. There are cheaper postage options available, if you&#8217;re more patient than I am.</p>
<p>The techniques I used were the same as with my <a href="http://github.com/techbelly/twitter_book">twitter_book</a> project. Firt, ruby scripts to pull tweets from twitter (and also wikipedia in this case) and emit some xml. Then, an xsl stylesheet to convert that xml into something I could feed into Apache fop. The resulting pdf was uploaded straight into <a href="http://www.lulu.com/content/paperback-book/§calcwars/8777462">lulu.com</a>.</p>
<p>All of this makes me want to make another one. And quickly. Keeping my eyes open for ideas&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techbelly.com/2010/05/14/449/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>My twitter book-making project</title>
		<link>http://www.techbelly.com/2010/04/12/my-twitter-book-making-project/</link>
		<comments>http://www.techbelly.com/2010/04/12/my-twitter-book-making-project/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 22:47:52 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[lulu]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.techbelly.com/?p=440</guid>
		<description><![CDATA[In other news, I made a book. A book of all my tweets since December 2007. I&#8217;m still not sure what I think about the exercise. Twitter&#8217;s the closest thing I have to a diary. I&#8217;ve never tweeted specifically in order to make a daily record, but that&#8217;s the form I chose for the book. [...]]]></description>
			<content:encoded><![CDATA[<p>In other news, I made a book. A book of all my tweets since December 2007.</p>
<p>I&#8217;m still not sure what I think about the exercise.</p>
<p>Twitter&#8217;s the closest thing I have to a diary. I&#8217;ve never tweeted specifically in order to make a daily record, but that&#8217;s the form I chose for the book.</p>
<p>And, I&#8217;ve got my own, personal reasons for wanting a record of the last couple of years.</p>
<p>So, this book &#8211; it&#8217;s 393 pages, give or take. And it has just short of 5,000 of my tweets in it. It cost me £20 to get printed.</p>
<p><object type="application/x-shockwave-flash" width="400" height="300" data="http://www.flickr.com/apps/video/stewart.swf?v=71377" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="flashvars" value="intl_lang=en-us&#38;photo_secret=e34b58b2cd&#38;photo_id=4515600905&#38;flickr_show_info_box=true"></param><param name="movie" value="http://www.flickr.com/apps/video/stewart.swf?v=71377"></param><param name="bgcolor" value="#000000"></param><param name="allowFullScreen" value="true"></param><embed type="application/x-shockwave-flash" src="http://www.flickr.com/apps/video/stewart.swf?v=71377" bgcolor="#000000" allowfullscreen="true" flashvars="intl_lang=en-us&#38;photo_secret=e34b58b2cd&#38;photo_id=4515600905&#38;flickr_show_info_box=true" height="300" width="400"></embed></object></p>
<p>It certainly does work as a device to take me back to certain times and certain places.</p>
<p>I like the way the references to webpages, events, and even people are already somewhat cryptic and heading towards being lost altogether. I do wonder what I&#8217;ll think of it in 5, 10, 15 years time. I wonder how much I&#8217;ll remember.</p>
<p>In form, it reminds me of a play or script, and there are certainly dramatis personae. But I&#8217;m the only one who speaks, and there&#8217;s little drama to the thing.</p>
<p>Sometimes, though, in the midst of my ramblings are some magic tweets &#8211; our last night in Berlin; the 12-week scan; Leonard coming home from hospital.</p>
<p> Browsing through it feels like going through an old box of photos.</p>
<p><a href="http://www.flickr.com/photos/bengriffiths/4516283310/" title="P1020427 by Techbelly, on Flickr"><img src="http://farm5.static.flickr.com/4029/4516283310_558345abf4.jpg" width="500" height="255" alt="P1020427" /></a></p>
<p>This version is something short of beautiful. But it&#8217;s a start. I&#8217;m going to literally put it on the shelf for a month or two and then come back to it.</p>
<p>In the meantime, if you want to make your own, you can try to run <a href="http://github.com/techbelly/twitter_book">the scripts I wrote</a>. I got this copy printed in Blackwells on Charing Cross Road, where they have a special in-store <a href="http://bookshop.blackwell.co.uk/jsp/editorial/browse/espresso.jsp">bookmaking machine</a>. I&#8217;ve got another one on order from <a href="http://www.lulu.com/uk">lulu.com</a> in a slightly different format.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techbelly.com/2010/04/12/my-twitter-book-making-project/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>YQL and Scraperwiki sitting in a tree&#8230;</title>
		<link>http://www.techbelly.com/2010/04/12/yql-and-scraperwiki-sitting-in-a-tree/</link>
		<comments>http://www.techbelly.com/2010/04/12/yql-and-scraperwiki-sitting-in-a-tree/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 16:25:00 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[scraperwiki]]></category>
		<category><![CDATA[yql]]></category>

		<guid isPermaLink="false">http://www.techbelly.com/?p=432</guid>
		<description><![CDATA[Scraperwiki is brilliant. YQL is brilliant. Now, they can get together and make lots of datababies. Using the simple webservice I&#8217;ve written, it&#8217;s a bit easier to use scraperwiki data in YQL queries and to mash up scraperwiki data with other YQL sources. YQL YQL presents a uniform query interface, modelled on SQL, for various [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://scraperwiki.com/">Scraperwiki</a> is brilliant. <a href="http://developer.yahoo.com/yql"><span class="caps">YQL</span></a> is brilliant. Now, they can get together and make lots of datababies.</p>
<p>Using the simple webservice I&#8217;ve written, it&#8217;s a bit easier to use scraperwiki data in YQL queries and to mash up scraperwiki data with other YQL sources.</p>
<h3><span class="caps">YQL</span></h3>
<p><span class="caps">YQL</span> presents a uniform query interface, modelled on <span class="caps">SQL</span>, for various web APIs. You can run queries like <a href="http://developer.yahoo.com/yql/console/#h=select%20*%20from%20flickr.photos.recent">select * from flickr.photos.recent</a> to get a list, in json or in xml, of recent flickr photos.</p>
<p>Data can be mashed together from multiple tables/urls, like so:</p>
<pre>
    select * from search.web where query in
        (select title from rss
            where url="http://rss.news.yahoo.com/rss/topstories"
            | truncate(count=1))
    limit 1
</pre>
<p><a href="http://developer.yahoo.com/yql/console/#h=select%20*%20from%20search.web%20where%20query%20in%20%28select%20title%20from%20rss%20where%20url%3D%22http%3A//rss.news.yahoo.com/rss/topstories%22%20%7C%20truncate%28count%3D1%29%29%20limit%201">[run that in the <span class="caps">YQL</span> console]</a></p>
<p>By publishing a chunk of <span class="caps">XML</span> and javascript by way of an adaptor non-Yahoo! services can be queried through <span class="caps">YQL</span>. </p>
<p>There are already adaptors published for <a href="http://datatables.org/">many web APIs</a>. <span class="caps">YQL</span> calls these things &#8216;datatables&#8217;. And you can use them like this:</p>
<pre>
    USE "http://myserver.com/mytables.xml" AS mytable;
    SELECT * FROM mytable WHERE...
</pre>
<p>With me so far?</p>
<h3>Scraperwiki</h3>
<p>Scraperwiki is a new, still-in-beta service for building web-scrapers and sharing the data they scrape. More scrapers are appearing daily and the site provides a useful <span class="caps">API</span> for querying the data created.</p>
<h3>Using scraperwiki in <span class="caps">YQL</span></h3>
<p>I&#8217;ve created a service that automatically generates <span class="caps">YQL</span> datatable definitions from scraperwiki scrapers. You can find the definition for any scraperwiki scraper at a url that looks like this: http://swikiyql.heroku.com/SCRAPERWIKI_SHORT_NAME.xml</p>
<p>You&#8217;ll need a scraperwiki <span class="caps">API</span> key &#8211; you can sign up for one on their site. But once you&#8217;ve done that you should be able to run <span class="caps">YQL</span> queries like this</p>
<pre>
    use 'http://swikiyql.heroku.com/wikipedia-2010-uk-election-candidates.xml'
        AS candidates;
    SELECT * FROM candidates
        WHERE party='UKIP'
        AND sw_api_key='YOUR_SW_API_KEY';
</pre>
<p>which queries the data from <a href="http://scraperwiki.com/scrapers/show/wikipedia-2010-uk-election-candidates/data/">this scraperwiki scrape</a>. And using this, you should be able to mash together different scraperwiki scrapes, or mash scrapes with any other YQL tables.</p>
<p>That&#8217;s it really &#8211; the source code for the swikiyql (pronounced swikiyql) is <a href="http://github.com/techbelly/scraperwikiyql">on github</a> and there are probably lots of things wrong with it, but it works for me.</p>
<p>Now, go, mash things up!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techbelly.com/2010/04/12/yql-and-scraperwiki-sitting-in-a-tree/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Merry fucking Xmas, love Big Brother.</title>
		<link>http://www.techbelly.com/2009/11/28/merry-fucking-xmas-love-big-brother/</link>
		<comments>http://www.techbelly.com/2009/11/28/merry-fucking-xmas-love-big-brother/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 20:15:25 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[big brother]]></category>
		<category><![CDATA[christmas]]></category>
		<category><![CDATA[trees]]></category>

		<guid isPermaLink="false">http://www.techbelly.com/?p=411</guid>
		<description><![CDATA[Christmas tree decoration seen in Canary Wharf shopping centre reads: CCTV in operation here. This has to be a prank, right? There&#8217;s no way, even in the Orwellian Albtraum of Canary Wharf, that someone would have decided this an appropriate Christmas decoration for the shopping centre&#8217;s christmas trees. Alas, I fear it&#8217;s real and intentional: [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.techbelly.com/wp-content/uploads/2009/11/IMG_0144.jpg"><img src="http://www.techbelly.com/wp-content/uploads/2009/11/IMG_0144-225x300.jpg" alt="IMG_0144" title="IMG_0144" width="225" height="300" align="left" class="size-medium" style="padding-right: 10px"/></a></p>
<p>Christmas tree decoration seen in Canary Wharf shopping centre reads: <b>CCTV in operation here</b>.</p>
<p>This has to be a prank, right? There&#8217;s no way, even in the Orwellian Albtraum of Canary Wharf, that someone would have decided this an appropriate Christmas decoration for the shopping centre&#8217;s christmas trees.</p>
<p>Alas, I fear it&#8217;s real and intentional: what you see here is the red version of the sign on the red-lit trees. Similar colour-coordinated signs were on the blue trees too. In fact, this sign was on every damned Christmas tree in the whole of the damned centre.</p>
<p>It&#8217;s possibly the most obnoxious, awful thing I&#8217;ve ever seen come out of this obnoxious, awful managerial surveillance culture of ours. This defies parody. If it&#8217;s a prank, it&#8217;s an excellent one. But&#8230;</p>
<p>You know, I hate the polythene-thin sentiment of Christmas, in so many ways. But even I think we&#8217;re worse off if Christmas means <b>goodwill to all men, and remember, we&#8217;re watching you people</b>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techbelly.com/2009/11/28/merry-fucking-xmas-love-big-brother/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sucking tweets into a local database</title>
		<link>http://www.techbelly.com/2009/11/14/sucking-tweets-into-a-local-database/</link>
		<comments>http://www.techbelly.com/2009/11/14/sucking-tweets-into-a-local-database/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 01:47:27 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.techbelly.com/?p=406</guid>
		<description><![CDATA[A friend asked me yesterday if I could snap together a script to build a local database of tweets using the twitter search API. This is what I came up with. The script takes one argument &#8211; the term to search on &#8211; and creates a sqlite3 database in the current directory containing all the [...]]]></description>
			<content:encoded><![CDATA[<p>A friend asked me yesterday if I could snap together a script to build a local database of tweets using the twitter search API.</p>
<p><a href="http://pastie.textmate.org/698244">This is what I came up with.</a> </p>
<p>The script takes one argument &#8211; the term to search on &#8211; and creates a sqlite3 database in the current directory containing all the tweets that the twitter search API returns for that term. </p>
<p>It requires <a href="http://datamapper.org/">datamapper</a> and <a href="http://github.com/dancroak/twitter-search">twitter_search</a> gems to be installed. </p>
<p>Have at it, make it better, bend it to your twitter-slurping needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techbelly.com/2009/11/14/sucking-tweets-into-a-local-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Play IF in Campfire</title>
		<link>http://www.techbelly.com/2009/11/13/play-if-in-campfire/</link>
		<comments>http://www.techbelly.com/2009/11/13/play-if-in-campfire/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 23:56:08 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[campfire]]></category>
		<category><![CDATA[if]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.techbelly.com/?p=398</guid>
		<description><![CDATA[Ruby is an excellent language for writing small scripts to glue stuff together. Here&#8217;s a script I knocked together that lets you play a zcode text adventure (interactive fiction) with your friends in Campfire. You&#8217;ll need a room, account, etc. in Campfire; you&#8217;ll need to compile this version of dumb-frotz; and you&#8217;ll need a zcode [...]]]></description>
			<content:encoded><![CDATA[<p>Ruby is an excellent language for writing small scripts to glue stuff together. Here&#8217;s <a href="http://techbelly.com/campfrotz.rb">a script</a> I knocked together that lets you play a <a href="http://en.wikipedia.org/wiki/Z-machine">zcode</a> text adventure (interactive fiction) with your friends in <a href="http://campfirenow.com/">Campfire</a>.</p>
<p>You&#8217;ll need a room, account, etc. in Campfire; you&#8217;ll need to compile this <a href="http://woz.gs/tim/zork/">version of dumb-frotz</a>; and you&#8217;ll need a zcode file to play &#8211; plenty of those at the <a href="http://ifdb.tads.org">Interactive Fiction Database</a>. </p>
<p>I only wrote about this because <a href="http://twitter.com/lazyatom/status/5682190846">@lazyatom called me a genius</a> for doing it. Which was nice.</p>
<p><a href="http://techbelly.com/campfrotz.rb">Have fun.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.techbelly.com/2009/11/13/play-if-in-campfire/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
