<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>No Content, No Fuss: Category hacking</title>
    <link>http://anil.recoil.org/blog/articles/category/hacking</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Anil Madhavapeddy</description>
    <item>
      <title>Parsing EXIF/IPTC photo tags using pyexiv2 on Leopard</title>
      <description>&lt;p&gt;I've been looking around at refreshing my current photo gallery to make it easier to update, since I'm around 1000 photos behind over the last year.  Part of making it easier to use is to adopt an &lt;a href="http://www.apple.com/aperture"&gt;Aperture&lt;/a&gt;-based system of marking the metadata directly in the image itself, and figuring out how to render so many pictures more effectively in my &lt;a href="http://anil.recoil.org/gallery/"&gt;gallery&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The best library I could find to do the job is &lt;a href="http://www.exiv2.org"&gt;Exiv2&lt;/a&gt; and its associated Python bindings &lt;a href="http://tilloy.net/dev/pyexiv2/"&gt;pyexiv2&lt;/a&gt;.  They use the rather complex &lt;a href="http://www.boost.org/doc/libs/1_35_0/libs/python/doc/index.html"&gt;Boost.Python&lt;/a&gt; bindings, which are a total pain to compile on MacOS X Leopard.&lt;/p&gt;

&lt;p&gt;In order to get it to work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use the latest &lt;a href="http://www.finkproject.org"&gt;Fink&lt;/a&gt; to install:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;python25&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;boost1.34.python25&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;libexiv2&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;scons&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Download the latest &lt;a href="http://tilloy.net/dev/pyexiv2/download.htm"&gt;pyexiv2 distribution&lt;/a&gt;, extract it, and drop in my &lt;a href="http://anil.recoil.org/files/pyexiv2/Makefile"&gt;exiv2 Leopard Makefile&lt;/a&gt; into the extracted directory.&lt;/li&gt;
&lt;li&gt;Type in:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;make&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo make install&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Test it out by running python2.5 and experimenting with importing pyexiv2 (see the pyexiv2 &lt;a href="http://tilloy.net/dev/pyexiv2/developers.htm"&gt;developer guide&lt;/a&gt; for more information.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'll tidy this up into a fink package sometime, but for now I want to press on with finishing my &lt;a href="http://www.djangoproject.org/"&gt;Django&lt;/a&gt; experiments.&lt;/p&gt;</description>
      <pubDate>Thu, 17 Apr 2008 11:58:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:1c1c8218-945d-4f62-a566-953d1b685766</guid>
      <author>anil@recoil.org (Anil Madhavapeddy)</author>
      <link>http://anil.recoil.org/blog/articles/2008/04/17/parsing-exif-iptc-photo-tags-using-pyexiv2-on-leopard</link>
      <category>hacking</category>
      <category>macosx</category>
    </item>
    <item>
      <title>Deens, welcome to the Internet!</title>
      <description>&lt;p&gt;Inspired by finishing my PhD corrections (!) today, I decided to hook up the DNS server from our &lt;a href="http://melange.recoil.org/"&gt;Melange&lt;/a&gt; project up to the Internet.  The authoritative server is called &lt;a href="http://melange.recoil.org/trac/browser/apps/deens/"&gt;deens&lt;/a&gt; (since the co-author is one &lt;a href="http://www.tjd.phlegethon.org/"&gt;Tim Deegan&lt;/a&gt;, geddit?), and is written in pure &lt;a href="http://caml.inria.fr/"&gt;OCaml&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This is all rather experimental, to put it mildly, but I stuck in the zone file below, hooked it up as a delegate to our main name-servers, checked it against the &lt;a href="http://www.dnsreport.com/tools/dnsreport.ch?domain=deens.recoil.org"&gt;DNS Report&lt;/a&gt;, and it all seems to be working!&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ORIGIN deens.recoil.org. ;
$TTL    240
deens.recoil.org. 604800 IN SOA  (
    deens.recoil.org. anil.recoil.org.
    2006122401 3600 1800 3024000 1800
)
        IN  NS     ns1.deens.recoil.org.
        IN  NS     deensns.recoil.org.
ns1     IN  A      194.70.3.132
dynamic IN  CNAME  dynamic.recoil.org.
static  IN  CNAME  static.recoil.org.
anil    IN  CNAME  dynamic
stats   IN  CNAME  dynamic
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I also modified &lt;a href="http://stats.recoil.org/"&gt;stats.recoil.org&lt;/a&gt; to be an alias to &lt;em&gt;stats.deens.recoil.org&lt;/em&gt;, so all the requests for that domain will go via the deens setup.  You actually need a user/pass to access the site, but that doesn't matter; if it gets that far, the DNS bit has worked.&lt;/p&gt;

&lt;p&gt;There's still an awful lot of tedious work to get the server into a production-ready state, such as proper logging, more error handling and recovery, etc., but I really hope to find the time in 2007 to polish this up somewhat.  Performance is excellent already; faster than &lt;a href="http://www.isc.org/bind/"&gt;BIND&lt;/a&gt; by quite a lot, and it can optionally use more memory to cache responses to shoot up to crazy levels.&lt;/p&gt;

&lt;p&gt;Incidentally, the &lt;a href="http://melange.recoil.org/trac/browser/apps/mldig/"&gt;dig replacement&lt;/a&gt; utility also seems to be working fairly well, and &lt;a href="http://dave.recoil.org/"&gt;David Scott&lt;/a&gt; has been messing around with a &lt;a href="http://www.apple.com/macosx/features/bonjour/"&gt;Bonjour&lt;/a&gt; implementation that will get finished sometime in 2007 as well (honest!).&lt;/p&gt;</description>
      <pubDate>Sat, 30 Dec 2006 01:11:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:fa0b4534-23b5-4166-b078-d29a1a43f3ca</guid>
      <author>anil@recoil.org (Anil Madhavapeddy)</author>
      <link>http://anil.recoil.org/blog/articles/2006/12/30/deens-welcome-to-the-internet</link>
      <category>research</category>
      <category>hacking</category>
      <category>net</category>
    </item>
    <item>
      <title>Mercurial FastCGI module</title>
      <description>&lt;p&gt;Our &lt;a href="http://www.lighttpd.net"&gt;lighttpd&lt;/a&gt; setup has been very unstable in recent months, probably brought on by the load of the large &lt;a href="http://www.selenic.com/mercurial"&gt;Mercurial&lt;/a&gt; repositories &lt;a href="http://hg.recoil.org/"&gt;hosted&lt;/a&gt; on Recoil since the Google &lt;a href="http://code.google.com/soc/"&gt;Summer of Code&lt;/a&gt; mentoring.&lt;/p&gt;

&lt;p&gt;The source of the instability was really hard to track down, but it seems to be the automatic spawning of &lt;a href="http://www.fastcgi.org/"&gt;FastCGI&lt;/a&gt; processes by the web-server, and lighttpd failing to handle a &lt;a href="http://en.wikipedia.org/wiki/SIGCHLD"&gt;SIGCHLD&lt;/a&gt; somewhere when a child process crashes.  To sort this out, I just converted all the Ruby on Rails setups (this blog and &lt;a href="http://nick.recoil.org/"&gt;Nick's&lt;/a&gt;) to use an external spawn.&lt;/p&gt;

&lt;p&gt;This only leaves our Mercurial vhost &lt;a href="http://hg.recoil.org/"&gt;hg.recoil.org&lt;/a&gt; to switch to using FastCGI, and I couldn't find a module for this anywhere and so lashed up some Python glue to do the job.&lt;/p&gt;

&lt;p&gt;You can download the small distribution for Mercurial 0.9 (&lt;a href="http://anil.recoil.org/projects/hg-fcgi-0.9.tar.gz"&gt;hg-fcgi-0.9.tar.gz&lt;/a&gt;).  It has a FastCGI library written by someone else, the Python files to glue the Mercurial and FastCGI libraries together, and a simple rc script to launch the external web process.&lt;/p&gt;&lt;p&gt;Instructions are for lighttpd... install the Python files somewhere, modify them to point to the Mercurial directory, run the rc script to start the daemon, and then add something similar to the following to your lighttpd config file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;fastcgi.server = (
  ".fcgi" =&amp;gt; ( "localhost" =&amp;gt;
    ( "socket" =&amp;gt; "/var/cache/fcgi/sites/hg.recoil.org/dirsock" )),
  ".hg" =&amp;gt; ( "localhost" =&amp;gt;
    ( "socket" =&amp;gt; "/var/cache/fcgi/sites/hg.recoil.org/sock" )),
)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Also add "index.fcgi" to &lt;em&gt;index-file.names&lt;/em&gt; in the config file, and touch it in the vhost directory to create an empty file (this is to avoid getting a 404 error and instead pass it through to the FastCGI process).  Similarly, touch a .hg file for every repository you want to serve.  You could do this differently by passing through a URL prefix and modifying the Python appropriately, but I prefer finer control over what we're serving.&lt;/p&gt;

&lt;p&gt;Hope this is useful; I won't bother submitting it back to the Mercurial list as it looks like the &lt;a href="http://www.selenic.com/hg/"&gt;official hg repo&lt;/a&gt; has a different code layout; I'll check it out later on when I have a bit more time and integrate properly.&lt;/p&gt;

&lt;p&gt;I have no idea whether or not this will actually improve our stability, but it's at least easier to move onto a different web-server now that everything is FastCGI.  All I need now is an OpenBSD/php5-fastcgi port, which doesn't seem to exist (yet).&lt;/p&gt;</description>
      <pubDate>Wed, 27 Dec 2006 20:59:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:c9de9f88-5d89-42ea-9430-6df6c7054109</guid>
      <author>anil@recoil.org (Anil Madhavapeddy)</author>
      <link>http://anil.recoil.org/blog/articles/2006/12/27/mercurial-fastcgi-module</link>
      <category>hacking</category>
      <category>net</category>
    </item>
    <item>
      <title>Practical OCaml</title>
      <description>&lt;p&gt;I noticed on the OCaml mailing list that &lt;a href="http://www.apress.com/book/bookDisplay.html?bID=10146"&gt;Practical OCaml&lt;/a&gt; is due to be released in the US quite soon.  Could this be the first real competition that &lt;a href="http://www.ffconsultancy.com"&gt;Jon Harrop&lt;/a&gt; will face for his excellent but pricey &lt;a href="http://www.ffconsultancy.com/products/ocaml_for_scientists/"&gt;Objective Caml for Scientists&lt;/a&gt; ?!&lt;/p&gt;

&lt;p&gt;Things are heating up on the OCaml book front at last, and Jon has been getting some &lt;a href="http://wagerlabs.com/articles/2006/08/23/objective-caml-for-scientists"&gt;rave reviews&lt;/a&gt; of his book!  We have a long-running joke about how much I hate the colour syntax highlighting he used in his book, and it amused me greatly to note that someone else in the comments for the rave review of his book also shared my heretical opinion, ha ha!&lt;/p&gt;

&lt;p&gt;Incidentally, I just pushed the beginnings of an OCaml &lt;a href="http://melange.recoil.org/trac/browser/lib/config"&gt;config file parsing library&lt;/a&gt; to the &lt;a href="http://melange.recoil.org/"&gt;Melange&lt;/a&gt; source tree.  The code in there is almost beginning to look useable...&lt;/p&gt;</description>
      <pubDate>Mon, 28 Aug 2006 23:12:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:fe6fc59a-1931-4daa-8842-980187a7a1ac</guid>
      <author>anil@recoil.org (Anil Madhavapeddy)</author>
      <link>http://anil.recoil.org/blog/articles/2006/08/28/practical-ocaml</link>
      <category>hacking</category>
      <category>books</category>
      <trackback:ping>http://anil.recoil.org/blog/articles/trackback/94</trackback:ping>
    </item>
    <item>
      <title>My first Cocoa steps</title>
      <description>&lt;p&gt;&lt;a href="http://anil.recoil.org/blog/files/mlgalleryedit.png" rel="lightbox" title="mlgalleryedit screenshot"&gt;&lt;img style="float:right" src="/blog/files/mlgalleryedit-thumb.png" alt="mlgalleryedit" /&gt; &lt;/a&gt;
Ever since I got my first Powerbook back in 2000, I've been meaning to learn Cocoa and Carbon to hack on MacOS X GUIs.  On the flight over to San Francisco, I finally found the uninterrupted time to knock up a simple GUI interface to my &lt;a href="http://anil.recoil.org/gallery"&gt;gallery&lt;/a&gt; meta-data files.  Overall, the experience was pretty positive.  It's definitely more satisfying than my experiences with Windows and UNIX GUI programming, mainly because the result is so pretty!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Objective-C has a really nice dynamic message dispatch mechanism, used to good effect by Cocoa.  The &lt;a href="http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/AutoreleasePools.html"&gt;autorelease&lt;/a&gt; mechanism plays well with C memory management to provide a reference-counted interface which is fairly well abstracted.  My application still leaks memory like a sieve though; I miss OCaml!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cocoa provides a huge number of ways to do the same thing.  &lt;a href="http://www.cocoadevcentral.com/articles/000080.php"&gt;Bindings&lt;/a&gt; are the fancy new thing, &lt;a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/chapter_5_section_4.html"&gt;MVC&lt;/a&gt; is the older "paradigm", and of course &lt;a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CarbonCocoaDoc/Articles/CarbonCocoaComm.html"&gt;Carbon&lt;/a&gt; predates all of this.  The documentation is a bit of a mess for a beginner to the framework, as crucial facts on how to get simple stuff done are scattered across a myriad of documents.  Thanks Google.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Tiger has some funky new Cocoa controls.  Check out the use of &lt;a href="http://developer.apple.com/documentation/Cocoa/Reference/CocoaBindingsRef/BindingsText/NSTokenField.html"&gt;NSTokenField&lt;/a&gt; on the screenshot which lets the tag entry field auto-complete just like Mail does!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The APIs can be unfortunately verbose at times, as the following code snippet which does a little bit of simple string manipulation shows.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt; NSArray *a = [tag componentsSeparatedByString:@&amp;quot; &amp;quot;];
    iter2 = [a objectEnumerator];
    while (s = [iter2 nextObject]) {
        NSString *e = [s stringByTrimmingCharactersInSet:
            [NSCharacterSet whitespaceCharacterSet]];
         if (![e isEqual:@&amp;quot;&amp;quot;]) 
            [tags addObject:[e retain]];
    }&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;I'm quite looking forward to doing more work on this simple application now that the basics are mastered.  Hmm... preferences panes next, then a bit of Cocoa bindings, and perhaps I feel OCamlCocoa coming on...&lt;/p&gt;</description>
      <pubDate>Sat, 15 Jul 2006 03:45:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:2ad19e99-c73a-41b6-9af4-36eb6d17ffdb</guid>
      <author>anil@recoil.org (Anil Madhavapeddy)</author>
      <link>http://anil.recoil.org/blog/articles/2006/07/15/my-first-cocoa-steps</link>
      <category>hacking</category>
      <trackback:ping>http://anil.recoil.org/blog/articles/trackback/78</trackback:ping>
    </item>
    <item>
      <title>Cambridge quickies</title>
      <description>&lt;p&gt;
Well I've been back in Cambridge for a week now, catching up on stuff that's been languishing in the last month of travelling.  So here are some blog quickies!
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Shouts out to the newest blogger, the least German-like German person I know!  &lt;a href="http://www.whoop.org/"&gt;Whooooop&lt;/a&gt; yeah yeah...&lt;/li&gt;
&lt;li&gt;Released a new version of &lt;a href="http://www.openfx.org/"&gt;OpenFX&lt;/a&gt;, with some really cool new &lt;a href="http://www.openfx.org/gallery/animations/"&gt;features&lt;/a&gt; from Dr. Stuart Ferguson!&lt;/li&gt;
&lt;li&gt;Sorry about the backlog of OpenBSD-related things; I think I've caught up on all my mails, and imported and updated lots of bits and bobs and ports.  Please re-mail me if I've ignored anything you have sent me recently.&lt;/li&gt;
&lt;li&gt;Released a test version of &lt;a href="http://anil.recoil.org/projects/review2atom.html"&gt;review2atom&lt;/a&gt;, the result of my &lt;a href="http://www.cduce.org/ocaml.html"&gt;ocamlduce&lt;/a&gt; hackery (and many thanks to Alan Frisch for answering my incessant questions!).&lt;/li&gt;
&lt;li&gt;Submitted DarwinPorts for &lt;a href="http://www.lri.fr/~signoles/prog.en.html"&gt;calendar&lt;/a&gt; (&lt;tt&gt;dports/devel/caml-calendar&lt;/tt&gt;) and ocamlduce (&lt;tt&gt;dports/lang/ocamlduce&lt;/tt&gt;).&lt;/li&gt;
&lt;li&gt;I'm going to buy a &lt;a href="http://www.ukjuicers.com/"&gt;juicer&lt;/a&gt;; turnip smoothie is en route!&lt;/li&gt;
&lt;/ul&gt;</description>
      <pubDate>Fri, 23 Sep 2005 15:38:10 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:3e0707ce-d2d2-44f6-bf47-c245c59f7cb7</guid>
      <author>avsm</author>
      <link>http://anil.recoil.org/blog/articles/2005/09/23/cambridge-quickies</link>
      <category>cambridge</category>
      <category>hacking</category>
    </item>
    <item>
      <title>Python on Symbian Series 60</title>
      <description>&lt;p&gt;
I bought a &lt;a href="http://www.nokia.com/nokia/0,,54665,00.html"&gt;Nokia 7610&lt;/a&gt; some time ago, and have taken hundreds of pictures using it.  When creating the &lt;a href="http://anil.recoil.org/gallery/"&gt;gallery&lt;/a&gt; section of my site, I ran into an annoying limitation: the pictures contained on the phone did not embed the date the picture was taken as part of the image.  Manually copying the date and time for 350 images was a bit much as well...
&lt;/p&gt;

&lt;p&gt;
The problem with sending images via Bluetooth to my laptop is that the OBEX transfer stamps the date of the transfer instead of the date the picture was taken.  There turned out to be a conveniently easy answer to this problem though, as Nokia released a version of &lt;a href="http://www.forum.nokia.com/main/0,,034-821,00.html"&gt;Python for Symbian Series 60&lt;/a&gt;.  This suddenly elevates the phone from being a complete pain to program (due to the Symbian C++ libraries being amazingly badly documented), to something that's actually quite usable.
&lt;/p&gt;

&lt;p&gt;
It took about an hour to come up with the first cut of &lt;tt&gt;&lt;a href="http://anil.recoil.org/projects/imgcollect-1.0.py"&gt;imgcollect.py&lt;/a&gt;&lt;/tt&gt;, which assembles a list of mtimes for each image on my phone, performs Bluetooth Device Discovery, and transmits the mtimes and all the pictures to my laptop.  After that, a little shell script on the laptop is enough to stamp the pictures with the correct mtime:
&lt;/p&gt;

&lt;pre&gt;
#!/bin/sh
while read FNAME MTIME; do
        DATE=`date -r $MTIME "+%G%m%d%H%M.%S"`
        touch -t $DATE $FNAME
done
&lt;/pre&gt;

&lt;p&gt;I'm actually quite impressed with Nokia at last!  Next step is to work out a two-way synchronization so that I don't keep re-transmitting images which I already have on the phone (unfortunately, &lt;a href="http://www.apple.com/macosx/features/isync/"&gt;iSync&lt;/a&gt; is pretty useless with the Nokia 7610, even in Tiger).&lt;/p&gt;</description>
      <pubDate>Fri, 24 Jun 2005 14:14:37 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:322f6a2c-6a5f-4242-8c7f-5c01f9d86e9d</guid>
      <author>avsm</author>
      <link>http://anil.recoil.org/blog/articles/2005/06/24/python-on-symbian-series-60</link>
      <category>hacking</category>
    </item>
    <item>
      <title>Updated Subethaedit OCaml mode</title>
      <description>&lt;p&gt;The &lt;a href="http://www.codingmonkeys.de/subethaedit/"&gt;Subethaedit&lt;/a&gt; syntax highlighting for OCaml is working nicely.  I fixed up few minor bugs and packaged up version 1.1, available &lt;a href="http://anil.recoil.org/projects/ocaml-subethaedit-1.1.tgz"&gt;here&lt;/a&gt;.  Have fun!&lt;/p&gt;</description>
      <pubDate>Tue, 21 Jun 2005 22:01:38 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:41a581c0-6eed-4565-8e3e-ca1d82999ddb</guid>
      <author>avsm</author>
      <link>http://anil.recoil.org/blog/articles/2005/06/21/updated-subethaedit-ocaml-mode</link>
      <category>hacking</category>
    </item>
    <item>
      <title>C2K5 thoughts</title>
      <description>&lt;p&gt;
Finally had some time to get back from the OpenBSD hackathon and take stock of what I worked on.  It was pretty interesting one this year, as I went without having much idea of what to work on (unlike last year, when I had a mad backlog to catch up on).   Some stuff I did during the week included:
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clean up the &lt;a href="http://www.openbsd.org/cgi-bin/cvsweb.cgi/src/usr.bin/ssh/atomicio.c"&gt;atomicio&lt;/a&gt; interface used in &lt;a href="http://www.openssh.com"&gt;OpenSSH&lt;/a&gt; and &lt;i&gt;&lt;a href="http://www.openbsd.org/cgi-bin/man.cgi?query=nc"&gt;nc(1)&lt;/a&gt;&lt;/i&gt; to provide simpler semantics.  Error checking from read/write functions are a real headache in C, as the functions return &lt;tt&gt;-1&lt;/tt&gt; on error, which means a signed &lt;tt&gt;ssize_t&lt;/tt&gt; is returned.  However, they accept an unsigned value as the size of the buffer to process, which means they could potentially return a value outside the range of the return value.  This means you have to check if the return is &lt;tt&gt;-1&lt;/tt&gt;, which indicates an error, and otherwise cast to a &lt;tt&gt;size_t&lt;/tt&gt; to correctly get the buffer size back.  With the new atomicio, it always returns a &lt;tt&gt;size_t&lt;/tt&gt;, and returns &lt;tt&gt;0&lt;/tt&gt; to signal an error (with &lt;tt&gt;errno&lt;/tt&gt; containing the error, and &lt;tt&gt;EPIPE&lt;/tt&gt; being set for an &lt;tt&gt;EOF&lt;/tt&gt; condition).&lt;/li&gt;
&lt;li&gt;Start looking at the Bluetooth stack to get L2CAP and RFCOMM support.  We are half-way through un-netgraphing the FreeBSD stack and having a more traditional &lt;tt&gt;netbt&lt;/tt&gt; socket interface (much like &lt;tt&gt;netinet&lt;/tt&gt; or &lt;tt&gt;netinet6&lt;/tt&gt;) to Bluetooth.&lt;/li&gt;
&lt;li&gt;Use &lt;a href="http://cil.sf.net/"&gt;CIL&lt;/a&gt; to implement a few fun kernel source-&gt;source transforms.  &lt;tt&gt;&lt;a href="http://www.openbsd.org/cgi-bin/cvsweb.cgi/ports/devel/cil/files/kerneltrace.ml"&gt;kerneltrace&lt;/a&gt;&lt;/tt&gt; just accepts a regular expression and inserts a &lt;tt&gt;printf&lt;/tt&gt; in the function prologue which outputs the function name and any arguments passed into it.  Had this idea when chatting with &lt;a href="http://www.monkey.org/~marius/"&gt;Marius&lt;/a&gt;, and it turned out to be very useful when trying to figure out dataflow in the Bluetooth stack (just compile with &lt;tt&gt;make CC="/usr/local/bin/cilly --dokerneltrace --trace-regexp='ubt|ng_blue'"&lt;/tt&gt;).
The second one was even simpler; &lt;tt&gt;&lt;a href="http://www.openbsd.org/cgi-bin/cvsweb.cgi/ports/devel/cil/files/randomvars.ml"&gt;randomvars&lt;/a&gt;&lt;/tt&gt; assigns a non-zero value to every local variable in a function call to help track down uninitialized-local-variable bugs. Heres &lt;a href="http://www.openbsd.org/cgi-bin/cvsweb.cgi/src/usr.bin/mg/search.c.diff?r1=1.15&amp;amp;r2=1.16"&gt;one&lt;/a&gt; Chad Loder found in &lt;i&gt;&lt;a href="http://www.openbsd.org/cgi-bin/man.cgi?query=mg"&gt;mg(1)&lt;/a&gt;&lt;/i&gt;.&lt;/li&gt;
&lt;li&gt;Other random &lt;a href="http://marc.theaimsgroup.com/?l=openbsd-cvs&amp;amp;m=111689009724884&amp;amp;w=2"&gt;signed/unsigned cleanups&lt;/a&gt; in OpenSSH.  Boring but important I guess...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All in all, the hackathon re-motivated me to continue work on the OCaml-based daemons that &lt;a href="http://recoil.org/~djs/"&gt;Dave&lt;/a&gt; and I have been hacking on.  I don't want to be fixing random buffer or integer overflows  in an OpenBSD hackathon 5 years from now; we need to move on to more high-level issues.&lt;/p&gt;</description>
      <pubDate>Sat, 04 Jun 2005 16:14:18 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:bda198f9-42f3-42c8-8742-4ad90f30c8fd</guid>
      <author>avsm</author>
      <link>http://anil.recoil.org/blog/articles/2005/06/04/c2k5-thoughts</link>
      <category>hacking</category>
      <category>openbsd</category>
    </item>
    <item>
      <title>Arise, MLBlog</title>
      <description>&lt;p&gt;
I got tired of trying to combine the various blogging and gallery tools
into something that did what I wanted: take a simple directory of images,
blog entries, links, papers and output a nice HTML/RSS version of the
directory.  So I hacked up a quick blog tool in OCaml that does the trick,
and put it live.
&lt;/p&gt;

&lt;p&gt;
Its got quite a few rough edges at the moment, especially to do with
the lack of date archives and the large number of images on the front page
of the &lt;a href="http://anil.recoil.org/gallery/"&gt;gallery&lt;/a&gt;.
Note that the location of the RSS links have changed as well, as I've
switched to using &lt;a href="http://www.nongnu.org/ocamlrss"&gt;ocaml-rss&lt;/a&gt; for outputting
it instead of the homebrew format used before in blosxom.
One thing that has come out really well is the use of a flat tag namespace instead of the previous directory structure; it allows me to share stories and images among multiple categories without needing symlink hacks.
&lt;/p&gt;</description>
      <pubDate>Mon, 23 May 2005 21:00:04 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:3e604f8d-7eba-4a06-a997-3185d8790bb5</guid>
      <author>avsm</author>
      <link>http://anil.recoil.org/blog/articles/2005/05/23/arise-mlblog</link>
      <category>hacking</category>
      <category>recoil</category>
    </item>
  </channel>
</rss>
