Archive for July, 2005

StoJ Open-sourced

I’m pleased to announce the open-source release of StoJ. The code is being released under the MIT license, and can be downloaded from this darcs repository. (You can find Darcs itself here.)

$ darcs get http://www.lshift.net/~tonyg/stoj/

Alternatively, there’s a snapshot you can download.

(If you click on the repository link above and are presented with a python script, don’t worry - it’s because there’s an index.cgi as part of the codebase. Use Darcs to grab a snapshot.)

Add comment July 29th, 2005 tonyg

The Web interface divide

Matthias and I were talking about website ‘templating’ — that is, making Web pages parameterised on the content.

We weren’t discussing the technical rationale behind it — constructive laziness is axiomatic — but how best to accomplish a separation of concerns between contributors. For example, frequently we co-operate with companies or individuals that specialise in design. Typically we want to impose a logical boundary so we can’t mess with their design and they can’t mess with our .. whatever bit we are doing.

Naturally, this is not a novel or uncommon goal and there are the soi disant standards XSLT and CSS that provide for just this thing. We’ve found that XSLT can be useful, but since it is a transformation language, it is too easy to cross the boundary of what appears versus how it appears. That leaves CSS.

So is CSS the right place to draw the line? If we provide the dynamic content and boilerplate as immutable HTML, can the designer do everything they want to?

As the CSS Zen Garden demonstrates, a great deal of a Web page’s appearance can be controlled with CSS — which is, after all, the idea; however, the Zen Garden creators concede that it requires some otherwise superfluous markup to get this range of control. There has to be some give and take between strictly semantic markup and markup that is amenable to styling. Plone’s default templates do a decent job of this: without the CSS stylesheets the pages are still easy to follow. Modulo a few compromises with the form of the HTML, then, CSS can go a long way.

There are some things that CSS as it’s currently implemented won’t do. Briefly: it can’t reorder content, and in most cases it can’t replace or insert content (there’s also some kinds of layout it doesn’t provide for yet — multi-column flowed text, for example). For things like form design these are crucial.

On the other hand, form design really is part of the user interface, and not the content; so perhaps something like XForms can supplement CSS to cover all the bases.

1 comment July 28th, 2005 mikeb

Browser-side XForms

At last there appears to be a working implementation of XForms that is written in Javascript and runs entirely inside a browser: FormFaces. The clear separation of content from presentation, and the declarative nature of XForms have always appealed to me, but the lack of a browser-side implementation has so far put me off from using it. Perhaps it’s time for another try?

Add comment July 22nd, 2005 matthias

TiddlyWiki adaptation

I’ve started work on an adaption of TiddlyWiki. The things I want to improve:

  • TiddlyWiki has a degree of reflection — editing the node ‘MainTitle’ changes the displayed title, for example. It does these inconsistently though, with bits of privileged markup. I’d rather it kept them as nodes and simply styled those nodes specially — ideally using CSS that is itself editable. A side effect of this will hopefully be to make the HTML more accessible (since it will closer to, if not thoroughly, semantic markup) .

  • I’d like a Stickies-like interface, where nodes remember their position and can be moved around and resized. This gives the user an opportunity to use spatial reasoning to keep a mental map of the information, something that regular websites (and the Web at large) lack.

UPDATE There’s a darcs repository

Add comment July 21st, 2005 mikeb

Searching IMAP in Gnus

I spent a good few hours trying to convince Gnus to search my IMAP folders, under XEmacs. Googling turned up quite a lot of stuff, but most of it is wrong/irrelevant. In the end all I needed to do was:

  • stick (require 'nnir) in my XEmacs init file
  • add (nnir-search-engine imap) to my .gnus file, like so:

    (setq gnus-secondary-select-methods
          '((nnimap "imap.lshift.net"
                    (nnimap-stream ssl)
                    (nnimap-authinfo-file "~/.authinfo")
                    (nnimap-nov-is-evil t)
                    (nnir-search-engine imap))))
    
  • re-byte-compile the nnir.el file in the XEmacs package directory for gnus - on my system that is /usr/share/xemacs21/xemacs-packages/lisp/gnus. For some reason the nnir.elc that comes with the XEmacs gnus package is broken, so unless it gets produced afresh the use of nnir results in mysterious errors.

After that, marking groups in the group buffer and hitting G G prompts for a search string and proceeds to carry out the search. Nice.

2 comments July 21st, 2005 matthias

RESTful AJAX Continuations

I saw Avi Bryant talk about Seaside yesterday. Seaside is quite a neat framework. TonyG and Andy have been playing with it for some time.

Avi mentioned that Seaside’s continuation-based model of web application development is in some sense the anti-RESTful - there is a lot of state kept on the server. It occurred to me though that this doesn’t have to be the case. Implementation details aside, in most cases continuations can be quite compact and hence one should be able to to round-trip them between the client and server, thus removing the server-side state. That is, essentially, the approach taken by WASH/CGI.

What really makes Seaside interesting is the way it allows composition at the page level, and extends this seamlessly to AJAX -style web applications.

It seems like we are only a small step away from RESTful AJAX-style continuation-based web applications.

Add comment July 20th, 2005 matthias

Squeak Scheme

A few days ago, I mentioned the idea of building a Scheme machine atop the existing Squeak VM and image. I’ve started some work in that direction: I’ve built (yet another) S-expression reader for Squeak, with associated data types and a unit test suite, and I’ve started building an interpreter that I intend to use to explore different ways of overlaying a Scheme-like environment on the existing Smalltalk environment. Once something settles down, a compiler to Smalltalk bytecode can be built.

Apropos the bytecode, I installed VMMaker in my image to look for a tail-call bytecode. Sadly, there doesn’t seem to be any such feature implemented at the moment, although it may not be much work to implement it. I’ll be interested to see how the Squeak community reacts to a tail-call implementation: with luck, it will be accepted into mainstream VMs.

Add comment July 20th, 2005 tonyg

SuperCollider 3

A few months ago, I pulled SuperCollider 3 from CVS and built it. Just yesterday, while replacing the strings of my guitar, I needed a guitar tuner and so turned to SuperCollider to build one. Finding the help text somewhat skeletal, I updated my CVS checkout and rebuilt the application. The documentation has been significantly fleshed out and the software now sports a fancy new icon as well as what looks like a port to windows. I’m looking forward to exploring it in greater depth.

Add comment July 20th, 2005 tonyg

Nevow Jukebox

I am currently engaged in writing another shared jukebox.

If you search Freshmeat for the word “jukebox”, you’ll find several distinct kinds of software. Mostly, you’ll find software like, say, XMMS, which provides an unnecessarily complex GUI for choosing and queuing up tracks for local play. Secondly, you’ll find packages like GNUMP3d which serve a music database for anyone online to listen to. But what I want is the third kind: something like Globecom Jukebox, which offers a web-based interface that allows many users to add to and modify a single playlist, which is played through speakers in one corner of the room. This problem has been solved several times before - GlobeCom is just one example - but in all cases maintaining the music database seems to be very painful, and the local hard drive that stores it is quickly overwhelmed.

To address this, the new jukebox will use a limited web crawler to discover all the music in collections it is pointed at, and (ultimately) use ID3 tags as well as file names as search terms. This means instead of copying your music collection over to it (which can quickly overwhelm the disk space on the music server), you need only make your local music collection available over the Web, and point the jukebox at it. If I can find an easy way to extend it to support SMB collections I’ll add those too.

I’m using Python, Twisted, and Nevow to build the jukebox. Python is a natural fit for a problem of this kind. Because various asynchronous events must be handed, Twisted is essential. After which, integrating the web interface directly into the daemon using Nevow seems easier than writing the web interface with a separate tool and providing a distinct way for the tool to talk to the jukebox.

Twisted and Nevow have the distinction of having, respectively, very little and practically no documentation. By far the most useful documentation on Nevow I’ve found is Meet Stan. “Stan” is a data structure for representing XML trees, and is the key to how Nevow dynamically generates XHTML. In contrast to the DOM, Stan

  • is relatively lightweight
  • has a convenient data language for representing fragments of XML trees in program code
  • includes powerful elements that directly support dynamic generation

I’d recommend anyone trying to get to grips with Nevow to read this first, followed by this Nevow user manual. Having got to grips with Stan, I’ve been able to achieve a very clean separation between content and code using XML templates.

The jukebox code currently consists of a number of separate programlets that are just sufficient to show that we can drive the various tools we’re using (which include not only Nevow, but also pymad and pyao) and make them do the things we need to. Now it’s just simple matter of programming.

I also need to choose a name for it. Any suggestions?

1 comment July 19th, 2005 Paul Crowley

The Design of a Pretty-printing Library

This paper is hard going, but very rewarding. The author concentrates on two ways of transforming a formal, algebraic specification into an implementation, starting with very simple examples and working up to a pretty-printing library.

The reason this paper is worthwhile is that, by moving very slowly and by demonstrating the same theme over and over, each time using a slightly more complex example, the author allows the reader to develop a clear insight into the connection between the terms and the coterms of an algebra.

The two styles of implementation he explores are taking the terms of an algebra and building a datatype from them more-or-less directly, and taking the coterms (or contexts) of the algebra and using them as the core of the datatype instead. Equational reasoning from these starting points leads to dual implementations of the semantics of the specification.

The programs based on terms seem natural to me — reasoning with coterms is awkward at first — but coterm-based programs reify far more detail of the ongoing computation, in a way reminiscent of the design of a custom interpreter for a domain-specific language. To get access, from a term-based solution, to the information that is explicitly represented in a coterm-based solution, you would need to make use of reflective primitives in the host language.

It’s intriguing, the way reflection unexpectedly appears in the mirror-image of a data structure…

Add comment July 18th, 2005 tonyg

Previous Posts

Calendar

July 2005
M T W T F S S
    Aug »
 123
45678910
11121314151617
18192021222324
25262728293031

Posts by Month

Posts by Category