<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>code monk</title>
	<atom:link href="http://drj11.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://drj11.wordpress.com</link>
	<description>hacking habits</description>
	<lastBuildDate>Fri, 27 Jan 2012 14:28:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='drj11.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>code monk</title>
		<link>http://drj11.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://drj11.wordpress.com/osd.xml" title="code monk" />
	<atom:link rel='hub' href='http://drj11.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Unix command line pebbles</title>
		<link>http://drj11.wordpress.com/2012/01/13/unix-command-line-pebbles/</link>
		<comments>http://drj11.wordpress.com/2012/01/13/unix-command-line-pebbles/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 11:31:37 +0000</pubDate>
		<dc:creator>drj11</dc:creator>
				<category><![CDATA[/bin/sh]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://drj11.wordpress.com/?p=922</guid>
		<description><![CDATA[I always find that &#8220;sitting next to someone new&#8221; is an interesting and revealing experience. I learn new things, they learn new things. Over the years I&#8217;ve accumulated a bunch of tricks about using the command line, using vi, and even using emacs. The thing I&#8217;m talking about are things can&#8217;t really be learned in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=922&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I always find that &#8220;sitting next to someone new&#8221; is an interesting and revealing experience.  I learn new things, they learn new things.  Over the years I&#8217;ve accumulated a bunch of tricks about using the command line, using vi, and even using emacs.  The thing I&#8217;m talking about are things can&#8217;t really be learned in a formal context, they are too small and there are too many of them.  Yet collectively they form part of the fabric of what it means to be a vi user or a shell programmer or whatever.  Picking them up and passing them on by sitting next to someone is the only way I know to spread them.  Well, maybe this blog post is a start.</p>
<p>Here&#8217;s a few I&#8217;ve recently picked up or passed on:</p>
<p><code>cd -</code></p>
<p>It changes directory to the last directory that you changed from.  It&#8217;s /bin/bash not /bin/sh (so I personally would avoid writing it in scripts).  I think someone alleged that this was undocumented, but in fact I recently checked and it is in fact documented in the <em>builtins</em> section of the /bin/bash man page, which is huge.</p>
<p>It&#8217;s useful when you want to cd to some directory to run a command, but then cd back.</p>
<p>Line 25 of the <a href="https://bitbucket.org/ScraperWiki/scraperwiki/src/b30ef424dce1/uml/runlocal#cl-25">runlocal script in ScraperWiki</a> used to do just that in order to start a service from within a different current directory:</p>
<p><pre class="brush: plain;">
cd ../services/scriptmgr
node ./scriptmgr.js &amp;
cd -
</pre></p>
<p>Because I don&#8217;t like writing bash-specific scripts, <a href="https://bitbucket.org/ScraperWiki/scraperwiki/src/32fec230c0cd/uml/runlocal#cl-30">I changed this to use a subshell, with round brackets</a>:</p>
<p><pre class="brush: plain;">
(
    cd ../services/scriptmgr
    node ./scriptmgr.js &amp;
)
</pre></p>
<p>A subshell is used to run the code between the round brackets, and it is just a forked copy of the shell.  It has exactly the same environment (environment variables, open files, and so on), but is in another process.  Since the Current Working Directory is specific to the process, changing it in the subshell has no effect on the outer shell, which carries on unaffected after the subshell has returned.  So that&#8217;s something I&#8217;ve passed on recently.</p>
<p><code>cp foo.cnf{-inhg,}</code></p>
<p>This is the same as <code>cp foo.cnf-inhg foo.cnf</code>.  It copies a file by removing the <em>-inhg</em> extension from its name.  ScraperWiki stores some config files in Mercurial (the <em>-inhg</em> versions), and they are copied so they can be edited locally (the versions without the <em>-inhg</em> suffix).  I&#8217;m sure this has all sorts of evil uses.</p>
<p><code>sudo !!</code></p>
<p>Of the things I&#8217;ve picked up recently, this is my favourite.  I like how some of these tips are a combination of things that I already knew individually but hadn&#8217;t thought to combine.  Of course I know that <em>sudo thing</em> runs <em>thing</em> as root, and I did once know that <em>!!</em> is the /bin/csh mechanism (stolen by /bin/bash) for executing the previously typed command.  In combination, <em>sudo !!</em> runs the previously typed command as root.  Which is perfect for when you typed <em>pip install thinginator</em> instead of <em><u>sudo</u> pip install thinginator</em>.</p>
<p><code>Ctrl-R</code></p>
<p>The favourite thing I seem to have spread seems to be Ctrl-R.  (in /bin/bash) you press Ctrl-R, start typing, and bash will search for what you type in your command history; press Return to execute the command or Ctrl-R to find the next older match.  Press Ctrl-C if you didn&#8217;t really want to do that.</p>
<p>Credits</p>
<p>One of the @pysheff crowd for <em>sudo !!</em>; can&#8217;t remember whether it was <a href="https://twitter.com/#!/davbo">@davbo</a> or <a href="https://twitter.com/#!/dchetwynd">@dchetwynd</a>.</p>
<p><a href="https://twitter.com/#!/rossjones">Ross Jones</a> for <em>cd -</em>;</p>
<p>Bitbucket user <a href="https://bitbucket.org/mammadori">mammadori</a> &#8220;{-ext,}&#8221;.</p>
<p>If you enjoyed this post, you may also like <a href="http://blog.plover.com/prog/bash-expr.html">Mark Dominus&#8217; semi-rant on the craptastic way to do calculation in shell scripts</a>.  Huh, now I feel compelled to that Mark gets it wrong about GNU Shell; arithmetic expansion is not a GNU innovation, it <a href="http://pubs.opengroup.org/onlinepubs/007908799/xcu/chap2.html#tag_001_006_004">comes from POSIX</a>, having been slightly mutated from an earlier Korn Shell feature.  And if he had comments I would&#8217;ve said that on his &#8220;blag&#8221;.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/drj11.wordpress.com/922/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/drj11.wordpress.com/922/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/drj11.wordpress.com/922/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/drj11.wordpress.com/922/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/drj11.wordpress.com/922/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/drj11.wordpress.com/922/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/drj11.wordpress.com/922/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/drj11.wordpress.com/922/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/drj11.wordpress.com/922/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/drj11.wordpress.com/922/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/drj11.wordpress.com/922/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/drj11.wordpress.com/922/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/drj11.wordpress.com/922/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/drj11.wordpress.com/922/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=922&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://drj11.wordpress.com/2012/01/13/unix-command-line-pebbles/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c6dfaac50b9c43815dd18081e87f3e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">drj11</media:title>
		</media:content>
	</item>
		<item>
		<title>My Favourite Bugs, Part 2</title>
		<link>http://drj11.wordpress.com/2011/05/12/my-favourite-bugs-part-2/</link>
		<comments>http://drj11.wordpress.com/2011/05/12/my-favourite-bugs-part-2/#comments</comments>
		<pubDate>Thu, 12 May 2011 11:16:16 +0000</pubDate>
		<dc:creator>drj11</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[bugs]]></category>

		<guid isPermaLink="false">http://drj11.wordpress.com/?p=912</guid>
		<description><![CDATA[Another one. Two of us were working at the client&#8217;s site on the software for what was essentially a compact static robot that was responsible for moving small items from a hopper to a delivery point. There was approximately one instance of the hardware that we were writing software for, and it sat on a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=912&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Another one.</p>
<p>Two of us were working at the client&#8217;s site on the software for what was essentially a compact static robot that was responsible for moving small items from a hopper to a delivery point.  There was approximately one instance of the hardware that we were writing software for, and it sat on a bench between our two workstations.  Most of the mechanical bits were in a more or less finished state.  I was particularly impressed with the piston that generated partial vacuum so that items could be picked with a moving arm with suction cups on.  Just one or two gears were made of prototyping plastic; and because of a gearing problem the belt didn&#8217;t move at the speed that it said it should in the spec.  But you know, typical prototype hardware.  The electronics were a mixture of off-the-shelf dev kits for 8-bit embedded micros, mini custom circuit boards for novel sensors, and lovingly hand soldered discrete parts.  Add to that the fact that as a software guy I didn&#8217;t really understand the importance of grounding, and <em>La Machine</em> wasn&#8217;t always completely reliable (my colleague had just lent me Tracy Kidder&#8217;s <em>Soul of a New Machine</em>).</p>
<p>Various optical/IR sensors kept track of the items as they moved inside the internals of the machine, various other sensors kept track of motor positions and/or speeds.  There was a slightly hairy state machine (documented using OmniGraffle) to keep track of it all.  The target pick rate was 5 items per second, and as it took more than 200ms for an item to go from the hopper to the point where it left the machine, there could be several items &#8220;in-flight&#8221; at any one time (and of course, picking an item was never completely reliable, so the sensors were used to track the items, and determine if a retry was required).</p>
<p>This day it seemed to be working fine, except for some reason the software was reporting that items were failing to be delivered, when in fact I could plainly see that items were popping out of the top of the machine.  This was causing the machine to prematurely stop, as it would, sensibly, stop picking items if it thought that a picked item was stuck inside the machine somewhere.  Up to this point it had basically been working fine; it had been working the same morning. I was sat thinking about this and investigating somewhat.  I&#8217;d even checked the last thing I&#8217;d changed.  So I called my colleague over (just at the next desk) and he came over to look while I demonstrated the problem.  It worked.  There was no problem.  Flakies (there&#8217;s a memorable part of Kidder&#8217;s book where one of the engineers in helping a more junior engineer sort out a problem with a wire-wrap memory board, grabs the whole frame and shakes it, claiming that it&#8217;s probably just <em>flakies</em>; of course it works after that).</p>
<p>So that&#8217;s okay then.  But when I try it again, it&#8217;s not working.  Colleague comes over.  Works.  I work at it on my own.  Doesn&#8217;t work.</p>
<p>It turned out that it was quite a sunny day.  The sun reached the window in the afternoon.  Sunlight was falling on machine near the optical sensor and presumably bouncing around enough to prevent the sensor from registering the occlusion as the item went past.  When my colleague came over, he was standing over the machine and his shadow blocked the sunlight.  This wouldn&#8217;t be a problem in the production hardware, as it was all in a box (and hence, dark inside).</p>
<p>I constructed an optical shield and installed it on <em>La Machine</em> (a post-it note stuck to the side).</p>
<p>This was not a problem that could be fixed using print.  We did have print via the serial port, but printing more than one character was hazardous because it meant that time taken to transmit characters on the serial line would interfere with the realtime operation of the rest of the software (when items are being picked every 200ms, every millisecond counts).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/drj11.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/drj11.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/drj11.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/drj11.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/drj11.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/drj11.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/drj11.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/drj11.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/drj11.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/drj11.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/drj11.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/drj11.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/drj11.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/drj11.wordpress.com/912/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=912&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://drj11.wordpress.com/2011/05/12/my-favourite-bugs-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c6dfaac50b9c43815dd18081e87f3e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">drj11</media:title>
		</media:content>
	</item>
		<item>
		<title>My Favourite Bugs</title>
		<link>http://drj11.wordpress.com/2011/05/11/my-favourite-bugs/</link>
		<comments>http://drj11.wordpress.com/2011/05/11/my-favourite-bugs/#comments</comments>
		<pubDate>Wed, 11 May 2011 07:15:43 +0000</pubDate>
		<dc:creator>drj11</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[bugs]]></category>

		<guid isPermaLink="false">http://drj11.wordpress.com/?p=910</guid>
		<description><![CDATA[I&#8217;ve been reading Seibel&#8216;s Coders at Work, a series of interviews with various venerable hacker types. It&#8217;s fun! Seibel often steers the conversation to a few clearly prepared questions. This seems to be a nice strategy, it realigns the interview and keeps it going when someone is banging on about his pet project, and it [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=910&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been reading <a href="http://gigamonkeys.wordpress.com/">Seibel</a>&#8216;s <em>Coders at Work</em>, a series of interviews with various venerable hacker types.  It&#8217;s fun!</p>
<p>Seibel often steers the conversation to a few clearly prepared questions.  This seems to be a nice strategy, it realigns the interview and keeps it going when someone is banging on about his pet project, and it means we often get several opinions on a topic.  One of the stock questions is, &#8220;what&#8217;s the worst bug you&#8217;ve had to deal with?&#8221;.  Here&#8217;s one of mine.</p>
<p>I was part of a small team writing the garbage collector for a new implementation of the Dylan language.  Our garbage collector was soft-realtime (pauses for GC for interactive programs were comparable to pauses due to page faults), generational copying, with a read-barrier, implemented on stock hardware and on multiprocessor machines.  32-bit Intel, 64-bit Alpha, 32- or 64-bit MIPS, SPARC (and probably more, I forget).</p>
<p>Our client were the compiler group.  They were implementing the compiler for Dylan, and they had to integrate our garbage collector with their runtime.  Lots of meetings about object layouts, header formats, hash tables, multithreaded stack allocation, that sort of thing.  The compiler development was (finally) going through a bootstrapping phase.  The compiler was being used to compile itself (previously the compiler was compiled using a version of Dylan that was &#8220;hosted&#8221; on a Common Lisp implementation).  This was a troublesome phase.  Compiling the compiler was typically done overnight, it took several hours.  There was a change in the semantics of multimethod dispatch (I think), and it was important to get the first self-hosted implementation of the compiler with the new semantics out to the people using the compiler, so they didn&#8217;t accidentally write code to the old semantics.</p>
<p>The overnight compile was usually done on the dual processor SPARC.  Unfortunately the overnight compile had stopped.  At an assertion in the garbage collector.  After running for several hours.  It wasn&#8217;t really feasible to restart the compilation, I would be on the bus home before it hit the assertion again.  And maybe it was due to some thread scheduling that only became a problem on a multiprocessor machine.  The assert looked fine.  It was checking that some value only increased monotonically.  After some time thinking about in our group, we realised that the assert was fine, unless we were on a multiprocessor machine.  I think the assertion was outside of a monitored block or something like that.  The rest of the code (we reasoned) was fine.  So the code was right, but the assertion was wrong.</p>
<p>We could edit the assertion out and ship a new release over to the compiler group.  They would integrate the new release and it would be fine the next day.  What about all those people in the US that wanted to use the new compiler when they woke later today?  They couldn&#8217;t wait that long.</p>
<p>We patched the live binary.  The overnight compile had stopped at this assertion and was showing it in the debugger.  We looked up the NOP instruction in the architecture manuals and poked it in at the location where the assertion branched (or did it trap into the debugger? I forget).  So now the assertion never fired.  We let the debugger continue the process, and the compile ran fine with no garbage collection problems and finished a couple of hours later.  Everyone could use the new compiler today!</p>
<p>This was not a problem that could have been fixed by using print.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/drj11.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/drj11.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/drj11.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/drj11.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/drj11.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/drj11.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/drj11.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/drj11.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/drj11.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/drj11.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/drj11.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/drj11.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/drj11.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/drj11.wordpress.com/910/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=910&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://drj11.wordpress.com/2011/05/11/my-favourite-bugs/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c6dfaac50b9c43815dd18081e87f3e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">drj11</media:title>
		</media:content>
	</item>
		<item>
		<title>The importance of AV</title>
		<link>http://drj11.wordpress.com/2011/04/04/the-importance-of-av/</link>
		<comments>http://drj11.wordpress.com/2011/04/04/the-importance-of-av/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 10:37:43 +0000</pubDate>
		<dc:creator>drj11</dc:creator>
				<category><![CDATA[rant]]></category>
		<category><![CDATA[voting]]></category>

		<guid isPermaLink="false">http://drj11.wordpress.com/?p=899</guid>
		<description><![CDATA[As you may know here in the UK we&#8217;re about to have a referendum to change the way we vote for our elected MPs. It means I have something important to talk about. Kerning. Kerning is the &#8220;negative space&#8221; between a pair of letters. Where the shapes of two adjacent letterforms complement each other, there [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=899&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As you may know here in the UK we&#8217;re about to have a referendum to change the way we vote for our elected MPs.  It means I have something important to talk about.</p>
<p><a href="http://drj11.files.wordpress.com/2011/04/kernav.pdf"><img src="http://drj11.files.wordpress.com/2011/04/kernav.png?w=380&#038;h=216" alt="" title="kernav" width="380" height="216" class="size-full wp-image-901" /></a></p>
<p>Kerning.</p>
<p>Kerning is the &#8220;negative space&#8221; between a pair of letters.  Where the shapes of two adjacent letterforms complement each other, there is a danger of leaving too large a space between them if you space out the letters too rigidly.  In the logo above, the <em>A</em> and the <em>V</em> in the first line have been brought closer together compared to the second line.  I hope you can appreciate that &#8220;Yes to AV&#8221; has the better letter-spacing.  And if you can&#8217;t, GET OFF MY BLOG!</p>
<p>This is the launch of the &#8220;Yes to AV; No to A V&#8221; campaign.  I even have a logo with totally web 2.0 compliant round corners in a shade that isn&#8217;t blue.</p>
<p>Any half decent package that allows you to type in text should allow you to adjust the kerning, the spacing between the letters.  In Mac OS X the feature has been built into the standard text widget, and hence incorporated into every application that plays nicely, since the dawn of time.  I did the graphic in <a href="http://inkscape.org/">Inkscape</a> which, being an X11 app, does not play nicely, but it didn&#8217;t matter.  Most of the time you don&#8217;t need to hand kern the spacing between individual letters, because the font files that describe the letterforms also come with kerning tables, to adjust the spacing between pairs of letters that comonly need attention.  &#8220;AV&#8221; is not as common as &#8220;Ye&#8221; or &#8220;Wo&#8221; but i&#8217;d still expect it to be kerned by the font software.</p>
<p>And so it is.  It turns out that in my installation of Inkscape I have two <em>Times</em> fonts that I can choose in the pull-down font selector thingy.  One called <em>Times New Roman</em>, one called <em>Times</em>.</p>
<p><img src="http://drj11.files.wordpress.com/2011/04/selecttimes.png?w=380" alt="" title="times"   class="alignleft size-full wp-image-903" /></p>
<p>So in making my &#8220;Yes to AV; No to A V&#8221; logo, all I had to do was choose <em>Times New Roman</em> for the &#8220;Yes to AV&#8221; line, and choose <em>Times</em> for the &#8220;No to A V&#8221; line.  I expect <em>Times New Roman</em> is the system font exposed as an X11 font, and <em>Times</em> is some craptastic knockoff supplied with Inkscape that obviously has second-rate kerning tables.  Thanks for that.</p>
<p>This article was of course inspired by the leader in The Observer (you will recall the dark ages of the 20th century when people read the news in print; The Observer is a notable Sunday publication from that era):<br />
<a href="http://drj11.files.wordpress.com/2011/04/obsav330.png"><img src="http://drj11.files.wordpress.com/2011/04/obsav330.png?w=380" alt="" title="obsav330"   class="size-full wp-image-904" /></a></p>
<p>Weird.  The appalling typography almost distracted me from reading the article (another win for that new-fangled web technology).  Even weirder: they get their typography sorted on the opposite page.</p>
<p>So the message is clear: &#8220;Yes to AV; No to A V&#8221;.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/drj11.wordpress.com/899/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/drj11.wordpress.com/899/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/drj11.wordpress.com/899/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/drj11.wordpress.com/899/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/drj11.wordpress.com/899/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/drj11.wordpress.com/899/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/drj11.wordpress.com/899/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/drj11.wordpress.com/899/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/drj11.wordpress.com/899/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/drj11.wordpress.com/899/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/drj11.wordpress.com/899/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/drj11.wordpress.com/899/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/drj11.wordpress.com/899/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/drj11.wordpress.com/899/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=899&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://drj11.wordpress.com/2011/04/04/the-importance-of-av/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c6dfaac50b9c43815dd18081e87f3e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">drj11</media:title>
		</media:content>

		<media:content url="http://drj11.files.wordpress.com/2011/04/kernav.png" medium="image">
			<media:title type="html">kernav</media:title>
		</media:content>

		<media:content url="http://drj11.files.wordpress.com/2011/04/selecttimes.png" medium="image">
			<media:title type="html">times</media:title>
		</media:content>

		<media:content url="http://drj11.files.wordpress.com/2011/04/obsav330.png" medium="image">
			<media:title type="html">obsav330</media:title>
		</media:content>
	</item>
		<item>
		<title>Fun with Polarization</title>
		<link>http://drj11.wordpress.com/2010/10/13/fun-with-polarization/</link>
		<comments>http://drj11.wordpress.com/2010/10/13/fun-with-polarization/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 15:35:06 +0000</pubDate>
		<dc:creator>drj11</dc:creator>
				<category><![CDATA[science]]></category>
		<category><![CDATA[3d glasses]]></category>
		<category><![CDATA[polarisation]]></category>

		<guid isPermaLink="false">http://drj11.wordpress.com/?p=874</guid>
		<description><![CDATA[I went to see Toy Story 3 in 3D (great film, but the 3D was not worth it); so I have a pair of those cheap plastic &#8220;3D&#8221; glasses. They&#8217;re actually polarising lenses (er, filter, not lens, as the picture is not magnified or minified, but whatever). You can use them to Do Science at [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=874&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I went to see Toy Story 3 in 3D (great film, but the 3D was not worth it); so I have a pair of those cheap plastic &#8220;3D&#8221; glasses.</p>
<p>They&#8217;re actually polarising lenses (er, filter, not lens, as the picture is not magnified or minified, but whatever).  You can use them to Do Science at home:<br />
<div id="attachment_875" class="wp-caption alignnone" style="width: 390px"><a href="http://drj11.files.wordpress.com/2010/10/img_1770.jpg"><img src="http://drj11.files.wordpress.com/2010/10/img_1770.jpg?w=360&#038;h=270" alt="" title="polarized iPod" width="360" height="270" class="alignnone size-medium wp-image-875" /></a><p class="wp-caption-text">Birefringence</p></div></p>
<p>Above is a picture of an iPod taken through one of the lenses (of the 3D glasses).  The coloured pattern is, I think, due to birefringence, but I&#8217;m not competent to explain it entirely.</p>
<p>Same shot, but using the other lens:<br />
<a href="http://drj11.files.wordpress.com/2010/10/img_1771.jpg"><img src="http://drj11.files.wordpress.com/2010/10/img_1771.jpg?w=360&#038;h=270" alt="" title="iPod" width="360" height="270" class="alignnone size-medium wp-image-877" /></a></p>
<p>So we see that the lens can be used to see patterns that are otherwise not visible.  In this case, we can see stress patterns in the plastic (I think).  Looking a bit more carefully at the iPod pictures, we can see that the patterns on the iPod are different for the two lenses.  Thus, there are two different sorts of light that each lens passes.</p>
<p>The next picture involves a mirror:<br />
<a href="http://drj11.files.wordpress.com/2010/10/img_1774.jpg"><img src="http://drj11.files.wordpress.com/2010/10/img_1774.jpg?w=300&#038;h=225" alt="" title="mirror" width="300" height="225" class="alignnone size-medium wp-image-880" /></a></p>
<p>I am holding the camera behind one of the lenses and shooting a picture into the mirror so I can see myself and the glasses and camera in the mirror. [edit: it's more fun to put the glasses on and look into a mirror and close one eye, but I can't show you a picture of that.]</p>
<p>Note that from the viewer side both of the lenses in the glasses are transparent.  But as seen in the mirror, one of the lenses is opaque.  Curiously the lens that is opaque in the mirror, is the one in front of the camera.  How did the picture get taken!?  Clearly light is able to enter the camera having passed through the right-hand lens.  But the camera, behind the right-hand lens, is not visible.  So light leaving the body of the camera through the right-hand lens cannot pass through the lens again when reflected in the mirror:</p>
<p><a href="http://drj11.files.wordpress.com/2010/10/polarization.png"><img src="http://drj11.files.wordpress.com/2010/10/polarization.png?w=380" alt="" title="polarization"   class="alignnone size-full wp-image-882" /></a></p>
<p>My explanation of this is that the light acquires a property as it passes through the lens, and the mirror changes that property so that light with the new property cannot pass through the lens.  The property is the handedness of circular polarisation.  The right-hand lens filters the light so it contains right-circular polarised light (say); the mirror reflects it into left-circular polarised light which cannot pass back through the lens (and into the camera sensor).  Note that light that passes through the <em>left</em> lens and is reflected in the mirror, <em>can</em> pass through the right-lens.</p>
<p>[edit: however, I have a problem with this explanation, as it does not explain what happens when I get my laser pointer out...]</p>
<p>3D films work by displaying one frame through a left-circular polarising filter, and the next through a right-circular polarising filter, and alternating.  A reflective screen with the right properties will maintain the separate polarisation of alternate frames.  Circular polarising filters in the glasses are insensitive to viewing angle, so it&#8217;s a superior option to linear polarisation.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/drj11.wordpress.com/874/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/drj11.wordpress.com/874/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/drj11.wordpress.com/874/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/drj11.wordpress.com/874/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/drj11.wordpress.com/874/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/drj11.wordpress.com/874/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/drj11.wordpress.com/874/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/drj11.wordpress.com/874/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/drj11.wordpress.com/874/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/drj11.wordpress.com/874/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/drj11.wordpress.com/874/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/drj11.wordpress.com/874/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/drj11.wordpress.com/874/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/drj11.wordpress.com/874/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=874&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://drj11.wordpress.com/2010/10/13/fun-with-polarization/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c6dfaac50b9c43815dd18081e87f3e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">drj11</media:title>
		</media:content>

		<media:content url="http://drj11.files.wordpress.com/2010/10/img_1770.jpg?w=360" medium="image">
			<media:title type="html">polarized iPod</media:title>
		</media:content>

		<media:content url="http://drj11.files.wordpress.com/2010/10/img_1771.jpg?w=360" medium="image">
			<media:title type="html">iPod</media:title>
		</media:content>

		<media:content url="http://drj11.files.wordpress.com/2010/10/img_1774.jpg?w=300" medium="image">
			<media:title type="html">mirror</media:title>
		</media:content>

		<media:content url="http://drj11.files.wordpress.com/2010/10/polarization.png" medium="image">
			<media:title type="html">polarization</media:title>
		</media:content>
	</item>
		<item>
		<title>Colouring Doubt&#8217;s Flag</title>
		<link>http://drj11.wordpress.com/2010/09/24/colouring-doubts-flag/</link>
		<comments>http://drj11.wordpress.com/2010/09/24/colouring-doubts-flag/#comments</comments>
		<pubDate>Fri, 24 Sep 2010 09:33:48 +0000</pubDate>
		<dc:creator>drj11</dc:creator>
				<category><![CDATA[environment]]></category>
		<category><![CDATA[global warming]]></category>
		<category><![CDATA[science]]></category>

		<guid isPermaLink="false">http://drj11.wordpress.com/?p=866</guid>
		<description><![CDATA[Judith Curry is keen to frame doubt in the form of an italian flag. Specifically with reference to this statement from IPCC WG1 Summary for Policy Makers: Most of the observed increase in global average temperatures since the mid-20th century is very likely due to the observed increase in anthropogenic greenhouse gas concentrations. Curry&#8217;s flag [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=866&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://judithcurry.com/2010/09/15/doubt/">Judith Curry is keen to frame doubt in the form of an italian flag</a>.  Specifically with reference to this statement from <a href="http://www.ipcc.ch/publications_and_data/ar4/wg1/en/spmsspm-understanding-and.html">IPCC WG1 Summary for Policy Makers</a>:</p>
<blockquote><p>
Most of the observed increase in global average temperatures since the mid-20th century is very likely due to the observed increase in anthropogenic greenhouse gas concentrations.
</p></blockquote>
<p>Curry&#8217;s flag interpretation of this statement is that we could colour the flag 5% white (uncommitted belief), 67% green (anthropogenic forcing), 28% red (natural variability).  A minor quibble: the opposite of &#8220;due to increase in anthropogenic GHG&#8221; is not &#8220;natural variability&#8221; as that excludes other anthropogenic activies such as sulphate emissions and secondary effects like ozone increases due to Montreal protocol.  Anyway, her flag would look like this (if she drew it):<br />
<a href="http://drj11.files.wordpress.com/2010/09/flag0.png"><img src="http://drj11.files.wordpress.com/2010/09/flag0.png?w=380&#038;h=126" alt="" title="flag0" width="380" height="126" class="alignnone size-full wp-image-867" /></a></p>
<p>Does that seem right, can we be almost certain that there is only 5% wiggle room for doubt?  Also, if I say that 70% of the variation is anthropogenic that doesn&#8217;t mean the rest (or almost all the rest) is natural, it just means I don&#8217;t know.  I interpret the IPCC statement as meaning that there are a wide range of supportable beliefs about the anthropogenic cause of 20th century warming, but 95% (ish) of those will have more than 50% of the flag coloured green.  Amongst the population of possible flags is this one:<br />
<a href="http://drj11.files.wordpress.com/2010/09/flag1.png"><img src="http://drj11.files.wordpress.com/2010/09/flag1.png?w=380&#038;h=126" alt="" title="flag1" width="380" height="126" class="alignnone size-full wp-image-869" /></a></p>
<p>Note that this flag already represents quite an extreme position with respect to the IPCC statement, because whilst it&#8217;s compatible with the IPCC statement, only 5% of the flags have a smaller green area than this.  Here&#8217;s a more median position:</p>
<p><a href="http://drj11.files.wordpress.com/2010/09/flag2.png"><img src="http://drj11.files.wordpress.com/2010/09/flag2.png?w=380&#038;h=126" alt="" title="flag2" width="380" height="126" class="alignnone size-full wp-image-870" /></a></p>
<p>How can we represent the range of beliefs that are compatible with the IPCC statement.  Like this?<br />
<a href="http://drj11.files.wordpress.com/2010/09/flag3.png"><img src="http://drj11.files.wordpress.com/2010/09/flag3.png?w=380&#038;h=126" alt="" title="flag3" width="380" height="126" class="alignnone size-full wp-image-871" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/drj11.wordpress.com/866/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/drj11.wordpress.com/866/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/drj11.wordpress.com/866/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/drj11.wordpress.com/866/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/drj11.wordpress.com/866/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/drj11.wordpress.com/866/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/drj11.wordpress.com/866/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/drj11.wordpress.com/866/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/drj11.wordpress.com/866/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/drj11.wordpress.com/866/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/drj11.wordpress.com/866/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/drj11.wordpress.com/866/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/drj11.wordpress.com/866/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/drj11.wordpress.com/866/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=866&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://drj11.wordpress.com/2010/09/24/colouring-doubts-flag/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c6dfaac50b9c43815dd18081e87f3e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">drj11</media:title>
		</media:content>

		<media:content url="http://drj11.files.wordpress.com/2010/09/flag0.png" medium="image">
			<media:title type="html">flag0</media:title>
		</media:content>

		<media:content url="http://drj11.files.wordpress.com/2010/09/flag1.png" medium="image">
			<media:title type="html">flag1</media:title>
		</media:content>

		<media:content url="http://drj11.files.wordpress.com/2010/09/flag2.png" medium="image">
			<media:title type="html">flag2</media:title>
		</media:content>

		<media:content url="http://drj11.files.wordpress.com/2010/09/flag3.png" medium="image">
			<media:title type="html">flag3</media:title>
		</media:content>
	</item>
		<item>
		<title>Python dictionary: iterating and adding</title>
		<link>http://drj11.wordpress.com/2010/03/05/python-dictionary-iterating-and-adding/</link>
		<comments>http://drj11.wordpress.com/2010/03/05/python-dictionary-iterating-and-adding/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 08:58:11 +0000</pubDate>
		<dc:creator>drj11</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://drj11.wordpress.com/?p=854</guid>
		<description><![CDATA[On one of my earlier articles about Python dictionaries Jay asks (I paraphrase): What if you want to add items to a dictionary whilst iterating? And what if you want those items to appear in the iteration? Python&#8217;s standard dictionary iterators won&#8217;t help you. Here&#8217;s a plan: keep a set, visited of keys that you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=854&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://drj11.wordpress.com/2009/04/02/python-iterating-and-mutating-dictionary/">On one of my earlier articles about Python dictionaries</a> Jay asks (I paraphrase): What if you want to add items to a dictionary whilst iterating?  And what if you want those items to appear in the iteration?  Python&#8217;s standard dictionary iterators won&#8217;t help you.</p>
<p>Here&#8217;s a plan:</p>
<ol>
<li> keep a set, <em>visited</em> of keys that you have already visited;
<li> get the set of keys from the dictionary and subtract <em>visited</em>, leaving you with a set of keys not yet visited, <em>todo</em>;
<li> visit each of the keys in <em>todo</em>;
<li> now we have visited each of the keys in <em>todo</em>, add those keys to <em>visited</em>;
<li> during the iteration the set of keys in the dictionary may have changed, so repeat from (2), stopping when <em>todo</em> is empty.
</ol>
<p><pre class="brush: python;">
def iterall(adict):
    &quot;&quot;&quot;Iterate over all the items in a dictionary,
    including ones which are added during the iteration.
    &quot;&quot;&quot;
    visited = set()
    while True:
        todo = set(adict.keys()) - visited
        if not todo:
            break
        for k in todo:
            if k in adict:
                yield k, adict[k]
        visited |= todo
</pre></p>
<p>Here it is in use:</p>
<pre>
&gt;&gt;&gt; d=dict(a=1,b=2)
&gt;&gt;&gt; for k,v in iterall(d):
...     print k,v
...     d['c'+k[0]] = 'new'
...
a 1
b 2
cb new
ca new
cc new
</pre>
<p>Python&#8217;s set datatype makes this easy to program and it has reasonable performance.</p>
<p>Obligatory Python whinge: The function implemented above, <em>iterall</em>, is effectively a new method that I&#8217;ve implemented for the <code>dict</code> class.  But I can&#8217;t add a new method to a class that someone else implemented.  Unlike, say, Common Lisp, Dylan, Smalltalk, and Objective-C, where I can.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/drj11.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/drj11.wordpress.com/854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/drj11.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/drj11.wordpress.com/854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/drj11.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/drj11.wordpress.com/854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/drj11.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/drj11.wordpress.com/854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/drj11.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/drj11.wordpress.com/854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/drj11.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/drj11.wordpress.com/854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/drj11.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/drj11.wordpress.com/854/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=854&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://drj11.wordpress.com/2010/03/05/python-dictionary-iterating-and-adding/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c6dfaac50b9c43815dd18081e87f3e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">drj11</media:title>
		</media:content>
	</item>
		<item>
		<title>Python: a string indexing trick</title>
		<link>http://drj11.wordpress.com/2010/02/23/python-a-string-indexing-trick/</link>
		<comments>http://drj11.wordpress.com/2010/02/23/python-a-string-indexing-trick/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 09:42:04 +0000</pubDate>
		<dc:creator>drj11</dc:creator>
				<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://drj11.wordpress.com/?p=846</guid>
		<description><![CDATA[Let&#8217;s say you want to extract all the lines of a file where the character at index 5 is not a space: Problem: short lines. line[5] might not be a valid index. Exception. You might consider line[5:6]. Normally this is the same as line[5], but when line is short then instead of raising an Exception [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=846&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say you want to extract all the lines of a file where the character at index 5 is not a space:</p>
<p><pre class="brush: python;">
with open('sequences.gb') as f:
  for line in f:
    if line[5] != ' ':
      print line[:-1]
</pre></p>
<p>Problem: short lines.  <code>line[5]</code> might not be a valid index.  Exception.</p>
<p>You might consider <code>line[5:6]</code>.  Normally this is the same as <code>line[5]</code>, but when <code>line</code> is short then instead of raising an <a href="http://docs.python.org/reference/simple_stmts.html#raise">Exception</a> it evaluates to the empty string, <code>""</code>.</p>
<p>In this case it will result in short lines being selected and printed.  If the test was <code>if line[5:6] in string.letters</code> then it will result in short lines being rejected.  But that changes the semantics of the test for the lines that are long enough.  If I had written <code>if '&nbsp;'.startswith(line[5:6])</code> then I keep the same test semantics for long lines and I reject short lines.  It&#8217;s weird and not clear though.</p>
<p>Sometimes this trick may be appropriate, and you may be able to tweak your test to accommodate it.  Don&#8217;t let the clarity slide.  There is a great deal of merit to: <code>if len(line) &gt; 5 and line[5] != ' '</code>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/drj11.wordpress.com/846/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/drj11.wordpress.com/846/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/drj11.wordpress.com/846/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/drj11.wordpress.com/846/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/drj11.wordpress.com/846/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/drj11.wordpress.com/846/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/drj11.wordpress.com/846/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/drj11.wordpress.com/846/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/drj11.wordpress.com/846/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/drj11.wordpress.com/846/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/drj11.wordpress.com/846/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/drj11.wordpress.com/846/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/drj11.wordpress.com/846/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/drj11.wordpress.com/846/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=846&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://drj11.wordpress.com/2010/02/23/python-a-string-indexing-trick/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c6dfaac50b9c43815dd18081e87f3e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">drj11</media:title>
		</media:content>
	</item>
		<item>
		<title>Python: Getting FASTA with itertools.groupby</title>
		<link>http://drj11.wordpress.com/2010/02/22/python-getting-fasta-with-itertools-groupby/</link>
		<comments>http://drj11.wordpress.com/2010/02/22/python-getting-fasta-with-itertools-groupby/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 12:30:35 +0000</pubDate>
		<dc:creator>drj11</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[bioinformatics]]></category>
		<category><![CDATA[FASTA]]></category>
		<category><![CDATA[itertools.groupby]]></category>

		<guid isPermaLink="false">http://drj11.wordpress.com/?p=825</guid>
		<description><![CDATA[I&#8217;d like to introduce you to my new best friend: itertools.groupby. Let&#8217;s say you want to do some processing of the genes in Danio rerio (zebrafish). Here&#8217;s the Ensembl project&#8217;s FASTA file containing all the peptide sequences: ftp://ftp.ensembl.org/pub/release-56/fasta/danio_rerio/pep/Danio_rerio.Zv8.56.pep.all.fa.gz. (After I&#8217;ve decompressed it) the file looks like this: &#62;ENSDARP00000100686 pep:known scaffold:Zv8:Zv8_NA5235:758:1999:1 gene:ENSDARG00000076631 transcript:ENSDART00000111668 LKSHSNTQPYLTVDSSGKYLRSQLHSQWHPINEKFRCEVCGRCFHSNTNLLVHYAVHTGE KPYKCSFCEKGFSQKGNLQAHERIHRGEKPFSCVICGRSFTQKVCLRNHERIHRGEKPFT CMTCGKGFTQKVTLQQHLAVHDKTTKRLCITCSSTFRTSSAKAVHKPIQSSNMP [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=825&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d like to introduce you to my new best friend: <a href="http://docs.python.org/library/itertools.html#itertools.groupby"><code>itertools.groupby</code></a>.</p>
<p>Let&#8217;s say you want to do some processing of the genes in <a href="http://en.wikipedia.org/wiki/Zebrafish"><i>Danio rerio</i> (zebrafish)</a>.  Here&#8217;s the Ensembl project&#8217;s FASTA file containing all the peptide sequences: <a href="ftp://ftp.ensembl.org/pub/release-56/fasta/danio_rerio/pep/Danio_rerio.Zv8.56.pep.all.fa.gz"><code>ftp://ftp.ensembl.org/pub/release-56/fasta/danio_rerio/pep/Danio_rerio.Zv8.56.pep.all.fa.gz</code></a>.</p>
<p>(After I&#8217;ve decompressed it) the file looks like this:</p>
<pre>
&gt;ENSDARP00000100686 pep:known scaffold:Zv8:Zv8_NA5235:758:1999:1 gene:ENSDARG00000076631 transcript:ENSDART00000111668
LKSHSNTQPYLTVDSSGKYLRSQLHSQWHPINEKFRCEVCGRCFHSNTNLLVHYAVHTGE
KPYKCSFCEKGFSQKGNLQAHERIHRGEKPFSCVICGRSFTQKVCLRNHERIHRGEKPFT
CMTCGKGFTQKVTLQQHLAVHDKTTKRLCITCSSTFRTSSAKAVHKPIQSSNMP
&gt;ENSDARP00000094838 pep:known scaffold:Zv8:Zv8_NA8956:1000:1382:1 gene:ENSDARG00000070696 transcript:ENSDART00000104063
FLISSVDNSEYMRNGDFLPTRLQAQQDAVNIICHSKTRSNPENNVGLITMANNCEVLTTL
TPDTGRILSKLHAVQPRGVISFCTGIRVAHV
&gt;ENSDARP00000102657 pep:known scaffold:Zv8:Zv8_NA8774:1123:1377:-1 gene:ENSDARG00000078974 transcript:ENSDART00000114102
MASAPPSSPHNRSRSEDEEDPVDTMISKTGCAELHYTLLDCMAEHQDWRKCQTEVLKFKE
CMSAYQNTRKEQLLKQKTSATESV
[...]
</pre>
<p>It&#8217;s a list of peptide sequences, with each sequence consisting of a header line beginning with &#8216;&gt;&#8217;:</p>
<p><code>&gt;ENSDARP00000100686 pep:known </code>&#8230;</p>
<p>The header contains identification information (and is probably too long for my blog); following the header is a number of lines of peptide data (using <a href="http://en.wikipedia.org/wiki/Amino_acid#Table_of_standard_amino_acid_abbreviations_and_side_chain_properties">IUPAC/IUBMB amino acid abbreviations</a>):</p>
<p><code>LKSHSNTQPYLTVDSSGKYLRSQLHSQWHP</code>&#8230;</p>
<p>The job of <code>itertools.groupby(<var>iterable</var>, <var>key=fn</var>)</code> is to group together the items in <var>iterable</var> that have the same key.  For example if you have a sequence of e-mail addresses, and you use a key function that extracts the domain part of the e-mail address (<code>def domainkey(m): return m.partition('@')[-1]</code>) then each group that you get out of <code>itertools.groupby</code> will have e-mails that share the domain part after the &#8216;@&#8217;.</p>
<p>It is usual for the data sequence passed to <code>itertools.groupby</code> to be sorted, but it doesn&#8217;t have to be, and <code>itertools.groupby</code> won&#8217;t sort it.  This is useful.  For example, returning to our FASTA file, if we have a key function that simply identifies a line as a header or not:</p>
<p><pre class="brush: python;">
def isheader(line):
    return line[0] == '&gt;'
</pre></p>
<p>Then when we use this in a call to <code>itertools.groupby</code> the groups will simply alternate between a group of header lines, and a group of non-header lines.  Like this (The printout is truncated on the right so that I had some space to write in):</p>
<p><a href="http://drj11.files.wordpress.com/2010/02/fasta400.png"><img src="http://drj11.files.wordpress.com/2010/02/fasta400.png?w=380&#038;h=148" alt="" title="fasta400" width="380" height="148" class="alignnone size-full wp-image-826" /></a></p>
<p>(Note that all of the &#8220;header&#8221; groups are just one line long, since a sequence has only one header line)</p>
<p>Since the groups just alternate header, non-header, the number of groups is twice the number of sequences:</p>
<p><pre class="brush: python;">
import itertools
with open('Danio_rerio.Zv8.56.pep.all.fa') as f:
  print len(list(itertools.groupby(f, key=isheader)))//2
</pre></p>
<p>The above code tells me the file has 28,630 peptide sequences.  Of course, using <code>len</code> and <code>list</code> is a bit naughty; <code>len</code> doesn&#8217;t work on iterables so I had to convert it to a list, not good (on memory usage).  Could&#8217;ve used <code>sum</code>, a generator expression, and a bit of <a href="http://drj11.wordpress.com/2007/05/25/iversons-convention-or-what-is-the-value-of-x-y/">Iverson&#8217;s Convention</a>: <code>sum(g for g,_ in itertools.groupby(open('Danio_rerio.Zv8.56.pep.all.fa'), key=isheader))</code>.</p>
<p>The useful thing about <code>itertools.groupby</code> is that it lets you deal with the header and the peptide sequence as a single group, without having to worry about detecting the start of the next sequence or handling end-of-file correctly.</p>
<p>Say you wanted to make a dictionary that mapped from Ensembl identifiers to the peptide sequence itself:</p>
<p><pre class="brush: python;">
def aspairs(file):
  for header,group in itertools.groupby(f, isheader):
    if header:
      line = group.next()
      ensembl_id = line[1:].split()[0]
    else:
      sequence = ''.join(line.strip() for line in group)
      yield ensembl_id, sequence

with open('Danio_rerio.Zv8.56.pep.all.fa') as f:
  d = dict(aspairs(f))
</pre></p>
<p>Notice how <var>ensembl_id</var> is set when a header line is read, but only used on the next spin through the loop when the sequence group is processed (in the <code>else</code>).</p>
<p>Filtering is easy too.  Well, for one thing you can write a filter/comprehension on the output of <code>aspairs</code>, but say you didn&#8217;t want to do that, and you wanted to filter in the loop itself.  You need another variable, set when the header is processed, that says whether we want to process (and yield) the sequence.  Say we&#8217;re interested in only the novel genes (the second word of the header is &#8220;pep:novel&#8221;):</p>
<p><pre class="brush: python;">
def aspairsnovel(file):
  for header,group in itertools.groupby(f, isheader):
    if header:
      line =group.next()
      word = line[1:].split()
      ensembl_id = word[0]
      isnovel = word[1] == 'pep:novel'
    elif isnovel:
      sequence = ''.join(line.strip() for line in group)
      yield ensembl_id, sequence
</pre></p>
<p>Why do I mention using <code>itertools.groupby</code> at all?  Because if you try processing a FASTA file using a <code>for</code> loop it gets a bit awkward:</p>
<p><pre class="brush: python;">
def aspairs(file):
  seq = ''
  for line in file:
    if isheader(line):
      if seq:
        yield ensembl_id, seq
      ensembl_id = line[1:].split()[0]
      seq = ''
    else:
      seq += line.strip()
  yield ensembl_id, seq
</pre></p>
<p>The code to emit the (id,sequence) pair occurs when a new header line is detected (inside the <code>if isheader</code>, above), and it has to have a special case for the first header line in the file (because there is no sequence to emit).  That code to emit the (id,sequence) pair also has to appear after the <code>for</code> loop to cope with the last sequence in the file.  The variable used to accumulate the sequence data, <var>seq</var>, has to be reset in two different places: once before the loop begins, and then inside the loop every time we see a header line.</p>
<p>Awkward.</p>
<p>Using a <code>while</code> loop is even worse because now you have to detect end-of-file as well.</p>
<p>The idea of using <code>itertools.groupby</code> to parse files like this came out of a discussion between me and Nick Barnes while we were coding on <a href="http://clearclimatecode.org/">Clear Climate Code</a>.</p>
<p>Step 2 of the GISTEMP algorithm begins by reading the <code>Ts.txt</code> which looks like this:</p>
<pre>  495-11424037187400101286BEAVER MINES,AL
1935  -80    4  -50  -16   69  113  153  136  107   38 9999  -11
1936  -89 -240  -37   28  116  131  172  145  107   73   16  -73
1937 -183 -114  -24   45   92  120  153  138  103   76  -21  -53
1938  -28 -110   -4   30   84  133  158  132  147   76  -21  -38
[...more records here...]
  495-11404037187400201189PINCHER CREEK A,AL
1979 9999 9999 9999 9999 9999  145  168  164  139   80  -11  -13
1980 -113  -49  -27   76  110  129  166  131  113   82   14  -73
1981   -3  -24   24   57   92  115  155  177  126   55   32  -54
[...more records here...]
</pre>
<p>You can see the structural similarity to FASTA format.  In this case we have sequences of temperature records with each block starting with a header line that has information about the station.</p>
<p>Nick had the idea of using <code>itertools.groupby</code> and I had the idea of using <code>key=lambda line: line[0]==' '</code> (which is essentially the version of <code>isheader</code> that you need for <code>Ts.txt</code> files).  If you like you can compare <a href="http://code.google.com/p/ccc-gistemp/source/browse/trunk/code/step2.py?r=204#38"><code>read_text</code> from step2.py</a> with its counterpart, <a href="http://code.google.com/p/ccc-gistemp/source/browse/trunk/code/step2.py?r=200#64"><code>text_to_binary</code>, from the earlier version</a>.  Although you should note that this is not strictly a fair comparison because the earlier version is very close the original Fortran, and there are more changes than just having the idea of using <code>itertools.groupby</code>.</p>
<p>The application to FASTA files was inspired by my reading Mitchell Model&#8217;s «<a href="http://oreilly.com/catalog/9780596154516">Bioinformatics Programming Using Python</a>».</p>
<p>Bonus exercise (for the diligent reader): How bad is it to convert the output of <code>itertools.groupby</code> to a list, like I do in my counting example: <code>len(list(itertools.groupby(f, key=isheader)))//2</code> ?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/drj11.wordpress.com/825/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/drj11.wordpress.com/825/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/drj11.wordpress.com/825/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/drj11.wordpress.com/825/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/drj11.wordpress.com/825/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/drj11.wordpress.com/825/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/drj11.wordpress.com/825/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/drj11.wordpress.com/825/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/drj11.wordpress.com/825/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/drj11.wordpress.com/825/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/drj11.wordpress.com/825/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/drj11.wordpress.com/825/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/drj11.wordpress.com/825/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/drj11.wordpress.com/825/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=825&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://drj11.wordpress.com/2010/02/22/python-getting-fasta-with-itertools-groupby/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c6dfaac50b9c43815dd18081e87f3e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">drj11</media:title>
		</media:content>

		<media:content url="http://drj11.files.wordpress.com/2010/02/fasta400.png" medium="image">
			<media:title type="html">fasta400</media:title>
		</media:content>
	</item>
		<item>
		<title>Screw the planet!</title>
		<link>http://drj11.wordpress.com/2010/02/11/screw-the-planet/</link>
		<comments>http://drj11.wordpress.com/2010/02/11/screw-the-planet/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 09:09:23 +0000</pubDate>
		<dc:creator>drj11</dc:creator>
				<category><![CDATA[environment]]></category>
		<category><![CDATA[global warming]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://drj11.wordpress.com/?p=821</guid>
		<description><![CDATA[The earth is getting warmer. Ecosystems are changing. Food webs around the world are upset. We are in the middle of mass extinction. For years the green lobby have been complaining about this, finally over the last decade their voice can be heard as global warming becomes a political talking point. We can save the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=821&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The earth is getting warmer.  Ecosystems are changing.  Food webs around the world are upset.  We are in the middle of mass extinction.</p>
<p>For years the green lobby have been complaining about this, finally over the last decade their voice can be heard as global warming becomes a political talking point.  We can save the Earth.</p>
<p>Screw that!  The greens are getting way too much political capital out of global warming.  Sending your money to Friends of the Earth, World Wildlife Fund for Nature, the RSPB, and so on, will not solve global warming.  They are not in the game.</p>
<p>The planet is not under threat.  Our life on this planet is under threat.  Runaway global warming will be bad.  For any metazoan.  Everything larger than than a hyrax will be wiped out.  But life will go on, the Earth will be claimed once more by the Archaea and it will be business as usual really.  Nature&#8217;s brief experimental dalliance with multi-cellular life will have ended.  She will conclude that &#8220;further research is necessary&#8221;.</p>
<p>So the debate around global warming is not about saving the Earth, it is about saving <em>our</em> way of life on the Earth.  And let&#8217;s get this straight, once we&#8217;ve &#8220;solved&#8221; global warming, we&#8217;ll have put a nuclear power plant on every (100 Km or so of) coastline, we&#8217;ll have replaced inefficient sheep pastures with huge plantations of biofuel crops, we&#8217;ll have peppered the entire countryside with wind turbines, and glazed vast deserts with solar PV farms.</p>
<p>We will not have saved the polar bear, the poison arrow tree frogs.  All those bromeliads teetering on the brink of their fragile hilltop ecosystems in the South American rain forest?  All gone.  It will be our fault, collectively.  And it will be sad.  But solving global warming and saving your favourite obscure cute species are not the same problem.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/drj11.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/drj11.wordpress.com/821/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/drj11.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/drj11.wordpress.com/821/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/drj11.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/drj11.wordpress.com/821/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/drj11.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/drj11.wordpress.com/821/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/drj11.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/drj11.wordpress.com/821/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/drj11.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/drj11.wordpress.com/821/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/drj11.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/drj11.wordpress.com/821/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=drj11.wordpress.com&amp;blog=258145&amp;post=821&amp;subd=drj11&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://drj11.wordpress.com/2010/02/11/screw-the-planet/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c6dfaac50b9c43815dd18081e87f3e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">drj11</media:title>
		</media:content>
	</item>
	</channel>
</rss>
