<?xml version="1.0" encoding="utf-8"?>
<!-- If you are running a bot please visit this policy page outlining rules you must respect. http://www.livejournal.com/bots/ -->
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:lj="http://www.livejournal.com">
  <id>urn:lj:livejournal.com:atom1:lhealy</id>
  <title>Liam Healy</title>
  <subtitle>Liam Healy</subtitle>
  <author>
    <name>Liam Healy</name>
  </author>
  <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/"/>
  <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom"/>
  <updated>2009-05-03T21:37:46Z</updated>
  <lj:journal userid="9173244" username="lhealy" type="personal"/>
  <link rel="service.feed" type="application/x.atom+xml" href="http://lhealy.livejournal.com/data/atom" title="Liam Healy"/>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:12838</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/12838.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=12838"/>
    <title>GSLL using FSBV</title>
    <published>2009-05-03T21:37:46Z</published>
    <updated>2009-05-03T21:37:46Z</updated>
    <category term="lisp"/>
    <content type="html">The &lt;a href="http://common-lisp.net/project/gsll/"&gt;GNU Scientific Library for Lisp (GSLL)&lt;/a&gt; now makes use of &lt;a href="http://repo.or.cz/w/fsbv.git"&gt;Foreign Structures By Value (FSBV)&lt;/a&gt; to define functions that pass or return complex scalars, which are represented as structures in GSL.  The tests in &lt;code&gt;gsll-tests&lt;/code&gt; will test some of these functions, and they all pass.&lt;br /&gt;&lt;br /&gt;Since my last posting, there have been some improvements to FSBV; among them, the copying between Lisp and foreign code happens automatically in the definition with either &lt;code&gt;fsbv:defcfun&lt;/code&gt; or &lt;code&gt;fsbv:foreign-funcall&lt;/code&gt;.  Since there is some preparation involving structures needed for libffi, and this need be done only once per function when it is defined,  &lt;code&gt;fsbv:defcfun&lt;/code&gt; makes a closure separately when it is loaded and then the invocation of the function just  calls that closure on the specific arguments.  If &lt;code&gt;fsbv:foreign-funcall&lt;/code&gt; is called with the symbol used for the Lisp name of the &lt;code&gt;fsbv:defcfun&lt;/code&gt;, it will also use that closure.  GSLL takes advantage of that efficiency.  Since I think FSBV won't change too much now (at least in the interface) I have tagged it with "0.1" release.&lt;br /&gt;&lt;br /&gt;For those GSLL users who have no need for complex functions and don't want to bother installing libffi and FSBV, GSLL will compile and load fine without them; of course, those functions won't be available.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:12721</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/12721.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=12721"/>
    <title>Foreign structures by value</title>
    <published>2009-04-29T01:36:13Z</published>
    <updated>2009-04-29T01:36:13Z</updated>
    <category term="lisp"/>
    <content type="html">I have written &lt;a href="http://repo.or.cz/w/fsbv.git"&gt;Foreign Structures By Value&lt;/a&gt; which will allow calling foreign functions that either take or return structures by value instead of by reference (i.e., with a pointer).  It requires &lt;a href="http://common-lisp.net/project/cffi/"&gt;CFFI&lt;/a&gt; and &lt;a href="http://sourceware.org/libffi/"&gt;libffi&lt;/a&gt;, and should work in any environment where those are both supported.&lt;br /&gt;&lt;p&gt; For example, the complex type is defined in the &lt;a href="http://www.gnu.org/software/gsl/"&gt;GNU Scientific Library (GSL)&lt;/a&gt; as&lt;br /&gt;&lt;pre&gt;
typedef struct
  {
    double dat[2];
  }
gsl_complex;
&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;The function &lt;code&gt;gsl_complex_conjugate&lt;/code&gt; takes and returns a structure of this type by value,&lt;br /&gt;&lt;pre&gt;
gsl_complex gsl_complex_conjugate (gsl_complex z);
&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;If we define&lt;br /&gt;&lt;pre&gt;
(fsbv:defcstruct (complex :constructor complex :deconstructor (realpart imagpart))
  (dat :double :count 2))
(defun complex-conjugate (complex-number)
  (fsbv:with-foreign-objects ((gslin 'complex complex-number))
    (object
     (fsbv:foreign-funcall "gsl_complex_conjugate" complex gslin complex)
     'complex)))
&lt;/pre&gt;&lt;br /&gt;then we can call this function from Lisp: &lt;br /&gt;&lt;pre&gt;
(complex-conjugate #c(3.0d0 4.0d0))
#C(3.0 -4.0)
&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;This is making its way into &lt;a href="http://common-lisp.net/project/gsll/"&gt;GSLL&lt;/a&gt; but in the meantime should be usable for other projects.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:12471</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/12471.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=12471"/>
    <title>Regression (unit) test in Lisp, including float tests</title>
    <published>2009-03-17T01:00:43Z</published>
    <updated>2009-03-17T01:00:43Z</updated>
    <category term="lisp"/>
    <content type="html">In the course of writing &lt;a href="http://common-lisp.net/project/gsll/"&gt;GSLL&lt;/a&gt;, I found that I needed some software for regression (unit) tests.  I &lt;a href="http://lhealy.livejournal.com/2006/04/26"&gt;mentioned before&lt;/a&gt; that I had made use of &lt;a href="http://www.cs.northwestern.edu/academics/courses/325/readings/lisp-unit.html"&gt;lisp-unit&lt;/a&gt;, augmenting with a test of floating point equivalence.  Tom Hermann has similar needs; he saw what I had done and merged it with his own, better, floating point test.  He has put this together into an augmented lisp-unit.  The git &lt;a href="http://repo.or.cz/w/lisp-unit.git"&gt;repository&lt;/a&gt; has been set up with the permission of Christopher Riesbeck, the author of lisp-unit.  Instead of including my extended lisp-unit now, GSLL (specifically, gsll-tests) makes use of this separate repository.  Other projects could similarly benefit.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:12275</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/12275.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=12275"/>
    <title>Passing a complex number to a foreign function</title>
    <published>2009-01-15T23:38:42Z</published>
    <updated>2009-01-16T13:42:08Z</updated>
    <category term="lisp"/>
    <category term="gsl"/>
    <content type="html">&lt;p&gt;&lt;a href="http://www.gnu.org/software/gsl/"&gt;GSL&lt;/a&gt; has a number of functions that take complex scalars as arguments.  It defines them with either &lt;br /&gt;&lt;pre&gt;
typedef struct
  {
    double dat[2];
  }
gsl_complex;
&lt;/pre&gt;&lt;br /&gt;or&lt;br /&gt;&lt;pre&gt;
typedef struct
  {
    float dat[2];
  }
gsl_complex_float;
&lt;/pre&gt;&lt;br /&gt;These complex numbers are always passed by value, not as a pointer.  This presents a problem to Lisp users as many foreign function interfaces and &lt;a href="http://common-lisp.net/project/cffi/"&gt;CFFI&lt;/a&gt; do not allow passing structs directly.&lt;br /&gt;&lt;p&gt;&lt;br /&gt;I thought maybe there was a way around this.  Could it be that the real and imaginary parts are simply passed sequentially as if they were two successive arguments to the function?  In fact, this does work for numbers of type (complex double-float), but when I tried that on (complex single-float), it would return without error but with the result computed as if the imaginary part was 0.  I thought maybe there was a padding issue, so I packed the two single-floats into a single 64-bit word that I then interpreted as a double-float.  When passing this single argument to a function that expects a (complex single-float), the correct answer is computed.  &lt;br /&gt;&lt;p&gt;&lt;br /&gt;For example, the BLAS function &lt;code&gt;caxpy&lt;/code&gt; works on single-floats:&lt;br /&gt;&lt;pre&gt;
(FOREIGN-FUNCALL "gsl_blas_caxpy" 
		 :DOUBLE (PACK-COMPLEX-AS-DOUBLE ALPHA) 
		 :POINTER (MPOINTER X) :POINTER (MPOINTER Y)
		 :INT)
&lt;/pre&gt;&lt;br /&gt;where &lt;code&gt;#'pack-complex-as-double&lt;/code&gt; does the packing on the complex scalar &lt;code&gt;alpha&lt;/code&gt; described, and the function &lt;code&gt;zaxpy&lt;/code&gt; works on double-floats&lt;br /&gt;&lt;pre&gt;
(FOREIGN-FUNCALL "gsl_blas_zaxpy" 
		 :DOUBLE (REALPART ALPHA) 
		 :DOUBLE (IMAGPART ALPHA) 
		 :POINTER (MPOINTER X) :POINTER (MPOINTER Y) 
		 :INT)
&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;This has now been incorporated into &lt;a href="http://common-lisp.net/project/gsll"&gt;GSLL&lt;/a&gt;.  I assume it is not portable; I am on Debian amd64 but it works on x86 (32 bit) as well.  It seems to be portable across CL implementations, at least it works in SBCL and CCL.  So I have built in a test that tries a simple function; if it gets the wrong answer than all the functions that want a complex scalar will signal an error.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:11829</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/11829.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=11829"/>
    <title>GSLL new version</title>
    <published>2009-01-04T20:25:14Z</published>
    <updated>2009-01-04T23:45:29Z</updated>
    <category term="lisp"/>
    <category term="gsl"/>
    <content type="html">The new version &lt;a href="http://common-lisp.net/project/gsll/"&gt;GNU Scientific Library for Lisp&lt;/a&gt; (GSLL) is now available.  This library has many mathematical functions used in science and engineering applications.  It works on several Lisp implementations.&lt;br /&gt;&lt;p&gt;&lt;br /&gt;The most significant changes from the previous version include:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;All objects are memory managed (garbage collected), which means they can have indefinite extent like any other Lisp object.  There is no need to put the object creation in a &lt;code&gt;letm&lt;/code&gt;; in fact &lt;code&gt;letm&lt;/code&gt; doesn't exist anymore.  Use &lt;code&gt;let&lt;/code&gt;, or &lt;code&gt;defparameter&lt;/code&gt;, etc.&lt;br /&gt;&lt;li&gt; All array (vector and matrix) element types that are supported by the platform, CL implementation, CFFI, and GSL, are supported by GSLL.&lt;br /&gt;&lt;li&gt; On SBCL both Lisp and C use the same representation for array contents; they are not copied between the two sides.  Thanks to Tamas Papp's foreign-friendly arrays for the inspiration.&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;There have been some function name and argument changes, so users of the previous version will need to update their code.  Please use the &lt;a href="http://repo.or.cz/w/gsll.git"&gt;git repository&lt;/a&gt; and discontinue using the old svn repository.&lt;br /&gt;&lt;br /&gt;Feedback welcome, here or on the &lt;a href="http://common-lisp.net/cgi-bin/mailman/listinfo/gsll-devel"&gt;mailing list&lt;/a&gt;.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:11629</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/11629.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=11629"/>
    <title>Clozure CL on Debian</title>
    <published>2008-09-30T21:15:06Z</published>
    <updated>2008-10-01T15:01:54Z</updated>
    <category term="lisp"/>
    <category term="debian"/>
    <content type="html">&lt;p&gt;&lt;br /&gt;A while back, &lt;a href="http://lhealy.livejournal.com/2006/12/01"&gt;I mentioned&lt;/a&gt; trying OpenMCL for Debian.  OpenMCL is now &lt;a href="http://trac.clozure.com/openmcl"&gt;Clozure CL&lt;/a&gt; (CCL), and version 1.2 for MacOSX and Linux (PPC and amd64) was &lt;a href="http://groups.google.com/group/comp.lang.lisp/browse_thread/thread/643a952201bddacf/1f8e539791566899?show_docid=1f8e539791566899&amp;amp;pli=1"&gt;recently announced&lt;/a&gt;.  I gave it another try and the experience is much better, though it needs Debianization.&lt;br /&gt;&lt;p&gt;&lt;br /&gt;The &lt;a href="http://pkg-common-lisp.alioth.debian.org/"&gt;Debian Common Lisp Team&lt;/a&gt; has produced a &lt;a href="http://pkg-common-lisp.alioth.debian.org/clid/clid.html/"&gt;Common Lisp in Debian&lt;/a&gt; manual, so I followed that to Debianize CCL.  As root,&lt;br /&gt;&lt;pre&gt;
&amp;gt; lx86cl64
Welcome to Clozure Common Lisp Version 1.2-r10552  (LinuxX8664)!
? (load "/usr/share/common-lisp/source/common-lisp-controller/common-lisp-controller.lisp")
? (common-lisp-controller:compile-common-lisp-controller-v5 "ccl")
(#P"/var/cache/common-lisp-controller/0/ccl/common-lisp-controller/common-lisp-controller.lx64fsl"
 #P"/var/cache/common-lisp-controller/0/ccl/cl-asdf/asdf.lx64fsl"
 #P"/var/cache/common-lisp-controller/0/ccl/cl-asdf/wild-modules.lx64fsl"
 #P"/var/cache/common-lisp-controller/0/ccl/common-lisp-controller/post-sysdef-install.lx64fsl")
&lt;/pre&gt;&lt;br /&gt;Now as an ordinary user,&lt;br /&gt;&lt;pre&gt;
? (load "/var/cache/common-lisp-controller/0/ccl/common-lisp-controller/common-lisp-controller.lx64fsl")
? (load "/var/cache/common-lisp-controller/0/ccl/cl-asdf/asdf.lx64fsl")
? (load "/var/cache/common-lisp-controller/0/ccl/cl-asdf/wild-modules.lx64fsl")
? (load "/var/cache/common-lisp-controller/0/ccl/common-lisp-controller/post-sysdef-install.lx64fsl")
? (common-lisp-controller:init-common-lisp-controller-v5 "ccl")
? (ccl:save-application "ccl-deb")
&lt;/pre&gt;&lt;br /&gt;When restarted with&lt;br /&gt;&lt;code&gt;&lt;br /&gt; lx86cl64 ccl-deb&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;all the Debian definitions are there.  (I recommend using &lt;a href="http://packages.debian.org/search?keywords=rlwrap"&gt;rlwrap&lt;/a&gt; from a shell for easier input editing.)  &lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;I tried to compile and load various debian packages and other systems, with reasonably good success;&lt;br /&gt;&lt;pre&gt;
(clc:clc-require :asdf-system-connections)
(clc:clc-require :cl-base64)
(clc:clc-require :cl-ppcre)
(clc:clc-require :md5)
(clc:clc-require :port)
(clc:clc-require :iterate)
(clc:clc-require :cl-utilities)
(clc:clc-require :uffi)
(clc:clc-require :clsql-uffi)
(clc:clc-require :clsql-sqlite3)
(clc:clc-require :cffi)
(clc:clc-require :drakma)
(clc:clc-require :cl-html-parse)
&lt;/pre&gt;&lt;br /&gt;all worked fine;  I did get errors from a few things&lt;br /&gt;&lt;pre&gt;
(clc:clc-require :memoization)
 Error: The function CCL:ARGLIST is predefined in OpenMCL.
(use-package :iterate :cl-user)
&amp;gt; Error: Using #&amp;lt;Package "ITERATE"&amp;gt; in #&amp;lt;Package "COMMON-LISP-USER"&amp;gt;
&amp;gt;        would cause name conflicts with symbols inherited by that package: 
&amp;gt;        ITERATE:TERMINATE  TERMINATE
 (clc:clc-require :trivial-http)
&amp;gt; Error: Module TRIVIAL-HTTP was not provided by any function on *MODULE-PROVIDER-FUNCTIONS*.
&lt;/pre&gt;&lt;br /&gt;I'm sure many of my applications (tested mainly on SBCL and a little CLISP) will need fixing up.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:11292</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/11292.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=11292"/>
    <title>AFS rides again</title>
    <published>2008-08-12T13:27:15Z</published>
    <updated>2008-08-13T23:41:43Z</updated>
    <category term="debian afs"/>
    <content type="html">&lt;p&gt;&lt;br /&gt;After using AFS for a number of years, I gave up on it several years ago in frustration, because it was complex and difficult to install with the Linux kernel of the time.  However, in the meantime, &lt;a href="http://openafs.org/"&gt;OpenAFS&lt;/a&gt; has become dominant, and it works well with Linux and Debian.  Installation is easy thanks to module-assistant:&lt;br /&gt;&lt;pre&gt;
 aptitude install module-assistant build-essential
 aptitude install krb5-user krb5-clients
 aptitude install openafs-client openafs-modules-source openafs-krb5
 m-a prepare
 m-a a-i openafs
 invoke-rc.d openafs-client start
&lt;/pre&gt;&lt;br /&gt;The whole world is now under /afs.  To authenticate to the default cell,&lt;br /&gt;&lt;pre&gt;
 kinit
 aklog
&lt;/pre&gt;&lt;br /&gt;Having access to several AFS servers, I'm still trying to figure out how to get simultaneous access to all of them.  It seems that you can only kinit to one realm at a time.  However, it need not be your default realm;&lt;br /&gt;&lt;pre&gt;
kinit user@OTHER.REALM
aklog -cell other.afs.server -k OTHER.REALM
&lt;/pre&gt;&lt;br /&gt;works.  &lt;br /&gt;&lt;p&gt;&lt;br /&gt;AFS wants cache space, which it insists be ext2 or ext3.  If you don't have those (I have xfs), don't worry, you can make one in a file on any filesystem:&lt;br /&gt;&lt;pre&gt;
  dd if=/dev/zero of=/some/local/dir count=nnnn bs=1M 
  mkfs.ext3 /some/local/dir
  mount /some/local/dir /var/cache/openafs -o loop
&lt;/pre&gt;&lt;br /&gt;When you configure the client, give a size 95% of nnnn, it won't allow any larger.  Also when configuring the client, say yes to "Dynamically generate the contents of /afs?" (AFS_DYNROOT).  This will free you from your home cell's listing of sites, and use /etc/openafs-client/CellServDB, but it will effectively dynamically mount them: it won't actually contact the server until you refer to a site.&lt;br /&gt;&lt;/p&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:11062</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/11062.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=11062"/>
    <title>Using git to stitch together a broken subversion repository</title>
    <published>2008-08-02T19:43:22Z</published>
    <updated>2008-08-02T19:43:22Z</updated>
    <category term="git"/>
    <content type="html">I have recently learned &lt;a href="http://git.or.cz/"&gt;git&lt;/a&gt; for version control, having used Subversion for four years and CVS for four years prior to that.  It has a lot of nice features and I thought of a good application: restoration of lost history on a Subversion repository.&lt;br /&gt;&lt;br /&gt;In the process of moving my project &lt;a href="http://common-lisp.net/project/gsll"&gt;GSLL&lt;/a&gt; from a private subversion repository to a public one on common-lisp.net, I lost the entire history.  I was trying to extract the GSLL part from my whole repository, which had several other projects.  I had tried an svnadmin dump and then svndumpfilter, but this did not work for me, leaving me with no history and the version number at 25 from the failed filtering attempts.&lt;br /&gt;&lt;br /&gt;When I saw a blog at newartisans &lt;a href="http://www.newartisans.com/blog_files/diving.into.git.php#unique-entry-id-65"&gt;describe the usage of git for a similar task&lt;/a&gt;, I decided to try to transfer my repository to git (with the intention of abandoning subversion) and at the same time restore the entire history.  I was able to do it, but it took some work and I was unable to use git rebase exclusively as the newartisans blogger did, because I had a branched history, with two subversion branches "trunk" and "ffa" and a tag "pre-iospec".  Here is how I did it, edited (I hope correctly) to eliminate my trial-and-error-failures:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt; Get a fresh copy of the new svn repository and check out the branches&lt;br /&gt;&lt;pre&gt;
 git svn clone --stdlayout svn+ssh://public/repo/ /tmp/clnetsvn
 cd /tmp/clnetsvn
 git checkout -b trunk trunk
 git checkout -b ffa ffa
&lt;/pre&gt;&lt;br /&gt;If you use --no-metadata to git-svn, there will be no additions to the commit message indicating the Subversion source and version numbers.  If you want to completely forget about the svn repository, that might be desirable, but I wanted to be able to identify the svn versions to aid in the stitching process.&lt;br /&gt;&lt;br /&gt;&lt;li&gt; Get a fresh copy of the old private svn repository for which new commits stopped when the new repository was created&lt;br /&gt;&lt;pre&gt;
 git svn clone --stdlayout svn+ssh://private/repo/ /tmp/localsvn
 cd /tmp/localsvn
 git checkout -b trunk trunk
 git checkout -b pre-iospec tags/pre-iospec
&lt;/pre&gt;&lt;br /&gt;I decided to keep the tag pre-iospec though I don't really need it anymore.&lt;br /&gt;&lt;br /&gt;&lt;li&gt; Create a staging area to do some git surgery&lt;br /&gt;&lt;pre&gt;
 mkdir ~/staging; cd ~/staging; git init
 git remote add localsvn /tmp/localsvn
 git remote add clnetsvn /tmp/clnetsvn
 git fetch localsvn
 git fetch clnetsvn
 git checkout --no-track -b old localsvn/trunk
 git checkout --no-track -b pre-ffa clnetsvn/trunk
 git checkout --no-track -b master clnetsvn/ffa
&lt;/pre&gt;&lt;br /&gt;Note I have renamed the two active branches to "pre-ffa" (from "trunk") and "master" (from "ffa") , reflecting my intention that ffa will soon become the main branch of development, and the previous trunk will be archived for historical purposes and won't see much further development.&lt;br /&gt;&lt;br /&gt;&lt;li&gt; Do the stitching&lt;br /&gt;First, confirm that the last commit of old is the same as the first substantive commit of either pre-ffa or master&lt;br /&gt;&lt;pre&gt;
 git diff old..6ed4d0626
&lt;/pre&gt;&lt;br /&gt;There is no output, indicating that the two commits are identical; 6ed4d0626 was the second checkin on clnetsvn.  The first is just the creation of trunk and has no contents.  If there had been a difference (indicating something had changed between the two commits), I would have had to check it in, as is the case on the newartisans blog.  Now rebase the ffa branch onto old (it could as well have been trunk, but only one should be rebased):&lt;br /&gt;&lt;pre&gt;
 git rebase old master
&lt;/pre&gt;&lt;br /&gt;Based on &lt;a href="http://marc.info/?t=121694253600001&amp;amp;r=1&amp;amp;w=2"&gt;the advice of Jakub Narebski&lt;/a&gt;, I created a file .git/info/grafts which consists of two SHA1 ids:&lt;br /&gt;&lt;pre&gt;
 0069b7f5af9a90dde26de14c7c19ae92e4d9f38b eef416b5cb25797ae266cda2f28e0c56c1675437
&lt;/pre&gt;&lt;br /&gt;The id of the first commit in trunk split off from ffa is 0069b7f5...; it has a parent commit that is duplicated on the ffa branch that is unified with the old repostory, but meanwhile its lineage ends with the start of the clnetsvn respository.  The id of its parent is eef416b5... on the unified branch.  This may be easily confirmed if --no-metadata was not used, because the Subversion information stamp in its actual parent and in the same commit on the unified branch have identical subversion information.  The grafts file needs the entire 40 hex digit SHA1 ID; it doesn't work with an abbreviated id.  At this point, an inspection with gitk --all shows the correct hierarchy; everything looks fine because the presence of the grafts file connects the lineage correctly.  However, a git push would result in a broken repository, because the grafts file is not pushed.  So, do &lt;br /&gt;&lt;pre&gt;
 git checkout pre-ffa
 git filter-branch 646c623c193139ba491c3bccc6ff6dd26bfa4bdc..HEAD
&lt;/pre&gt;&lt;br /&gt;with 646c623... being the first commit in the now-rebased master.  Note that this differs from the advice in the &lt;a href="http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html"&gt;git-filter-branch man page&lt;/a&gt; which says to use the graft id, but that didn't work for me and this does; I suspect an error on the man page or a change in how git filter-branch works.  &lt;br /&gt;&lt;br /&gt;To summarize: &lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;Do a rebase to connect the current master branch onto its old history from the first svn repository; &lt;br /&gt;&lt;li&gt;Do the graft because two git-rebases on each branch would have left duplicated histories back to the start of the new (public) repository&lt;br /&gt;&lt;li&gt;Apply filter-branch so that this would be permanent when the repository is pushed.&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt; Push to remote repository&lt;br /&gt;&lt;pre&gt;
 git remote add origin ssh://remote/repository
 git push --all origin
 git push --tags
&lt;/pre&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;And that's it, everything looks correct.  Git is very nice.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:10938</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/10938.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=10938"/>
    <title>SBCL in Debian testing (lenny): good news</title>
    <published>2008-05-16T01:38:35Z</published>
    <updated>2008-05-16T01:38:35Z</updated>
    <category term="lisp"/>
    <category term="debian"/>
    <content type="html">Thanks to lots of work and attention from various people:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://release.debian.org/migration/testing.pl?package=sbcl"&gt;http://release.debian.org/migration/testing.pl?package=sbcl&lt;/a&gt;&lt;br /&gt;Checking sbcl&lt;br /&gt;&lt;br /&gt;    * trying to update sbcl from 1:0.9.16.0-1 to 1:1.0.16.0-2 (candidate is 12 days old)&lt;br /&gt;    * sbcl is going in today</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:10615</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/10615.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=10615"/>
    <title>SBCL in Debian testing (lenny)</title>
    <published>2008-05-03T23:42:39Z</published>
    <updated>2008-07-02T02:59:43Z</updated>
    <category term="lisp"/>
    <category term="debian"/>
    <content type="html">Recently I noticed that SBCL in Debian testing is quite old; it is currently at 0.9.16 and evidently blocked there:&lt;br /&gt;&lt;pre&gt;
=== sbcl:
= Missing build(s) on alpha,sparc
 This might need manual action from your side.
 See http://buildd.debian.org/pkg.cgi?pkg=sbcl
= No migration to testing for 585 days.
 See &amp;lt;http://release.debian.org/migration/testing.pl?package=sbcl&amp;gt;
&lt;/pre&gt;&lt;br /&gt;I have tried to &lt;a href="http://lists.alioth.debian.org/pipermail/pkg-common-lisp-devel/2008-April/000553.html"&gt;stir the pot&lt;/a&gt;, and there has been some progress.  This version of testing will release as lenny in the fall, and it would be a shame if it released with such an old version of SBCL.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:10463</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/10463.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=10463"/>
    <title>Cairo for Lisp</title>
    <published>2008-03-22T13:22:03Z</published>
    <updated>2008-03-22T21:47:40Z</updated>
    <category term="lisp"/>
    <category term="graphics"/>
    <content type="html">&lt;p&gt;I have been looking into using &lt;a href="http://cairographics.org/"&gt;Cairo&lt;/a&gt; for various 2D drawing needs.  A key advantage is the availability of a variety of output formats, including both screen and hardcopy.  One potential application is traditional x-y scientific/engineering plots.  Although there are many options for doing that, even using Lisp, I have a Lisp package I adapted many years ago for this purpose that now lacks a good back end for output.  My thought is that Cairo would be good for that, as it is a standardized library, widely available, with many modern output formats.  I also have other 2D output that I do from Lisp, which I now do with a thin postscript definition layer that I wrote.  Switching to Cairo would give me some more flexibility.&lt;br /&gt;&lt;p&gt;&lt;br /&gt;I did some research and found that there were &lt;i&gt;three&lt;/i&gt; sets of bindings for Cairo:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;cl-cairo&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://common-lisp.net/project/cl-cairo2/"&gt;cl-cairo2&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://www.cliki.net/cffi-cairo"&gt;cffi-cairo&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;The first, cl-cairo, despite being linked from the cairographics web page, appeared to be dead.  I found the author, Lars Nostdal, on #lisp who said the project was no longer active, so with his permission I modified the &lt;a href="http://cairographics.org/bindings/"&gt;Cairo bindings page&lt;/a&gt; to mention cl-cairo2 and cffi-cairo and remove cl-cairo.  cl-cario2, from Tamás K Papp, seems more active, but I had trouble getting it to run; I've &lt;a href="http://common-lisp.net/pipermail/cl-cairo2-devel/2008-March/000015.html"&gt;posted my problems&lt;/a&gt; and am awaiting a response.  Finally, I tried cffi-cairo from chriss.  It did not compile, but it was easy to fix the problem: the CFFI interface has changed, defctype no longer has a :translate-p argument. With a slight modification, the example &lt;br /&gt;&lt;code&gt;(run-snippet-png '(:clip :clip-image))&lt;/code&gt; ran and produces PNG files that looked correct.&lt;br /&gt;&lt;p&gt;&lt;br /&gt;It looks like I'll be using cffi-cairo.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:10022</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/10022.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=10022"/>
    <title>Never a NaN or Inf</title>
    <published>2008-03-08T20:12:34Z</published>
    <updated>2008-03-11T02:06:48Z</updated>
    <category term="floating point"/>
    <category term="lisp"/>
    <category term="fortran"/>
    <category term="c"/>
    <content type="html">&lt;p&gt;In very few cases is it acceptable to me that a floating-point calculation would produce NaN or Inf; it almost always means that there is an error somewhere in my program.  Following the principle that it is best to detect an error as soon as possible, I would like to know immediately whenever either of these is created, by trapping the exception and signaling an error.  Depending on the language and implementation, this doesn't always happen by default. Here are some different languages and compilers, and how to set to make this happen:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Lisp: &lt;a href="http://www.sbcl.org/"&gt;SBCL&lt;/a&gt;:  &lt;code&gt;(sb-int:set-floating-point-modes :traps '(:invalid :divide-by-zero :overflow)) and &lt;br /&gt;&lt;/code&gt;&lt;a href="http://www.cons.org/cmucl/"&gt;CMUCL&lt;/a&gt;:  &lt;code&gt;(&lt;a href="http://common-lisp.net/project/cmucl/doc/cmu-user/extensions.html#@funs12"&gt;ext:set-floating-point-modes&lt;/a&gt; :traps '(:invalid :divide-by-zero :overflow))&lt;/code&gt;.&lt;br /&gt;Also &lt;a href="http://common-lisp.net/project/gsll/"&gt;GSLL&lt;/a&gt; provides &lt;code&gt;#'set-floating-point-modes&lt;/code&gt;.&lt;br /&gt;&lt;li&gt;Fortran: for &lt;a href="http://gcc.gnu.org/onlinedocs/gcc-4.2.3/gfortran/"&gt;gfortran&lt;/a&gt;, use the compiler flag &lt;a href="http://gcc.gnu.org/onlinedocs/gcc-4.2.3/gfortran/Debugging-Options.html#Debugging-Options"&gt;&lt;code&gt;-ffpe-trap=invalid,zero,overflow&lt;/a&gt;.&lt;br /&gt;&lt;li&gt;C/C++: use &lt;br /&gt;&lt;pre&gt;
#include &amp;lt;fenv.h&amp;gt;
trapfpe () {
  &lt;a href="http://www.gnu.org/software/libc/manual/html_node/Control-Functions.html"&gt;feenableexcept&lt;/a&gt;(&lt;a href="http://www.gnu.org/software/libc/manual/html_node/Status-bit-operations.html#Status-bit-operations"&gt;FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW&lt;/a&gt;);
}
&lt;/pre&gt;&lt;br /&gt;In C, this will need to be included: &lt;code&gt;void trapfpe();&lt;/code&gt; &lt;br /&gt;In C++, this will need to be included (also works for C):&lt;br /&gt;&lt;pre&gt;
#ifndef _TRAPFPE_H_
#define _TRAPFPE_H_

#include &amp;lt;sys/cdefs.h&amp;gt;

__BEGIN_DECLS
void trapfpe(void);
__END_DECLS

#endif /* _TRAPFPE_H_ */
&lt;/pre&gt;&lt;br /&gt;and then in either, include &lt;code&gt;trapfpe();&lt;/code&gt; at the beginning.  This should be portable to C99 compilers/libc but I've used only gcc and glibc.  Also, &lt;a href="http://www.gnu.org/software/gsl/"&gt;GSL&lt;/a&gt; has &lt;a href="http://www.gnu.org/software/gsl/manual/html_node/Setting-up-your-IEEE-environment.html"&gt;&lt;code&gt;gsl_ieee_env_setup&lt;/code&gt;&lt;/a&gt;.&lt;br /&gt;&lt;/ul&gt;&lt;/code&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:9795</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/9795.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=9795"/>
    <title>SBCL, libc6, and GCC</title>
    <published>2008-03-05T14:14:23Z</published>
    <updated>2008-03-05T14:14:23Z</updated>
    <category term="lisp"/>
    <category term="debian"/>
    <content type="html">&lt;p&gt;&lt;br /&gt;For those that don't follow the mailing list, &lt;a href="http://www.sbcl.org/"&gt;SBCL&lt;/a&gt; on &lt;a href="http://www.debian.org/"&gt;Debian&lt;/a&gt; is unusable in &lt;a href="http://www.debian.org/releases/unstable/"&gt;unstable&lt;/a&gt;.  SBCL did not change, but Debian upgraded &lt;a href="http://packages.debian.org/sid/libc6"&gt;libc6&lt;/a&gt; to 2.7-9.  This causes SBCL to spin at 100% usage, or simply to hang, while starting up.  The only relevant change to libc6 is that it is now compiled with GCC 4.3 instead of 4.2; the libc6 maintainer has confirmed that backing out this change and recompiling libc6 with GCC 4.2 allows SBCL to work.  It is still unclear where the problem(s) is/are; but the experts have narrowed it down further.  Follow the developments on the &lt;a href="http://bugs.debian.org/469058"&gt;Debian bug report&lt;/a&gt;; even if you don't use Debian, presumably this combination of software is a problem.  In the meantime, if you are a sid user, don't upgrade!  Though apparently some people have experienced the problem as a random failure, my experience is that it's 100% reproduceible.&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Software is complicated.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:9716</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/9716.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=9716"/>
    <title>GNU Scientific Library for Lisp</title>
    <published>2008-02-24T23:40:55Z</published>
    <updated>2008-02-25T02:41:57Z</updated>
    <category term="lisp"/>
    <category term="gsl"/>
    <content type="html">The &lt;a href="http://www.gnu.org/software/gsl/"&gt;GNU Scientific Library&lt;/a&gt; is a library of applied mathemetics commonly used in science and engineering.  I have written &lt;a href="http://common-lisp.net/project/gsll/"&gt;GNU Scientific Library for Lisp (GSLL)&lt;/a&gt;, a fairly complete interface to this library from Common Lisp.  My intent is that the interface be as Lisp-natural as possible.  Though this will be useful for those of us that do scientific programming in Lisp, even those who aren't Lisp programmers might use this library as a desk-calculator interface to GSL.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:9325</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/9325.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=9325"/>
    <title>Comparison of floating point numbers in Common Lisp</title>
    <published>2008-01-26T19:22:10Z</published>
    <updated>2008-01-26T19:22:10Z</updated>
    <category term="floating point"/>
    <category term="lisp"/>
    <content type="html">&lt;p&gt;
   Floating point numbers are a computer representation of the real
   numbers.  Unlike the real numbers, there are a finite
   number of them.  So there is a smallest and largest floating point
   number, and all others have a predecessor and successor.
   &lt;p&gt;
   Because different compilers and platforms can reorder a calculation
   and optimize in a way that is approximated differently and so do
   not necessarily produce the same floating point number, it is
   difficult to compare two floating point numbers and conclude that
   they represent the same result.  For the purposes of regression (or
   unit) testing, we would like to do exactly this.  Bruce Dawson
   addressed this problem in "&lt;a href="http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm"&gt;Comparing
   Floating Point Numbers&lt;/a&gt;."  He makes the point that the best way
   to do this correctly is to interpret each floating point number as
   an integer.  By taking advantage of the &lt;a href="http://en.wikipedia.org/wiki/IEEE_floating-point_standard"&gt;IEEE
   754&lt;/a&gt; standard for representation of floating point numbers, we
   can construct a function that maps the floating point numbers to
   the integers.  The genius of the standard's inventor &lt;a href="http://http.cs.berkeley.edu/~wkahan/"&gt;W. Kahan&lt;/a&gt; is that a
   mapping derived from the standard, call it i(x), satisfies three
   properties:&lt;/p&gt;
   &lt;ul&gt;
   &lt;li&gt;If two floats a&amp;lt;b, then i(a)&amp;lt;i(b),
    &lt;li&gt;if two floats are adjacent and a&amp;lt;b, then i(b)=i(a)+1,&lt;/li&gt;
    &lt;li&gt;and finally i(0.0)=0.&lt;/li&gt;
   &lt;/ul&gt;
&lt;p&gt;
   Dawson provides some clever C constructs to read a floating point
   number as an integer, and instruction on how to prevent the
   compiler from complaining about your trickery in doing so.  Common
   Lisp instead provides us with
   functions with which we can properly construct our own integers.
   As a side benefit, we don't care what the &lt;i&gt;actual&lt;/i&gt;
   representation of the floating point number is; we will build our
   own IEEE-like representation.  We don't exactly want the full
   IEEE754 word though; we leave off the most significant bit, which is a sign
   bit, and instead make the sign of the integer agree with the
   sign of the float.&lt;/p&gt;
   &lt;p&gt;
What we end up with is an &lt;i&gt;enumeration of the floats&lt;/i&gt;.
   That is, for every single precision float, there is one integer in
   the range 
   [-2139095039, 2139095039], and vice versa, with the exception that
   both positive and negative zero (allowed by the standard) map to
   zero.  Likewise, there is a one-to-one mapping of the
    double precision floats to
   [-9218868437227405311,9218868437227405311].  Floats with
   special values (positive and negative infinity, and &lt;a href="http://en.wikipedia.org/wiki/NaN"&gt;NaN&lt;/a&gt;) that are required
   by the standard do not have integer values.
   &lt;p&gt;
   I have written &lt;a href="http://common-lisp.net/~lhealy/numerical/floating-point.lisp"&gt;the
   following functions&lt;/a&gt; in Common 
   Lisp: 
   &lt;ul&gt;
   &lt;li&gt;&lt;code&gt;float-as-integer&lt;/code&gt; which is the function i(x);&lt;/li&gt;
   &lt;li&gt;&lt;code&gt;integer-as-float&lt;/code&gt; which is the inverse function
   (this isn't necessary but can be useful) and
   also returns the rational form of the float;&lt;/li&gt;
   &lt;li&gt;&lt;code&gt;decode-IEEE754&lt;/code&gt; (used by other functions) that
   returns five values: 
   significand, exponent, sign, bits in significand, bits in
   exponent, all as integers;&lt;/li&gt;
   &lt;li&gt;&lt;code&gt;format-IEEE754-bits&lt;/code&gt; which prints out the
   binary form of the IEEE word, separated into the three parts
   (this isn't necessary but is nice for comparing with bit
   expansions shown in references like the Wikipedia page).&lt;/li&gt;
   &lt;/ul&gt;
   &lt;p&gt;
  Here are some interesting floats:
   &lt;pre&gt;
(float-as-integer most-negative-single-float)
-2139095039
(float-as-integer least-negative-single-float)
-1
(float-as-integer -0.0f0)
0
(float-as-integer 0.0f0)
0
(float-as-integer least-positive-single-float)
1
(float-as-integer (- 1.0f0 single-float-negative-epsilon))
1065353215
(float-as-integer 1.0f0)
1065353216
(float-as-integer (+ 1.0f0 single-float-epsilon))
1065353217
(float-as-integer most-positive-single-float)
2139095039
&lt;/pre&gt;
   &lt;p&gt;
   A regression test would record not the floating point number, but
   the integer produced by &lt;code&gt;float-as-integer&lt;/code&gt;.  Since
   integers can be unambiguously formatted to and read from a text
   file in a unique way, a subsequent recomputation would provide a
   clear indication of how close the floats are.  Of course, we must
   decide how much error we're going to allow, because a correct
   calculation may produce slightly different integers.  As an added
   bonus, these functions can be used to identify (in languages other
   than Lisp) when a positive single float has been interpreted as a
   double float.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:9056</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/9056.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=9056"/>
    <title>Multiprocessing lisp evaluations</title>
    <published>2008-01-22T23:01:15Z</published>
    <updated>2008-01-22T23:01:15Z</updated>
    <category term="lisp"/>
    <content type="html">I sometimes need to evaluate the same form with different parameters repeatedly.  Such as&lt;br /&gt;&lt;pre&gt;
(job 1)
(job 2)
(job 3)
...
&lt;/pre&gt;&lt;br /&gt;When these are time consuming, I'd like to take advantage of the two processors I have in my computer.  As the jobs are independent of each other (no communication), I only need to maintain a job queue, have each processor pick off the front of the queue, and then place the results in an accessible place before getting the next job.  Since &lt;a href="http://www.sbcl.org/"&gt;SBCL&lt;/a&gt; has &lt;a href="http://www.sbcl.org/manual/Threading.html#Threading"&gt;threads&lt;/a&gt;, at least for Linux on x86 and amd64, I should be able to use this mechanism to build the job queue.  Following &lt;a href="http://books.google.com/books?id=MgcJAAAACAAJ"&gt;Rochkind&lt;/a&gt; Section 5.17, I have written the following:&lt;br /&gt;&lt;pre&gt;
(defparameter *job-lock* (sb-thread:make-mutex :name "job lock"))
(defparameter *results* (list nil))
(defvar *end-of-jobs* (make-symbol "EOJ"))
(defvar *jobs* nil)

(defun worker (job)
  (let ((my-job nil)
	(more-jobs t))
    (loop while more-jobs
       do
       (sb-thread:with-mutex (*job-lock*)
	 (setf more-jobs (or *jobs*))
	 (setf my-job (when more-jobs (pop *jobs*))))
       (when my-job			; there is a job to be done
	 (if (eq my-job *end-of-jobs*)
	     (setf more-jobs nil)
	     (let ((my-results (apply job my-job))) ; call the job outside the mutex
	       (sb-thread:with-mutex (*job-lock*)   ; save results
		 (push my-results *results*))))))))

(defun run-tasks (job dataset number-of-workers)
  "The job is a function that takes one non-null argument.
   The dataset is a list of arglist sets for the job.
   The number-of-workers is the number of workers desired, 
   presumably the number of processors available."
  (setf *jobs* (make-list number-of-workers :initial-element *end-of-jobs*)
	*results* (list nil))
  (dolist (ds dataset) (push ds *jobs*))
  (let ((threads (list nil)))
    (loop repeat number-of-workers
       do (push (sb-thread:make-thread (lambda () (worker job))) threads))
    (dolist (thread (butlast threads)) (sb-thread:join-thread thread))
    (butlast *results*)))
&lt;/pre&gt;&lt;br /&gt;Try this example:&lt;br /&gt;&lt;pre&gt;
(defun job (x) (list x (+ (loop for i from 1 to 2000000 sum (let ((p (* i x))) (1- (expt p (/ p))))))))
(run-tasks #'job '((1) (2) (3) (4) (5) (6) (7) (8) (9) (10)) 2)
((1 105.73587) (2 58.11023) (3 41.245914) (4 31.676012) (5 26.053244)
 (6 22.305136) (7 19.607342) (8 17.642727) (9 15.433696) (10 14.060191))
&lt;/pre&gt;&lt;br /&gt;Unfortunately, after I coded this up and tried it on my actual function, I found that that function was not thread safe, due to use of a foreign library that wasn't thread safe.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:8840</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/8840.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=8840"/>
    <title>lhealy @ 2008-01-05T12:45:00</title>
    <published>2008-01-05T17:51:48Z</published>
    <updated>2008-01-05T20:17:52Z</updated>
    <category term="olpc"/>
    <category term="im"/>
    <category term="pidgin"/>
    <content type="html">I have my new OLPC XO-1 now, from the "Give one get one program".  My intended use is mainly for updates from the road while on bike tours.&lt;br /&gt;&lt;br /&gt;One thing I'd like is instant messaging.  The "Chat Activity" works to other XOs but evidently not to anyone else.  &lt;a href="http://olpcnews.com/forum/index.php?topic=198.0"&gt;Pidgin and Finch&lt;/a&gt; have been ported, so I tried Finch, being text-based and therefore presumably simpler.  It works, but unfortunately it is based on ncurses.  Evidently, few if any of the curses controls work on th XO, so I can't even expand the "window" to full screen.  It would be nice if there were a plain text (no pseudo-windowing, no curses, etc.) IM client, perhaps one based on libpurple?&lt;br /&gt;&lt;br /&gt;Update: I found &lt;a href="http://naim.n.ml.org/about"&gt;NAIM&lt;/a&gt; which is full screen and does not try to emulate windowing, but has an odd choice of colors - the typein area is white letters on a white background, which makes it hard to see.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:8495</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/8495.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=8495"/>
    <title>Profiling in SLIME</title>
    <published>2007-11-06T23:57:06Z</published>
    <updated>2007-11-06T23:57:06Z</updated>
    <category term="lisp"/>
    <content type="html">This is about the easiest profiling I've seen in any language.  In&lt;br /&gt;fact, I think it's the only time I been able to make significant&lt;br /&gt;improvements based on the report.&lt;br /&gt;&lt;pre&gt;M-x slime-toggle-profile-fdefinition&lt;/pre&gt; on all the functions you want to&lt;br /&gt;profile, &lt;pre&gt;M-x slime-profile-reset&lt;/pre&gt; to clear any existing data, and&lt;br /&gt;&lt;pre&gt;M-x slime-profile-report&lt;/pre&gt; to see the report after running.&lt;br /&gt;I did it on one of my functions which was taking 700+ seconds to run.&lt;br /&gt;I immediately saw that I was doing an unnecessary computation, which&lt;br /&gt;when removed resulted in a 90 second run.  Some more profiling and&lt;br /&gt;other work yielded an end result of 2.5 seconds.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:8432</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/8432.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=8432"/>
    <title>DoD authentication in Iceweasel/Icedove</title>
    <published>2007-10-25T17:21:58Z</published>
    <updated>2007-10-26T12:57:15Z</updated>
    <category term="debian"/>
    <content type="html">Common DoD authentication with certificates and the &lt;a href="http://en.wikipedia.org/wiki/Common_Access_Card"&gt;Common Access Card&lt;/a&gt; (CAC) is possible in Debian for Iceweasel (Firefox) and Icedove (Thunderbird).  It can be reduced to the following:&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;Install the &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/3182"&gt;DoD Configuration&lt;/a&gt; add-on in Iceweasel by clicking on "Install Now" button.&lt;br /&gt;&lt;li&gt;Save that xpi file from Iceweasel by clicking right on the button. Install the file in Icedove: Tools -&amp;gt; Add-ons -&amp;gt; Install.&lt;br /&gt;&lt;li&gt;Test from web by visiting &lt;a href="http://www.navy.mil"&gt;http://www.navy.mil&lt;/a&gt;; the URL should be green.  You do not need your CAC.&lt;br /&gt;&lt;li&gt;Load packages in Debian:&lt;br /&gt;&lt;pre&gt;
sudo aptitude install libpcsclite1 pcsc-tools libccid coolkey
&lt;/pre&gt;&lt;br /&gt;This will enable the CAC reader in Debian unstable; I don't know if the versions of previous Debian releases will work.  Note that not all CAC readers are supported; see the &lt;a href="http://packages.debian.org/sid/libccid"&gt;list&lt;/a&gt;.  In particular, the ActivCard 2.0 USB, which is very common, is &lt;a href="http://bugs.debian.org/428016"&gt;&lt;i&gt;not&lt;/i&gt; supported&lt;/a&gt;. &lt;br /&gt;&lt;li&gt;With your CAC inserted, visit &lt;a href="http://infosec.navy.mil"&gt;http://infosec.navy.mil&lt;/a&gt;.  You will be prompted for your PIN, and you should be able to select your certificate.  To see the certificate information that the server has, visit the &lt;a href="https://infosec.navy.mil/certtest/certificateHandler"&gt;PKI Cert test page&lt;/a&gt;.&lt;br /&gt;&lt;li&gt;You can sign/encrypt email by using the S/MIME button, and set up defaults for every email with Edit -&amp;gt; Account Settings -&amp;gt; Security. Note that OpenPGP security is completely separate from CAC security, and the icons that display in messages and the composition area shouldn't be confused.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;That should do it.  References: &lt;a href="http://www7320.nrlssc.navy.mil/pubs/2006/CommonAccessCardLinux.pdf"&gt;Van Alstyne&lt;/a&gt;, &lt;a href="http://pkg-coolkey.alioth.debian.org/"&gt;CoolKey package&lt;/a&gt;.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:8093</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/8093.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=8093"/>
    <title>Extension functions in sqlite3, again</title>
    <published>2007-09-29T19:54:27Z</published>
    <updated>2007-09-29T19:54:27Z</updated>
    <category term="lisp"/>
    <category term="sqlite"/>
    <content type="html">I mentioned before that I cleaned up and posted mathematical and string extension functions for SQLite3.  Some things have changed in the interim, which necessitated going through a few revisions.  So now &lt;a href="http://sqlite.org/contrib/download/extension-functions.c?get=22"&gt;the new version&lt;/a&gt; is available which makes compilation and use easier.  For one thing, the SQLite source is no longer required to compile it.  Second, it uses the standard sqlite3_load_extension interface, which should make it easier to use.  The interface through CL using CLSQL is now &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
(in-package :sqlite3)

;;; Add mathematical and string functions to SQL queries using
;;; libsqlitefunctions from
;;; http://www.sqlite.org/contrib/download/extension-functions.c?get=22

(def-sqlite3-function
    "sqlite3_enable_load_extension"
    ((db sqlite3-db) (onoff :int))
 :returning :int)

(def-sqlite3-function
    "sqlite3_load_extension"
    ((db sqlite3-db)
     (filename :cstring)
     (entrypoint :int)
     (errmsg :int))
  :returning :int)

(eval-when  (:compile-toplevel :load-toplevel :execute)
  (export 'enable-sqlite3-extension-functions))

(defun enable-sqlite3-extension-functions (database)
  "Set up the SQLite3 mathematical extension functions.  This
   must be called every time the database is connected
   before any extension function is used."
  (let ((db-ptr (clsql-sqlite3::sqlite3-db database)))
    (sqlite3-enable-load-extension db-ptr 1)
    (unless (zerop
	     (sqlite3-load-extension db-ptr "libsqlitefunctions.so" 0 0))
      (error "Can't load libsqlitefunctions.so."))))
&lt;/pre&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:7837</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/7837.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=7837"/>
    <title>cl-mcclim out of date in Debian unstable</title>
    <published>2007-09-07T16:04:04Z</published>
    <updated>2007-09-07T16:04:04Z</updated>
    <category term="lisp"/>
    <category term="debian"/>
    <content type="html">People are talking about the hot new mcclim (0.9.5).  But unstable has 0.9.2; experimental only has 0.9.4 and it has not migrated to unstable in the six months it's been there because, supposedly, the etch freeze &lt;a href="http://packages.qa.debian.org/c/cl-mcclim.html"&gt;http://packages.qa.debian.org/c/cl-mcclim.html&lt;/a&gt;.  But etch has long since been released; why the continued logjam?</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:7623</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/7623.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=7623"/>
    <title>GMAT on Debian amd64</title>
    <published>2007-09-02T17:42:58Z</published>
    <updated>2007-09-02T17:42:58Z</updated>
    <category term="space"/>
    <category term="debian"/>
    <content type="html">NASA has recently made available its &lt;a href="http://gmat.gsfc.nasa.gov/index.html"&gt;General Mission Analysis Tool (GMAT)&lt;a&gt;, a space trajectory and mission analysis system, under an open source license.  The precompiled version relies on WxWidgets 2.8, which aren't yet available in Debian (though there are &lt;a href="http://www.wxwidgets.org/downloads/"&gt;debs available&lt;/a&gt;) and is for i386.  So I have tried to compile under etch/amd64 using WxWidgets 2.6.  The src/README file explains very well how to set options, but not how to compile, so here's what I've figured out.&lt;br /&gt;&lt;br /&gt;sudo aptitude install libwxgtk2.6-dev libwxbase2.6-dev wx2.6-headers &lt;br /&gt;sudo aptitude install libdevil-dev libdevil1c2&lt;br /&gt;In src/topLevelBuildFiles/linux/BuildEnv.mk, remove local/ from the path:&lt;br /&gt;  WXCPPFLAGS = `/usr/bin/wx-config --cppflags`&lt;br /&gt;  WXLINKFLAGS = `/usr/bin/wx-config --libs --gl-libs --static=no`&lt;br /&gt;Make source code changes in src/base/forcemodel/ForceModel.cpp, line 1129 add "long"&lt;br /&gt;            std::sprintf(sataddr, "%x", (unsigned long)sat);&lt;br /&gt;Change to the src directory, and make links&lt;br /&gt;  ln -sf topLevelBuildFiles/linux/MakeGmat.eclipse topLevelBuildFiles/linux/BuildEnv.mk .&lt;br /&gt;Then make&lt;br /&gt;  make -f MakeGmat.eclipse&lt;br /&gt;&lt;br /&gt;Unfortunately, the compilation ends in error.&lt;/a&gt;&lt;/a&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:7193</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/7193.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=7193"/>
    <title>DRAKMA</title>
    <published>2007-05-16T17:56:19Z</published>
    <updated>2007-05-16T17:56:19Z</updated>
    <category term="lisp"/>
    <content type="html">Yesterday's blog mentioned trouble I'm having with cl-curl, my own package.  A comment pointed me to &lt;a href="http://weitz.de/drakma/"&gt;DRAKMA&lt;/a&gt;, yet another Edi Weitz bequest to the lisp world.  It is a native common lisp http client that handles the particular web site I am scraping data from, complete with password and cookies.  It was very simple to rewrite my access functions to use DRAKMA, and it is able to retrieve all the data I wanted, no memory fault like cl-curl.  So I will update the cl-curl project page to recommend DRAKMA.&lt;br /&gt;&lt;p&gt;&lt;br /&gt;It was a little unclear how to install DRAKMA; here is my condensed summary, on Debian:&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;sudo aptitude install cl-chunga cl-puri cl-flexi-streams&lt;br /&gt;&lt;li&gt;wget &lt;a href="http://common-lisp.net/project/usocket/releases/usocket-0.3.2.tar.gz"&gt;http://common-lisp.net/project/usocket/releases/usocket-0.3.2.tar.gz&lt;/a&gt;&lt;br /&gt;&lt;li&gt;wget &lt;a href="http://common-lisp.net/project/cl-plus-ssl/download/cl+ssl-2007-03-10.tar.gz"&gt;http://common-lisp.net/project/cl-plus-ssl/download/cl+ssl-2007-03-10.tar.gz&lt;/a&gt;&lt;br /&gt;&lt;li&gt;wget &lt;a href="http://weitz.de/files/drakma.tar.gz"&gt;http://weitz.de/files/drakma.tar.gz&lt;/a&gt;&lt;br /&gt;&lt;li&gt;tar zxvf usocket-0.3.2.tar.gz&lt;br /&gt;&lt;li&gt;tar zxvf cl+ssl-2007-03-10.tar.gz&lt;br /&gt;&lt;li&gt;tar zxvf drakma.tar.gz&lt;br /&gt;&lt;li&gt;clc-register-user-package usocket-0.3.2/usocket.asd&lt;br /&gt;&lt;li&gt;clc-register-user-package cl+ssl-2007-03-10/cl+ssl.asd&lt;br /&gt;&lt;li&gt;clc-register-user-package drakma-0.7.0/drakma.asd&lt;br /&gt;&lt;li&gt;,l drakma (in slime)&lt;br /&gt;&lt;/ol&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:7134</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/7134.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=7134"/>
    <title>Parsing HTML and memory fault from cl-curl</title>
    <published>2007-05-15T14:46:29Z</published>
    <updated>2007-05-15T14:46:29Z</updated>
    <category term="lisp"/>
    <content type="html">I've had need to parse HTML in lisp from time to time.  The latest reason is some very specific and uncomplicated HTML that I scrape for some satellite data off a published database.  A search online turns up &lt;a href="http://common-lisp.net/project/xmls/"&gt;XMLS&lt;/a&gt; as a likely candidate for this task.  I have used it successfully in the past, but recently I find it won't parse its own example and its own supplied HTML documentation, to say nothing of the real HTML I want it to parse.  It either returns NIL (meaning an error in parsing the correct HTML), or only the first line of HTML. There is a thread on comp.lang.lisp about how to parse HTML, and many people recommend &lt;a href="http://www.cliki.net/CL-HTML-Parse"&gt;cl-html-parse&lt;/a&gt;.  I was dissuaded at first because of the wiki comments implying that it had been superseded by pxmlutils whose web page in turn implies that it had been superseded by... XMLS!  But cl-html-parse works just fine on the web pages I need to scrape.&lt;br /&gt;&lt;p&gt;&lt;br /&gt;So, success.  But then, I am grabbing the web page with &lt;a href="http://common-lisp.net/project/cl-curl/"&gt;cl-curl&lt;/a&gt; which works most of the time, but for a particular query gives "memory fault," I think because there is a lot of data.  And the author/maintainer of cl-curl is... me! D'Oh.  It would be nice to have cl-curl using CFFI instead of UFFI, maybe based on the pedagogical development given in the &lt;a href="http://common-lisp.net/project/cffi/manual/html_node/Tutorial.html#Tutorial"&gt;CFFI tutorial&lt;/a&gt;.  My hope is at least it would solve this problem.  Any interest/volunteers/motivators?</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:lhealy:6731</id>
    <link rel="alternate" type="text/html" href="http://lhealy.livejournal.com/6731.html"/>
    <link rel="self" type="text/xml" href="http://lhealy.livejournal.com/data/atom/?itemid=6731"/>
    <title>Math and string extension functions for SQLite</title>
    <published>2007-04-22T23:05:17Z</published>
    <updated>2008-01-22T22:40:59Z</updated>
    <category term="sqlite"/>
    <content type="html">I have posted my port of Mikey C's extension functions for sqlite,&lt;br /&gt;&lt;a href="http://sqlite.org/contrib/download/extension-functions.tgz?get=17"&gt;http://sqlite.org/contrib/download/extension-functions.tgz?get=17&lt;/a&gt;&lt;br /&gt;but a more thorough list of functions would be as follows:&lt;br /&gt;&lt;br /&gt;Math:&lt;br /&gt;acos, asin, atan, atn2, atan2, cosh, asinh, atanh, degrees,&lt;br /&gt;radians, cos, sin, tan, cot, cosh, sinh, tanh, coth, exp,&lt;br /&gt;log, log10, power, sign, sqrt, square, ceil, floor, pi&lt;br /&gt;&lt;br /&gt;String:&lt;br /&gt;difference, replicate, charindex (2 or 3 arguments),&lt;br /&gt;leftstr, rightstr, ltrim, rtrim, trim, replace,&lt;br /&gt;reverse, proper, padl, padr, padc, strfilter&lt;br /&gt;&lt;br /&gt;Aggregate:&lt;br /&gt;stdev, variance, mode, median, lower_quartile, upper_quartile</content>
  </entry>
</feed>
