Archive for April 4, 2004

Sunday, April 4, 2004

Modal Web Server

Chris Double implemented a simple continuation-based Web framework in Scheme. Here’s an example:

‘show-message’ is a function that displays an HTML page with a message and an ‘Ok’ anchor. The ‘Ok’ anchor goes to an URL as described above:

(define (show-message msg)
   (lambda (url)
        (head (title ,msg))
         (p ,msg)
         (p (a (@ (href ,url)) "Ok")))))))

We can use this by registering with the server a function that calls it a couple of times:

 (lambda ()
   (show-message "Hello")
   (show-message "World")))

Accessing the registered function displays the first ‘Hello’ page. Clicking ‘Ok’ will then resume the function and display the second ‘World’ page. Clicking ‘Ok’ on that page exits the function.

Property List Tools 1.0

Late Night Software’s Property List Tools can convert property list files into AppleScript records and also save the records back to disk as property list files.

read property list file "HD:Users:mjt:Library:Preferences:com.c-command.DropDMG.plist"
    |NSWindow Frame MJTRegistrationWindow|:"616 395 477 436 0 0 1280 1002 ", 
    |NSWindow Frame AgreementsWindow|:"-313 476 265 308 -1280 0 1280 1024 ",