Home

Sat, Oct. 4th, 2008, 06:50 pm
[i]xach: Giant Pumpkin Pyramid


Giant Pumpkin Pyramid, originally uploaded by shannabeane.

We went to the pumpkin festival over in Cumberland this afternoon. They're trying to break a world record for jack-o-lanterns, and while most of the pumpkins were just sitting in grids on the ground (with little tags from an accounting firm certifying the counts), the most impressive display was on this multilevel scaffolding structure.

Thu, Oct. 2nd, 2008, 05:30 am
[i]xach: Clojure talk videos

Rich Hickey left a comment on my last post with a link to the videos of his talk:

Part 1 and Part 2.

These are essentially screencasts of his slides, with audio added. I haven't watched them (I was there in person, after all) so I'm not sure if the Q&A audio was faithfully captured; check it out and let me know.

Update Michael Livshin reports the questions are not always audible, but the answers usually make up for it.

Tue, Sep. 30th, 2008, 11:50 am
[i]xach: September Boston Lisp meeting


Rich Hickey, originally uploaded by Zach Beane.

Rich Hickey's Clojure talk last night was a big hit. The room was packed, the 90 minute talk ran to a dense 180 minutes, and he got two ovations from appreciative Lisp and Scheme hackers. The back and forth of questions and answers was exciting, with the questions exhibiting a good knowledge of the problems in the design space, and Rich's answers demonstrating he has thought about all the same problems in detail, made key decisions, and followed them through. It was also awesome that he could make subtle humorous points about esoteric languages and everyone knew exactly what he was talking about.

Highly recommended.

Mon, Sep. 29th, 2008, 12:13 pm
[i]xach: How to fix bugs in someone else's software

Tim Kerchmar has written an excellent article about working with a vendor to debug a problem. His specific context is working with Roger Corman, but the advice applies in many other situations. For example, I think Lisp library authors are in the same boat as one-man vendors, except you aren't paying them.

Here's a bit of it:

  1. If the software vendor is a one man shop, support is a distraction from other work. He is not sitting around hitting refresh on his email waiting for the next question to answer. Your good attitude about this frustrating bug in his product will go a long way towards his feelings of good will.
  2. You don't want to piss him off. He's probably the only guy in the world who knows this software product deeply, and if you couldn't trivially solve the bug from header files or documentation, you're going to need his help.
  3. When it comes to support, you get what you pay for, although the author's pride in his product can go a small ways.
  4. He is one person. The official term for you is "user". There are lots of you guys clamoring for his time.
  5. If you do your homework, he will do his.
  6. Don't distract him with your bad spelling or grammar.

Mon, Sep. 29th, 2008, 12:05 pm
[i]xach: More irritant-reduction

In SBCL, ASDF hooks into the REQUIRE mechanism so you can type (require 'mysystem). On other systems you can also figure out a way to hook REQUIRE, so you can avoid typing (asdf:oos 'asdf:load-op 'mysystem).

I got tired of trying to figure out how to do this in different ways on different Lisp systems, so below is a file I've been loading from my init files to get consistent, concise ASDF loading across implementations. It also adds a crude registry maintenance system and a way to reload a system without using :FORCE. :FORCE has the downside of recompiling and reloading all other dependencies, which is never what I want.

It's a work in progress, but so far I've been pretty happy using (asdf:load* 'mysystem) and (asdf:reload 'mysystem). YMMV.

(require 'asdf)

(in-package #:asdf)

(export '(load* reload register register-permanently))

(defvar *registry-file*
  (merge-pathnames (make-pathname :directory '(:relative "asdf")
                                  :name "registry"
                                  :type "sexp")
                   (user-homedir-pathname)))

(eval-when (:compile-toplevel :load-toplevel :execute)
  (let ((registry (probe-file *registry-file*)))
    (when registry
      (with-open-file (stream registry)
        (loop for form = (read stream nil)
              while form do (push form *central-registry*))
        (setf *central-registry*
              (remove-duplicates *central-registry* :test #'equalp))))))

(defun load* (system &key verbose)
  (oos 'load-op system :verbose verbose)
  t)

(defun reload (system)
  (let ((name (coerce-name system)))
    (remhash name *defined-systems*)
    (load* name)))

(defun register (form)
  (pushnew form *central-registry* :test #'equalp))

(defun register-permanently (form)
  (register form)
  (ensure-directories-exist *registry-file*)
  (with-open-file (stream *registry-file*
                   :direction :output
                   :if-exists :append
                   :if-does-not-exist :create)
    (prin1 form stream)
    (terpri stream)))

;;; Automatically recompile stale FASLs

(handler-bind ((style-warning #'muffle-warning))
  (defmethod perform :around ((o load-op) (c cl-source-file))
    (handler-case (call-next-method o c)
      (#+sbcl sb-ext:invalid-fasl
       #-sbcl error ()
       (perform (make-instance 'compile-op) c)
       (call-next-method)))))

Do you have any ugly local hacks that you think aren't polished enough to share, but that make your life much easier? Share them anyway, and let's clean them up and use them and improve life everywhere.

Mon, Sep. 29th, 2008, 11:20 am
[i]xach: Filing off life's little irritating corners

Sometimes asdf-install drives me crazy. Here's what I've been doing in my ~/.sbclrc so it doesn't ask me where I want to install all the time:

(require 'asdf)
(require 'asdf-install)

(setf asdf-install::*locations*
      (list (list "~/asdf/source/" "~/asdf/systems/" "ASDF")))

(push #p"~/asdf/systems/" asdf:*central-registry*)

(fmakunbound 'asdf-install::where)

(defun asdf-install::where ()
  (first asdf-install::*locations*))

On a related note, I can't live without tilde expansion in sbcl any more.

Sun, Sep. 28th, 2008, 08:38 pm
[i]xach: A grab bag of random Lisp things

The Boston Lisp meeting is tomorrow night. Rich Hickey will talk about Clojure. I'll be there, and you should be too. For more info, check Fare's post.

Bill Clementson wrote a summary of the September Vancouver Lisp meeting, including slides and audio of Hans Hübner's presentation.

Chun Tian released a new version of cl-net-snmp. The comp.lang.lisp announcement has some interesting details. He registered an enterprise number for Lisp with the IANA and has been working on a Lisp MIB. I think that is pretty cool.

Dan Weinreb added his take on the failure of Lisp, and it got a zillion comments.

Sat, Sep. 27th, 2008, 09:09 pm
[i]xach: ZS3 is a Common Lisp library for working with Amazon S3

I've just published ZS3, a Common Lisp library for working with Amazon S3. I wrote it to support the Alzheimer's Art Quilt Initiative virtual patch generator, which stores the patches on S3.

I first tried using CL-S3, but I couldn't get it working on SBCL for binary file uploads. There were some workarounds possible, but it seemed like starting from scratch might work better for me.

ZS3 has been tested and works fine on SBCL, Clozure CL, Allegro CL, and LispWorks CL. It doesn't work on CLISP due to a Gray stream issue; I haven't been able to figure out the problem. CLISP debuggers welcome! I haven't tested it on other Common Lisps, so I'd love to hear if it works or doesn't work elsewhere. Update The patch linked here does the trick on CLISP.

It should install fine with asdf-install. It's also available from git.xach.com.

To give you a general idea of what it can do, here's the defpackage form:

(defpackage #:zs3
  (:use #:cl)
  ;; Credentials
  (:export #:*credentials*
           #:access-key
           #:secret-key
           #:file-credentials)
  ;; Buckets
  (:export #:all-buckets
           #:creation-date
           #:name
           #:all-keys
           #:bucket-exists-p
           #:create-bucket
           #:delete-bucket
           #:bucket-location)
  ;; Bucket queries
  (:export #:query-bucket
           #:continue-bucket-query
           #:bucket-name
           #:keys
           #:common-prefixes
           #:prefix
           #:marker
           #:delimiter
           #:truncatedp
           #:last-modified
           #:etag
           #:size
           #:owner)
  ;; Objects
  (:export #:get-object
           #:get-vector
           #:get-string
           #:get-file
           #:put-object
           #:put-vector
           #:put-string
           #:put-file
           #:copy-object
           #:delete-object
           #:delete-objects
           #:delete-all-objects
           #:object-metadata)
  ;; Access Control
  (:export #:get-acl
           #:put-acl
           #:grant
           #:acl-eqv
           #:*all-users*
           #:*aws-users*
           #:*log-delivery*
           #:acl-email
           #:acl-person
           #:me
           #:make-public
           #:make-private)
  ;; Logging
  (:export #:enable-logging-to
           #:disable-logging-to
           #:enable-logging
           #:disable-logging
           #:logging-setup)
  ;; Misc.
  (:export #:*use-ssl*
           #:make-post-policy
           #:head
           #:authorized-url
           #:resource-url)
  ;; Util
  (:export #:octet-vector
           #:now+
           #:now-
           #:file-etag
           #:parameters-alist
           #:clear-redirects)
  (:shadow #:method))

For the full scoop, check out the full documentation.

This would have been much more difficult to write, portably, without the great (and portable) libraries Drakma, Closure XML, and Ironclad.

Wed, Sep. 24th, 2008, 01:38 pm
[i]xach: Lord Chesterfield, lifehacker

I knew a gentleman, who was so good a manager of his time, that he would not even lose that small portion of it, which the calls of nature obliged him to pass in the necessary-house; but gradually went through all the Latin poets, in those moments. He bought, for example, a common edition of Horace, of which he tore off gradually a couple of pages, carried them with him to that necessary place, read them first, and then sent them down as a sacrifice to Cloacina: this was so much time fairly gained; and I recommend you to follow his example.

— Letter XXI, Lord Chesterfield's Letters to his Son

Wed, Sep. 24th, 2008, 01:35 pm
[i]xach: Benjamin Franklin on documentation

These embarrassments that the Quakers suffer'd from having establish'd and published it as one of their principles that no kind of war was lawful, and which, being once published, they could not afterwards, however they might change their minds, easily get rid of, reminds me of what I think a more prudent conduct in another sect among us, that of the Dunkers. I was acquainted with one of its founders, Michael Welfare, soon after it appear'd. He complain'd to me that they were grievously calumniated by the zealots of other persuasions, and charg'd with abominable principles and practices, to which they were utter strangers. I told him this had always been the case with new sects, and that, to put a stop to such abuse, I imagin'd it might be well to publish the articles of their belief, and the rules of their discipline. He said that it had been propos'd among them, but not agreed to, for this reason:

"When we were first drawn together as a society," says he, "it had pleased God to enlighten our minds so far as to see that some doctrines, which we once esteemed truths, were errors; and that others, which we had esteemed errors, were real truths. From time to time He has been pleased to afford us farther light, and our principles have been improving, and our errors diminishing. Now we are not sure that we are arrived at the end of this progression, and at the perfection of spiritual or theological knowledge; and we fear that, if we should once print our confession of faith, we should feel ourselves as if bound and confin'd by it, and perhaps be unwilling to receive farther improvement, and our successors still more so, as conceiving what we their elders and founders had done, to be something sacred, never to be departed from."

— from his autobiography