<?xml version="1.0" encoding="utf-8"?>

<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<title type="text">Roberto De Almeida</title>
<subtitle type="html"><![CDATA[
Polyglot ramblings on programming and life
]]></subtitle>
<id>http://dealmeida.net/blog/index.atom</id>
<link rel="alternate" type="text/html" href="http://dealmeida.net/blog" />
<link rel="self" type="application/atom+xml" href="http://dealmeida.net/blog/index.atom" />


<author>
<name>Roberto De Almeida</name>
<uri>http://dealmeida.net/blog/index.atom</uri>
<email>roberto@dealmeida.net</email>
</author>
<rights>Copyright 2008 Roberto De Almeida</rights>
<generator uri="http://pyblosxom.sourceforge.net/" version="1.4.3 01/10/2008">
PyBlosxom http://pyblosxom.sourceforge.net/ 1.4.3 01/10/2008
</generator>

<updated>2008-02-27T18:01:01Z</updated>
<!-- icon?  logo?  -->

<entry>
<title type="html">Ambigram</title>
<category term="" />
<id>http://dealmeida.net/blog/2008/02/27/ambigram</id>
<updated>2008-02-27T18:01:01Z</updated>
<published>2008-02-27T18:01:01Z</published>
<link rel="alternate" type="text/html" href="http://dealmeida.net/blog/ambigram.html" />
<content type="html">&lt;p&gt;After reading &lt;a href=&quot;http://en.wikipedia.org/wiki/Angels_and_Demons&quot;&gt;Angels &amp;amp; Demons&lt;/a&gt; (I almost typed &lt;code&gt;daemons&lt;/code&gt;) I decided to make an ambigram out of name, ie, a drawing that remains unaltered after a 180 degrees rotation. Turns out that my name is pretty easy for this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://dealmeida.net/images/2008/02/21/roberto_de_almeida.png&quot; alt=&quot;An ambigram of Roberto De Almeida&quot; /&gt;&lt;/p&gt;

&lt;p&gt;You should be able to read &quot;Roberto de almeida&quot; above! The drawing is a little sketchy because I did with the mouse using Inkscape, since I don&apos;t have a scanner at hand.&lt;/p&gt;
</content>
</entry>

<entry>
<title type="html">Open Science</title>
<category term="" />
<id>http://dealmeida.net/blog/2008/02/26/open_science</id>
<updated>2008-02-26T01:10:30Z</updated>
<published>2008-02-26T01:10:30Z</published>
<link rel="alternate" type="text/html" href="http://dealmeida.net/blog/open_science.html" />
<content type="html">&lt;p&gt;I&apos;m doing an &lt;a href=&quot;http://trac.dealmeida.net/&quot;&gt;experiment&lt;/a&gt; with my recent papers: each has a Trac instance, so that code and the article text (a LaTeX file) can be shared between colaborators using Subversion. Data is hosted on an &lt;a href=&quot;http://opendap.org/&quot;&gt;Opendap&lt;/a&gt; server, running my trusty &lt;a href=&quot;http://pydap.org/&quot;&gt;pydap&lt;/a&gt;. But the best part is that the whole process, from downloading data to composing the article pdf, is done through a Makefile. The Makefile creates a virtual environment, downloads the required Python modules, and bootstraps the analyses. Just type &lt;code&gt;make&lt;/code&gt; and enjoy.&lt;/p&gt;

&lt;p&gt;Now imagine if all scientists embraced the open-source philosophy of open collaboration and &lt;em&gt;real&lt;/em&gt; meritocracy and did the same.&lt;/p&gt;
</content>
</entry>

<entry>
<title type="html">Reading Seabird files</title>
<category term="" />
<id>http://dealmeida.net/blog/2008/02/08/reading_seabird_files</id>
<updated>2008-02-08T01:27:00Z</updated>
<published>2008-02-08T01:27:00Z</published>
<link rel="alternate" type="text/html" href="http://dealmeida.net/blog/reading_seabird_files.html" />
<content type="html">&lt;p&gt;Seabird is a common brand of CTD, an equipment designed to measure conductivity, temperature and depth on the ocean. From conductivity it&apos;s possible to calculate the water salinity, and from that you obtain a profile of the density of the water. Small changes in density are responsible for part of the ocean currents that flow around the world.
&lt;/p&gt;
&lt;p&gt;The Seabird processing software generates files with the &lt;code&gt;cnv&lt;/code&gt; extension, containing a header with the metadata followed by the data as ASCII or in binary format. The file header can look like this:
&lt;/p&gt;
&lt;div class=&quot;codehilite&quot;&gt;&lt;pre&gt;* Some info
* Some kind of variable: with data
** Two stars:  must really important
# but there&amp;#39;s also hashes
# and keys here like = this
# file_type: binary
*END*
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The data follows, either as packed 4-byte floats or column separated ASCII values. Pretty simple stuff.
&lt;/p&gt;
&lt;p&gt;This week I wrote a &lt;a href=&quot;http://pydap.org/&quot;&gt;pydap&lt;/a&gt; plugin to serve Seabird files. The parsing code, which could be useful to other oceanographers using Python, looks like this:
&lt;/p&gt;
&lt;table class=&quot;codehilitetable&quot;&gt;&lt;tr&gt;&lt;td class=&quot;linenos&quot;&gt;&lt;pre&gt; 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;div class=&quot;codehilite&quot;&gt;&lt;pre&gt;&lt;span class=&quot;n&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;*END*&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Process headers.&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;re&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;compile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;    (?:\*{1,2}|\#)\s    # starts with &amp;quot;* &amp;quot; or &amp;quot;** &amp;quot; or &amp;quot;# &amp;quot;&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;    (.*?)               # everything until next token&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;    \s*(?::|=|$)\s*     # &amp;quot;:  &amp;quot; or &amp;quot; = &amp;quot; or EOL&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;    (.*)                # all the rest, if any&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;re&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;VERBOSE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;attributes&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;groups&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;header&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\r\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;line&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;attributes&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lazy_eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()))&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;attributes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;file_type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;attributes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;file_type&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;binary&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lower&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;nquan&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;attributes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;nquan&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file_type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;binary&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fromstring&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;f&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;elif&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file_type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;ascii&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fromstring&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sep&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shape&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nquan&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;p&gt;The code works by splitting the metadata and the data at the &lt;code&gt;*END*&lt;/code&gt; point. The headers are processed using a somewhat generous regular expression that looks for &lt;code&gt;(key,value)&lt;/code&gt; pairs, leaving the value as an empty string when necessary. The function &lt;code&gt;lazy_eval&lt;/code&gt; comes from pydap, and consists of a &lt;a href=&quot;http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286134&quot;&gt;safe eval&lt;/a&gt; that returns only strings, numbers, lists and tuples.
&lt;/p&gt;
&lt;p&gt;The data handling is even more simple. We decode the data using numpy&apos;s &lt;code&gt;fromstring&lt;/code&gt;, depending on if it&apos;s in ASCII or binary. The data is then reshaped, according to the number of variables described in the metadata. Pretty straightforward.
&lt;/p&gt;


</content>
</entry>

<entry>
<title type="html">Arc Challenge</title>
<category term="" />
<id>http://dealmeida.net/blog/2008/02/07/arc_challenge</id>
<updated>2008-02-07T12:57:59Z</updated>
<published>2008-02-07T12:57:59Z</published>
<link rel="alternate" type="text/html" href="http://dealmeida.net/blog/arc_challenge.html" />
<content type="html">&lt;p&gt;Paul Graham has issued a &lt;a href=&quot;http://arclanguage.org/item?id=722&quot;&gt;silly challenge&lt;/a&gt; to compare show how &lt;a href=&quot;http://arclanguage.org/&quot;&gt;Arc&lt;/a&gt; compares with other languages. The idea is to
&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;generate a page with an input field and a submit button. If the user clicks on submit, he gets a second page with a link saying &amp;quot;click here.&amp;quot; If he clicks on that, he gets a third page saying &amp;quot;you said: ...&amp;quot; where ... was whatever he put in the input field. This has to happen without the value being passed in the url; it should not be possible to change the behavior of the third page by editing the url in the second.
&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;Here&apos;s my take. Instead of using Python I used Javascript, together with the fantastic &lt;a href=&quot;http://jquery.com/&quot;&gt;jQuery&lt;/a&gt; library:
&lt;/p&gt;
&lt;table class=&quot;codehilitetable&quot;&gt;&lt;tr&gt;&lt;td class=&quot;linenos&quot;&gt;&lt;pre&gt;1
2
3
4
5
6&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;div class=&quot;codehilite&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;lt;form&amp;gt;&amp;lt;input /&amp;gt;&amp;lt;input type=submit /&amp;gt;&amp;lt;/form&amp;gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendTo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;body&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;submit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;form input&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;hide&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;parent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;continue&amp;lt;/a&amp;gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;a&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;form&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;you said: &amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;form input&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;p&gt;The code runs completely on the client-side, and uses a loose definition of &amp;quot;page&amp;quot;, since the browser never reloads. After coming up with this solution I saw a couple more of Javascript solutions on the challenge page, and one of them also uses jQuery. But I was more interested in this &lt;a href=&quot;http://www.lukas-renggli.ch/blog/take-the-arc-challenge&quot;&gt;Seaside solution&lt;/a&gt; from Lukas Renggli. I tried playing with Squeak/Seaside some time ago, but the documentation consisted of out-of-date tutorials spread over a dozen different websites. Maybe I should give it another try.
&lt;/p&gt;


</content>
</entry>

<entry>
<title type="html">Magicdate</title>
<category term="" />
<id>http://dealmeida.net/blog/2008/02/06/magicdate</id>
<updated>2008-02-06T23:56:50Z</updated>
<published>2008-02-06T23:56:50Z</published>
<link rel="alternate" type="text/html" href="http://dealmeida.net/blog/magicdate.html" />
<content type="html">&lt;p&gt;&lt;a href=&quot;http://pypi.python.org/pypi/magicdate&quot;&gt;Magicdate&lt;/a&gt; is a simple Python module that I wrote, inspired by Simon Willison&apos;s &lt;a href=&quot;http://simonwillison.net/2003/Oct/6/betterDateInput/&quot;&gt;dateparse.js&lt;/a&gt;, to parse fuzzy dates like &amp;quot;last sunday&amp;quot; or &amp;quot;Jan 4th&amp;quot;. Particularly, I like to use it with my Python scripts to parse command line arguments; it even comes with a custom parser for &lt;code&gt;optparse&lt;/code&gt;:
&lt;/p&gt;
&lt;table class=&quot;codehilitetable&quot;&gt;&lt;tr&gt;&lt;td class=&quot;linenos&quot;&gt;&lt;pre&gt;1
2
3
4
5&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;div class=&quot;codehilite&quot;&gt;&lt;pre&gt;&lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;optparse&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;OptionParser&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;magicdate&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;parser&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;OptionParser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;option_class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;magicdate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MagicDateOption&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;parser&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;add_option&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;-s&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;--start&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dest&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;start&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;magicdate&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;parser&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;add_option&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;-e&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;--end&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dest&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;end&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;magicdate&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;today&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;p&gt;So it&apos;s now possible to do:
&lt;/p&gt;
&lt;table class=&quot;codehilitetable&quot;&gt;&lt;tr&gt;&lt;td class=&quot;linenos&quot;&gt;&lt;pre&gt;1&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;div class=&quot;codehilite&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;some-script.py --start &lt;span class=&quot;s2&quot;&gt;&amp;quot;1 week and 2 days ago&amp;quot;&lt;/span&gt; --end yesterday
&lt;/pre&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;p&gt;Today I added support for the &amp;quot;x time ago&amp;quot; syntax, per &lt;a href=&quot;http://vislab-ccom.unh.edu/~schwehr/&quot;&gt;Kurt&lt;/a&gt;&apos;s request (the only person I know who has a CV as a Google Earth KML file!). The new syntax was pretty easy to implement, since the code iterates over pairs of regexps/parsing functions to handle the processing when a match is found. All I had to do was add a new function and upload the code to the Cheeseshop.
&lt;/p&gt;
&lt;p&gt;The module still needs a homepage (the Cheeseshop entry points to a 404, although the download link works). I need to organize all my projects on my homepage, but it&apos;ll have to wait a little.
&lt;/p&gt;
&lt;p&gt;And speaking of 404s, two weeks ago I went to a music school close to home, to have pandeiro (a brazilian percussion instrument) lessons. When a woman sent me to room 404 I had to fight the urge to make the joke &amp;quot;I&apos;ll never find it!&amp;quot;. :)
&lt;/p&gt;
</content>
</entry>
</feed>
