الأحد، 28 فبراير 2010

Is it time for a JVM-based web browser?

Figure 1: Screen shot of JWebPane in action (source).



There are currently two exciting platforms for which one can develop:

  • The Java Virtual Machine (JVM). Advantages: Great tools, hosts many languages, lots of free software is available for it (databases, support for many file formats, etc.), supports modularity (OSGi, Jigsaw).

  • The web browser. Advantages: One can quickly try out an application without downloading anything, URLs encode application states and are bookmarkable, the ability to clone application states via tabs, integrates hypermedia and data streams of all kinds.


Then how about combining these two platforms? It seems like a missed opportunity for the JVM that all major browsers now have JITs for JavaScript, but none of them uses the JVM. What would a JVM-based web browser look like?

It would be modular, every aspect of it would be extensible in Java. It would be host to a new kind of web/desktop application hybrid. If the JWebPane technique of porting Webkit to Java2D really works, then it can even provide a perfect web experience (Fig 1, 2). Alas, it has been a long while since there was any news about JWebPane.



Figure 2: JWebPane is a port of Webkit to the JVM (source).


I do realize that applets go a long way in the direction of this vision, but several minor details add up so that one still feels the barrier between Java and the browser. I could never get excited about JavaFX, it always felt like Java was trying to be like Flash. But the idea of a JVM-based web browser, HotJava 2 if you will, does excite me in ways I cannot all explain rationally. I can see myself extending such a browser with many tools and writing all my future applications based on it.



Update 2010-03-02: See my comment below on a refinement of these ideas.

Update 2010-12-15: Oracle has granted my wish and turned JavaFX from a language into a library.

السبت، 27 فبراير 2010

The next generation of web application UI layout

User interface layout has been one of the main challenges that has held web applications back (desktop integration is another one). Especially vertical arrangements such as the following used to be next to impossible: Bars at the top and at the bottom contain widgets that take up minimal height, while the content is displayed at the center and takes up the remaining vertical space. Note that this is trivial to do in desktop GUI frameworks such as Java Swing. Recently, Ajax frameworks have made progress in this regard. Now you can implement the above mentioned scenario, but you have to specify fixed heights for the bars (the screen shot shows this kind of bar at the top of the window and above the email message). A small price to pay, especially as those frameworks do it in pure CSS (=fast). I am aware of three frameworks that perform this kind of magic:


  • Sproutcore: Looks great, JavaScript-centric, borrows patterns from Ruby on Rails (project layout, models) and Cocoa (binding, properties). Sproutcore has a Ruby-based generator for code that makes it easy to get started and is itself easy to install, thanks to Ruby’s Gem packaging mechanism. Sproutcore is used by Apple for MobileMe. Current disadvantages: sparsely documented, relatively slow development turn-around (it takes a while to reload after changes). Demos.


  • Google Web Toolkit (GWT): Java-centric, having a single code base on client and server is priceless, great tooling (Eclipse), fast development turn-around, well documented. The new kind of layout is a feature called “Layout Panels”. GWT is used by Google for Google Wave. Demos.

  • Cappuccino: I have not tried this one out. I’m not sure that having a custom language (Objective-J) on top of JavaScript is the way to go, especially as Sproutcore does most (all?) of what Objective-J is capable of in pure JavaScript. Cappuccino has a cool browser-based IDE and GUI builder called Atlas.


So this makes full-featured web GUIs possible today. Regarding the future, I’ve written a blog post about what CSS might be capable of, one day.



Update 2010-12-13: I’ve heard good things about how Qooxdoo performs layout. Apparently they layout programmatically via JavaScript. This allows them to do more sophisticated things, but it makes layouting a bit slower.



Update 2011-01-24: The ultimate CSS layout spec for webapps

LaTeX, PDF slides, and dual displays

Presentation programs such as Microsoft PowerPoint or Apple Keynote make clever use of the secondary monitor in a dual display setting: For example, if you are using your notebook with a projector, the projector will show the slides, but the notebook will function as a kind of teleprompter, showing the slides plus additional information. This additional information can be notes, the current time, the remaining time (when you specify the maximum duration of a talk), the next slide, etc. This is obviously helps with time management and smooth transitions between slides.

And then there are those of us who use LaTeX to produce PDF files with their slides. I like the fact that I can have a pure PDF work flow (especially handy on Mac OS X with its native PDF support) and that LaTeX is cross-platform (I use Linux at work, Mac OS X at home). The latest TeX Live distributions already come with the Beamer Class which is easy to use, well-documented, and includes several themes. I have yet to discover a program that has as many features as PowerPoint or Keynote, but at least I have found two options for showing the notes in a PDF file on the secondary monitor:

Let me know if there are any other programs.

السبت، 20 فبراير 2010

OpenOffice’s auto-correction madness and how to fix it

I do appreciate having OpenOffice as a free and fairly capable cross-platform alternative to Microsoft Office. But one of its features is a perfect example of why the adjective “intelligent” is mainly used in quotes when writing about office software: auto-correction. It bothers me in two cases:

  • Automatic URL formatting: Type a URL and OpenOffice turns it into a hard-to-edit underlined hyperlink. Fix: Menu command “Tools → AutoCorrect Options...”, tab “Options” lets you switch off “URL Recognition”.


  • Automatic date formatting (in Calc): Type a date as 2010-02-18 and OpenOffice turns it into 02/18/2010. There are two solutions: If you like having a common format for dates, you select the column in question, invoke “Format Cells...” via the context menu, use the “Category” called “Date” and change the format. If you want to input anything without constantly being corrected, use the “Category” called “Text”.