الأحد، 30 مايو 2010

Two fun eighties movies

Over the weekend, I watched the following two movies from the eighties:


  • The secret of my success” (1987) with Michael J. Fox and Helen Slater. Plot: Young man uses a trick to make it from mail boy to the top of his company.

  • Working girl” (1988) with Melanie Griffith, Harrison Ford, and Sigourney Weaver. Plot: Very similar to above. This time it is Melanie Griffith as a creative secretary. She finds a way to realize one of her ideas after it almost got stolen.


Both movies are still fun, including the occasional laugh about the hair.

الأحد، 23 مايو 2010

New York City in an alternate universe (photo)




Source: “Other Roads Taken”, click to enlarge

The TV show “Fringe” partly takes place in an alternate universe. One thing that is intriguing about that universe is how the skyline of New York City looks. The still-present Twin Towers are an obvious choice, but the domed skyscraper is especially intriguing. Turns out that this building had been planned for NYC in 1908 by Gaudi. Imagine that. It is called the Grand American Hotel. Fringepedia lists more differences between the universes. Amusing: Alternate universes tend to have Zeppelins in them.



Update 2011-02-22: All posts on Fringe.

الاثنين، 3 مايو 2010

Facebook adopts RDFa

This is a big deal. RDFa allows one to search web pages as if they were databases. Think Google, but with additional options such as: “Show me movies that ...” or “Show me books written by ...” or even “Show me opinions on books written by ...”. With Facebook’s weight behind it, we will hopefully see wider adoption. Publishers that initially support Facebook’s Open Graph standard are IMDb, Microsoft, NHL, Posterous, Rotten Tomatoes, TIME, and Yelp. That already includes quite a bit of useful data. Well, at least as far as movies are concerned.

الأحد، 2 مايو 2010

Running a WAR as a desktop application

If you have written a web application, the next logical step is to make it available offline. The long-term solution is clear: You give your web application an offline mode, which will hopefully be complemented by explicit application management in web browsers. Short- to mid-term, though, that is often not feasible, because the server provides crucial functionality to the client. Thus, I was looking for a different solution.



One option I had seen was Hudson’s self-executable WAR file: When you execute java -jar hudson.war, an embedded web server starts and you can immediately try out Hudson. This approach had two limitations that I didn’t like. First, I wanted my solution to be acceptable for end users, so I wanted a graphical user interface. Second, the embedded web server extracted the WAR file to a temporary directory and did so again for each startup, wasting time. In contrast, my solution does the following things:


  • The application is a JAR file, the WAR is embedded inside. I opted against a single binary for JAR and WAR, because packaging the JAR as a nice desktop application adds platform-specific data, anyway, and makes it often impossible to deploy the result as a WAR.

  • When the JAR starts up, a Swing user interface is shown. If this hasn’t been done before, the WAR file is extracted to a directory next to the JAR file. The idea is that there is a dedicated folder for the application in which the JAR resides. The location of the JAR is determined via this trick. The WAR file (=ZIP format) in the classpath is extracted to the file system using the standard Java API.

  • Next, a web server is started and pointed to the web application directory in the file system (none of the web servers I’ve seen is able to serve a WAR file directly, let alone one that is embedded inside a JAR file). I used Winstone, because it is so small. There are even smaller ones, but those won’t allow you to use servlets. Obviously, any embeddable Java servlet container will do.


  • A button allows the user to open the starting page of the web application in the default web browser. java.awt.Desktop (Java 6) allows you to do this. Currently, localhost and a fixed port is used. In the future, the port should be configurable and one could maybe automatically switch to a different port if the default one is occupied.

  • Finally, I also produced a Mac OS X application. Such an application is a folder with the file name extension “.app” and the JAR file inside. This has the nice side effect of hiding the extracted WAR directory.



This is all there is to it. Now even non-technical end users can try out my web application without having to go through the steps of downloading and installing a web server. You can download the Eclipse project of my implementation (be warned, the code is quite experimental).