<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Jeremy Mates’s Blog</title>
    <link rel="alternate" type="text/html" href="http://sial.org/blog/" />
    <link rel="self" type="application/atom+xml" href="http://sial.org/blog/atom.xml" />
   <id>tag:sial.org,2008:/blog//2</id>
    <link rel="service.post" type="application/atom+xml" href="https://sial.org/mt/support/mt-atom.cgi/weblog/blog_id=2" title="Jeremy Mates’s Blog" />
    <updated>2008-05-11T03:20:27Z</updated>
    <subtitle><![CDATA[&lt;lint class='belly' /&gt;]]></subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 3.2</generator>
 
<entry>
    <title>One Random Saturday</title>
    <link rel="alternate" type="text/html" href="http://sial.org/blog/2008/05/one_random_saturday.html" />
    <link rel="service.edit" type="application/atom+xml" href="https://sial.org/mt/support/mt-atom.cgi/weblog/blog_id=2/entry_id=288" title="One Random Saturday" />
    <id>tag:sial.org,2008:/blog//2.288</id>
    
    <published>2008-05-11T03:07:54Z</published>
    <updated>2008-05-11T03:20:27Z</updated>
    
    <summary> Busy with on-call duties earlier this week, recovered Saturday....</summary>
    <author>
        <name>Jeremy Mates</name>
        <uri>http://sial.org/</uri>
    </author>
            <category term="Art" />
            <category term="Photography" />
    
    <content type="html" xml:lang="en" xml:base="http://sial.org/blog/">
<style type="text/css"><!-- @import url(http://sial.org/_xs/mt/style/blog/localized.css); --></style>
        <![CDATA[<p><a href="http://www.flickr.com/photos/jeremymates/sets/72157604992202787/"><img src="http://farm3.static.flickr.com/2007/2482190534_7203b0354c.jpg" width="399" height="500" alt="Five" /></a></p>
<p>Busy with on-call duties earlier this week, recovered Saturday.</p>]]>
        
    </content>
</entry>
<entry>
    <title>Lack of Safety at Eastlake &amp; Fuhrman</title>
    <link rel="alternate" type="text/html" href="http://sial.org/blog/2008/05/lack_of_safety_at_eastlake_fuh.html" />
    <link rel="service.edit" type="application/atom+xml" href="https://sial.org/mt/support/mt-atom.cgi/weblog/blog_id=2/entry_id=287" title="Lack of Safety at Eastlake &amp; Fuhrman" />
    <id>tag:sial.org,2008:/blog//2.287</id>
    
    <published>2008-05-09T22:21:09Z</published>
    <updated>2008-05-09T23:31:08Z</updated>
    
    <summary><![CDATA[From: Jeremy Mates &lt;jmates@sial.org&gt; Date: Fri, 9 May 2008 15:18:55 -0700 To: nick.licata@seattle.gov, sally.clark@seattle.gov, richard.conlin@seattle.gov, david.della@seattle.gov, richard.mciver@seattle.gov, tom.rasmussen@seattle.gov, peter.steinbrueck@seattle.gov, carbina.resendez@seattle.gov, m.j.kelly@cascadebicycleclub.org Subject: Bicycle Safety Improvements at Eastlake & Fuhrman? How many more bicyclists must die, or be injured, before the...]]></summary>
    <author>
        <name>Jeremy Mates</name>
        <uri>http://sial.org/</uri>
    </author>
            <category term="Sports" />
    
    <content type="html" xml:lang="en" xml:base="http://sial.org/blog/">
<style type="text/css"><!-- @import url(http://sial.org/_xs/mt/style/blog/localized.css); --></style>
        <![CDATA[<pre>From: Jeremy Mates &lt;jmates@sial.org&gt;
Date: Fri, 9 May 2008 15:18:55 -0700
To: nick.licata@seattle.gov, sally.clark@seattle.gov,
        richard.conlin@seattle.gov, david.della@seattle.gov,
        richard.mciver@seattle.gov, tom.rasmussen@seattle.gov,
        peter.steinbrueck@seattle.gov, carbina.resendez@seattle.gov,
        m.j.kelly@cascadebicycleclub.org
Subject: Bicycle Safety Improvements at Eastlake & Fuhrman?

How many more bicyclists must die, or be injured, before the city
improves the safety of the Eastlake & Fuhrman intersection for
bicyclists and pedestrians?

http://www2.seattle.gov/fire/realTime911/getRecsForDatePub.asp?action=Today&incDate=&rad1=des

  5/9/2008 2:51:31 PM F080040691 E17 M16
  Eastlake Av E / Fuhrman Av E Medic Response

Thank you,
Jeremy Mates</pre>
<p><a href="http://www.thestranger.com/seattle/Content?oid=322254">Bryce Lewis</a> died at this intersection on 9/7/2007:</p>
<blockquote>The crash site, an intersection that sees 30,000 cars a day, is notoriously dangerous for cyclists ("scary as shit," one Point 83 poster called it). Although Seattle Department of Transportation (SDOT) spokesman Gregg Hirakawa says SDOT has no specific records indicating that the intersection of Eastlake and Fuhrman avenues is more dangerous than other trouble spots. (SDOT doesn't keep crash statistics by intersection.) "This is a major connection [for cyclists], and it needs improvement," says David Hiller, advocacy director for the Cascade Bicycle Club.</blockquote>
<p>Update: Councilmember <a href="mailto:Jan.Drago@Seattle.Gov">Jan Drago</a> (chair, Transportation Committee) and <a href="mailto:Grace.Crunican@Seattle.Gov">Grace Crunican</a> (Director of the Seattle Department of
Transportation) are the most appropriate contacts to voice concern over this intersection.</p>





<!-- technorati tags start --><p style="text-align:right;font-size:10px;">Technorati Tags: <a href="http://www.technorati.com/tag/cycle" rel="tag">cycle</a></p><!-- technorati tags end -->]]>
        
    </content>
</entry>
<entry>
    <title>Seattle Chess Resource</title>
    <link rel="alternate" type="text/html" href="http://sial.org/blog/2008/05/seattle_chess_resource.html" />
    <link rel="service.edit" type="application/atom+xml" href="https://sial.org/mt/support/mt-atom.cgi/weblog/blog_id=2/entry_id=286" title="Seattle Chess Resource" />
    <id>tag:sial.org,2008:/blog//2.286</id>
    
    <published>2008-05-08T18:29:33Z</published>
    <updated>2008-05-09T01:23:00Z</updated>
    
    <summary>Northwest Chess: Chess News from Washington and Oregon. My chess playing appears to greatly suffer during Winter, perhaps related to the general lack of sunlight? Also very blunder prone when on-call…...</summary>
    <author>
        <name>Jeremy Mates</name>
        <uri>http://sial.org/</uri>
    </author>
            <category term="Chess" />
    
    <content type="html" xml:lang="en" xml:base="http://sial.org/blog/">
<style type="text/css"><!-- @import url(http://sial.org/_xs/mt/style/blog/localized.css); --></style>
        <![CDATA[<p><a href="http://www.flickr.com/photos/jeremymates/2475580258/" title="Chess Confusion by thrig, on Flickr"><img src="http://farm3.static.flickr.com/2205/2475580258_6e4b235d1a_t.jpg" width="100" height="100" alt="Chess Confusion" style="float: right; margin-left: 1em; margin-bottom: 1em;" /></a><a href="http://www.nwchess.com/calendar/weekly.htm">Northwest Chess: Chess News from Washington and Oregon</a>. My chess playing appears to greatly suffer during Winter, perhaps related to the general lack of sunlight? Also very blunder prone when on-call…</p>]]>
        
    </content>
</entry>
<entry>
    <title>System Debugging</title>
    <link rel="alternate" type="text/html" href="http://sial.org/blog/2008/05/system_debugging.html" />
    <link rel="service.edit" type="application/atom+xml" href="https://sial.org/mt/support/mt-atom.cgi/weblog/blog_id=2/entry_id=285" title="System Debugging" />
    <id>tag:sial.org,2008:/blog//2.285</id>
    
    <published>2008-05-06T17:48:58Z</published>
    <updated>2008-05-06T02:44:04Z</updated>
    
    <summary>Computer system debugging benefits from both experience with and knowledge of the system. It also benefits from many questions being asked, until a cause is known, or at least potential causes being eliminated. As an example, a junior admin may...</summary>
    <author>
        <name>Jeremy Mates</name>
        <uri>http://sial.org/</uri>
    </author>
            <category term="Computers" />
    
    <content type="html" xml:lang="en" xml:base="http://sial.org/blog/">
<style type="text/css"><!-- @import url(http://sial.org/_xs/mt/style/blog/localized.css); --></style>
        <![CDATA[<p>Computer system debugging benefits from both experience with and knowledge of the system. It also benefits from many questions being asked, until a cause is known, or at least potential causes being eliminated. As an example, a junior admin may note that a filesystem fails to unmount, and eventually ask a senior admin for help.</p>
<p>(As an aside, <a href="http://www.catb.org/~esr/faqs/smart-questions.html">learning how to ask smart questions</a> can help avoid time wasted over an “it doesn’t work” exchange.)</p>]]>
        <![CDATA[<p>Possible workflow for a filesystem failing to unmount:</p>
<img src="http://sial.org/blog/diagnostics-1.png" height="388" width="368" />
<p>A good admin will ask many questions, and try to answer all of them, either by asking, or if possible, running the commands. The exact order of steps is not important so much as checking a wide variety of symptoms. Another admin may check <tt>df</tt> to see if the filesystem is actually mounted before running <tt>sudo lsof | grep mountpoint</tt> for open files. These commands are (usually) quick to run, and (usually) additional terminals can be opened to continue should one command be slow or block.</p>
<p>Junior admins should spend as much time learning the system as possible. Books such as the <a href="http://www.amazon.com/gp/product/0130206016?ie=UTF8&tag=sialorg-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=0130206016">UNIX System Administration Handbook</a><img src="http://www.assoc-amazon.com/e/ir?t=sialorg-20&l=as2&o=1&a=0130206016" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> should help, as will delving through the manuals or other available vendor documentation. Consider also reading <a href="http://sial.org/howto/debug/unix/">Unix Debugging Tips</a>.</p>
<h3>Quick System Overview</h3>
<p>Be aware that an error message may not be from the problem, but something affected by the real problem. This is why some initial time spent getting a feel for the system will almost always help:</p>
<ul style="list-style-type: square;">
  <li><p><b>How long has the system been running?</b> Use the <tt>uptime</tt> command, which also shows the system load. (Old RedHat 7.2 systems, if left running long enough, would eventually show 100% CPU usage due to a <tt>procps</tt> bug.)</p></li>
  <li><p><b>Abnormal CPU, disk, or memory use?</b> <tt>top</tt>, <tt>free</tt> on Linux, <tt>vmstat 1</tt> or <tt>iostat</tt> can all be consulted in a matter of seconds. Processes stuck in <tt>D</tt> state or high I/O wait times may indicate an overburdened disk system.</p>
  <p>Note: <tt>df</tt> and similar commands can hang on a broken NFS mount. With multiple SSH or a screen session, this probably is not a concern. If one only has a single console link, the blocked <tt>df</tt> process could hamper diagnostics.</p></li>
  <li><p><b>Anything strange in the system logs?</b> This is more relevant should the system have recently rebooted. Check <tt>dmesg</tt>, and wherever else the logging daemon sends this information.</p></li>
  <li><p><b>RAID or SAN or LVM state?</b> More relevant on database and file server systems than throwaway desktop or service nodes. Due to the plethora of different arrays and devices possible here, best to write a wrapper script that figures out what the system has, and emits appropriate diagnostics.</p>
</ul>
<p><a href="http://www.nagios.org/">Monitoring</a> can help collect and alarm on abnormal CPU, memory, or disk usage. However, these should not page, as a busy but perfectly operational system may show high CPU, and waking someone up for false alarms hurts their ability to work on real issues.</p>]]>
    </content>
</entry>
<entry>
    <title>Lode Runner</title>
    <link rel="alternate" type="text/html" href="http://sial.org/blog/2008/05/lode_runner.html" />
    <link rel="service.edit" type="application/atom+xml" href="https://sial.org/mt/support/mt-atom.cgi/weblog/blog_id=2/entry_id=284" title="Lode Runner" />
    <id>tag:sial.org,2008:/blog//2.284</id>
    
    <published>2008-05-05T15:41:04Z</published>
    <updated>2008-05-05T01:22:00Z</updated>
    
    <summary>Reaching level 150 in Lode Runner is possible; I never had the patience, nor time to leave the Apple //e running for the duration required. Thanks to a virtual machine, the game can be saved and resumed as necessary. Following...</summary>
    <author>
        <name>Jeremy Mates</name>
        <uri>http://sial.org/</uri>
    </author>
            <category term="Computers" />
    
    <content type="html" xml:lang="en" xml:base="http://sial.org/blog/">
<style type="text/css"><!-- @import url(http://sial.org/_xs/mt/style/blog/localized.css); --></style>
        <![CDATA[<p>Reaching level 150 in <a href="http://en.wikipedia.org/wiki/Lode_Runner">Lode Runner</a> is possible; I never had the patience, nor time to leave the <a href="http://en.wikipedia.org/wiki/Apple_ii">Apple //e</a> running for the duration required. Thanks to a <a href="http://www.xs4all.nl/~gp/VirtualII/">virtual machine</a>, the game can be saved and resumed as necessary. Following level 150, the levels start over again, except the enemies are faster. This happens again at level 300.</p>
<p>Level 52 is tricky the second time through, and requires cutting corners to reach the falling enemy in time. The third time through, a different strategy is required, as the enemy is now too fast to reach in time. Instead, one must dig to get past the upper two enemies, then fall into the usual pattern.</p>
<p>Curtains fall at level 357, where the now twice sped enemy always intercepts one before crossing the first ladder (only eight bits were allocated for the level counter, as following level 256, it wraps, hence level 101 being displayed):</p>
<a href="http://sial.org/blog/loderunner-level357.png"><img src="http://sial.org/blog/loderunner-level357-tm.jpg" height="100" width="144" border="1" alt="Lode Runner Level 357" /></a>
<p>Note: <tt>lode_runner1.po</tt> on the Asimov Apple //e archive is corrupt at level 130-something. I am using <tt>lode_runner.do.gz</tt>. If paranoid, <a href="http://entropymine.com/jason/lr/misc/controls.html">advance through the levels</a> with control+U or control+6 to confirm the levels look right.</p>
<p>Next, Championship Lode Runner.</p>]]>
        
    </content>
</entry>
<entry>
    <title>Polaroid: Film &amp; Company</title>
    <link rel="alternate" type="text/html" href="http://sial.org/blog/2008/05/polaroid_film_company.html" />
    <link rel="service.edit" type="application/atom+xml" href="https://sial.org/mt/support/mt-atom.cgi/weblog/blog_id=2/entry_id=283" title="Polaroid: Film &amp; Company" />
    <id>tag:sial.org,2008:/blog//2.283</id>
    
    <published>2008-05-04T08:39:56Z</published>
    <updated>2008-05-04T01:54:49Z</updated>
    
    <summary>The Film Do not much like Polaroid film. To be fair, I am using a Holgaroid back to a Holga. Peeves: loading the film is tricky, though worse is extracting the film for exposure, as the paper pull tabs risk...</summary>
    <author>
        <name>Jeremy Mates</name>
        <uri>http://sial.org/</uri>
    </author>
            <category term="Photography" />
    
    <content type="html" xml:lang="en" xml:base="http://sial.org/blog/">
<style type="text/css"><!-- @import url(http://sial.org/_xs/mt/style/blog/localized.css); --></style>
        <![CDATA[<h3>The Film</h3>
<p>Do not much like Polaroid film. To be fair, I am using a Holgaroid back to a Holga. Peeves: loading the film is tricky, though worse is extracting the film for exposure, as the paper pull tabs risk breaking, leaving the film stranded, and the ninth exposure usually pulls the tenth out along with it. Another problem: odd streaks down the film, which appear to line up with the pull tab paper: somehow this is getting compressed against the film through the rollers?</p>
<div style="display: block; margin-left: auto; margin-right: auto"><a href="http://www.flickr.com/photos/jeremymates/2448281366/" title="Dream by thrig, on Flickr"><img src="http://farm4.static.flickr.com/3109/2448281366_edf5908ac0.jpg" width="389" height="500" alt="Dream" /></a></div>
<p>Film quality excellent, with a deep glossy black, though getting the exposure right was very tricky, as the Holgaroid metered nothing like my DSLR measured. A incident light meter should give better readings, but I do not own one.</p>
<p>Digital or regular film photography, combined with post processing and glossy printing, while slower, should produce similar effects. I could see using Polaroid to take test shots for medium or large format needs. However! Given that <a href="http://thelede.blogs.nytimes.com/2008/02/08/polaroid-abandons-instant-photography/?hp">Polaroid is going the way of the Dodo</a>, best to avoid the resulting high film prices until and if an instant film market emerges following 2009.</p>
<h3>The Company</h3>
<blockquote>“Dire financial straits notwithstanding, Polaroid paid senior executives and directors a total of $6.3 million in bonuses, consulting fees, and lump-sum pension payouts in the months before the [bankruptcy] filing. Payments included $1.7 million in incentive comp to former CEO DiCamillo, while former CFO Judy Boynton got $300,000 in severance, a $510,000 stock award, and a $638,000 lump-sum pension payout. (Boynton, now the CFO of Royal Dutch/Shell Group, is listed as an unsecured creditor, for an additional severance of $600,000 she is still owed.)”<br><br>“Polaroid retirees had feared the results of a sale to OEP, and that fear was justified. After June 28, the company's cash balance plan was terminated and handed over to the federal Pension Benefit Guarantee Corp., meaning many retirees had their pension payments slashed. Employees on long-term disability received letters informing them that they would not be hired by the new company and that their benefits were being terminated. Indeed, the Massachusetts attorney general's office had difficulty convincing OEP, as owner of the new Polaroid, to sponsor the retirees' supplemental Medicare plan, even though that sponsorship costs nothing except time spent keeping the books.”<br><br>&nbsp;&nbsp;&nbsp;&nbsp;— <a href="http://www.cfo.com/article.cfm/3007726/1/c_3046585">What’s Wrong with This Picture?</a></blockquote><br>]]>
        
    </content>
</entry>
<entry>
    <title>Reading</title>
    <link rel="alternate" type="text/html" href="http://sial.org/blog/2008/05/reading.html" />
    <link rel="service.edit" type="application/atom+xml" href="https://sial.org/mt/support/mt-atom.cgi/weblog/blog_id=2/entry_id=282" title="Reading" />
    <id>tag:sial.org,2008:/blog//2.282</id>
    
    <published>2008-05-03T16:25:12Z</published>
    <updated>2008-05-03T16:29:02Z</updated>
    
    <summary>The Kindle from Amazon is now in stock. I’ve only seen one or two floating around work. The device looks interesting, though is not on my immediate to buy list, mainly due to the stacks of real books I need...</summary>
    <author>
        <name>Jeremy Mates</name>
        <uri>http://sial.org/</uri>
    </author>
            <category term="Books" />
    
    <content type="html" xml:lang="en" xml:base="http://sial.org/blog/">
<style type="text/css"><!-- @import url(http://sial.org/_xs/mt/style/blog/localized.css); --></style>
        <![CDATA[<p>The <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2Fkindle&tag=sialorg-20&linkCode=ur2&camp=1789&creative=9325">Kindle</a><img src="http://www.assoc-amazon.com/e/ir?t=sialorg-20&amp;l=ur2&amp;o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> from Amazon is now in stock. I’ve only seen one or two floating around work. The device looks interesting, though is not on my immediate to buy list, mainly due to the stacks of real books I need to read. Most recently:</p>
<ul>
  <li><a href="http://www.amazon.com/gp/product/1580491650?ie=UTF8&tag=sialorg-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=1580491650">Dubliners</a><img src="http://www.assoc-amazon.com/e/ir?t=sialorg-20&l=as2&o=1&a=1580491650" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></a></li>
  <li><a href="http://www.amazon.com/gp/product/0451530152?ie=UTF8&tag=sialorg-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=0451530152">A Portrait of the Artist as a Young Man</a><img src="http://www.assoc-amazon.com/e/ir?t=sialorg-20&l=as2&o=1&a=0451530152" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></li>
</ul>
<p>Based on conversations with our Dublin staff, Dublin is very much so not the town James Joyce wrote about.</p>]]>
        
    </content>
</entry>
<entry>
    <title>Big Blobs</title>
    <link rel="alternate" type="text/html" href="http://sial.org/blog/2008/05/big_blobs.html" />
    <link rel="service.edit" type="application/atom+xml" href="https://sial.org/mt/support/mt-atom.cgi/weblog/blog_id=2/entry_id=281" title="Big Blobs" />
    <id>tag:sial.org,2008:/blog//2.281</id>
    
    <published>2008-05-02T10:35:19Z</published>
    <updated>2008-05-02T03:44:55Z</updated>
    
    <summary>Perl coding can evolve towards the use of a Big Blob—a large structure of deeply nested data—once perldsc and perllol are mastered. That is, input from various sources is assembled into the Big Blob, any required munging performed, and the...</summary>
    <author>
        <name>Jeremy Mates</name>
        <uri>http://sial.org/</uri>
    </author>
            <category term="Perl" />
    
    <content type="html" xml:lang="en" xml:base="http://sial.org/blog/">
<style type="text/css"><!-- @import url(http://sial.org/_xs/mt/style/blog/localized.css); --></style>
        <![CDATA[<p><a href="http://www.perl.org/">Perl coding</a> can evolve towards the use of a Big Blob—a large structure of deeply nested data—once <a href="http://perldoc.perl.org/perldsc.html"><tt>perldsc</tt></a> and <a href="http://perldoc.perl.org/perllol.html"><tt>perllol</tt></a> are mastered. That is, input from various sources is assembled into the Big Blob, any required munging performed, and the data structure iterated over to emit some sort of output or change. This method does work, though suffers from a number of avoidable flaws.</p>
<p class="sial-block-code">if ( $line =~ m/^ { $/x ) {
  $rule_target[-1]-&gt;[-1]-&gt;{_subrules} = [];
  push @rule_target, $rule_target[-1]-&gt;[-1]-&gt;{_subrules};
}</p>
<p>First, consider instead providing an Object Oriented interface, thus hiding the Big Blob. However, this may defeat a “well, I’m just trying to mangle X into Y, not waste time with class struggles” coding effort. Whether OO makes sense depends on the project. A standalone data conversion script probably does not justify OO. Code that other code will use, or a service interface, especially one used by other groups or users, will likely benefit from OO.</p>
<p>Secondly, Big Blobs could be a solution looking for a problem. The coder knows how to parse data into the blob, then iterate over the mess, but never considers whether a blob should have been used.</p>
<p class="sial-block-code">my %big_blob = load_from_file($filename);

upload_to_database(\%big_blob);</p>
<p>In many cases, the entirety of data need not be loaded into memory, and instead only the minimum necessary data retained in memory before acting on it:</p>
<p class="sial-block-code">while &lt;$fh&gt; {
  my %line_data;
  # ... parse line into line_data hash

  # upload line_data contents to database
  $db-&gt;...

} continue {
  if ($. % 1000) {
    $db-&gt;commit();
  }
}</p>
<p>This method scales better, as it no longer is bound by memory, and will not require DB_File or refactoring should the data set exceed available memory. The question: “do I really need to parse all the data to memory, or is there a more efficient solution?” will help prevent inappropriate use of Big Blobs.</p>

<!-- technorati tags start --><p style="text-align:right;font-size:10px;">Technorati Tags: <a href="http://www.technorati.com/tag/Perl" rel="tag">Perl</a></p><!-- technorati tags end -->]]>
        
    </content>
</entry>
<entry>
    <title>Chart &amp; Graph</title>
    <link rel="alternate" type="text/html" href="http://sial.org/blog/2008/05/chart_graph.html" />
    <link rel="service.edit" type="application/atom+xml" href="https://sial.org/mt/support/mt-atom.cgi/weblog/blog_id=2/entry_id=280" title="Chart &amp; Graph" />
    <id>tag:sial.org,2008:/blog//2.280</id>
    
    <published>2008-05-01T04:14:50Z</published>
    <updated>2008-05-01T04:15:41Z</updated>
    
    <summary>Chart No, not Visio. Visio drives me batty. I use OmniGraffle, except at work. Graph Graphjam. Technorati Tags: chart...</summary>
    <author>
        <name>Jeremy Mates</name>
        <uri>http://sial.org/</uri>
    </author>
            <category term="Art" />
            <category term="Computers" />
    
    <content type="html" xml:lang="en" xml:base="http://sial.org/blog/">
<style type="text/css"><!-- @import url(http://sial.org/_xs/mt/style/blog/localized.css); --></style>
        <![CDATA[<h3>Chart</h3>
<p><a href="http://www.flickr.com/photos/jeremymates/2446416513/" title="Choice by thrig, on Flickr"><img src="http://farm4.static.flickr.com/3074/2446416513_3bbdec8f9f_m.jpg" width="240" height="159" alt="Choice" /></a></p>
<p>No, not Visio. Visio drives me batty. I use OmniGraffle, except at work.</p>
<h3>Graph</h3>
<p><a href="http://graphjam.com/">Graphjam</a>.</p>
<!-- technorati tags start --><p style="text-align:right;font-size:10px;">Technorati Tags: <a href="http://www.technorati.com/tag/chart" rel="tag">chart</a></p><!-- technorati tags end -->]]>
        
    </content>
</entry>
<entry>
    <title>Locking from Cron</title>
    <link rel="alternate" type="text/html" href="http://sial.org/blog/2008/04/locking_from_cron.html" />
    <link rel="service.edit" type="application/atom+xml" href="https://sial.org/mt/support/mt-atom.cgi/weblog/blog_id=2/entry_id=279" title="Locking from Cron" />
    <id>tag:sial.org,2008:/blog//2.279</id>
    
    <published>2008-04-21T14:10:17Z</published>
    <updated>2008-04-21T00:13:01Z</updated>
    
    <summary>Periodic jobs must often not run more than one instance at a time. Unfortunately, simple solutions often fail to account for common edge cases. For example, assume a need to synchronize files each hour with rsync. On unix, a cron...</summary>
    <author>
        <name>Jeremy Mates</name>
        <uri>http://sial.org/</uri>
    </author>
            <category term="Coding" />
    
    <content type="html" xml:lang="en" xml:base="http://sial.org/blog/">
<style type="text/css"><!-- @import url(http://sial.org/_xs/mt/style/blog/localized.css); --></style>
        <![CDATA[<p>Periodic jobs must often not run more than one instance at a time. Unfortunately, simple solutions often fail to account for common edge cases. For example, assume a need to synchronize files each hour with <tt>rsync</tt>. On unix, a cron job is perhaps the quickest solution:</p>
<p class="sial-block-code"># run just past the top of the hour
# as many other things run then
7 * * * * rsync -e ssh -az --delete /source desthost:/dest</p>
<p>However, this solution has a major edge case that can bring down the system. Worse, simplistic attempts to fix this fault can result in <tt>rsync</tt> not running.</p>


<!-- technorati tags start --><p style="text-align:right;font-size:10px;">Technorati Tags: <a href="http://www.technorati.com/tag/cron" rel="tag">cron</a></p><!-- technorati tags end -->]]>
        <![CDATA[<a href="http://www.amazon.com/Downward-Spiral-Deluxe-Explicit/dp/B00150W1K6/sialorg-20/ref=nosim"><img src="http://sial.org/blog/red-spiral.jpg" height="100" width="100" border="1" style="float: right; margin-left: 1em; margin-bottom: 1em;" /></a>
<h2>Resource Usage Spiral</h2>
<p><tt>rsync</tt>, run directly from cron, will run until the file transfer has completed, or a bug causes the rsync to hang, or some fault causes rsync to terminate unexpectedly: bad memory, a system reboot, a <a href="http://sial.org/howto/shell/kill-9/">cowboy admin getting frisky with <tt>kill -9</tt></a>, and so forth. The most worrying is when <tt>rsync</tt> operates normally, but takes too long to complete. In this case, cron will launch subsequent <tt>rsync</tt>, and over time, if the other <tt>rsync</tt> never exit, the system will eventually fail.</p>
<p>The <tt>rsync --timeout=999</tt> option is useful, but not complete. This option ensures <tt>rsync</tt> will eventually exit. However, it will not help when <tt>crond</tt> launches the next instance while <tt>rsync</tt> is still transferring files. A wrapper script around <tt>rsync</tt> is necessary to prevent multiple instances from running.</p>
<h2>Naïve Locking Schemes</h2>
<p class="sial-block-code">&lt; Lovecraft&gt; thrig: its a matter of making a
  script that looks for a lock file. if exist
  &lt;lockfile&gt;, don't start. Ifnot exist &lt;lockfile&gt;
  make one and start.
&lt; thrig&gt; Lovecraft: and what else?
&lt; Lovecraft&gt; Thats it</p>
<p>File locking requires <i>slightly</i> more thought than looking for a lock, and not running if it exists. Lovecraft’s incomplete solution will cause problems should the system crash, should the system restart normally without the script handling the shutdown signal properly, should the script be terminated by <tt>kill -9</tt> (even if it trapped other signals properly), should a hardware fault cause the script to exit, should a system configuration issue prevent the lock file from being created. Worst, if poorly written and poorly monitored, nobody may know the <tt>rsync</tt> process is not running—until some need reveals the lack of recent files on the destination server, which could be weeks or months since things went awry.</p>
<p class="sial-block-code">#!/bin/sh
# Skeleton locking with signal handling.
# Much more sanity checking required!
PID_FILE="/var/lock/foopid"

cleanup () {
  rm -- "$PID_FILE"
}
trap "cleanup" 0 1 2 13 15

# Race condition probably not a concern,
# due to the infrequency of rsync runs.
[ -e "$PID_FILE" ] &amp;&amp; exit

touch "$PID_FILE" || exit
rsync --timeout=999 -e ssh -az \
  /sourcedir/ desthost:/destdir
cleanup</p>
<p>Lock files introduce a new problem: the lock file suggests—but by no means proves—the associated process is actually running. That is, depending on the implementation, the <tt>rsync</tt> may be running, and no lock file created—a permissions problem coupled with an “ignore errors creating lock file” implementation—or the <tt>rsync</tt> process may not be running, and a lock file exists, for the various reasons outlined above. Consider locking against the process name, not a file on disk.</p>
<h2>Ideas for Improvements</h2>
<p>Software besides <tt>crond</tt>, such as <a href="http://www.cfengine.org/">CFEngine</a>, provide locking functionality. If possible, use these solutions, as they are likely better tested than an in-house shell script. CFEngine or similar configuration management software can also ensure the lock directory exists and has the correct permissions, if a lock file scheme is used.</p>
<p>With <a href="http://www.perl.org/">Perl</a>, one solution is to <a href="http://www.perlmonks.org/?node_id=590619">lock the script itself via the special <tt>__DATA__</tt> filehandle</a>, which will avoid the various problems of an external lock file. I generally prefer Perl over the shell, as the shell lacks the equivalent of <tt>perl -c</tt>, makes writing unit tests difficult, and has a <a href="http://sial.org/blog/2007/01/shell_quoting_gotcha.html">number of scary edge cases</a> that can delete entire disks.</p>
<p>Another implementation wraps the <tt>rsync</tt> inside a loop. This prevents multiple <tt>rsync</tt> from running, but pushes the locking and monitoring to the wrapper script instead. This runs the process an hour after the previous one completes, not once every hour.</p>
<p class="sial-block-code">while sleep 3600; do
  rsync ...
done</p>
<p>Monitoring whether <tt>rsync</tt> actually did anything is another can of worms. This monitoring should not be an e-mail, as if frequent it will become cron spam, filtered and ignored. Monitoring should also not report transitory errors, where the target is temporarily unavailable, as investigating false alarms waste time.</p>]]>
    </content>
</entry>
<entry>
    <title>On Unicode and &amp;#119585;</title>
    <link rel="alternate" type="text/html" href="http://sial.org/blog/2008/04/unicode.html" />
    <link rel="service.edit" type="application/atom+xml" href="https://sial.org/mt/support/mt-atom.cgi/weblog/blog_id=2/entry_id=277" title="On Unicode and &amp;#119585;" />
    <id>tag:sial.org,2008:/blog//2.277</id>
    
    <published>2008-04-20T10:13:21Z</published>
    <updated>2008-04-19T20:16:56Z</updated>
    
    <summary>Folks often wander into #perl, asking about “Wide character …” messages. For unknown reasons, some people are reluctant to read the perldiag documentation that explains this message, and, having been cajoled into reading the documentation, reluctant to follow the advice...</summary>
    <author>
        <name>Jeremy Mates</name>
        <uri>http://sial.org/</uri>
    </author>
            <category term="Coding" />
    
    <content type="html" xml:lang="en" xml:base="http://sial.org/blog/">
<style type="text/css"><!-- @import url(http://sial.org/_xs/mt/style/blog/localized.css); --></style>
        <![CDATA[<p>Folks often wander into <tt>#perl</tt>, asking about “Wide character …” messages. For unknown reasons, some people are reluctant to read the <a href="http://perldoc.perl.org/perldiag.html"><tt>perldiag</tt></a> documentation that explains this message, and, having been cajoled into reading the documentation, reluctant to follow the advice it outlines, instead insisting on a regex solution to perhaps strip the offending characters. An unrelated discussion at work educed two must reads regarding Unicode:</p>
<ol>
  <li><a href="http://jmglov.blogspot.com/2008/04/thou-shalt-grok-unicode.html">Thou shalt grok Unicode!</a></li>
  <li><a href="http://ahinea.com/en/tech/perl-unicode-struggle.html">Unicode-processing issues in Perl and how to cope with it</a></li>
</ol>
<p><a href="http://sial.org/blog/2006/12/unicode_christmas.html">More Unicode</a>.</p>


<!-- technorati tags start --><p style="text-align:right;font-size:10px;">Technorati Tags: <a href="http://www.technorati.com/tag/characters" rel="tag">characters</a>, <a href="http://www.technorati.com/tag/utf8" rel="tag">utf8</a></p><!-- technorati tags end -->]]>
        
    </content>
</entry>
<entry>
    <title>Seattle Weather Links</title>
    <link rel="alternate" type="text/html" href="http://sial.org/blog/2008/04/seattle_weather_links.html" />
    <link rel="service.edit" type="application/atom+xml" href="https://sial.org/mt/support/mt-atom.cgi/weblog/blog_id=2/entry_id=278" title="Seattle Weather Links" />
    <id>tag:sial.org,2008:/blog//2.278</id>
    
    <published>2008-04-20T00:23:40Z</published>
    <updated>2008-04-20T00:23:53Z</updated>
    
    <summary>Mostly for outdoor photography reference by myself: NWS Seattle Pacific NorthWest MM5 Weather Forecasts (neato technical detail) Hour-by-hour precipitation Column-integrated cloud water...</summary>
    <author>
        <name>Jeremy Mates</name>
        <uri>http://sial.org/</uri>
    </author>
            <category term="Science" />
    
    <content type="html" xml:lang="en" xml:base="http://sial.org/blog/">
<style type="text/css"><!-- @import url(http://sial.org/_xs/mt/style/blog/localized.css); --></style>
        <![CDATA[<p>Mostly for outdoor photography reference by myself:</p>
<ul>
  <li><a href="http://www.wrh.noaa.gov/forecast/MapClick.php?TempBox=1&ExtraBox=1&RainBox=1&PoPBox=1&Submit=Submit&FcstType=graphical&textField1=47.61022&textField2=-122.30433&site=sew&WindBox=1&SkyBox=1&ThunderBox=1&AheadHour=0">NWS Seattle</a></li>
  <li><a href="http://www.atmos.washington.edu/mm5rt/gfsinit.html">Pacific NorthWest MM5 Weather Forecasts</a> (neato technical detail)</li>
  <ul>
    <li><a href="http://www.atmos.washington.edu/~ovens/loops/wxloop.cgi?mm5d3_ww_pcp1+///1">Hour-by-hour precipitation</a></li>
    <li><a href="http://www.atmos.washington.edu/~ovens/loops/wxloop.cgi?mm5d3_intcld+///3">Column-integrated cloud water</a></li>
  </ul>
</ul>]]>
        
    </content>
</entry>
<entry>
    <title>Seattle Japanese Garden</title>
    <link rel="alternate" type="text/html" href="http://sial.org/blog/2008/04/seattle_japanese_garden.html" />
    <link rel="service.edit" type="application/atom+xml" href="https://sial.org/mt/support/mt-atom.cgi/weblog/blog_id=2/entry_id=275" title="Seattle Japanese Garden" />
    <id>tag:sial.org,2008:/blog//2.275</id>
    
    <published>2008-04-16T02:41:10Z</published>
    <updated>2008-04-15T05:43:37Z</updated>
    
    <summary>The Japanese Garden in Seattle offers several photography sessions each year. These let you use a tripod and other gear not normally permitted in the garden. Well worth the money, as there were only three other photographers, and the weather...</summary>
    <author>
        <name>Jeremy Mates</name>
        <uri>http://sial.org/</uri>
    </author>
            <category term="Art" />
    
    <content type="html" xml:lang="en" xml:base="http://sial.org/blog/">
<style type="text/css"><!-- @import url(http://sial.org/_xs/mt/style/blog/localized.css); --></style>
        <![CDATA[<a href="http://www.flickr.com/photos/jeremymates/sets/72157604547285593/"><img src="http://farm4.static.flickr.com/3063/2414831797_ec50393156_t.jpg" width="100" height="67" alt="Teahouse" style="float: right; margin-left: 0.66em; margin-bottom: 0.66em; border: solid thin black;"/></a><p>The <a href="http://www.seattle.gov/parks/parkspaces/japanesegarden.htm">Japanese Garden</a> in Seattle offers several photography sessions each year. These let you use a tripod and other gear not normally permitted in the garden. Well worth the money, as there were only three other photographers, and the weather mostly cooperated. Most useful lenses were the 18-70 kit zoom and 105mm macro.</p>]]>
        
    </content>
</entry>
<entry>
    <title>Chocolate!</title>
    <link rel="alternate" type="text/html" href="http://sial.org/blog/2008/04/chocolate.html" />
    <link rel="service.edit" type="application/atom+xml" href="https://sial.org/mt/support/mt-atom.cgi/weblog/blog_id=2/entry_id=274" title="Chocolate!" />
    <id>tag:sial.org,2008:/blog//2.274</id>
    
    <published>2008-04-12T05:22:33Z</published>
    <updated>2008-04-12T05:23:56Z</updated>
    
    <summary> This photo required six bars of chocolate, three vertical on each side. There is a lego roof keeping the bars vertical, between two boxed sets of the Tale of Genji (Seidensticker and Tyler). The only lighting is from a...</summary>
    <author>
        <name>Jeremy Mates</name>
        <uri>http://sial.org/</uri>
    </author>
            <category term="Art" />
            <category term="Food" />
    
    <content type="html" xml:lang="en" xml:base="http://sial.org/blog/">
<style type="text/css"><!-- @import url(http://sial.org/_xs/mt/style/blog/localized.css); --></style>
        <![CDATA[<p><a href="http://www.flickr.com/photos/jeremymates/2401881991/" title="Chocolate! by thrig, on Flickr"><img src="http://farm3.static.flickr.com/2310/2401881991_58911bd434.jpg" width="337" height="500" alt="Chocolate!" style="border: solid thin black;" /></a></p>
<p>This photo required six bars of chocolate, three vertical on each side. There is a lego roof keeping the bars vertical, between two boxed sets of the Tale of Genji (Seidensticker and Tyler). The only <a href="http://www.flickr.com/photos/jeremymates/2227269891/">lighting is from a desk lamp</a>, the direct shine of which being masked off from the camera by shirts and chess boards. The Ferrero Rocher (picked up pretty much at random from the store; I had no idea how large the central chocolate should have been) rests atop a book case, and the background is a cork board. A polarizer was used, though I set it when the chocolate was wrapped, not unwrapped, so that might have been adjusted better. Had trouble lining the camera up square with the opening, which ball heads make difficult. May want to <a href="http://www.amazon.com/Bogen-Manfrotto-Compact-Release-Supports/dp/B00009R6H9/sialorg-20/ref=nosim">pickup a head</a> that allows finer adjustment.</p>
<!-- technorati tags start --><p style="text-align:right;font-size:10px;">Technorati Tags: <a href="http://www.technorati.com/tag/chocolate" rel="tag">chocolate</a></p><!-- technorati tags end -->]]>
        
    </content>
</entry>
<entry>
    <title>Islamabomb</title>
    <link rel="alternate" type="text/html" href="http://sial.org/blog/2008/04/islamabomb.html" />
    <link rel="service.edit" type="application/atom+xml" href="https://sial.org/mt/support/mt-atom.cgi/weblog/blog_id=2/entry_id=273" title="Islamabomb" />
    <id>tag:sial.org,2008:/blog//2.273</id>
    
    <published>2008-04-10T12:05:13Z</published>
    <updated>2008-04-10T05:06:19Z</updated>
    
    <summary>Roughly 20 years ago, Ojhri went up in smoke following a very loud bang. Shells rained down on the International School of Islamabad, totaling—if memory serves—13½ hits, including one to the auditorium we had gathered in. This was followed by...</summary>
    <author>
        <name>Jeremy Mates</name>
        <uri>http://sial.org/</uri>
    </author>
            <category term="Misc" />
    
    <content type="html" xml:lang="en" xml:base="http://sial.org/blog/">
<style type="text/css"><!-- @import url(http://sial.org/_xs/mt/style/blog/localized.css); --></style>
        <![CDATA[<p>Roughly 20 years ago, <a href="http://en.wikipedia.org/wiki/Ojhri_Camp">Ojhri</a> went up in smoke following a very loud bang. Shells rained down on the International School of Islamabad, totaling—if memory serves—13½ hits, including one to the auditorium we had gathered in. This was followed by several days off, while folks from the U.S. Carrier docked in Karachi dug out ordnance from people's driveways. Others did not fare so well.</p>]]>
        
    </content>
</entry>

</feed> 

