<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Posts tagged redux  - Entropy and Ecstasy</title><link>http://aaron.maenpaa.ca/blog/tags/redux/</link><description>The most recent ranting and ravings of a madman.</description><lastBuildDate>Sun, 22 May 2016 05:32:35 GMT</lastBuildDate><generator>PyRSS2Gen-1.0.0</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Even More Snow</title><link>http://aaron.maenpaa.ca/blog/entries/2011/01/27/even_more_snow/</link><description>&lt;p&gt;At this rate, no one is going to believe me when I say New York doesn't get very wintery &lt;cite&gt;;-)&lt;/cite&gt;&lt;/p&gt;
&lt;a class="reference external image-reference" href="http://www.flickr.com/photos/zacherates/5394135879/"&gt;&lt;img alt="/blog/entries/2011/01/27/even_more_snow/snow1-5b657673a6f6.min.jpg" src="/blog/entries/2011/01/27/even_more_snow/snow1-5b657673a6f6.min.jpg"/&gt;&lt;/a&gt;
&lt;a class="reference external image-reference" href="http://www.flickr.com/photos/zacherates/5394721900/"&gt;&lt;img alt="/blog/entries/2011/01/27/even_more_snow/snow2-423d1674e032.min.jpg" src="/blog/entries/2011/01/27/even_more_snow/snow2-423d1674e032.min.jpg"/&gt;&lt;/a&gt;
&lt;a class="reference external image-reference" href="http://www.flickr.com/photos/zacherates/5394713670/"&gt;&lt;img alt="/blog/entries/2011/01/27/even_more_snow/snow3-bacd7da07970.min.jpg" src="/blog/entries/2011/01/27/even_more_snow/snow3-bacd7da07970.min.jpg"/&gt;&lt;/a&gt;
&lt;a class="reference external image-reference" href="http://www.flickr.com/photos/zacherates/5394109853/"&gt;&lt;img alt="/blog/entries/2011/01/27/even_more_snow/snow4-080e81fc3f38.min.jpg" src="/blog/entries/2011/01/27/even_more_snow/snow4-080e81fc3f38.min.jpg"/&gt;&lt;/a&gt;
&lt;a class="reference external image-reference" href="http://www.flickr.com/photos/zacherates/5394104465/"&gt;&lt;img alt="/blog/entries/2011/01/27/even_more_snow/snow5-681d1e7524d3.min.jpg" src="/blog/entries/2011/01/27/even_more_snow/snow5-681d1e7524d3.min.jpg"/&gt;&lt;/a&gt;
</description><guid isPermaLink="true">http://aaron.maenpaa.ca/blog/entries/2011/01/27/even_more_snow/</guid><pubDate>Thu, 27 Jan 2011 21:55:39 GMT</pubDate></item><item><title>Snow 2.0</title><link>http://aaron.maenpaa.ca/blog/entries/2011/01/21/snow_2_0/</link><description>&lt;p&gt;It snowed again last night and when I woke up the snow was still fresh. Taking more pictures seemed like the right thing to do:&lt;/p&gt;
&lt;a class="reference external image-reference" href="http://www.flickr.com/photos/zacherates/5376103681/"&gt;&lt;img alt="/blog/entries/2011/01/21/snow_2_0/snow1-beac919b08f7.min.jpg" src="/blog/entries/2011/01/21/snow_2_0/snow1-beac919b08f7.min.jpg"/&gt;&lt;/a&gt;
&lt;a class="reference external image-reference" href="http://www.flickr.com/photos/zacherates/5376100113/"&gt;&lt;img alt="/blog/entries/2011/01/21/snow_2_0/snow2-02b3aef69402.min.jpg" src="/blog/entries/2011/01/21/snow_2_0/snow2-02b3aef69402.min.jpg"/&gt;&lt;/a&gt;
&lt;a class="reference external image-reference" href="http://www.flickr.com/photos/zacherates/5376094581/"&gt;&lt;img alt="/blog/entries/2011/01/21/snow_2_0/snow3-4b8bc602d305.min.jpg" src="/blog/entries/2011/01/21/snow_2_0/snow3-4b8bc602d305.min.jpg"/&gt;&lt;/a&gt;
&lt;a class="reference external image-reference" href="http://www.flickr.com/photos/zacherates/5376691298/"&gt;&lt;img alt="/blog/entries/2011/01/21/snow_2_0/snow4-6003e76907ba.min.jpg" src="/blog/entries/2011/01/21/snow_2_0/snow4-6003e76907ba.min.jpg"/&gt;&lt;/a&gt;
&lt;a class="reference external image-reference" href="http://www.flickr.com/photos/zacherates/5376684648/"&gt;&lt;img alt="/blog/entries/2011/01/21/snow_2_0/snow5-6117e3d584ce.min.jpg" src="/blog/entries/2011/01/21/snow_2_0/snow5-6117e3d584ce.min.jpg"/&gt;&lt;/a&gt;
</description><guid isPermaLink="true">http://aaron.maenpaa.ca/blog/entries/2011/01/21/snow_2_0/</guid><pubDate>Fri, 21 Jan 2011 18:48:23 GMT</pubDate></item><item><title>How to change Chrome's User-Agent string (redux)</title><link>http://aaron.maenpaa.ca/blog/entries/2010/12/28/how_to_change_chrome_s_user_agent_string_redux/</link><description>&lt;p&gt;As another brief addendum  to a different post (the one about &lt;a class="reference external" href="http://aaron.maenpaa.ca/blog/entries/2010/12/09/how_to_change_chrome_s_user_agent_string/"&gt;changing Chrome's user-agent string&lt;/a&gt;), if you use &lt;a class="reference external" href="http://portableapps.com/apps/internet/google_chrome_portable"&gt;Google Chrome Portable&lt;/a&gt; to masquerade as an iPhone then you can have both a fake-iphone-chrome and a normal-chrome. This is handy for when you want to be able to use the non-iPhone versions of various websites while you're testing.&lt;/p&gt;
</description><guid isPermaLink="true">http://aaron.maenpaa.ca/blog/entries/2010/12/28/how_to_change_chrome_s_user_agent_string_redux/</guid><pubDate>Tue, 28 Dec 2010 13:24:47 GMT</pubDate></item><item><title>Don't Try to Reminplement HTML in your Rectangle of Joy (redux)</title><link>http://aaron.maenpaa.ca/blog/entries/2010/12/28/don_t_try_to_reminplement_html_in_your_rectangle_of_joy_redux/</link><description>&lt;p&gt;As a brief addendum to my previous &lt;a class="reference external" href="http://aaron.maenpaa.ca/blog/entries/2010/12/15/don_t_try_to_reminplement_html_in_your_rectangle_of_joy/"&gt;post about HTML&lt;/a&gt;, I just thought I'd point out that &lt;a class="reference external" href="https://www.google.com/webmasters/tools"&gt;Google's Webmaster Tools&lt;/a&gt; work on my phone while Bing's do not.&lt;/p&gt;
&lt;p&gt;Obviously, checking on your website from your phone may not be a core use case (after all, the only reason I know it works on my phone is that I've been travelling and just happened to try it out while away from my &amp;quot;real&amp;quot; computer) but phones and other mobile devices are an increasingly important way people use web applications. Consequently, if your web app lives inside a Flash or Silverlight rectangle you're cutting off an entire class of uses.&lt;/p&gt;
</description><guid isPermaLink="true">http://aaron.maenpaa.ca/blog/entries/2010/12/28/don_t_try_to_reminplement_html_in_your_rectangle_of_joy_redux/</guid><pubDate>Tue, 28 Dec 2010 13:21:11 GMT</pubDate></item><item><title>JavaScript Templates (redux)</title><link>http://aaron.maenpaa.ca/blog/entries/2010/12/14/javascript_templates_redux/</link><description>&lt;p&gt;In the spirit of &lt;a class="reference external" href="http://codekata.pragprog.com/"&gt;code kata&lt;/a&gt; (the origional problem was a kata) here is an alternative solution to the JavaScript templating problem:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;template&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;grammar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;parsec&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;grammar&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
        &lt;span class="nx"&gt;parsec&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;placeholder&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;[$]\\w+&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="nx"&gt;parsec&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;literal&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;[^$]+&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;]);&lt;/span&gt;

    &lt;span class="kd"&gt;with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;grammar&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
        &lt;span class="nx"&gt;root&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;template&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;or&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;literal&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;repeated&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;eof&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;source&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
            &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;handlers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nx"&gt;literal&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
                    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="p"&gt;},&lt;/span&gt;

                &lt;span class="nx"&gt;placeholder&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
                    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;substring&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="p"&gt;},&lt;/span&gt;

                &lt;span class="nx"&gt;template&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
                    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;evaluate&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="p"&gt;};&lt;/span&gt;

            &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;evaluate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;handlers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;

            &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;grammar&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;source&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;evaluate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;root&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;})(&lt;/span&gt;&lt;span class="nx"&gt;parsec&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;util&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It's a bunch longer. It's not quite ten time's longer, but it's kind of close... and it passes exactly the same test suite and has the same features, so what, if anything is good about it?&lt;/p&gt;
&lt;p&gt;For one thing, it uses a completely different approach. It builds a &lt;a class="reference external" href="http://en.wikipedia.org/wiki/Recursive_descent_parser"&gt;recursive descent parser&lt;/a&gt; using a parsing library that I put together that's based on &lt;a class="reference external" href="http://www.haskell.org/haskellwiki/Parsec"&gt;Parsec&lt;/a&gt;. The basic idea of Parsec, and other parser combinator libraries, is that you define simple parsers and then compose them into more complicated parsers using combinators. What this means is that, while it is not necessary here, this approach can handle much more complicated languages than the &lt;a class="reference external" href="http://aaron.maenpaa.ca/blog/entries/2010/12/13/javascript_templates/"&gt;regex based approach&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Oh, and there was one little nugget of joy in there that deserves special mention. You, might have missed it, so I'll show it again:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="kd"&gt;with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;grammar&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="nx"&gt;root&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;template&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;or&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;literal&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;repeated&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;eof&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;That's right, a &lt;a class="reference external" href="https://developer.mozilla.org/en/JavaScript/Reference/Statements/with"&gt;with statement&lt;/a&gt;. I bet you never though you would see somebody actually try to use one of those. Sure, &lt;tt class="docutils literal"&gt;with&lt;/tt&gt; statements are &lt;a class="reference external" href="http://www.yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/"&gt;widely reviled&lt;/a&gt;, they are not one of the &lt;a class="reference external" href="http://www.jslint.com/lint.html#with"&gt;good parts&lt;/a&gt;, and &lt;a class="reference external" href="http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/"&gt;they're dead in EC5 strict mode&lt;/a&gt;... but embedded DSLs are one of the places where you're allowed to cheat like there's not tomorrow. 'sides, &lt;tt class="docutils literal"&gt;$.extend(window, grammar);&lt;/tt&gt; is your other option for scope manipulation and that's just plain &lt;strong&gt;evil&lt;/strong&gt;.&lt;/p&gt;
</description><guid isPermaLink="true">http://aaron.maenpaa.ca/blog/entries/2010/12/14/javascript_templates_redux/</guid><pubDate>Tue, 14 Dec 2010 20:22:19 GMT</pubDate></item><item><title>Top Ten Commands (redux)</title><link>http://aaron.maenpaa.ca/blog/entries/2010/11/30/top_ten_commands_redux/</link><description>&lt;p&gt;A few years ago I posted a list of the &lt;a class="reference external" href="http://aaron.maenpaa.ca/blog/entries/2008/04/10/entertaining-meme/"&gt;top ten commands I use&lt;/a&gt; gleaned by parsing the output of &lt;tt class="docutils literal"&gt;history&lt;/tt&gt;. Here's the origional list ca. 2008:&lt;/p&gt;
&lt;pre class="literal-block"&gt;aaron@athena ~$ history | awk '{print $2}' | sort | uniq -c | sort -rn | head
 134 ls
  90 svn
  77 cd
  16 sudo
  15 gvim
  12 rm
  11 script/server
  11 hg
  10 mongrel_rails
   7 slocate
&lt;/pre&gt;
&lt;p&gt;... and here's the new list ca. 2010:&lt;/p&gt;
&lt;pre class="literal-block"&gt;aaron@ares ~$ history | awk '{print $2}' | sort | uniq -c | sort -rn | head
 198 hg
  59 paver
  41 ls
  36 ./blogc
  33 cd
  26 python
  19 gvim
  14 fab
  12 rm
  12 ./dist/sassey
&lt;/pre&gt;
&lt;div class="section" id="and-the-winner-is"&gt;
&lt;h3&gt;And the winner is...&lt;/h3&gt;
&lt;p&gt;The big change is that &lt;a class="reference external" href="http://mercurial.selenic.com/"&gt;Mercurial&lt;/a&gt; has completely replaced &lt;a class="reference external" href="http://subversion.tigris.org/"&gt;Subversion&lt;/a&gt; as my version control system of choice. Not only that, but I actually use &lt;tt class="docutils literal"&gt;hg&lt;/tt&gt; more than I used to use &lt;tt class="docutils literal"&gt;svn&lt;/tt&gt;. Part of this is that &lt;tt class="docutils literal"&gt;hg&lt;/tt&gt; is better/faster/easier/more useful than &lt;tt class="docutils literal"&gt;svn&lt;/tt&gt; and part of it is that I've really gotten in the habit of using Mercurial for &lt;strong&gt;everything&lt;/strong&gt; (which you might argue is a consequence of that first thing ;-).&lt;/p&gt;
&lt;p&gt;I've started using &lt;a class="reference external" href="http://paver.github.com/paver/"&gt;Paver&lt;/a&gt; and &lt;a class="reference external" href="http://docs.fabfile.org/0.9.3/"&gt;Fabric&lt;/a&gt; and they are both awesome. I've stopped using &lt;a class="reference external" href="http://rubyonrails.org/"&gt;Rails&lt;/a&gt;, but I was only really using it for school (My current &amp;quot;web framework&amp;quot; of choice is &lt;a class="reference external" href="http://www.cherrypy.org/"&gt;CherryPy&lt;/a&gt;, it is also awesome).&lt;/p&gt;
&lt;p&gt;&lt;tt class="docutils literal"&gt;./blogc&lt;/tt&gt; which takes the number four sport, is one of the &lt;a class="reference external" href="http://aaron.maenpaa.ca/blog/entries/2010/11/03/new_location_new_tools_redux/"&gt;new tools&lt;/a&gt; that I use to work on my blog.&lt;/p&gt;
&lt;p&gt;Other than that, I still use &lt;tt class="docutils literal"&gt;gvim&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;rm&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;ls&lt;/tt&gt;, and &lt;tt class="docutils literal"&gt;cd&lt;/tt&gt;. Shocking!&lt;/p&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://aaron.maenpaa.ca/blog/entries/2010/11/30/top_ten_commands_redux/</guid><pubDate>Tue, 30 Nov 2010 09:14:05 GMT</pubDate></item><item><title>cat in Sawzall (redux)</title><link>http://aaron.maenpaa.ca/blog/entries/2010/11/20/cat_in_sawzall_redux/</link><description>&lt;p&gt;After playing with Sawsall a little bit more, I have a slightly better version of cat than &lt;a class="reference external" href="http://aaron.maenpaa.ca/blog/entries/2010/11/05/cat_in_sawzall/"&gt;the last one I posted&lt;/a&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;w: string = input;
emit stdout &amp;lt;- w;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This gets rid of the table and makes the program one whole line shorter &lt;tt class="docutils literal"&gt;:)&lt;/tt&gt;&lt;/p&gt;
</description><guid isPermaLink="true">http://aaron.maenpaa.ca/blog/entries/2010/11/20/cat_in_sawzall_redux/</guid><pubDate>Sat, 20 Nov 2010 15:57:37 GMT</pubDate></item><item><title>New Location, New Tools (redux)</title><link>http://aaron.maenpaa.ca/blog/entries/2010/11/03/new_location_new_tools_redux/</link><description>&lt;p&gt;Two years ago I posted that I had &lt;a class="reference external" href="http://aaron.maenpaa.ca/blog/entries/2007/12/09/new-location-new-tools/"&gt;moved my blog from Blogger to some django based thing&lt;/a&gt;. Recently, I've moved to a different, even more custom, system. In the intervening time, I've written precisely fourteen and one-half blog posts. You may be thinking to yourself: &amp;quot;Surely, that means you spend more time working on your blog's software than actually, y'know, blogging&amp;quot;. You would be right, it just turns out that I happen to like it that way.&lt;/p&gt;
&lt;p&gt;The new engine is based around the idea of having all of the blog posts stored as &lt;a class="reference external" href="http://docutils.sourceforge.net/rst.html"&gt;reStructuredText&lt;/a&gt; documents and then generating all of the indexes/feeds/etc. as a build step producing a bunch of static HTML. This has a couple of neat effects:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;The entire state of my blog can be stored in &lt;a class="reference external" href="http://mercurial.selenic.com/"&gt;version control&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;I can do all of my editing using my favourite &lt;a class="reference external" href="http://www.vim.org/"&gt;text editor&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;I can do silly things like running &lt;a class="reference external" href="http://optipng.sourceforge.net/"&gt;OptiPNG&lt;/a&gt; over every single image as a build step.&lt;/li&gt;
&lt;li&gt;I can say: &amp;quot;My blog software is &lt;a class="reference external" href="http://nginx.org/"&gt;nginx&lt;/a&gt;&lt;a class="footnote-reference" href="#id2" id="id1"&gt;1&lt;/a&gt;.&amp;quot;&lt;/li&gt;
&lt;li&gt;It has the highest &lt;a class="reference external" href="http://developer.yahoo.com/yslow/"&gt;YSlow&lt;/a&gt; score of anything I have ever worked on.&lt;/li&gt;
&lt;li&gt;It has a development server (for realz).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Those might sound like the sort of the features that only a programmer could love, well it just so happens that I an one. Sure, this probably only works because (including the post about changing tools) I've only got something like fifteen and two-thirds blog posts, but it all makes more sense if you think of the blog posts I write as cleverly disguised unit tests for whatever blog software I'm working on at the time &lt;tt class="docutils literal"&gt;;)&lt;/tt&gt;&lt;/p&gt;
&lt;table class="docutils footnote" frame="void" id="id2" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label"/&gt;&lt;col/&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id1"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;It isn't actually. I use &lt;a class="reference external" href="http://httpd.apache.org/"&gt;Apache&lt;/a&gt; just like everybody else. nginx just sounds cooler.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</description><guid isPermaLink="true">http://aaron.maenpaa.ca/blog/entries/2010/11/03/new_location_new_tools_redux/</guid><pubDate>Wed, 03 Nov 2010 21:40:33 GMT</pubDate></item><item><title>With Statement (Redux)</title><link>http://aaron.maenpaa.ca/blog/entries/2008/04/19/with-statement-redux/</link><description>&lt;p&gt;My &lt;a class="reference external" href="http://aaron.maenpaa.ca/blog/entries/2008/04/12/statement-ruby/"&gt;previous implementation&lt;/a&gt; of the &lt;tt class="docutils literal"&gt;with_statement&lt;/tt&gt; in ruby had one major flaw: It allowed only a single context manager per with block. While effective, it leads to cluttered code, like the following:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="n"&gt;with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;hello.txt&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)){&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
    &lt;span class="n"&gt;with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;bonjour.txt&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)){&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
        &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Effective, but it isn't as clear as it could be and introduces more nesting than is really necessary. This coupled with my desire to explore varargs methods and blocks in ruby has lead me to a more robust implementation that can take an arbitrary number of managers as a parameter.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;managers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;with_&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;managers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;resources&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;managers&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;nitems&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
            &lt;span class="k"&gt;begin&lt;/span&gt;
                &lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;managers&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;delete_at&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;resources&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;resource&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;enter&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
                &lt;span class="n"&gt;with_&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;managers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;resources&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;ensure&lt;/span&gt;
                &lt;span class="n"&gt;resource&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="k"&gt;end&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;
            &lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;resources&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;

    &lt;span class="n"&gt;with_&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;managers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;[]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;block&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The preceding implementation is more complex than the original. In addition to introducing &amp;quot;star magic&amp;quot;&lt;a class="footnote-reference" href="#id2" id="id1"&gt;1&lt;/a&gt;, it relies on recursive creation of &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;begin-ensure&lt;/span&gt;&lt;/tt&gt; blocks which complicates exception handling; however, this implementation allows for such beautiful usage as:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="n"&gt;with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;hello.txt&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;bonjour.txt&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
    &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Should a manager's exit method raise an exception, that exception will supersede any exception raised within the block, though it will &lt;em&gt;not&lt;/em&gt; interfere with exiting other managers.&lt;/p&gt;
&lt;p&gt;An implementation and unittests are available in a &lt;a class="reference external" href="http://hg.crimzon.ath.cx/with_statement/"&gt;Mercurial repository&lt;/a&gt;. The implementation can be retrieved as follows:&lt;/p&gt;
&lt;pre class="literal-block"&gt;hg clone http://hg.crimzon.ath.cx/with_statement
&lt;/pre&gt;
&lt;p&gt;Both the implementation and unittests are licensed under the MIT license.&lt;/p&gt;
&lt;table class="docutils footnote" frame="void" id="id2" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label"/&gt;&lt;col/&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#id1"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;As it is called by &lt;a class="reference external" href="http://www.logilab.org/857"&gt;pylint&lt;/a&gt;.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</description><guid isPermaLink="true">http://aaron.maenpaa.ca/blog/entries/2008/04/19/with-statement-redux/</guid><pubDate>Sat, 19 Apr 2008 15:25:03 GMT</pubDate></item><item><title>Lorem Ipsum to Hebrew (redux)</title><link>http://aaron.maenpaa.ca/blog/entries/2007/12/08/lorem-ipsum-hebrew-redux/</link><description>&lt;p&gt;The previous post: &lt;a class="reference external" href="http://aaron.maenpaa.ca/blog/entries/2007/12/08/lorem-ipsum-hebrew/"&gt;Lorem Ipsum to Hebrew&lt;/a&gt; gets a little side tracked in the technical details. There's a program to evolve text using mutation-selection cycles and a program to chart the results, but it mostly misses the point.&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="http://drdino.com/articles.php?spec=76"&gt;Questions for Evolutionists&lt;/a&gt; asks:&lt;/p&gt;
&lt;pre class="literal-block"&gt;How can mutations (recombining of the genetic code) create any new, improved varieties?
(Recombining English letters will never produce Chinese books.)
&lt;/pre&gt;
&lt;p&gt;This question has two problems. First, it presents a straw man: nobody contends that mutations alone result in the awe inspiring adaptations possessed by the life all around us. The vast majority of mutations are silent-site mutations and have no effect on the phenotype of the resulting creature, because the mutation occurs in a non-coding section and is never expressed. The majority of the rest of mutations are deleterious and give you cancer or Down's syndrome or something equally nasty. Only a tiny fraction of mutations have any beneficial effect on those carrying the mutation.&lt;/p&gt;
&lt;p&gt;Mutation alone would never have produced the staggering variety of life that populates the Earth. Mutation combined with selection on the other hand can produce staggering effect on a population. Mutation introduces novel varieties into a population with each generation. While some mutants will be more fit than than their parents most will not be and some will be decidedly less so. The most fit individuals will found the next generation and beneficial mutations will slowly accumulate generation after generation producing the adaptations observed in current populations.&lt;/p&gt;
&lt;p&gt;Second, conceptualizing mutation as moving letters around, is a complete underrepresentation of the ways in which our genome's can be mis-copied. There can be deletions, replacements, duplications of single bases or entire sections of DNA. Additionally, it is at the completely wrong level of granularity. Mutation would not occur on the letters themselves but on the bytes representing them. With only 256 bytes to choose from you can represent either Macbeth or the I Ching with ease. Likewise, using only C, G, A and T you can just as easily spell E. Coli and H. Sapiens and you can almost spell Human immunodeficiency virus, but you would be missing the U.&lt;/p&gt;
&lt;div class="section" id="conclusion"&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;So how can mutation create new and improved variants? When acting alone, mutation would only ever improve an individual through luck. It is after all a random process and would mostly only introduce deleterious changes. When combined with selection on the other hand, together mutation and selection can produce amazing adaptations by allowing beneficial mutations to accumulate over generations.&lt;/p&gt;
&lt;/div&gt;
</description><guid isPermaLink="true">http://aaron.maenpaa.ca/blog/entries/2007/12/08/lorem-ipsum-hebrew-redux/</guid><pubDate>Sat, 08 Dec 2007 20:40:11 GMT</pubDate></item></channel></rss>