February 29, 2004

The Tenant

My friend Adam recently, out of the blue, bought me the DVD of The Tenant. Thanks Adam! I've been re-watching it, and I'm struck again about just how creepy and subtle this movie is.

The first few times I saw it, I just thought of it as a cool psychological horror film. This time, though, I wonder if it's not really about the treatment of immigrants in France (which is notoriously bad). Several times in the movie, the protagonist Trelkovsky is treated with suspicion because he's not French-born, although he is a French citizen. Not only as a tenant, but as a citizen he is obviously expected to not make any noise, and just stay out of sight. Perhaps the way everyone expects him to be like the previous tenant, Simone, is similar to the way everyone expects immigrants to behave like French people, except better.

But I don't want to overanalyze the movie. As for flipping out and imaging people playing soccer with human heads, I can't see any real symbolic significance.

Posted by ahyatt at 08:39 AM | Comments (0)

February 21, 2004

At City Hall

At lunchtime yesterday, I went down to City Hall to see the scene there. Since the city started marrying gay people there last week, there have been a huge turnout of people wanting to get married, and of course the Christian protesters one would expect at such a thing.

When I went there, the first thing I saw was Frank Chu, with his usual sign about the 12 galaxies. I suppose I should have expected it. On the steps of city hall itself, there was a sizable crowd of well-wishers. People honked their support as they drove by. In the middle of the crowd were Christians with huge signs about how homosexuals were going to hell. There was another sign off to the side in support of gay marriage. Whenever a couple came out after getting married, everyone would cheer. There was even a band playing!

Even with the protesters, it was just a great vibe in that place. Everyone was so happy, and the couples coming out had huge smiles. I only hope it can last for a while longer. I have a feeling it will probably end this next week. Although San Francisco supports it, the rest of the state does not, and the rest of the country really doesn't. So I don't know whether I saw the start of gay marriage in this country, or just the first abortive attempt at it. I think that eventually it will be legal, I can only hope it will be soon. But I'm very happy I could see what must be a pivotal moment in the movement. Thank you, Gavin Newsom, and thank you San Francisco!

Posted by ahyatt at 06:49 AM | Comments (0)

February 18, 2004

New food types in San Mateo

Two new types of food in downtown San Mateo recently appeared. The first is Krazy Krepes. A somewhat dorky name, and everyone who hears it thinks it's a chain creperie. But it's the first creperie in downtown San Mateo, maybe the first one in San Mateo at all. If it is, I can't find any evidence of it. I went there with my parents, who were visiting. I got a mushroom crepe, which had cream sauce, and a nice touch of tarragon. It was well made, and delicious.

The other new food type is Korean food. The restaurant Kyoto is now Kyoto Tofu House. Besides their old Japanese menu, they have a Korean menu. It seems that many, if not most Japanese restaurants in the Bay Area are either operated by Koreans or Chinese. At any rate, I had the tofu pot (they also had a small selection of other Korean dishes), which came with all the Korean appetizers one would expect. It was tasty, and spicy (as I ordered it). Although not cheap (it was about $7), the tofu pot and the appetizers added up to a very nice meal. I would go there again, but menu changes like this almost always indicate a restaurant in it's death throws. So try it before it disappears forever.

Posted by ahyatt at 10:17 PM | Comments (0)

February 06, 2004

Mac freezing problem update

My system is still freezing. But evidently I'm not the only one with this problem. It makes me feel a little better. Check the link, I did notice a correlation with some Mac windowing errors (and posted it to the discussion), but what it means I'm not sure yet.

Posted by ahyatt at 07:53 PM | Comments (1)

February 03, 2004

Continuation based web servers

I recently have been experimenting with writing simple applications in continuation based web servers. Continuations are a type of variable in Scheme that stores the state of a thread. They are good match for web servers, since you can use them to write a web application framework in which you can write a web application in a similar way to a normal program. I first read about continuation-based web servers in Paul Graham's article on Building Web Applications in Lisp. Paul Graham's a good salesman. He made it sound very alluring. I had to try it.

So, over the past few months, I have written a version of my personal page in two continuation based web frameworks - Seaside and PLT Scheme.

Seaside runs in Squeak Smalltalk. This is it's whole separate world, which is both good and bad. The good is that a database isn't really needed, you just use Squeak's memory to store everything, and save or load the whole Squeak environment as needed. The bad is that you have to do everything in this environment. No emacs! And you have to use an ugly, confusing GUI that has no relationship to the platform you are running in. And how would one telnet in and edit code? Yuck. But Seaside is a very nice framework. It allows you to embed the results of actions as blocks very naturally right where the controls are. For example a simple counter with plus and minus buttons:

renderContentOn: html
    html heading: count.
    html anchorWithAction: [self increment] text: '++'.
    html space.
    html anchorWithAction: [self decrement] text: '--'.

This makes writing pages very easy. There are problems, though. First of all, the server redirects you to the page with a session parameter. This is extremely ugly. So, if go to: "http://my.site/seaside/links" I get redirected to "http://my.site/seaside/links/@pcAAIJptPXWALgmy/LNsfQyMJ". So a visiting user has to bookmark this ugly URL that encodes a continuation session that almost certainly won't exist by the time the user returns. That's not good. Someone else raised the same point in the Seaside mailing list, and the poorly-thought out answer was "just store all session permanently in memory". That solution isn't very scalable, I'm afraid. The problem is it's hard to write an app that doesn't use sessions in this framework. Stateless communication is the natural state of the web, and therefore what the web does best. Seaside is an interesting framework, very easy to program in, but it needs to be able to do stateless page serving before I could really recommend it.

I also tested out PLT Scheme. According to blogger Bill Clementson, PLT Scheme is the best open source Lisp out. It comes with a continuation based web server. The framework is not really like Seaside. You can't embed actions in the page like you could in Seaside. Instead, you have to handle the responses all at once. The above example would be written something (I haven't tested or even made sure the syntax is correct) like:

(let ([count 0])
  (unit/sig () (import servlet^)
    (let loop ((count count))
         (let ((env (request-bindings 
                     (send/suspend
                      (lambda (k-url)
                        `(html (head (title "Counter"))
                               (body ([bgcolor "white"])
                                     (h1 ,count)
                                     (form ([action ,k-url [method "post"])
                                            (input ([type "submit"] [name "submit"] [value "+"]))
                                            (input ([type "submit"] [name "submit"] [value "-"])))))))))))
           (if (equal? (extract-binding/single 'submit env) "+")
               (loop (+ count 1))
             (loop (- count 1)))))))

A lot more unweildy, to be sure. Macros can help, and I'm thinking of ways to use them in a sensible manner. However, you can don't have to use the continuation-based sessions if you don't want to. I wrote my personal page in PLT Scheme, and didn't use sessions for the user-visible part. There was no point in it, since the interactions were not complex, and I wanted everything bookmarkable. But for my administartion page, it completely uses continuations, and I think the program is better for it. The only issue is that sessions time out, so if I start an administration task, then go and eat lunch, I'll have to restart from the beginning.

For my needs, I like PLT Scheme best, and I think my needs are not different from the normal web programmer's needs. Of course, for high-volume commercial sites, I wouldn't necessarily recommend it until it is a little more hardened. There have been reports of memory leaks. I'd like to make my new PLT Scheme-based personal page available, now I just have to figure out how to do this, since I can't exactly run it on my machine I pay for hosting on.

Posted by ahyatt at 07:59 AM | Comments (4)