<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Loar's Lair - Technical</title><link>http://matthew.loar.name/blog/technical/</link><lastBuildDate>Thu, 04 Mar 2010 11:23:43 GMT</lastBuildDate><item><title>Computer Science Programs - Joel Spolsky Saves Me Some Effort</title><link>http://matthew.loar.name/blog/2009/10/27/computer_science_programs_-_joel_spolsky_saves_me_some_effort/</link><pubDate>Tue, 27 Oct 2009 23:04:43 GMT</pubDate><category>Technical</category><description>&lt;p&gt;
Ever since my friend Elton made a
&lt;a href="http://eptiger.blogspot.com/search?updated-max=2009-08-27T00%3A32%3A00-07%3A00"&gt;post&lt;/a&gt;
about what he wished he had learned in college, I have been meaning to make my
own post about my experiences at &lt;a href="http://www.uiuc.edu"&gt;UIUC&lt;/a&gt;, er, I mean,
&lt;a href="http://www.illinois.edu"&gt;ILLINOIS&lt;/a&gt;.  I don't disagree with the things he
wishes CS programs would teach, though I do disagree with the value of the
education I received in college.  While Elton seems to have enjoyed his time at
UT and done well, the three years I spent at UIUC were the most miserable of my
life so far.  As I often find myself explaining to people today, there is
surprisingly little overlap between the skills required to be a good software
engineer and the things they teach you as an undergrad in what is supposedly one
of the top 5 computer science programs in the country.  My classes there were
far more about obtaining a pretty piece of paper to hang on my wall than
preparing to enter the workforce.  This was exemplified by the CS grad student I
met who appeared to be incapable of writing "Hello World" in C if his life
depended on it.
&lt;/p&gt;

&lt;p&gt;
Anyway, today I was going through my RSS feeds and found Joel Spolsky's
&lt;a href="http://www.joelonsoftware.com/items/2009/10/26.html"&gt;post&lt;/a&gt; on the subject,
and he hits it on the head.  Let's teach our students Scheme!  It's so
functional and elegant!  Nobody in industry uses it, but that's because they're
all unsophisticated heathens!  One of my colleagues once remarked on my zeal for
producing a quality product by saying that "If you ignore a bug long enough,
Matt will fix it."  Apparently if I delay a blog post long enough, Joel Spolsky
will write it.
&lt;/p&gt;

&lt;p&gt;
While I'm on the subject of Joel Spolsky, however, I need to take exception to
something he said in his
&lt;a href="http://www.joelonsoftware.com/items/2009/09/23.html"&gt;post&lt;/a&gt; on "Duct Tape
Programmers":
&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;
Duct tape programmers have to have a lot of talent to pull off this
shtick. They have to be good enough programmers to ship code, and we'll forgive
them if they never write a unit test, or if they xor the "next" and "prev"
pointers of their linked list into a single DWORD to save 32 bits, because
they're pretty enough, and smart enough, to pull it off.
&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;
As a member of the team which recently became the not-so-proud owner of GDI and
GDI+, I will say that if you do a crazy what-the-eff-is-he-doing "optimization"
like munging bits in a pointer and then fail to supply any unit tests for the
poor bastard who has to maintain your code after you run off to work on the Next
Big Thing, then you deserve to be fired.  Or shot.  Maybe both.
&lt;/p&gt;
</description></item><item><title>HTC Fuze</title><link>http://matthew.loar.name/blog/2009/04/26/htc_fuze/</link><pubDate>Sun, 26 Apr 2009 00:08:32 GMT</pubDate><category>Technical</category><description>&lt;p&gt;
A few weeks ago I replaced my broken Blackjack with an HTC Fuze.  So far it
seems to be an improvement.  The HTC Fuze combines a touchscreen with important
things like Send and End keys and a slide-out QWERTY keyboard.  The slide-out
keyboard is definitely an improvement on the Blackjack's tiny keys and allows
the Fuze to be narrower than the Blackjack, if twice as thick.  The Fuze is
pretty heavy, and I have the feeling that it would not take well to being
dropped.  Another thing I like is that unlike the Blackjack, it has a standard
Mini-USB port.
&lt;/p&gt;

&lt;p&gt;
Software-wise the phone is marginal.  It runs Windows Mobile 6.1 and comes
loaded with HTC TouchFLO(tm) software which provides a shinier and more
touch-friendly home screen.  Of course it's not very customizable, so the first
thing I did was turn it off.  I like how it files SMS messages into
conversations.  I never used SMS on the Blackjack, so I don't know if this is a
recent feature or not.  When using the web browser I have run into an issue
where it returns a "403 Forbidden" page for all sites.  I suspect this may be an
AT&amp;amp;T issue rather than a phone issue, as disconnecting and reconnecting to the
network fixes it.  This is made easier by the fact that the function performed
by holding the End key is configurable, and I have configured it to toggle
"airplane mode."
&lt;/p&gt;

&lt;p&gt;
The voice quality on the Fuze is fine, but using it as a phone can get very
irritating.  The keypad is through the touchscreen.  When a call is active, the
display has a number of buttons for functions such as turning on the
speakerphone, and you have to hit a softkey to bring up the keypad.  Also, the
screen turns off after a second while a call is active (presumably to avoid
inadvertent touchscreen presses), so you have to press the power key to turn it
back on.  This makes using touchtone interfaces (like voicemail) very frustrating.
&lt;/p&gt;

&lt;p&gt;
Today I woke up to find my phone frozen and had to remove the battery to restart
it.  I think the phone had been up for about a week.  It's a sad state of
affairs that I think a phone crashing after a week of uptime is marginally
acceptable, but hey, it's WinMo.
&lt;/p&gt;
</description></item><item><title>afsbak 1.0</title><link>http://matthew.loar.name/blog/2009/02/13/afsbak_1_0/</link><pubDate>Fri, 13 Feb 2009 06:26:41 GMT</pubDate><category>Technical</category><category>Software Releases</category><description>&lt;p&gt;
So I recently found myself wanting to share files between my desktop and my
laptop.  So I did what any sane, rational person would do.  I set up an AFS
cell.
&lt;/p&gt;

&lt;p&gt;
Of course, I didn't want to put anything important in AFS until I had a way to
back it up.  At ACM, we had access to the campus Tivoli TSM service, so we
ran an AIX machine for the sole purpose of using the old version of the TSM
client that had AFS support.  However, this wasn't exactly an option for me.
&lt;/p&gt;

&lt;p&gt;
I already used &lt;a href="http://backuppc.sourceforge.net"&gt;BackupPC&lt;/a&gt; for backups, so
I wanted to use that to back up AFS as well.  But how?  Someone pointed out
&lt;a href="http://www.physics.unc.edu/~stephen/BackupPC4AFS/"&gt;BackupPC4AFS&lt;/a&gt;, but this
doesn't allow for file-level backups, and the last thing I want to do is
maintain a modified BackupPC.
&lt;/p&gt;

&lt;p&gt;
I got the idea to take a vos dump and transform it into tar format and then feed
that into BackupPC.  I grabbed the restorevol utility from the OpenAFS source
tree and with some work produced
&lt;a href="http://matthew.loar.name/software/afsbak"&gt;afsbak&lt;/a&gt;.  It reads a vos dump
on stdin and produces a tar archive, optionally producing shell scripts that
when run will restore the ACLs on the containing directory.
&lt;/p&gt;

&lt;p&gt;
Please let me know if you find it useful or find issues.
&lt;/p&gt;
</description></item><item><title>A Brave New World of Secure DNS</title><link>http://matthew.loar.name/blog/2009/01/27/a_brave_new_world_of_secure_dns/</link><pubDate>Tue, 27 Jan 2009 07:38:12 GMT</pubDate><category>Technical</category><description>&lt;p&gt;
I was looking at the OpenSSH code the other day and I saw some code related to
retrieving fingerprints from DNS.  I had never heard of this, and I wondered how
that could be secure.
&lt;/p&gt;

&lt;p&gt;
Reading &lt;a href="http://www.rfc-editor.org/rfc/rfc4255.txt"&gt;RFC 4255&lt;/a&gt;, the answer
to that was simple: DNSSEC.  This really makes a lot of sense: if you're
trusting DNSSEC to guarantee the integrity of the value of the A record
providing you the IP address to connect to, why not trust it for the encryption
key to expect when you connect?  This is actually quite nice, since DNSSEC
protects you against DNS spoofing but doesn't protect you against IP spoofing.
&lt;/p&gt;

&lt;p&gt;
Of course, there's no reason it has to stop with SSH.  It turns out that there
is a CERT RR defined in &lt;a href="http://www.rfc-editor.org/rfc/rfc2538.txt"&gt;RFC
2238&lt;/a&gt; which is designed for storing X.509 or PGP certificates in DNS.  This is
particularly interesting given the way that the trust chain for X.509
certificates for HTTPS currently works.  The only guarantee you are connecting
to the real HTTP server for www.amazon.com and not one run by an attacker is
trusting that none of the Certificate Authorities that your browser trusts would
issue a certificate for www.amazon.com to anyone other than Amazon.com, Inc.
And for the vast majority of users, the CAs their browser trusts are the ones
that their browser or operating system vendor saw fit to include, which is
generally a very long list of CAs run by private companies whose rationale for
why you can trust them seems to range from "we charge money" to "we charge
obscene amounts of money."
&lt;/p&gt;

&lt;p&gt;
However, if it were possible to securely publish SSL certificates in DNS, the
need for these shady authorities would be eliminated.  And in turn, not needing
to shell out money for SSL certificates would hopefully lead to greater
proliferation of SSL for general web browsing, not simply for things like
order forms and online banking.  The true beauty is that this is
backward-compatible - there is no reason why you couldn't obtain a certificate
from a CA and publish it in DNS.  CAs might even continue to serve a purpose for
those who want to go to the hassle of getting an Extended Validation
certificate.
&lt;/p&gt;

&lt;p&gt;
Likewise, the CERT record could be used for storing public keys for signing and
encryption of email.  It would be much simpler for someone wishing to send you
an encrypted message to find your key if it were published in DNS, as they would
not have to determine which keyserver your key was on and whether it was in fact
your key.  Having such a key in DNS would also make verification of signed
messages easier for tools such as SpamAssassin or even MTAs.  Greater
proliferation of signed email could help in the neverending battle against spam.
&lt;/p&gt;

&lt;p&gt;
Keys stored in such a manner could also be used to solve the longstanding
problem of having to remember passwords for the myriad websites you visit.  Many
websites already use email addresses as usernames.  In a future world, this
email address might be used to look up a public key, which could be used for a
challenge-response authentication.  Though there's no reason sites couldn't ask
for a PGP public key instead of a password when creating an account today - the
main problem is that there is no protocol I know of for doing web authentication
using PGP keys - instead browsers support SSL client authentication, which
appears to me to be very unwieldy and I have never personally seen it used.
&lt;/p&gt;

&lt;p&gt;
And I think that about sums it up - there are several separate public-key
cryptography systems that serve overlapping purposes: X.509 certificates, PGP
keys, and SSH keys.  Each has a different trust model.  But imagine if hosts
and users on the internet were able to authenticate themselves to each other
based on a single trust apex at the DNS root.  Maybe this is all
pie-in-the-sky, but I have to hope that the future will bring resolution of the
awful mess we have now.
&lt;/p&gt;
</description></item><item><title>How to Waste Time</title><link>http://matthew.loar.name/blog/2009/01/09/how_to_waste_time/</link><pubDate>Fri, 09 Jan 2009 00:16:48 GMT</pubDate><category>Technical</category><description>&lt;p&gt;
My method of choice?  Rewriting managed code projects in C++.
&lt;/p&gt;

&lt;p&gt;
I've been doing that for a couple of things, namely &lt;a href="http://matthew.loar.name/software/neztu"&gt;Neztu&lt;/a&gt; and most recently &lt;a href="http://matthew.loar.name/blog/2008/09/04/me_and_you_and_a_blog_in_boo/"&gt;bloog&lt;/a&gt;.  The former actually makes sense, since I have blogged before about my issues with Mono.  My most significant qualm about it is its lack of support for fully precompiled sites, which means your clients get wonderful 5-10 second delays when it decides it needs to recompile something.  I had been under the impression that writing a web application in C++ would be an exercise in pain and suffering, but it turns out that when you combine &lt;a href="http://www.gnu.org/software/cgicc/"&gt;cgicc&lt;/a&gt; with the absolutely excellent &lt;a href="http://pqxx.org"&gt;pqxx&lt;/a&gt;, you get a (relatively) rapid development platform, and combined with the magic of FastCGI you get the performance and stability that is sorely lacking on so many sites these days.  I have my new C++ Neztu in a very functional state, but I wanted to implement all of the features of my 0.1 release before I make a formal release.  In the meantime, you can look at the &lt;a href="http://matthew.loar.name/hg/neztu"&gt;hg repo&lt;/a&gt;, under the neztu-cxx branch.  I have also decided to drop the liquidsoap support.  It seemed cool at the time, but forcing two tracks into a "not queued but not playing" state is kind of a dealbreaker, and the methods of interacting with the rest of Neztu were kludgey at best.
&lt;/p&gt;

&lt;p&gt;
My other project was pretty stupid, as other than being managed code, there wasn't anything terribly wrong with bloog.  But my philosophy is that if I enjoy it, it's not really wasting time.  Which is good, because thanks to &lt;a href="http://www.godisch.de/debian/wmwork/"&gt;wmwork&lt;/a&gt; I can tell you that I spent 15 hours rewriting it in C++.  The two main benefits were that I discovered the original bloog had some bugs in date parsing that meant it didn't handle timezones correctly (all my latest entries are timestamped in UTC, but older ones need adjustment).  Also, even my get-it-done sloppy unperformant C++ is 22% faster than the Boo version.  Like the original Boo version, I don't intend to make any formal release of this code, both because it's hardly production quality and because I seriously doubt its usefulness to anyone else, but it is in &lt;a href="http://matthew.loar.name/hg/bloog"&gt;Mercurial&lt;/a&gt;.
&lt;/p&gt;
</description></item><item><title>PuTTY and GSSAPI</title><link>http://matthew.loar.name/blog/2008/11/03/putty_and_gssapi/</link><pubDate>Mon, 03 Nov 2008 00:10:00 GMT</pubDate><category>Technical</category><description>&lt;p&gt;
So apparently when I wasn't looking, the PuTTY authors added support for GSSAPI, which is great.  Unfortunately, they only support SSPI on Windows.  Granted, this is the cleanest way, but depending on which version of Windows you are running, SSPI may or may not work for you.  If the client and server are in the same realm or AD domain it should work, but cross-realm is dicey since support for client-side host-to-realm mappings wasn't added until Vista.  Some people on the Kerberos list expressed disappointment that the PuTTY authors went this route.
&lt;/p&gt;

&lt;p&gt;
So I intend to add this support back in.  The PuTTY GSSAPI support has a radically different code layout from my current patch, so the first thing I have done is merge in the PuTTY upstream and streamline my diff against it.  The PuTTY code delayloads SSPI, so I'm hoping it will be straightforward to delayload MIT GSSAPI instead.
&lt;/p&gt;

&lt;p&gt;
At the same time, I got a feature request a few months ago for gssapi-keyex support.  I haven't made much progress there, but I am determined to fully exploit my current enthusiasm for working on PuTTY - it's always nice to work on projects that are actually useful to other people :).
&lt;/p&gt;
</description></item><item><title>Flite and Clunit Voices</title><link>http://matthew.loar.name/blog/2008/09/22/flite_and_clunit_voices/</link><pubDate>Mon, 22 Sep 2008 23:48:54 GMT</pubDate><category>Technical</category><description>&lt;p&gt;
I have been playing around with &lt;a href="http://www.speech.cs.cmu.edu/flite/"&gt;Flite&lt;/a&gt; lately, which is basically a way to take a FestVox voice built for Festival and convert it to C code which can then be compiled into one monolithic binary.  Flite ships with the KAL diphone voice.  However, I don't particularly care for this voice, and have been trying to convert the CMU CLB ARCTIC voice for use with flite.  I followed the &lt;a href="http://www.speech.cs.cmu.edu/flite/doc/flite_8.html#SEC19"&gt;guide&lt;/a&gt;, and the automated conversion went smoothly, but at runtime I got bad synthesis and errors like this:
&lt;/p&gt;

&lt;pre&gt;
clunits: unit type "f" not found
clunit_get_unit_index: can't find unit type f, using 0
&lt;/pre&gt;

&lt;p&gt;
After many hours of studying the flite code and the festival code, I finally discovered what the problem was.  In festvox/cmu_us_clb_arctic_clunits.scm, there was a phone-to-clunit mapping function:
&lt;/p&gt;

&lt;pre&gt;
(define (cmu_us_clb_arctic::clunit_name i)
  "(cmu_us_clb_arctic::clunit_name i)
Defines the unit name for unit selection for us.  The can be modified
changes the basic classification of unit for the clustering.  By default
this we just use the phone name, but you may want to make this, phone
plus previous phone (or something else)."
  (let ((name (item.name i)))
    (cond
     ((and (not cmu_us_clb_arctic::clunits_loaded)
       (or (string-equal "h#" name) 
           (string-equal "1" (item.feat i "ignore"))
           (and (string-equal "pau" name)
            (or (string-equal "pau" (item.feat i "p.name"))
            (string-equal "h#" (item.feat i "p.name")))
            (string-equal "pau" (item.feat i "n.name")))))
      "ignore")
     ((string-matches name "[aeiou].*")
      (string-append
       name
       (item.feat i "R:SylStructure.parent.stress")))
     ((string-equal name "pau")
      name)
     (t
      (string-append
       name
       (item.feat i "seg_onsetcoda"))))))
&lt;/pre&gt;

&lt;p&gt;
However, the converted C code contained just:
&lt;/p&gt;

&lt;pre&gt;
static char *cmu_us_clb_arctic_unit_name(cst_item *s)
{
    return cst_strdup(item_name(s));
}
&lt;/pre&gt;

&lt;p&gt;
Not surprisingly, converting arbitrary Scheme code to C is outside the capabilities of the Flite conversion code.  The code I replaced it with doesn't encompass all of the logic of the original, but appears to work fine:
&lt;/p&gt;

&lt;pre&gt;
static char *cmu_us_clb_arctic_unit_name(cst_item *s)
{
    const char *name = item_name(s);
    if (*name == 'a' || *name == 'e' || *name == 'i' || *name == 'o' || *name == 'u')
    {
      const char *stress = ffeature_string(s, "R:SylStructure.parent.stress");
      char *namey = cst_alloc(char, strlen(name) + strlen(stress) + 1);
      cst_sprintf(namey, "%s%s", name, stress);
      return namey;
    }
    else if (strcmp(name, "pau"))
    {
      const char *onsetcoda = ffeature_string(s, "seg_onsetcoda");
      char *namey = cst_alloc(char, strlen(name) + strlen(onsetcoda) + 1);
      cst_sprintf(namey, "%s%s", name, onsetcoda);
      return namey;
    }

    return cst_strdup(item_name(s));
}
&lt;/pre&gt;

&lt;p&gt;
(Before you go emailing me, cst_alloc terminates the process on allocation failure.  This code uses the same patterns as elsewhere in the Flite code.)
&lt;/p&gt;

&lt;p&gt;
And now I have a working Flite binary for this voice.
&lt;/p&gt;
</description></item><item><title>Mono and Monotony</title><link>http://matthew.loar.name/blog/2008/09/18/mono_and_monotony/</link><pubDate>Thu, 18 Sep 2008 07:43:40 GMT</pubDate><category>Technical</category><description>&lt;p&gt;
Work has been pretty slow lately - not too many bugs to work on.  But I have
been keeping busy at night trying to figure out Mono issues.  I upgraded the
test webserver at &lt;a href="http://www.acm.uiuc.edu"&gt;ACM&lt;/a&gt; to lenny and set up Mono
FastCGI, but they still managed to get it to randomly encounter compilation
errors due to missing files.
&lt;/p&gt;

&lt;p&gt;
Several nights of tedious debugging later, I believe I have discovered the
problem - when a new ApplicationHost is instantiated, it deletes all of the
files in the DynamicBase of the AppDomain.  Once I discovered this, I remembered
that the Mono people do say to only run one FastCGI server at a time.  However,
I'm not sure I like this approach, and so I'm planning to write a wrapper script
that will ensure that different servers use different directories to avoid
interference.
&lt;/p&gt;

&lt;p&gt;
Also, I have made some edits to my previous post on Mono FastCGI.  My Deny rule
was ill-conceived, and so I have changed it to simply send all ASP.NET filetypes
to the FastCGI server.  And while I realize that the Mono folks
&lt;a href="http://www.mono-project.com/FastCGI#Paths_vs._Extensions"&gt;recommend&lt;/a&gt; using
paths instead of extensions, as far as I can tell this is not possible using
mod_fcgid and FCGIWrapper.
&lt;/p&gt;

&lt;p&gt;
This brings me to another question - what is the best way to make an edit to a
published post?  Should I try to preserve the original content, appending edits
to the end or using strikeout?  Or simply replace?  I'm leaning toward the
latter, though I would like some kind of audit trail.  Since I have this all in
a Mercurial repo anyway, I'm thinking I need to get the changelog wired into my
system somehow.  I tried this once before, but I couldn't tease the log out of
hg in a format that cl2xhtml would take.
&lt;/p&gt;

&lt;p&gt;
I suppose I should end this post before I really start to ramble.
&lt;/p&gt;
</description></item><item><title>Mono FastCGI and Apache</title><link>http://matthew.loar.name/blog/2008/09/05/mono_fastcgi_and_apache/</link><pubDate>Fri, 05 Sep 2008 11:41:40 GMT</pubDate><category>Technical</category><description>&lt;p&gt;
&lt;a href="http://www.acm.uiuc.edu"&gt;ACM&lt;/a&gt; has been using Apache with mod_mono for a while (my fault) and while it works relatively well, there are some issues.  Namely, every once in a while the mono server will crash and requires manual restarting.  So when I heard that Mono now had FastCGI support, I was intrigued, hoping that it might alleviate these problems.
&lt;/p&gt;

&lt;p&gt;
I couldn't find any instructions on setting it up with Apache (using mod_fcgid), so I figured it out on my own.  Here's how I configured it to run my development copy of Neztu on Debian lenny:
&lt;/p&gt;

&lt;pre&gt;
# apt-get install mono-fastcgi-server2
# mkdir /tmp/mono-fastcgi
# chown www-data.www-data /tmp/mono-fastcgi
# echo DefaultInitEnv MONO_SHARED_DIR /tmp/mono-fastcgi &amp;gt; /etc/apache2/conf.d/mono-fastcgi
&lt;/pre&gt;

&lt;p&gt;
I then put the following in my vhost configuration:
&lt;/p&gt;

&lt;pre&gt;
Alias /neztu/ /home/matt/devel/neztu/www/
&amp;lt;Directory "/home/matt/devel/neztu/www"&amp;gt;
  DirectoryIndex index.aspx
  Options ExecCGI FollowSymLinks
  AddHandler fcgid-script .asax .ashx .asmx .aspx .axd .config .cs .dll .rem .soap

  FCGIWrapper "/usr/bin/fastcgi-mono-server2 /applications=/neztu:/home/matt/devel/neztu/www" .asax
  FCGIWrapper "/usr/bin/fastcgi-mono-server2 /applications=/neztu:/home/matt/devel/neztu/www" .ashx
  FCGIWrapper "/usr/bin/fastcgi-mono-server2 /applications=/neztu:/home/matt/devel/neztu/www" .asmx
  FCGIWrapper "/usr/bin/fastcgi-mono-server2 /applications=/neztu:/home/matt/devel/neztu/www" .aspx
  FCGIWrapper "/usr/bin/fastcgi-mono-server2 /applications=/neztu:/home/matt/devel/neztu/www" .ascx
  FCGIWrapper "/usr/bin/fastcgi-mono-server2 /applications=/neztu:/home/matt/devel/neztu/www" .axd
  FCGIWrapper "/usr/bin/fastcgi-mono-server2 /applications=/neztu:/home/matt/devel/neztu/www" .config
  FCGIWrapper "/usr/bin/fastcgi-mono-server2 /applications=/neztu:/home/matt/devel/neztu/www" .cs
  FCGIWrapper "/usr/bin/fastcgi-mono-server2 /applications=/neztu:/home/matt/devel/neztu/www" .dll
  FCGIWrapper "/usr/bin/fastcgi-mono-server2 /applications=/neztu:/home/matt/devel/neztu/www" .rem
  FCGIWrapper "/usr/bin/fastcgi-mono-server2 /applications=/neztu:/home/matt/devel/neztu/www" .soap
&amp;lt;/Directory&amp;gt;
&lt;/pre&gt;

&lt;p&gt;
And that's all there is to it.  I will have to test it further to see if it is able to recover from its hiccups with this method.
&lt;/p&gt;
</description></item><item><title>Me and You and A Blog in Boo</title><link>http://matthew.loar.name/blog/2008/09/04/me_and_you_and_a_blog_in_boo/</link><pubDate>Thu, 04 Sep 2008 00:01:27 GMT</pubDate><category>Technical</category><description>&lt;p&gt;
You may have noticed that I have changed my blog yet again.  I had switched to &lt;a href="http://nanoblogger.sourceforge.net"&gt;NanoBlogger&lt;/a&gt; a while back, but I wasn't quite satisfied with it.  For one, it was still separate from the rest of my site.  Also, while the concept of blogging software written entirely in bash is novel, it is also quite slow.  A thousand invocations of sed can't be the most efficient way to do anything.
&lt;/p&gt;

&lt;p&gt;
So I set about coming up with a way to migrate my blog to use spin like the rest of my site.  About this time I was also exploring new languages as part of my "maybe C++ isn't so wonderful after all" epiphany.  I had dabbled with Python before and found it kind of nice, so I started working in Python.
&lt;/p&gt;

&lt;p&gt;
However, I soon found something about Python that irritated me.  Python has automatic memory management, but for other resources, you still have to do C-style cleanup, which is ridiculous.  So it uses refcounting/garbage collection to automatically free memory.  Great.  I still need deterministic cleanup for file handles, database connections, etc. Not only do you have to explicitly call close() on the object when you are done with it, but you need to build for exception safety through the use of try-finally*.  This makes C++ with its RAII designs actually look good.
&lt;/p&gt;

&lt;p&gt;
I had been using &lt;a href="http://www.mono-project.com"&gt;Mono&lt;/a&gt; and C# for other projects.  At least the .NET Framework got this right - objects owning unmanaged resources implement the IDisposable interface.  C# contains a &lt;code&gt;using&lt;/code&gt; statement which not only automatically calls Dispose on the object no matter how the block is exited, but when used correctly also scopes the variable to the block.
&lt;/p&gt;

&lt;p&gt;
However, I've worked with C# before, and I wanted to try a new language.  That's when I discovered &lt;a href="http://boo.codehaus.org"&gt;Boo&lt;/a&gt;.  It's a language inspired by Python, but built as a .NET language (IronPython reimplements the Python class libraries on top of the .NET Framework with the goal of compatibility with code written for CPython; Boo doesn't aim for Python compatibility and uses the .NET class libraries).  Boo is also statically typed with type inference (and has optional duck typing).
&lt;/p&gt;

&lt;p&gt;
And thus I wrote Bloog.  It is designed to take a NanoBlogger database and build a thread-based blog that can be converted by &lt;a href="http://www.eyrie.org/~eagle/software/web/"&gt;spin&lt;/a&gt;.  While I could have simply used &lt;code&gt;verbatim&lt;/code&gt; blocks and kept the HTML as is, I didn't want to.  Luckily, I found &lt;a href="http://www.aaronsw.com/2002/html2text/"&gt;html2text&lt;/a&gt;, a Python thing that takes raw HTML and converts it to &lt;a href="http://daringfireball.net/projects/markdown"&gt;Markdown&lt;/a&gt;, which was the syntax I had been using for my most recent entries anyway.  After wiring Bloog up to &lt;a href="http://www.aspnetresources.com/blog/markdown_announced.aspx"&gt;Markdown.NET&lt;/a&gt;, I discovered something disturbing.  Not only is it not possible to parse the Markdown syntax in a streaming fashion (it supports grouping link URLs at the end of the content), but all the parser implementations I have seen rely on generating a bunch of MD5 sums for the purposes of escaping certain characters.  Not surprisingly, the Markdown conversion was very slow.  So I hacked up the Markdown converter to output thread instead, and just converted all of my old blog entries to that.  On top of that, I do all the timestamp-based optimizations to only generate what I need to, and the result was a compose-preview cycle that is orders of magnitude faster than NanoBlogger.  My hope that got me through this project is that this will persuade me to post more often.
&lt;/p&gt;

&lt;p&gt;
I would be extremely surprised if anyone else has the need to convert a NanoBlogger blog to thread, but I've made my &lt;a href="http://matthew.loar.name/hg/bloog/"&gt;Mercurial repository&lt;/a&gt; public, just in case.
&lt;/p&gt;

&lt;p&gt;
So, this is my new and hopefully more permanent blog.  Please let me know if you see anything out of order.
&lt;/p&gt;

&lt;p&gt;
*Apparently Python 2.5 adds the &lt;code&gt;with&lt;/code&gt; statement which works like &lt;code&gt;using&lt;/code&gt;, but you still have to import it from &lt;code&gt;__future__&lt;/code&gt;.
&lt;/p&gt;
</description></item></channel></rss>
