<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
  <title>the all-thing</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link rel="stylesheet" href="/static/style.css" type="text/css" />
  <link rel="alternate" type="application/rss+xml" title="the all-thing RSS feed" href="/index.rss" />
  <link rel="alternate" type="text/plain" title="the all-thing in plain text" href="/index.txt" />
  <script type="text/javascript" src="/static/mootools.js"></script>
  <script type="text/javascript" src="http://music.masanjin.net:9292/waxiest.js"></script>
</head>
<body>

<div id="main">
  <div id="header">
    <h1><a  href="/">the all-thing</a></h1>
    
  </div>
  <div id="sidebar">
    <h3>Recent comments</h3>

    <ul class="sidebar-list">
    
    <li><b><a  href="/whisper-0.5#58174069c046a78e55f02ef81da81e74">Dominique Julia</a></b>
        <i><a  href="/whisper-0.5">Whisper 0.5 released</a></i>
           one week ago
    </li>
    
    <li><b><a  href="/ruby-ncurses-and-thread-blocking#8fa2a0f392d7c0562d630e4936407c11">William Morgan</a></b>
        <i><a  href="/ruby-ncurses-and-thread-blocking">Ruby, Ncurses and blocked threads</a></i>
           three months ago
    </li>
    
    <li><b><a  href="/git-wtf-bf06ab7-released#533654a7a229569e27a6d0afd716c444">William Morgan</a></b>
        <i><a  href="/git-wtf-bf06ab7-released">git wtf bf06ab7 released</a></i>
           three months ago
    </li>
    
    <li><b><a  href="/git-wtf-bf06ab7-released#b7b7a905477674eb6985b34a964a0dca">Joao Nelas</a></b>
        <i><a  href="/git-wtf-bf06ab7-released">git wtf bf06ab7 released</a></i>
           three months ago
    </li>
    
    <li><b><a  href="/ruby-ncurses-and-thread-blocking#b00001114360ac152f87d4ac2a6e0c5b">Ollivier Robert</a></b>
        <i><a  href="/ruby-ncurses-and-thread-blocking">Ruby, Ncurses and blocked threads</a></i>
           three months ago
    </li>
    
    </ul>

    <h3>Authors</h3>
    <ul class="sidebar-list">
    
      <li><a class="author" href="/by/William+Morgan/">William&nbsp;Morgan</a>&nbsp;(65) </li>
    
    </ul>

    <h3>Tags</h3>
    <ul class="sidebar-list">
    
      <li><a class="label" href="/label/releases/">releases</a>&nbsp;(15) </li>
    
      <li><a class="label" href="/label/whisper/">whisper</a>&nbsp;(13) </li>
    
      <li><a class="label" href="/label/git/">git</a>&nbsp;(9) </li>
    
      <li><a class="label" href="/label/stats/">stats</a>&nbsp;(8) </li>
    
      <li><a class="label" href="/label/trollop/">trollop</a>&nbsp;(6) </li>
    
      <li><a class="label" href="/label/ruby/">ruby</a>&nbsp;(6) </li>
    
      <li><a class="label" href="/label/sup/">sup</a>&nbsp;(6) </li>
    
      <li><a class="label" href="/label/git-wtf/">git-wtf</a>&nbsp;(4) </li>
    
      <li><a class="label" href="/label/vm/">vm</a>&nbsp;(4) </li>
    
      <li><a class="label" href="/label/mathml/">mathml</a>&nbsp;(3) </li>
    
      <li><a class="label" href="/label/continuations/">continuations</a>&nbsp;(3) </li>
    
      <li><a class="label" href="/label/ditz/">ditz</a>&nbsp;(3) </li>
    
      <li><a class="label" href="/label/proglang/">proglang</a>&nbsp;(2) </li>
    
      <li><a class="label" href="/label/optimization/">optimization</a>&nbsp;(2) </li>
    
      <li><a class="label" href="/label/benchmarks/">benchmarks</a>&nbsp;(2) </li>
    
      <li><a class="label" href="/label/rubinius/">rubinius</a>&nbsp;(2) </li>
    
      <li><a class="label" href="/label/inlining/">inlining</a>&nbsp;(2) </li>
    
      <li><a class="label" href="/label/ubuntu/">ubuntu</a>&nbsp;(2) </li>
    
      <li><a class="label" href="/label/fibers/">fibers</a>&nbsp;(2) </li>
    
      <li><a class="label" href="/label/ritex/">ritex</a>&nbsp;(2) </li>
    
      <li><a class="label" href="/label/ruby1.9/">ruby1.9</a>&nbsp;(2) </li>
    
      <li><a class="label" href="/label/ncurses/">ncurses</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/javascript/">javascript</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/media/">media</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/vim/">vim</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/classification/">classification</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/massachusetts/">massachusetts</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/greasemonkey/">greasemonkey</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/wine/">wine</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/readme/">readme</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/ancient-greek/">ancient-greek</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/web/">web</a>&nbsp;(1) </li>
    
      <li><a class="label" href="/label/current+events/">current&nbsp;events</a>&nbsp;(1) </li>
    
    </ul>

    <h3>Other formats</h3>
    <ul class="sidebar-list">
    <li><a href="/index.rss"><img src="/static/rss-badge.png"/></a></li>
    <li><a href="/index.txt">plain text version</a></li>
    </ul>

    <h3 class="waxiest.author.original">Who is this man?</h3>
    <h3 class="waxiest.author.beautiful" style="display:none">I must find out more about this beautiful creature</h3>
    <h3 class="waxiest.author.beautifulbig" style="display:none">I MUST FIND OUT MORE ABOUT THIS BEAUTIFUL CREATURE</h3>
    <h3 class="waxiest.author.originalbig" style="display:none">WHO IS THIS MAN?</h3>

    <script type="text/javascript">
      var w = waxiest();
      w.optimizeHTMLSection("author", ["original", "beautiful", "beautifulbig", "originalbig"]);
    </script>

    <a href="http://masanjin.net" onClick="w.goalReached('greeting')">William Morgan</a>
  </div>
  <div id="content">
    
  <h2><a  href="/trollop-1.15-released">Trollop 1.15 released</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="five months ago">September 30, 2009  6:59pm</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/trollop/">trollop</a></span> <span class='label'><a  href="/label/releases/">releases</a></span> </div>
  
  <p class='first'>I&#8217;ve just released <a href="http://trollop.rubyforge.org">Trollop</a> 1.15, which fixes an
irritating misfeature pointed out by Rafael Sevilla: when Trollop runs out of
characters when it&#8217;s generating short option names, e.g. when you have a lot of
options, it shouldn&#8217;t throw an exception and die. It should just continue peacefully.</p>
<p>Trollop&#8217;s <a href="http://stackoverflow.com/questions/897630/really-cheap-command-line-option-parsing-in-ruby/1012930#1012930">reign of domination</a> continues!</p>
  <div class="comment-link">
    
    <a  href="/trollop-1.15-released#comments">No comments</a>.
  </div>

  <h2><a  href="/ruby-ncurses-and-thread-blocking">Ruby, Ncurses and blocked threads</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="7 months ago">August  6, 2009  6:40pm</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/ruby/">ruby</a></span> <span class='label'><a  href="/label/ncurses/">ncurses</a></span> <span class='label'><a  href="/label/sup/">sup</a></span> </div>
  
  <p class='first'>If you&#8217;re writing a multithreaded Ruby program that uses ncurses,
you might be curious why program stops running when you call
<code>Ncurses.getch</code>. <a href="http://sup.rubyforge.org">Sup</a> has been plagued
by this issue since 2005. Thankfully, I think I finally understand
it.</p>
<p>The problem is that there is a bug in the Ruby ncurses library
such that using blocking input will block <strong>all</strong> Ruby threads when
it waits for user input, instead of just the calling thread. So
<code>Ncurses.getch</code> will cause everything to grind to a halt.  This is
probably due to the library not releasing the <span class="caps">GVL</span> when blocking on
stdin.</p>
<p>This bug is present in the latest rubygems version of curses,
0.9.1. It has been fixed in the latest libncurses-ruby Debian
packages (1.1-3).</p>
<p>To see if you have a buggy, blocking version of the ruby ncurses
library, run this program:</p>
<p><code><pre class="ruby"><span class="ident">require</span> <span class="punct">'</span><span class="string">rubygems</span><span class="punct">'</span>
<span class="ident">require</span> <span class="punct">'</span><span class="string">ncurses</span><span class="punct">'</span>
<span class="ident">require</span> <span class="punct">'</span><span class="string">thread</span><span class="punct">'</span>

<span class="constant">Ncurses</span><span class="punct">.</span><span class="ident">initscr</span>
<span class="constant">Ncurses</span><span class="punct">.</span><span class="ident">noecho</span>
<span class="constant">Ncurses</span><span class="punct">.</span><span class="ident">cbreak</span>
<span class="constant">Ncurses</span><span class="punct">.</span><span class="ident">curs_set</span> <span class="number">0</span>

<span class="constant">Thread</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">do</span>
  <span class="ident">sleep</span> <span class="number">0.1</span>
  <span class="constant">Ncurses</span><span class="punct">.</span><span class="ident">stdscr</span><span class="punct">.</span><span class="ident">mvaddstr</span> <span class="number">0</span><span class="punct">,</span> <span class="number">0</span><span class="punct">,</span> <span class="punct">&quot;</span><span class="string">library is GOOD.</span><span class="punct">&quot;</span>
<span class="keyword">end</span>

<span class="keyword">begin</span>
  <span class="constant">Ncurses</span><span class="punct">.</span><span class="ident">stdscr</span><span class="punct">.</span><span class="ident">mvaddstr</span> <span class="number">0</span><span class="punct">,</span> <span class="number">0</span><span class="punct">,</span> <span class="punct">&quot;</span><span class="string">library is BAD.</span><span class="punct">&quot;</span>
  <span class="constant">Ncurses</span><span class="punct">.</span><span class="ident">getch</span>
<span class="keyword">ensure</span>
  <span class="constant">Ncurses</span><span class="punct">.</span><span class="ident">curs_set</span> <span class="number">1</span>
  <span class="constant">Ncurses</span><span class="punct">.</span><span class="ident">endwin</span>
  <span class="ident">puts</span> <span class="punct">&quot;</span><span class="string">bye</span><span class="punct">&quot;</span>
<span class="keyword">end</span></pre></code></p>
<p>(I purposely require <code>rubygems</code> in there to load the rubygems
ncurses library if it&#8217;s present; you can drop this if you don&#8217;t
use rubygems.)</p>
<p>There are two workarounds to this problem. First, you can simply
tell ncurses to use nonblocking input:</p>
<p><code><pre class="ruby"><span class="constant">Ncurses</span><span class="punct">.</span><span class="ident">nodelay</span> <span class="constant">Ncurses</span><span class="punct">.</span><span class="ident">stdscr</span><span class="punct">,</span> <span class="constant">true</span></pre></code></p>
<p>But if you&#8217;re writing a multithreaded app, you probably aren&#8217;t
interested in nonblocking input, unless you want a nasty polling
loop.</p>
<p>The better choice is to add a call to <code>IO.select</code> before <code>getch</code>,
which will block the calling thread until there&#8217;s an actual
keypress, and then allow <code>getch</code> to pick it up:</p>
<p><code><pre class="ruby"><span class="keyword">if</span> <span class="constant">IO</span><span class="punct">.</span><span class="ident">select</span> <span class="punct">[</span><span class="global">$stdin</span><span class="punct">],</span> <span class="constant">nil</span><span class="punct">,</span> <span class="constant">nil</span><span class="punct">,</span> <span class="number">1</span>
  <span class="constant">Ncurses</span><span class="punct">.</span><span class="ident">getch</span>
<span class="keyword">end</span></pre></code></p>
<p><code>IO.select</code> requires a delay, so you&#8217;ll have to handle the
periodic nils that generates. But the background threads should no longer block.</p>
<p>There is one further complication, which is that you won&#8217;t be able
to receive the pseudo-keypresses Ncurses emits when the terminal
size changes, since they don&#8217;t show up on <code>$stdin</code> and thus the
<code>select</code> won&#8217;t pass. The solution is to install your own signal
handler:</p>
<p><code><pre class="ruby"><span class="ident">trap</span><span class="punct">(&quot;</span><span class="string">WINCH</span><span class="punct">&quot;)</span> <span class="punct">{</span> <span class="punct">...</span> <span class="ident">handle</span> <span class="ident">sigwinch</span>  <span class="punct">...</span> <span class="punct">}</span></pre></code></p>
<p>You will still see the resize events coming from <code>getch</code>, but only
once the user presses a key. You can drop them at this point.</p>
<p>That should be enough to make any multithreaded Ruby ncurses app
able function. Of course, once everyone&#8217;s using a fixed version fo
the ncurses libraries, you can do away with the <code>select</code> and set
<code>nodelay</code> to false.</p>
<p>(One last hint for the future: I&#8217;ve found it necessary to set it
to false before every call to <code>getch</code>; otherwise a ctrl-c will
magically change it back to nonblocking mode. Not sure why.)</p>
  <div class="comment-link">
    
    <a  href="/ruby-ncurses-and-thread-blocking#comments">Three comments by <b>Felipe Contreras</b>, <b>William Morgan</b>, and one other</a>.
  </div>

  <h2><a  href="/git-wtf-bf06ab7-released">git wtf bf06ab7 released</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="7 months ago">July 28, 2009  8:13pm</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/releases/">releases</a></span> <span class='label'><a  href="/label/git/">git</a></span> <span class='label'><a  href="/label/git-wtf/">git-wtf</a></span> </div>
  
  <p class='first'>I&#8217;ve released git-wtf version bf06ab7. The highlight of this release is
colorized output. <span class="caps">ANSI</span> escape sequences are the future of the web.</p>
<p>Also, the feature / integration branch comparisons is now only displayed when
<code>-r</code> is supplied.</p>
<p>Check out the <a href="http://git-wt-commit.rubyforge.org/#git-wtf">git-wtf home page</a>
for an example of the fancy colorization, or just <a href="http://git-wt-commit.rubyforge.org/git-wtf">download it now</a>.</p>
  <div class="comment-link">
    
    <a  href="/git-wtf-bf06ab7-released#comments">Four comments by <b>Cameron Booth</b>, <b>William Morgan</b>, and one other</a>.
  </div>

  <h2><a  href="/my-little-continuation-framework">My little continuation framework</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="8 months ago">June 18, 2009  9:26pm</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/continuations/">continuations</a></span> <span class='label'><a  href="/label/web/">web</a></span> </div>
  
  <p class='first'>Since <a href="http://all-thing.net/fibers-via-continuations">continuations are so fast in Ruby
1.9</a>, I&#8217;ve been playing with a
simple little contination-based web framework I wrote based on code I ripped
out of <a href="http://masanjin.net/whisper/">Whisper</a>.</p>
<p>Using continuations is really awesome for webapps because you can write
application control flow just like you would write the regular program control
flow. You can write it in a single method, store state in local variables, use
<code>if</code> statements, whatever.</p>
<p>For example, here&#8217;s the entire code for a webapp that lets you increment and
decrement a number:</p>
<p><code><pre class="ruby"><span class="keyword">def </span><span class="method">run</span>
  <span class="ident">counter</span> <span class="punct">=</span> <span class="number">0</span>

  <span class="keyword">while</span> <span class="constant">true</span>
    <span class="ident">click</span> <span class="punct">=</span> <span class="ident">html</span> <span class="punct">&lt;&lt;</span><span class="constant">EOS</span><span class="string">
&lt;p&gt;Current counter value: <span class="expr">#{counter}</span>.&lt;/p&gt;
&lt;p&gt;To increment, <span class="expr">#{link_to &quot;click here&quot;, :increment}</span>&lt;/p&gt;
&lt;p&gt;To decrement, <span class="expr">#{link_to &quot;click here&quot;, :decrement}</span>&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</span><span class="constant">EOS</span>

    <span class="keyword">case</span> <span class="ident">click</span>
    <span class="keyword">when</span> <span class="symbol">:increment</span>
      <span class="ident">counter</span> <span class="punct">+=</span> <span class="number">1</span>
    <span class="keyword">when</span> <span class="symbol">:decrement</span>
      <span class="ident">counter</span> <span class="punct">-=</span> <span class="number">1</span>
    <span class="keyword">end</span>
  <span class="keyword">end</span>
<span class="keyword">end</span></pre></code></p>
<p>Pretty obvious huh? It&#8217;s a loop, and when someone clicks on the increment link,
you increment the counter, and when they click on the decrement counter, you
decrement it.  The app displays the <span class="caps">HTML</span> you see, and provides <code>/increment</code> and
<code>/decrement</code> links. The logic isn&#8217;t spread out across different methods and
different classes like it would be in a regular framework.</p>
<p>I added back-button support too, so pressing the back button after clicking
increment brings you to the previous number, and further increments and
decrements do the right thing.</p>
<p>I realize frameworks like Seaside and Wee have been doing this forever, but
it&#8217;s new to me and very fun.</p>
  <div class="comment-link">
    
    <a  href="/my-little-continuation-framework#comments">No comments</a>.
  </div>

  <h2><a  href="/ritex-0.3">Ritex 0.3 released</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="8 months ago">June 18, 2009  2:41am</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/ritex/">ritex</a></span> <span class='label'><a  href="/label/releases/">releases</a></span> </div>
  
  <p>I&#8217;ve released Ritex 0.3. No <span class="caps">API</span> or functionality changes; this is just
a set of miscellaneous tweaks that make Ritex work on Ruby 1.9.</p>
  <div class="comment-link">
    
    <a  href="/ritex-0.3#comments">No comments</a>.
  </div>

  <h2><a  href="/fibers-via-continuations">Fibers via Continuations</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="9 months ago">June  1, 2009  2:47pm</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/ruby/">ruby</a></span> <span class='label'><a  href="/label/ruby1.9/">ruby1.9</a></span> <span class='label'><a  href="/label/fibers/">fibers</a></span> <span class='label'><a  href="/label/continuations/">continuations</a></span> </div>
  
  <p class='first'>In the last post I talked about some <a href="http://all-thing.net/fibers">differences between fibers and
continuations</a>. What may not have been clear is
that continuations are more primitive and flexible than fibers are. In fact,
you can implement fibers using continuations.</p>
<p>Here&#8217;s how. The basic idea is that we want to maintain two variables with
continuations in them, <code>inside</code> and <code>outside</code>. The first one will transfer
execution into the block of code that forms the fiber. The second will transfer
control back to the outside world.</p>
<p>When the outside world calls <code>#resume</code>, we save our continuation point as
<code>outside</code>, and call the current <code>inside</code> continuation. When, within the block,
<code>#yield</code> is called, we save our current continuation point as <code>inside</code>, and
transfer code back to the current <code>outside</code>.</p>
<p>There are a few more details in terms of passing values from <code>#yield</code> to
<code>#resume</code>, handling the return value of the block, and handling excessive
calls to #<code>resume</code>, but that&#8217;s the basic story. Here&#8217;s the code:
<code><pre class="ruby"><span class="ident">require</span> <span class="punct">'</span><span class="string">continuation</span><span class="punct">'</span>

<span class="keyword">class </span><span class="class">CFiber</span>
  <span class="keyword">class </span><span class="class">Error</span> <span class="punct">&lt;</span> <span class="constant">StandardError</span><span class="punct">;</span> <span class="keyword">end</span>

  <span class="keyword">def </span><span class="method">initialize</span> <span class="punct">&amp;</span><span class="ident">block</span>
    <span class="attribute">@block</span> <span class="punct">=</span> <span class="ident">block</span>
    <span class="ident">callcc</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">cc</span><span class="punct">|</span>
      <span class="attribute">@inside</span> <span class="punct">=</span> <span class="ident">cc</span>
      <span class="keyword">return</span>
    <span class="keyword">end</span>
    <span class="attribute">@var</span> <span class="punct">=</span> <span class="attribute">@block</span><span class="punct">.</span><span class="ident">call</span> <span class="constant">self</span>
    <span class="attribute">@inside</span> <span class="punct">=</span> <span class="constant">nil</span>
    <span class="attribute">@outside</span><span class="punct">.</span><span class="ident">call</span>
  <span class="keyword">end</span>

  <span class="keyword">def </span><span class="method">resume</span>
    <span class="keyword">raise</span> <span class="constant">Error</span><span class="punct">,</span> <span class="punct">&quot;</span><span class="string">dead cfiber called!</span><span class="punct">&quot;</span> <span class="keyword">unless</span> <span class="attribute">@inside</span>
    <span class="ident">callcc</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">cc</span><span class="punct">|</span>
      <span class="attribute">@outside</span> <span class="punct">=</span> <span class="ident">cc</span>
      <span class="attribute">@inside</span><span class="punct">.</span><span class="ident">call</span>
    <span class="keyword">end</span>
    <span class="attribute">@var</span>
  <span class="keyword">end</span>

  <span class="keyword">def </span><span class="method">yield</span> <span class="ident">var</span>
    <span class="ident">callcc</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">cc</span><span class="punct">|</span>
      <span class="attribute">@var</span> <span class="punct">=</span> <span class="ident">var</span>
      <span class="attribute">@inside</span> <span class="punct">=</span> <span class="ident">cc</span>
      <span class="attribute">@outside</span><span class="punct">.</span><span class="ident">call</span>
    <span class="keyword">end</span>
  <span class="keyword">end</span>
<span class="keyword">end</span></pre></code></p>
<p>This is also runnable on Ruby 1.8&#8212;just remove the <code>require</code>.</p>
<p>So why does Ruby 1.9 bother to implement fibers, when we can just use
continuations?  I don&#8217;t know what the real answer is, but &#8220;speed&#8221; is at least a
<em>good</em> answer. Let&#8217;s do some some benchmarking to compare the two:</p>
<p><code><pre class="ruby"><span class="ident">require</span> <span class="punct">'</span><span class="string">benchmark</span><span class="punct">'</span>
<span class="ident">n</span> <span class="punct">=</span> <span class="constant">ARGV</span><span class="punct">.</span><span class="ident">shift</span><span class="punct">.</span><span class="ident">to_i</span>
<span class="constant">Benchmark</span><span class="punct">.</span><span class="ident">bm</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">bm</span><span class="punct">|</span>
  <span class="ident">bm</span><span class="punct">.</span><span class="ident">report</span> <span class="punct">&quot;</span><span class="string"> fibers</span><span class="punct">&quot;</span> <span class="keyword">do</span>
    <span class="ident">f</span> <span class="punct">=</span> <span class="constant">Fiber</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">do</span>
      <span class="ident">x</span><span class="punct">,</span> <span class="ident">y</span> <span class="punct">=</span> <span class="number">0</span><span class="punct">,</span> <span class="number">1</span>
      <span class="ident">loop</span> <span class="keyword">do</span>
        <span class="constant">Fiber</span><span class="punct">.</span><span class="ident">yield</span> <span class="ident">y</span>
        <span class="ident">x</span><span class="punct">,</span> <span class="ident">y</span> <span class="punct">=</span> <span class="ident">y</span><span class="punct">,</span> <span class="ident">x</span> <span class="punct">+</span> <span class="ident">y</span>
      <span class="keyword">end</span>
    <span class="keyword">end</span>

    <span class="ident">n</span><span class="punct">.</span><span class="ident">times</span> <span class="punct">{</span> <span class="punct">|</span><span class="ident">i</span><span class="punct">|</span> <span class="ident">f</span><span class="punct">.</span><span class="ident">resume</span> <span class="punct">}</span>
  <span class="keyword">end</span>

  <span class="ident">bm</span><span class="punct">.</span><span class="ident">report</span> <span class="punct">&quot;</span><span class="string">cfibers</span><span class="punct">&quot;</span> <span class="keyword">do</span>
    <span class="ident">f</span> <span class="punct">=</span> <span class="constant">CFiber</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">c</span><span class="punct">|</span>
      <span class="ident">x</span><span class="punct">,</span> <span class="ident">y</span> <span class="punct">=</span> <span class="number">0</span><span class="punct">,</span> <span class="number">1</span>
      <span class="ident">loop</span> <span class="keyword">do</span>
        <span class="ident">c</span><span class="punct">.</span><span class="ident">yield</span> <span class="ident">y</span>
        <span class="ident">x</span><span class="punct">,</span> <span class="ident">y</span> <span class="punct">=</span> <span class="ident">y</span><span class="punct">,</span> <span class="ident">x</span> <span class="punct">+</span> <span class="ident">y</span>
      <span class="keyword">end</span>
    <span class="keyword">end</span>

    <span class="ident">n</span><span class="punct">.</span><span class="ident">times</span> <span class="punct">{</span> <span class="punct">|</span><span class="ident">i</span><span class="punct">|</span> <span class="ident">f</span><span class="punct">.</span><span class="ident">resume</span> <span class="punct">}</span>
  <span class="keyword">end</span>
<span class="keyword">end</span></pre></code></p>
<p>We&#8217;ll start with backporting that code to the Ruby 1.8.7 that Ubuntu provides
(ruby 1.8.7 (2008-08-11 patchlevel 72)). For 10000 Fibonacci numbers, we see:</p>
<table style="margin-left: auto; margin-right: auto;">
	<tr>
		<td>         </td>
		<th>user   </th>
		<th>system </th>
		<th>total  </th>
		<th>real   </th>
	</tr>
	<tr>
		<td> <em>cfibers</em> </td>
		<td style="text-align:right;">0.810000 </td>
		<td style="text-align:right;">0.070000 </td>
		<td style="text-align:right;">0.880000 </td>
		<td style="text-align:right;">0.879930 </td>
	</tr>
</table>
<p>That&#8217;s roughly 11.4kfps (that&#8217;s thousand Fibonacci numbers per second) that we
can produce using continuation-based fibers.</p>
<p>Let&#8217;s try the ancient Ruby 1.9.0 that Ubuntu provides (Ruby 1.9.0 (2008-06-20
revision 17482)):</p>
<table style="margin-left: auto; margin-right: auto;">
	<tr>
		<td>         </td>
		<th>user   </th>
		<th>system </th>
		<th>total  </th>
		<th>real    </th>
	</tr>
	<tr>
		<td> <em>fibers</em> </td>
		<td style="text-align:right;">0.040000 </td>
		<td style="text-align:right;">0.000000 </td>
		<td style="text-align:right;">0.040000 </td>
		<td style="text-align:right;">0.037583 </td>
	</tr>
	<tr>
		<td> <em>cfibers</em> </td>
		<td style="text-align:right;">18.680000 </td>
		<td style="text-align:right;">1.770000 </td>
		<td style="text-align:right;">20.450000 </td>
		<td style="text-align:right;">20.482006 </td>
	</tr>
</table>
<p>Wow, fibers are fast: 250kfps. But things have gotten significantly worse for
cfibers, clocking at a measely 0.489kfps for cfibers.</p>
<p>Finally let&#8217;s try the latest and greatest Ruby 1.9.1 (ruby 1.9.1p129
(2009-05-12 revision 23412)):</p>
<table style="margin-left: auto; margin-right: auto;">
	<tr>
		<td>         </td>
		<th>user   </th>
		<th>system </th>
		<th>total  </th>
		<th>real    </th>
	</tr>
	<tr>
		<td> <em>fibers</em>  </td>
		<td style="text-align:right;">0.040000 </td>
		<td style="text-align:right;">0.000000 </td>
		<td style="text-align:right;">0.040000 </td>
		<td style="text-align:right;">0.035148 </td>
	</tr>
	<tr>
		<td> <em>cfibers</em> </td>
		<td style="text-align:right;">0.150000 </td>
		<td style="text-align:right;">0.000000 </td>
		<td style="text-align:right;">0.150000 </td>
		<td style="text-align:right;">0.155890 </td>
	</tr>
</table>
<p>Fibers are just as fast as before, but continuations have improved
dramatically&#8212;from 11.4kfps to 66.6kfps. Still, native fibers are more than
three times faster.</p>
<p>So perhaps Ruby 1.9.1 is the best of both worlds. When you need fast
non-preemptive concurrency, you can use native fibers; when you need to
implement your own crazy control structures, you can use continuations and be
assured that they&#8217;re still pretty darn fast (at least, as far as Ruby
operations are concerned).</p>
  <div class="comment-link">
    
    <a  href="/fibers-via-continuations#comments">No comments</a>.
  </div>

  <h2><a  href="/fibers">Fibers vs Continuations</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="9 months ago">May 31, 2009  9:20pm</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/ruby1.9/">ruby1.9</a></span> <span class='label'><a  href="/label/ruby/">ruby</a></span> <span class='label'><a  href="/label/fibers/">fibers</a></span> <span class='label'><a  href="/label/continuations/">continuations</a></span> </div>
  
  <p class='first'>Ruby 1.9 has both fibers and continuations. The two are often mentioned in the
same breath. They do vaguely similar-sounding things, and are <a href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/19609">implemented in
Ruby 1.9 with similar mechanics underneath the
hood</a>, much
as how <a href="http://www.atdot.net/~ko1/pub/ContinuationFest-ruby.pdf">continuations and threads were implemented with the same underlying
mechanics in Ruby 1.8</a>
[<span class="caps">PDF</span>, p. 14].</p>
<p>But implementation similarities aside, continuations and fibers have very
different semantics. A fiber behaves as a thread without preemption. Like a
thread, you create it, and it eventually dies; unlike a thread, you must
manually call <code>yield</code> and <code>resume</code> to transfer control in and out of it,
instead of just letting the runtime call them for you whenever it feels like
it. Like a thread, when you resume a fiber, you have the same call stack and
heap state (local variables) as when you left.</p>
<p>What&#8217;s nice about fibers is that, since you keep explicit control of the order
of execution, you can get thread-like behavior without all the hassle of
mutexes and synchronization. Of course you have to deal with the hassle of
ordering all your operations, but you at least have the option of avoiding the
fun race-condition game that always seems to crop up in threaded programming.</p>
<p>What about continuations? Instead of fibers&#8217; create, kill, yield, and resume
operations, a continuation only really has two operations: capture and resume.
A continuation is captured once, and may be resumed multiple times. When you
resume a continuation, the call stack is reverted to what it looked like when
it was captured, but the heap state stays the same. There&#8217;s no exit point or
death for a continuation (at least until Ruby gets bounded continuations);
execution simply continues from the capture point.</p>
<p>What&#8217;s nice about continuations is that you can use them to implement control
structures. Loops, exceptions, cross-procedure gotos&#8230; almost every control
structure you can come up with can be implemented with continuations.  In fact,
you can <a href="http://all-thing.net/fibers-via-continuations">implement fibers using
continuations</a>!</p>
<p>Let&#8217;s look at an example. Here&#8217;s the fiber-based Fibonacci computation from
<a href="http://www.infoq.com/news/2007/08/ruby-1-9-fibers">the InfoQ article on Fibers in Ruby
1.9</a>:
<code><pre class="ruby"><span class="ident">fib</span> <span class="punct">=</span> <span class="constant">Fiber</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">do</span>  
  <span class="ident">x</span><span class="punct">,</span> <span class="ident">y</span> <span class="punct">=</span> <span class="number">0</span><span class="punct">,</span> <span class="number">1</span> 
  <span class="ident">loop</span> <span class="keyword">do</span>  
    <span class="constant">Fiber</span><span class="punct">.</span><span class="ident">yield</span> <span class="ident">y</span> 
    <span class="ident">x</span><span class="punct">,</span> <span class="ident">y</span> <span class="punct">=</span> <span class="ident">y</span><span class="punct">,</span> <span class="ident">x</span> <span class="punct">+</span> <span class="ident">y</span> 
  <span class="keyword">end</span> 
<span class="keyword">end</span> 
<span class="number">20</span><span class="punct">.</span><span class="ident">times</span> <span class="punct">{</span> <span class="ident">puts</span> <span class="ident">fib</span><span class="punct">.</span><span class="ident">resume</span> <span class="punct">}</span></pre></code></p>
<p>Here we call <code>yield</code> from within the fiber once we&#8217;ve computed a number, which
transfers control to the main function, and which prints out the number yielded
and then calls <code>resume</code> to transfer control back to the fiber. A thread version
looks very similar:
<code><pre class="ruby"><span class="ident">require</span> <span class="punct">'</span><span class="string">thread</span><span class="punct">'</span>
<span class="ident">q</span> <span class="punct">=</span> <span class="constant">SizedQueue</span><span class="punct">.</span><span class="ident">new</span> <span class="number">1</span>
<span class="ident">fib</span> <span class="punct">=</span> <span class="constant">Thread</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">do</span>  
  <span class="ident">x</span><span class="punct">,</span> <span class="ident">y</span> <span class="punct">=</span> <span class="number">0</span><span class="punct">,</span> <span class="number">1</span> 
  <span class="ident">loop</span> <span class="keyword">do</span>  
    <span class="ident">q</span><span class="punct">.</span><span class="ident">push</span> <span class="ident">y</span> 
    <span class="ident">x</span><span class="punct">,</span> <span class="ident">y</span> <span class="punct">=</span> <span class="ident">y</span><span class="punct">,</span> <span class="ident">x</span> <span class="punct">+</span> <span class="ident">y</span> 
  <span class="keyword">end</span> 
<span class="keyword">end</span> 

<span class="number">20</span><span class="punct">.</span><span class="ident">times</span> <span class="punct">{</span> <span class="ident">puts</span> <span class="ident">q</span><span class="punct">.</span><span class="ident">pop</span> <span class="punct">}</span></pre></code></p>
<p>Since we don&#8217;t have explicit control over the scheduling, we implicitly
scheduled the order of operations by using a synchronized <code>SizedQueue</code> data
structure, which blocks the computation thread from computing a new number
until the printing thread is ready to receive it. (There are many ways we
could&#8217;ve accomplished this.)</p>
<p>Here&#8217;s the version using continuations:
<code><pre class="ruby"><span class="ident">require</span> <span class="punct">'</span><span class="string">continuation</span><span class="punct">'</span>
<span class="ident">c</span><span class="punct">,</span> <span class="ident">x</span><span class="punct">,</span> <span class="ident">y</span><span class="punct">,</span> <span class="ident">i</span> <span class="punct">=</span> <span class="ident">callcc</span> <span class="punct">{</span> <span class="punct">|</span><span class="ident">cc</span><span class="punct">|</span> <span class="punct">[</span><span class="ident">cc</span><span class="punct">,</span> <span class="number">0</span><span class="punct">,</span> <span class="number">1</span><span class="punct">,</span> <span class="number">1</span><span class="punct">]</span> <span class="punct">}</span>
<span class="ident">puts</span> <span class="ident">y</span>
<span class="ident">c</span><span class="punct">.</span><span class="ident">call</span> <span class="ident">c</span><span class="punct">,</span> <span class="ident">y</span><span class="punct">,</span> <span class="ident">x</span> <span class="punct">+</span> <span class="ident">y</span><span class="punct">,</span> <span class="ident">i</span> <span class="punct">+</span> <span class="number">1</span> <span class="keyword">if</span> <span class="ident">i</span> <span class="punct">&lt;</span> <span class="number">20</span></pre></code></p>
<p>You&#8217;ll notice there are no loops, and variables are never changed after
assignment. In fact the code is starting to look suspiciously like an inductive
proof, with one line that like a base case and another line that looks like a
recursive case. You can see why continuations make functional-programming
enthusiasts get excited!</p>
<p>This implementation works because resuming the continuation (the call to
<code>c.call</code>) replaces the call stack and point of execution with what they were at
the point it was captured (the call to <code>callcc</code>). In contrast, <code>resume</code>-ing the
fiber moved us back to the point we were when the fiber called <code>yield</code>, and so
the outer <code>loop</code> in the fiber implementation was necessary.</p>
<p>Beyond call stacks, another major difference between fibers and continuations
is the way the heap is treated. Multiple fibers on the same section of code do
not share local variables. Multiple continuations on the same section of code
<em>do</em>. Here&#8217;s a brief example. First, the fibers version:</p>
<p><code><pre class="ruby"><span class="ident">fib</span> <span class="punct">=</span> <span class="punct">(</span><span class="number">0</span> <span class="punct">...</span> <span class="number">5</span><span class="punct">).</span><span class="ident">map</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">i</span><span class="punct">|</span>
  <span class="constant">Fiber</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">do</span>
    <span class="ident">x</span> <span class="punct">=</span> <span class="number">0</span>
    <span class="constant">Fiber</span><span class="punct">.</span><span class="ident">yield</span> <span class="ident">x</span>
    <span class="ident">x</span> <span class="punct">+=</span> <span class="number">1</span>
  <span class="keyword">end</span>
<span class="keyword">end</span>

<span class="ident">fib</span><span class="punct">.</span><span class="ident">each</span> <span class="punct">{</span> <span class="punct">|</span><span class="ident">f</span><span class="punct">|</span> <span class="ident">puts</span> <span class="ident">f</span><span class="punct">.</span><span class="ident">resume</span> <span class="punct">}</span></pre></code></p>
<p>We create five fibers, and call <code>resume</code> on them once each. As you&#8217;d expect,
this prints out a series of 0&#8217;s. The variable <code>x</code> is not shared between the
multiple fibers. Of course, the fiber constructor here is a block, and blocks
are closures, so we could <em>make</em> them share state by moving the <code>x = 0</code> line
outside the <code>map</code> line. But that&#8217;s a result of having closures, not of fibers
per se.</p>
<p>Let&#8217;s try an example with multiple continuations, all jumping into the same point in the code:
<code><pre class="ruby"><span class="ident">require</span> <span class="punct">'</span><span class="string">continuation</span><span class="punct">'</span>

<span class="ident">x</span> <span class="punct">=</span> <span class="number">0</span>
<span class="ident">c</span> <span class="punct">=</span> <span class="ident">callcc</span> <span class="punct">{</span> <span class="punct">|</span><span class="ident">cc</span><span class="punct">|</span> <span class="ident">cc</span> <span class="punct">}</span>
<span class="ident">d</span> <span class="punct">=</span> <span class="ident">callcc</span> <span class="punct">{</span> <span class="punct">|</span><span class="ident">cc</span><span class="punct">|</span> <span class="ident">cc</span> <span class="punct">}</span> <span class="keyword">if</span> <span class="ident">c</span>
<span class="ident">e</span> <span class="punct">=</span> <span class="ident">callcc</span> <span class="punct">{</span> <span class="punct">|</span><span class="ident">cc</span><span class="punct">|</span> <span class="ident">cc</span> <span class="punct">}</span> <span class="keyword">if</span> <span class="ident">c</span> <span class="punct">&amp;&amp;</span> <span class="ident">d</span>
<span class="ident">f</span> <span class="punct">=</span> <span class="ident">callcc</span> <span class="punct">{</span> <span class="punct">|</span><span class="ident">cc</span><span class="punct">|</span> <span class="ident">cc</span> <span class="punct">}</span> <span class="keyword">if</span> <span class="ident">c</span> <span class="punct">&amp;&amp;</span> <span class="ident">d</span> <span class="punct">&amp;&amp;</span> <span class="ident">e</span>
<span class="ident">x</span> <span class="punct">+=</span> <span class="number">1</span>

<span class="ident">puts</span> <span class="ident">x</span>
<span class="ident">c</span><span class="punct">.</span><span class="ident">call</span> <span class="keyword">if</span> <span class="ident">c</span>
<span class="ident">d</span><span class="punct">.</span><span class="ident">call</span> <span class="keyword">if</span> <span class="ident">d</span>
<span class="ident">e</span><span class="punct">.</span><span class="ident">call</span> <span class="keyword">if</span> <span class="ident">e</span>
<span class="ident">f</span><span class="punct">.</span><span class="ident">call</span> <span class="keyword">if</span> <span class="ident">f</span></pre></code></p>
<p>We initialize <code>x</code> to 0, create 4 separate continuations, add one to <code>x</code>, and
call the continuations in order. (The postfix <code>if</code> statements ensure that the
continuations variables aren&#8217;t set or called more than once. Calling <code>c.call</code>
without arguments will jump back to the <code>c = callcc</code> line and set <code>c</code> to
<code>nil</code>.)</p>
<p>Silly, but it illustrates the point: the output is &#8220;1 2 3 4 5&#8221;, meaning that
the four continuations all share the same heap. When <code>d</code> is called, its <code>x</code> is
the same as the <code>x</code> of <code>c</code>, and even though it was 0 when <code>d</code> was captured, it
has since been modified by the resumption of <code>c</code>. When <code>e</code> is called, its <code>x</code>
is also the same <code>x</code>, and so on. (In fact this whole example depends on this
behavior&#8212;each of the continuation variables are only set once, and must
&#8220;retain&#8221; their value across all rentries to continuations above them.)</p>
<p>In additon to multiple continuations being able to share state, the converse is
true too: multiple resumes on the same continuation will share state:
<code><pre class="ruby"><span class="ident">require</span> <span class="punct">'</span><span class="string">continuation</span><span class="punct">'</span>

<span class="ident">x</span> <span class="punct">=</span> <span class="number">0</span>
<span class="ident">c</span> <span class="punct">=</span> <span class="ident">callcc</span> <span class="punct">{</span> <span class="punct">|</span><span class="ident">cc</span><span class="punct">|</span> <span class="ident">cc</span> <span class="punct">}</span>
<span class="ident">x</span> <span class="punct">+=</span> <span class="number">1</span>
<span class="ident">puts</span> <span class="ident">x</span>
<span class="ident">c</span><span class="punct">.</span><span class="ident">call</span> <span class="ident">c</span> <span class="keyword">while</span> <span class="ident">x</span> <span class="punct">&lt;</span> <span class="number">5</span></pre></code></p>
<p>This outputs the same thing as the examples above.</p>
<p>Hopefully that clears up some of the confusion. Here&#8217;s the summary:</p>
<table style="margin-left: auto; margin-right: auto;">
	<tr>
		<th>Fibers            </th>
		<th>Continuations       </th>
	</tr>
	<tr>
		<td style="vertical-align:top;">Four operations: create, exit, yield, resume. </td>
		<td style="vertical-align:top;">Two operations: capture and resume. </td>
	</tr>
	<tr>
		<td style="vertical-align:top;">Upon resume, call stack is wherever it was at the last yield. </td>
		<td style="vertical-align:top;">Upon resume, call stack is where it was when captured. </td>
	</tr>
	<tr>
		<td style="vertical-align:top;">Do not share state except via closure. </td>
		<td style="vertical-align:top;">Multiple continuations and multiple invocations of the same continuation can share state. </td>
	</tr>
</table>
  <div class="comment-link">
    
    <a  href="/fibers#comments">One comment by <b>William Morgan</b></a>.
  </div>

  <h2><a  href="/whisper-0.5">Whisper 0.5 released</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="9 months ago">May 20, 2009  4:48pm</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/whisper/">whisper</a></span> <span class='label'><a  href="/label/releases/">releases</a></span> </div>
  
  <p class='first'>I&#8217;ve released <a href="http://masanjin.net/whisper/">Whisper</a> version 0.5. 
Lots of good stuff since 0.3 (I didn&#8217;t announce 0.4 because it was
a minor bugfix release):</p>
<ul>
	<li>Nested comments are now properly supported.</li>
	<li>New &lt;pre&gt; and &lt;poem&gt; blocks added.</li>
	<li>A new <code>whisper-process-email</code> command for manually reprocessing email.
  You can also offload all email processing to this program instead of the main
  Whisper server, if you like.</li>
	<li>New dependency for the 0.2 version of <a href="http://ritex.rubyforge.org/">RiTeX</a>, which
  has equation array support (see <a href="http://all-thing.net/ritex-0.2">announcement</a> for details).</li>
	<li>Better mbox-splitting code, now that I&#8217;ve figured out how to do this properly
  in <a href="http://sup.rubyforge.org/">Sup</a>.</li>
	<li>RiTeX macros now properly persist throughout an entry.</li>
	<li>Many other minor bugfixes: attribution lines in emails, various incorrect
  bits of <span class="caps">HTML</span> output, escaping of Ritex error messages, etc.</li>
</ul>
<p>Try it now!</p>
<ol>
	<li><code>sudo gem install whisper --source <a href='http://masanjin.net/'>http://masanjin.net/</a></code></li>
	<li><code>whisper-init &lt;blog directory&gt;</code></li>
	<li>Follow the instructions.</li>
</ol>
  <div class="comment-link">
    
    <a  href="/whisper-0.5#comments">One comment by <b>Dominique Julia</b></a>.
  </div>

  <h2><a  href="/suck-eggs">Teaching your grandmother to suck eggs</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="10 months ago">May  6, 2009  1:31pm</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/ancient-greek/">ancient-greek</a></span> <span class='label'><a  href="/label/whisper/">whisper</a></span> <span class='label'><a  href="/label/ubuntu/">ubuntu</a></span> </div>
  
  <p class='first'>If you&#8217;re reading <a href="http://scienceblogs.com/goodmath/2006/11/the_c_is_efficient_language_fa.php">a random diatribe on whether C and C++ are good for
numerical
computing</a>
and happen to come across the curious expression &#8220;teaching your grandmother to
suck eggs&#8221;, and decide to learn more about it, you&#8217;ll quickly find references
to early usages in the 1749 Henry Fielding novel, <cite><a href="http://en.wikipedia.org/wiki/The_History_of_Tom_Jones,_a_Foundling">Tom
Jones</a></cite>, in
which the protagonist recounts:</p>
<blockquote>
<p>I remember my old schoolmaster, who was a prodigious great scholar, used
often to say, Polly matete cry town is my daskalon. The English of which, he
told us, was, That a child may sometimes teach his grandmother to suck eggs.</p>
</blockquote>
<p>And if you then think to yourself, what the heck is &#8220;Polly matete cry town is
my daskalon&#8221;? you need only grab your handy copy of William Shepard Walsh&#8217;s
1909 <a href="http://books.google.com/books?id=hrJkAAAAMAAJ">Handy-book of literary curiosities</a>, look up &#8220;Polly
matete&#8221; in the index, and find that it&#8217;s the transliteration (transphoneticization?) of:</p>
<blockquote>
<p>πολλοι μαθηται κρειττονες διδασκαλον</p>
</blockquote>
<p>which is the last line of a Greek epigram attributed &#8220;sometimes to Phillippus of Thessalonica, sometimes to Lucilius (both of whom lived in the early days of the Roman Empire)&#8221;, translated as:</p>
<p><div class='poem-title'>On a Stolen Statue of Mercury</div><pre class='poem'>Hermes, the volatile, Arcady's president,
  Lacquey of deities, robber of herds,
In this gymnasium constantly resident,
  Light-fingered Aulus bore off with these words:
Many a scholar, by travelling faster
On learning's high-road, runs away with his master.</pre></p>
<p>So there you go. And if you&#8217;re wondering what the original phrase means, Walsh
provides this helpful explanatory rhyme:</p>
<p><pre class='poem'>Teach not a parent's mother to extract
  The embryo juices of an egg by suction:
The good old lady can the feat enact
  Quite irrespective of your kind instruction.</pre></p>
<p>As a side note, <a href="http://masanjin.net/whisper/">Whisper</a> now supports
poems, and I just learned how to type Greek in Ubuntu.</p>
  <div class="comment-link">
    
    <a  href="/suck-eggs#comments">One comment by <b>Mike Schuresko</b></a>.
  </div>

  <h2><a  href="/jaunty">Jaunty Jackalope rockin&#8217; my world</a></h2>
  <div class="byline">
    <a  href="/by/William+Morgan/">William Morgan</a>,
    <span title="10 months ago">May  1, 2009  4:01am</span>
  </div>
  
    <div class="labels"><span class='label'><a  href="/label/ubuntu/">ubuntu</a></span> </div>
  
  <p class='first'>Ubuntu 9.04 is really pleasing me. Bootup time is 20 seconds (!) from <span class="caps">GRUB</span> to
login prompt, which is pretty incredible. It takes another 20 seconds from
typing my password and hitting enter to a Desktop with all my bells and
whistles loaded. In total, only 4 times the amount of time it takes for <code>ri
clone</code> to print something useless!</p>
<p>Other things I&#8217;m enjoying:</p>
<ul>
	<li>The fancy notification for IMs, wireless connections, etc is really sweet.
  It looks nice, is non-intrusive, and properly stops when the corresponding
  window has focus. I just wish it were somehow configurable.</li>
	<li>The orange satellite light on my laptop lights up every time the wireless is
  accessed. Every time I send an IM I feel like I&#8217;m a fucking astronaut.</li>
	<li>Various wireless issues I was having with 8.10 seem to have disappeared.</li>
	<li><a href="https://help.ubuntu.com/9.04/serverguide/C/screen-profiles.html">Screen profiles</a>. So cool.</li>
</ul>
  <div class="comment-link">
    
    <a  href="/jaunty#comments">No comments</a>.
  </div>



  <div class="pageblock">
  
  
    <span class="currentpagelink">1</span>
  
    <a class="pagelink" href="/index/1">2</a>
  
    <a class="pagelink" href="/index/2">3</a>
  
    <a class="pagelink" href="/index/3">4</a>
  
    <a class="pagelink" href="/index/4">5</a>
  
    <a class="pagelink" href="/index/5">6</a>
  
    <a class="pagelink" href="/index/6">7</a>
  
  &nbsp;<a class="pageword" href="/index/1">Next</a>
  </div>


  </div>

  <div id="footer" style="margin: 0px;">
    Served up by <a href="http://masanjin.net/whisper/">Whisper</a>. Yes!
  </div>
</div>
</body>
</html>
