« January 2008 | Main | March 2008 »
February 29, 2008
Announcing: Instaservlet
We've just released a package called Instaservlet, which enables you to get a servlet running in two lines of code, plus the servlet code. Here's a simple example:
(require (planet "instaservlet.ss" ("untyped" "instaservlet.plt" 1))) (define (servlet request) '(html (head (title "It's working!")) (body (h1 "Instaservlet is in the house!")))) (go! servlet)
Try it in PLT Scheme 3.99 and see!
This package arose out of the development work I did on Smut Shorts, which made me I realise we needed to support a quick start for web development. Instaservlet is the first step in doing this. Not only does it setup the servlet, it does it in a robust manner. Continuations are managed using the LRU manager, which can be a bit difficult to setup but it much more robust than the time-out manager. Instaservlet uses some sensible defaults which should work for most small to medium size sites — they're the setting used on Smut Shorts, so we know they can handle a reasonable load. It also sets up a nice default page to handle continuation expiry. Instaservlet is good enough to get you started with, and future versions will enable more customisations so it can scale to any website build using PLT Scheme.
Posted by Noel at 02:43 PM | Comments (0) | TrackBack
February 22, 2008
Naming Your Wireless
From my study I can pick up about six different wireless networks. They all have simple names: the name of the router (good old Belkin54g is always up and always open), the street, the owner. But in West Hollywood that is not the way they roll. How about fuckyougetyourownnetwork, or my favourite, Lesbian_Dildo_Vagina_Party? Is this a cultural thing? In all my time in the UK I've never seen a network with names like those. On the other hand I am pleased to see one of the networks is named after me. What are the networks around you called?
Posted by Noel at 02:14 PM | Comments (3) | TrackBack
February 15, 2008
Requiring up and down syntax levels
If you do any macro programming in PLT Scheme you are sure to run into the dreaded “no #%app syntax transformer is bound” error message at some point. Though puzzling, the fix is actually quite simple in almost all cases. Assuming you're using 3.99, you either need to:
(require (for-syntax scheme/base))(require (for-template scheme/base))
What the error means is that some syntax has expanded in a function application, but #%app, the PLT Scheme primitive that actually handles application, is not bound in the phase in which the syntax is being evaluated. Requiring for-syntax will bind #%app in the phase before the current evaluation phase, while requiring for-template will bind #%app in the phase after. In most cases you want for-syntax. However, if you are writing functions that return syntax that is then inserted into a program (such a function would be required for-syntax elsewhere) you must use the other form, to make sure the syntax has #%app available to it.
Posted by Noel at 10:59 AM | Comments (1) | TrackBack
February 14, 2008
Happy Valentine's from Untyped
For Valentine's Day we have created a new website, Smut Shorts. If you have something to say about love or lust, and can do so in 500 characters or less, then please add it to the growing number of “shorts”. It's anonymous and fun. Just, no porn thanks.
If you're reading this site, you're probably interested in the technical details behind Smut Shorts. It is a collaboration between a number of people, most of whom have chosen to be anonymous. The majority of the coding was done by yours truly, and therefore in Scheme. It is running on the PLT Scheme webserver (version 3.99) and uses PostgreSQL as the back-end. I coded it up in about two days. It was a side-project, so it was a bit of rush job and there is lots still to do. If you break the site let me know and I'll try to fix it.
A few interesting lessons were learned from doing this site. It all comes down to scalability, which is something that has recently been on my mind a lot. In this case we want to scale down to the low end — the guy who is just hacking up something in his spare time and wants to get it done in a hurry. Our frameworks, Snooze and Lylux, are pretty good but they don't support a fast start. You have to create a whole bunch of files before you've even got your first page up. Furthermore, we've always avoided creating a templating mechanism, as we've said that we'd rather use smart people who can balance parens than create this unnecessary divide between designers and programmers. I now recognise this is a mistake. Had we a templating mechanism I could have pushed more design work to my collaborators. It's not that they're stupid (far far from it) but they're busy and don't have time to learn even Scheme basics just so they change a few lines of text. If we're gonna grow the Scheme web-hacking community it has to start with dudes messing around in their spare time, so we need to address the low-end of scale. The high end of scale can wait till the IPO ;-)
Posted by Noel at 01:46 PM | Comments (3) | TrackBack
