الأحد، 27 ديسمبر 2009

Gestural computing: use your hands without touching

Gestural computing could be the answer to adopting multi-touch for desktop computers, where it hasn’t caught on as much as on cell phones. Gestural computing records hand movements in front of your computer. Thus, you don’t have to touch (and smudge) your screen and 3D gestures become possible. Not having to touch means that you don’t have to get as close, which is a good fit for current desktop setups where the monitor stands apart from the keyboard (=your hands). When typing a lot, you can just lift your hand briefly, perform a gesture, and then continue typing. In full gesture mode, you’ll probably look a bit like Tom Cruise in Minority Report (minus the gloves).
As mentioned in the article, touchless operation is a big plus in public spaces where hygiene really matters (just think about all the people touching an ATM screen).

الأحد، 20 ديسمبر 2009

Hated “The Phantom Menace"? Then this video review is for you.

Quoting “The Watcher”:
Finally, I watched this 70-minute critique of "Star Wars" prequel "The Phantom Menace" last night with increasing fascination and delight. It's hilarious, spot-on, perceptive, devastatingly accurate and more than a little surreal. Hey, don't take my word for it -- "Lost" executive producer Damon Lindelof said you should "watch it ALL" and actor/writer Simon Pegg said that it was "amazing." Agreed.
The humor does not always work for me, but it is still fun and makes some very good points.

الخميس، 10 ديسمبر 2009

Furniture for easier relocation

Having recently moved, I’m astonished how painful the process is, even though I don’t have a lot of stuff. There are a few cool ideas out there:



  • Casulo: A design that allows one to fold complete furniture for a small apartment into a compact, relatively small, box. No tools are needed and it is supposed to take about 10 minutes.

  • Furniture made of lightweight building boards: Only the outer hull of these boards is made of timber-derived materials, the inside consists of cardboard. This reduces material consumption by 40%. The reduction in weight is increasingly sought after, because customs have begun to charge by weight and wood is being used for heating and thus becoming more expensive. Lastly, light furniture is now easier to sell, because younger high-tech influenced generations don’t equate “heavy” with “quality”, any more. [Source in German]
    In fact, a study found out that 76% of Germans don’t think that lighter furniture has less quality. But, only 16.6% would buy furniture made partially out of cardboard. Well, I guess, you would have to see such furniture, in order to make a realistic decision. “Cardboard furniture” might conjure up the wrong image. [Source in German]

  • Gube Instant Furniture: Uses building blocks (mainly cubes) to assemble various kinds of furniture configurations. No tools are needed.


Additionally, the increasing popularity and real-world suitability of e-book readers should help with moving. Sometimes I have the feeling that the total weight of my books equals the total weight of the rest of everything I own. Already digitalization has helped me with trimming down: My iMac has replaced my hifi system, my TV, my VCR and my DVD player. And I now could get rid of all of my CDs, should the need arise. (But I’ll be waiting for a file system that corrects errors, until I do that; btrfs is a promising and free candidate.)


Have you heard of other ways of owning less or lighter stuff? Let me know...

السبت، 28 نوفمبر 2009

Christopher Avery on responsibility

Christopher Avery has a nice take on the topic of responsibility:

In his view, if something goes wrong, the mind has several automated responses, none of them completely adequate (in order of increased maturity):

  • Denial

  • Lay blame

  • Justify: Interestingly, he does not think that justifying one's actions is useful and puts this activity in a category similar to laying blame.

  • Shame: Obviously, beating yourself up over something that went wrong is as unproductive as beating someone else up.

  • Obligation: There is a lot of honor in the idea that someone “has” to do something. On the other hand, using the words “have to” (as in “I still have to do the dishes”) automatically creates friction as no one likes to be forced to do something, even by oneself.

Avery suggests that true responsibility goes beyond all these automated responses. One can work towards the goal of responsibility by refusing to accept some of the mind’s simpler answers for a given problem.

Adults must be supervised

This is a photo I made in London:It is obvious what they mean, but I liked the idea of adults having to be supervised by children.

الاثنين، 23 نوفمبر 2009

JavaScript will (probably) be moving forward

A quick recap of JavaScript history: For a long time, ECMAScript 4 was a really feature-rich proposal for a next generation JavaScript. It even included optional typing! Sadly, the involved parties prevented this proposal from ever becoming a standard. Instead ECMAScript “Harmony” was proposed that changed very little so that everyone could agree on it. In order to avoid confusion that proposal was called ECMAScript 5.
In the video “ECMA Harmony and the Future of JavaScript”, Brendan Eich talks about ECMAScript 5 history and possible future features. And this is where it gets interesting. Among the features that might make it are catchalls (functions that supervise how an object is accessed), classes as object facories, concurrency, iterators (to abstract iteration), generators, runtime type-like guards, versioning. Modules are being worked on at commonjs.org, as a library. More on the proposed features can be found at the ECMAScript wiki.

الأحد، 22 نوفمبر 2009

Things I miss most in Java

The following is a list of the language features I miss most when programming Java:



  • Closures: are useful for implementing abstractions that involve behavior. Smalltalk provides ample proof that functions and object-orientation go together well. Instead of giving Java functions as objects, its creators decided to support the encapsulation of behavior via inner classes. At long last, it looks like Java 7 will have closures. They are essentially functions with built-in compatibility with single-method interfaces. Not perfect, but certainly very useful.

  • Modules: are also coming to Java 7. Reinier Zwitserloot has a nice write-up of the rationale and current state of Jigsaw, Java’s module system. It is interesting that one requirement was that module have to cross-cut packages so that the core of Java can be properly modularized.

  • Generators: let one repeatedly invoke a method. The method does not return a value, it yields it. A yielded value is passed to the caller in the same manner as with a return statement. But, the next time the method is invoked, execution continues after the last yield. Thus, a yield suspends method execution, and an invocation resumes it. This helps whenever data has to be computed lazily, on demand and in a piecemeal fashion: (The beginning of) an infinite list can be iterated over by writing a generator with an infinite loop. Tree iterators become trivial to write; one uses a generator and recursion. And so on... Astonishingly, generators are already in an experimental version of the JVM.

  • Mix-ins: are class fragments that can be added to (mixed in) any given class, while defining it. The effect is similar to multiple inheritance, but results in a chain of classes (and not a tree, as with true multiple inheritance). Mix-ins are also sometimes called abstract subclasses, because they are classes whose superclass is left to be filled in. While it doesn’t look like mix-ins will be added to Java anytime soon, they could be simulated by tools as interfaces with implementations: If one attaches method implementations to special mix-in interfaces, those implementations could be automatically added to classes implementing such interfaces. While the compiled code will contain redundancies, the source code won’t and subtyping will work as expected. The attaching could be done by letting an annotation refer to a class.

  • Post-hoc interfaces: Wouldn’t it be nice if one could let a class implement an interface after it has already been defined? After all, one can add new leaves to the inheritance tree, why not new inner nodes? This would give one many of the benefits of duck typing, while keeping compile-time checking.


While other features (such as multiple dispatch and better code browsing) would be nice to have, the above list contains my most urgent wishes for Java.

الخميس، 19 نوفمبر 2009

Java 7 will have closures!

These pages have the details:
  • Closures after all?” is continually updated with new links and information.
  • Gafter’s “Closures for Java” has been updated with the new syntax which closely resembles FCM. Thus, the new closures use FCM syntax and (a simplified version of) Gafter’s type system. Correction: Gafter’s spec was written 2 weeks before Devoxx, as an attempt at a compromise between the competing proposals.
  • Reinier Zwitserloot has more background on how everything came about.
  • Update 2009-11-22: Stephen Colebourne gives an overview of the current situation.
  • Update 2009-12-03: Mark Reinhold posts “Closures for Java: The Q&A”.

السبت، 14 نوفمبر 2009

Mac OS: dim other displays while playing a movie

The scenario is obvious: You occasionally connect a projector to your Mac (be it a notebook or a desktop machine). While projecting a movie, the display of the Mac should be dimmed, in order to not distract from the projection. Luckily, the three most important applications for playing movies now support this feature. They allow one to dim when going into full screen mode:


  • DVD Player: Preferences → Full Screen → Dim other displays while playing


  • QuickTime Player 7 (old): Preferences → Full Screen → Background Color → Show on all displays


  • VLC: Preferences → Video → Black screens in Fullscreen mode (should play everything that QuickTime Player can)


Now, even better would be to let unused displays sleep, but this is definitely good enough. If you encounter a program that does not have this feature, you can use Shades as a work-around.



Update 2010-05-28: QuickTime Player 7 – which still comes with Snow Leopard – has the aforementioned preferences. Alas, the current version of it has not.

الاثنين، 9 نوفمبر 2009

FRITZ!Box: get call notifications on a Mac

The FRITZ!Box DSL modem also connects telephones to an analog line. In such a setting, the nifty Frizzix can be used to receive call notifications on a Mac. All you need to do is install Growl and then run Frizzix. The following image shows a Growl notification being displayed in the lower right corner of the screen. Note that in this case, “Axel Rauschmayer” is the caller (as I’ve called myself with my cell phone).

الأحد، 25 أكتوبر 2009

What does a multi-touch desktop GUI look like?

R. Clayton Miller’s 10/GUI is an interesting look at what multi-touch desktop GUIs might look like. Obstacles are that it's difficult to position large desktop monitors so that one can comfortably touch-use them for extended periods of time; and that using hands to manipulate on-screen objects tends to obstruct the view to them. 10/GUI has two main ideas: First, to use a giant multi-touch track-pad. Second to rethink the window manager. The first idea makes perfect sense. The second idea is neat, but can probably still improved upon. The idea is still that an application should fill out most of the screen. Splitting a screen in half, vertically should work, but more than two partitions don't seem possible. My personal bet would be on 2.5-dimensional zooming user interfaces that restrict navigational movements (to improve usability). Fingers should work well to quickly organize files, documents, windows, etc. Bumptop solves this one aspect neatly. Windows 1, Eclipse, and Windows 7 have some intriguing ideas about how to split screen space between windows.
Interestingly, Apple's notebooks and their multi-touch trackpads are well positioned to implement something similar to 10/GUI. Already, multi-touch gestures for scrolling and zooming make some GUI widgets inefficient and unnecessary.

الثلاثاء، 29 سبتمبر 2009

Canvas-based game: Ajax has come far

The online game “Berts Breakdown” is fun and there is no Flash involved! It is all done via JavaScript and the HTML5 canvas tag. Quite impressive. Warning: Canvas means that this game won’t run on Internet Explorer, only on Firefox and Safari (and possibly on Opera). [Source: Ajaxian]

[Update 2009-12-13] More pure JavaScript games are shown at EffectGames.

الأربعاء، 23 سبتمبر 2009

10Gbps: one cable to rule them all

Intel has just presented a new kind of optical cable technology called “Light Peak”. At 10Gbps it is fast enough to handle any kind of wired data transfer currently in operation: networking, displays, storage, etc. As a bonus, it can transport several protocols at the same time, so multi-function devices only need a single cable (there is no word on whether the cables also carry electricity, though). Lastly, cables can be up to 100m long. Engadget has pictures of the connector which looks suspiciously (and pleasantly) Firewire-like.

Update:Apple dictated Light Peak creation to Intel, could begin migration from other standards as early as 2010”. The headline sums up the article pretty well.

Update 2: A CNET article has more information on Light Peak. Apparently it did not originate at Apple.

Update 2011-02-25: Thunderbolt (code-named Light Peak): an overview

الاثنين، 21 سبتمبر 2009

Clip shows

Every now and then when following a TV series, an awkward kind of episode comes along: a frame story is used—rather heavy-handedly—as an excuse to sum up recent story lines by showing clips from past episodes. After just having watched one too many of those, I googled and found out that this kind of episode has a name, it’s called a “clip show”. The rationale for clip shows is as an introduction for newcomers to a series and to save production costs. A wikipedia article has more on this topic, including some history.

الأحد، 30 أغسطس 2009

A kinder, gentler philosophy of success

This is a great talk on how modern ideas about success put us under a lot of stress. Many of the points the speaker makes is how chance and fortune relativize many of our unforgiving ideals:

  • “Everyone can do anything” has to take into account that while some people do become very successful, it is also highly improbable that you will be one of them. The current prevalence of this idea is directly correlated to equally prevalent low self-esteem.


  • “You are responsible for yourself” puts many people on a constant emotional roller coaster because they own their successes as well as their failures.

  • In middle age England, poor people were considered “unfortunate” (=fortune played a role) whereas nowadays, they are often called “losers”, with far more (negative) personal connotations.

  • Great quote: “A snob is anyone who takes a small part of you and uses it to come to a complete vision of who you are.”

  • The answer to the question “what do you do” will often determine how much you are respected. So it is no surprise that people take career choices very seriously.


Incentives are bad for performance

The talk “The surprising science of motivation” by Dan Pink makes a great case that incentives lead to worse performance for any moderately complicated task. Instead of this (extrinsic) motivation, Pink suggests to encourage intrinsic motivation via: autonomy, mastery (get better at what you do), purpose.



This is similar to the findings reported in the article “Praise Children for Effort, Not Intelligence, Study Says”:

“Praising children's intelligence, far from boosting their self-esteem, encourages them to embrace self-defeating behaviors such as worrying about failure and avoiding risks,” said Dr. Dweck, lead author of the study. “However, when children are taught the value of concentrating, strategizing and working hard when dealing with academic challenges, this encourages them to sustain their motivation, performance and self-esteem.”
Praise of intelligence makes talent and success seem like magic, leading to a defeatist attitude when failing. Praise of effort gives you the feeling that things are fixable.

الجمعة، 28 أغسطس 2009

Resizing the Blogger editor

Update 2010-07-27: This problem is solved by the newest Blogger editor.

I finally found a work-around for one of Blogger's biggest annoyances, the small editor window:

  • This bookmarklet adjusts the editor size to the current size of the browser window.

  • If you add a keyword to the bookmarklet, it does not even have to be directly accessible anywhere: Lifehacker explains the basics of keywords, Mozilla describes the "add a keyword for this search" feature.

    الاثنين، 24 أغسطس 2009

    32bit Java 6 on Mac OS X Snow Leopard

    This is great news and confirms my prior suspicions. Finally, one can safely target Java 6 on the Mac, as I expect PPC Macs to become slowly irrelevant and most users to upgrade to Snow Leopard.

    Update 2009-08-29: We finally have more reliable confirmation that 32bit Macs will be able to run Java 6 on Snow Leopard. This is a big deal and I don’t understand why Apple hasn’t made this more public.

    Update 2009-09-02: More information on this topic, including how-tos for getting Eclipse running with Java 6.

    Update 2010-12-05: Java on Mac OS X Lion: the redux. News on what will happen to Java on Mac OS 10.7.

    الأحد، 23 أغسطس 2009

    A few things that bug me about Blogger

    Update 2009-09-02: The blog post “Best 17+ Blogger Hacks Of All Time” describes work-arounds for some of the complaints listed here.

    Update 2010-07-27: Blog post “The new blogger editor is great”.



    Don’t get me wrong: I love Blogger, otherwise my content wouldn't be here. The web application for managing posts is nearly perfect. But there are a few things that regularly annoy me. I list them in this blog post.

    User interface

    • Resizable editing area: This is the simplest to fix and the most annoying non-feature. Editing long posts becomes quite challenging when the editing area is so small. If you search for this issue on the web, you’ll find that people have been asking for this for quite some time now.

    • Shortcuts: Having shortcut keys to, say, turn text bold speed up editing. If one does it via access keys, it is relatively painless to implement.

    • Navigation: After editing a blog post, it makes most sense to directly return to that blog post (or, even better, to where one invoked editing). Right now, especially because I sometimes publish a post to see what it looks like, I need too many clicks to get where I want to.

    • Make “Edit Posts” more accessible: it is a frequently used feature (much more so than “Settings” or “Layout”).

    • Insert images at the current cursor position: Right now, one usually needs cut and paste to move them to their correct place, because the are always inserted at the top.


    • Smart quotes, smart apostrophes: "smart" turns into “smart” and don't turns into don’t. This would be awfully nice to have, especially if it was configurable for different languages.

    Markup

    • Tables: WYSIWYG editing for tables would be very useful.


    • Nested bullet lists: While nested bullet lists can be overdone, they are necessary, especially for shorter posts that need to be scanned quickly. Indenting an item via tab, outdenting it via shift-tab is how this is typically done.

    • Paragraph styles: pre, headings. pre is especially cumbersome when done directly in HTML, as the “Compose” editor changes pre content in unexpected ways (removes spaces etc.). It is an essential feature when writing about source code. Headings are relatively simple when adding them in HTML (you need to start at h4), but should still be GUI-accessible.

    • Breaking up long posts: Often it is nice to initially show a brief introduction and then continue into the full blog post by following a link. For feeds, having control over where content is broken up is handy, too.

    • Captions for images: With
      figure and legend
      in HTML 5, there will soon be standard markup for this. Blogger can already prepare for this by supporting captions now.


    • Special symbols: →, ⇒ and © come to mind, but there are many others that should be simple to insert.

    • Spoilers: Hiding text and revealing it only on demand is a nice feature for quizzes and such. A work-around is to draw text in white. Then one needs to select it to see it.

    Bugs

    • Special HTML characters: are handled strangely in round trips between “Compose” to “Edit Html”. Sometimes they are escaped, but brackets are not escaped when going from WYSIWYG to HTML and thus cause problems when going back. If one manually escapes angle brackets in HTML, the HTML entities are escaped and show up as ugly HTML code in WYSIWYG mode.


    السبت، 22 أغسطس 2009

    Five cool features of Eclipse 3.5

    (1) Block selection mode: works for cut, copy, and paste.


    (2) Go to the implementation of an interface method (control-click/command-click).

    (3) Better completion of inner interface implementations: When completing an interface such as Runnable, stubs for the methods are created immediately (instead of on demand, via a quick fix, as a second step).
       public static void main(String[] args) {
    new Runnable() {

    public void run() {
    // TODO Auto-generated method stub

    }
    };
    }

    (4) “Invert if” quick fix (when the cursor is on the “if” keyword). Turns
       public static void main(String[] args) {
    if (args.length == 0) {
    System.out.println("Need at least one argument.");
    } else {
    processArguments(args);
    }
    }
    into
       if (args.length != 0) {
    processArguments(args);
    } else {
    System.out.println("Need at least one argument.");
    }

    (5) Improved systrace for inner classes. Completing the word “systrace” inserts a system.out.println() with the name of the current method (if you do println debugging, you’ll always find where the printing happens). Prior to 3.5, this did not work well for inner classes. This has been fixed:
       public static void main(String[] args) {
    new Runnable() {
    public void run() {
    System.out
    .println("SidebarPanel.main(...).new Runnable() {...}.run()");
    }
    };
    }

    [Source of (2) and (4): Philip Mayer]

    الجمعة، 14 أغسطس 2009

    Likes and dislikes about Eclipse E4

    Update 2009-08-22: discovered Java2Script, added an item about it below.

    E4 is the next generation of the Eclipse Rich Client Platform and brings numerous improvements in a bid to stay relevant as a platform. In this post, I’ll first summarize what I have already written on E4 and then make several suggestions as to where I think E4 should be heading. It is an extended version of a comment I added to the artice “Eclipse has a future” which explains what E4 is and how it improves on prior versions. The author finishes with the sentence “I really am psyched!” (regarding Eclipse’s future). I share that excitement, especially after I found out that Eclipse is looking at all kinds of technologies (RAP, Flex, Dojo) for web-enablement.

    What happened so far

    First, a recap of what I’ve already blogged about E4 (directly or indirectly), listed in chronological order:

    More suggestions

    Next, I’ll mention the main things I would tell the Eclipse team were I ever to communicate with them directly. Due to developing Hyena and Facetator, I have experience with the following platforms: Dojo, GWT, Eclipse RCP, jQuery. This puts my in a good position to judge were Eclipse wants to go.
    • GWT: Talk to the GWT people as much as possible. They are doing incredible work, GWT version 2.0 is going to be amazing, also as a platform. They’ve already managed to make web programming in Java more comfortable than web programming in JavaScript. But GWT misses things that Eclipse could provide. I’ll list those things next.
    • Client-side modules: One big thing that GWT is missing and that Eclipse has (via OSGi) is true modularity. Very useful when collaborating with other people on a project. Some kind of client-side modularity mechanism plus server-side modules would result in a great platform. As a starting point, this page surveys existing JavaScript module systems: Spidermonkey, Dojo, etc. Even E4 is mentioned.
    • Browser widgets: Not enough standard widgets is another GWT problem. If GWT had the Eclipse community behind it, I’d suspect that that would quickly change.
    • GUI layout: For SWT browser edition, the thing to watch out for is GUI layout. It is what bothers me most when using GWT. Help is on the way, until then, drawing to Canvas (like Bespin does) is intriguing. Unfortunately, MS Internet Explorer does not support Canvas, yet.
    • More GWT wishes: More of my unfulfilled GWT wishes and a brief overview of 2.0 are posted here.
    • Java2Script: looks like an interesting alternative to GWT that is already Eclipse-based. I’m not too fond of how the widgets look (especially on Mac OS X Firefox). But the technology is sound and the widgets can (and probably should) be replaced by a standard widget toolkit such as Dojo.
    • RAP (a server-based technology that makes it relatively easy to add a web interface to an SWT application) is technically impressive. But the resulting applications are a bit slow, there is a limit of running only one application per browser and server at the same time, and you cannot do browser-only things like offline applications. As you can already guess, I would like E4 to focus on browser-centric technologies like GWT and Bespin and not on server-centric technologies like RAP.
    • Take a look at server-side JavaScript: They are doing exciting stuff such as modules, file system access, and binary data objects.
    • Client-side extensions: I would expect server-side plugins to provide client-side extensions. How can this be done? One possibility is to let the server-side plugin register a JavaScript URL with the server-side framework. This URL is sent to the client which downloads the script and executes it. The script then lets the client-side framework know about its services.

    الخميس، 13 أغسطس 2009

    Check out my link blog

    I often come across interesting web sites for which a whole blog post does not make sense. I will post those to my new link blog.



    Update 2011-02-17: I now publish my links as rauschma, on Twitter. An extra page details other ways of subscribing to things I publish.

    الأربعاء، 12 أغسطس 2009

    Mobile HTML: dial a phone number via a hyperlink

    As HTML5 is becoming a really cool way of developing applications for the major smart mobile platforms (iPhone, Blackberry, Android, Palm Pre, all of them Webkit-based), it would be nice if one could invoke the dialer. It turns out, you already can, via URLs such as tel:+49/89/12345. Dots, slashes and a prefixed plus are all handled corrrectly. SMS URLs and Skype URLs are also possible.

    الأحد، 9 أغسطس 2009

    MVV und MVG fürs Handy

    Es gibt mittlerweile zwei ganz nette mobile Auskünfte für den Nahverkehr in München.
    • www.efa.mobi: Die MVV-Auskunft, mobil.
    • mobil.mvg-live.de: Hier wird angezeigt, welche Verkehrsmittel demnächst an einer bestimmten Haltestelle abfahren. Zeigt leider nicht die S-Bahnen an. Beim MVV gibt es den „Abfahrtsmonitor“, der alles anzeigt.

    السبت، 1 أغسطس 2009

    Two great cross-platform mind-mapping applications

    These two mind-mapping applications are written in Java and thus run on all major operating systems (Mac, Linux, Windows).

    FreeMind

    FreeMind is completely free. It has made some great progress in recent years. Tips:
    • Switch on “Format → Automatic Layout” in the menu bar. It formats the mind map nicely.
    • The default is for nodes to be selected on hover. I prefer having to click to select a node. This behavior can be enabled via “Preferences → Behavior → Selection Method → By Click”.
    • Check out the shortcuts in the “Insert” and “Navigate” menus. They really speed up mind map creation.

    XMind

    XMind has a slick user interface, the basic version is free. Unfortunately, PDF export is a professional feature.

    الخميس، 30 يوليو 2009

    Requirements: RDF and social applications

    Update 2009-08-06: added more information on named graphs, a reference to AliBaba, and a clarification on text handling.

    RDF data is managed in a decentralized manner which makes it ideal for social applications (where many people collaborate). In this post, I've collected requirements for RDF engines on which a social application is to be built. The main features are
    • Named graphs: are supported by almost all RDF engines. They partition the RDF repository. Social applications should authorize access at graph granularity. That way, some graphs can be private and others public. RDF allows one to hide the “seams” between graphs at will. An RDF repository should support this by enabling one to show and hide graphs on the fly, during access. SPARQL and Sesame can both do this. The former by constraining the graph URI, the latter by specifying a set of contexts when invoking RepositoryConnection.getStatements().
    • Distributed version control: provides two abilities. First, versioning is useful for personal use (history, undo) and collaborative use (conflict management, tracking who made what changes). Second, peer-to-peer synchronization is useful for offline use, backup, and collaboration. Pastwatch is an example of very clever (file-based) distributed version control.
    • Text handling: to make long texts that are stored in RDF literals more accessible, one should be able to configure what property values are to be indexed. Ideally, version control would only store changes between versions (as opposed to the complete text). As an alternative to storing the text in the RDF repository, one can let the property point to an external document management system. Still, the necessity for version control remains.
    • Record the author of a statement: so that a social application can track who contributed what.
    Less important features:
    • Support for XML literals in SPARQL
    • Ease of use: should be easy to install and use; should focus on core RDF repository features.
    Three RDF engines come close:
    • Open Anzo: an RDF engine that supports versioning, user-based authentication, and text indexing. Replication is possible, but not in a distributed manner. Open Anzo’s philosophy is very much in line with this post.
    • IBM Semantic Layered Research Platform: does not seem to be updated any more. Poorly documented. I'm not sure if it can do distributed synchronization. Update: This is Open Anzo's precursor (see comments below).
    • OpenLink data spaces: powerful, offers all kinds of import and export services. But the free version does not have replication. I'm not sure how far beyond two-way replication its features go.
    • KiWi (Knowledge in a wiki): an intriguing social content platform that rolls its own RDF engine. Its content model deviates from pure RDF. It also cannot do distributed synchronization. Not publically available, yet.
    • Sesame has a new project called AliBaba that provides repository federation and change logging.
    Related technologies:
    • Changesets: an RDF vocabulary for keeping a history of changes. Useful for exporting data from a repository that supports versioning.

    الأحد، 19 يوليو 2009

    Detexify: draw to find a LaTeX symbol

    LaTeX has to many symbols that finding the right one is difficult. If you cannot put the symbol into words, you cannot Google for it. A while ago, I had an idea for quick lookup: record what typable character a symbol looks like and search for the symbol via the character. Recently, I've stumbled across a solution that is much neater than this: Detexify lets you draw something and then does a search for symbols that look similar. Cool and useful.

    Emacs org-mode: notes, planning, authoring – in plain text

    Emacs contains all kinds of craziness, but this is one of the coolest things I've seen in a long time: org-mode is an Emacs mode that does outlining, planning and authoring, all in plain text. A few of the highlights:


    • Everything is text. This does have disadvantages, but the advantages are obvious: easily exchanged by email, put into version control, a format many applications understand, etc.

    • Outlining

    • Hyperlinks to emails, web pages, files, etc. inside content


    • Meta-data such as tags and dates attached to content


    • Tables: continuously aligns all the cells of a column and can move columns around.


    • Spreadsheets: you can perform calculations in tables


    • Publishing: content can be published as HTML and LaTeX



    Find more information here:

    السبت، 18 يوليو 2009

    CSS layout: soon good enough for GUIs

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





    One of the sore points of Ajax has always been layout: CSS is great for document layout, but sucks at GUI layout. Where Java layout managers such as the grid-based JGoodies FormLayout (PDF) work really well and can do things such as “make this grid cell as narrow as the content allows”, CSS currently needs absolute length specifications. Furthermore, letting an element fill out all of the available space is really tricky, especially when done vertically. Thus it is no wonder that layout was ranked high on the OpenAjax browser wish list. Thankfully, the W3C is hard at work at fixing this problem and it seems that all the major browser vendors are on board (if you look at the editors).


    According to sources of mine, the W3C will try to consolidate these three proposals as much as possible, but might have to keep two, because GUI applications and document layout have such different requirements.

    الجمعة، 17 يوليو 2009

    Eclipse E4 is going even further in the web direction

    The latest version of E4 contains “web components”. It warms my heart that they are using Dojo (=true client-side technology) for some of their experiments. JavaScript OSGi modules also look cool (don’t get too excited, though: they are for server-side JavaScript).
    Update 2009-08-04: Check out SWT Browser edition. Its goal is to enable cross-compilation of SWT applications to something that runs in the browser. Flex cross-compilation is working, other approaches are under investigation.

    الأربعاء، 15 يوليو 2009

    I've found a use for microblogging (Twitter etc.)

    I'm still not sure I entirely understand all the fuss about Twitter. Microblogging feels like an exhibitionist version of cell phone texting: “Look everyone, I'm eating something yummy right now”. It occupies a curious niche between instant messaging, chat rooms, and blogging. But, looking for a good way of blogging links, I've found that it fits my needs perfectly:
    • New entries are simple to create. For link blogs, one only needs a short description and a link.
    • By exporting to RSS or Atom, I can include the link blog in the side bar of my main blog.
    I initially tried Twitter, but it turns URLs into micro-URLs such as http://bit.ly/zd5p0. By introducing another level of indirection, linking becomes a lot more brittle: Should bit.ly ever shut down, all my links would be lost. Thus, I looked at Plurk, but finally decided on FriendFeed, because it does not have a limit on how long one's text can be.

    الأحد، 12 يوليو 2009

    Facetator: simple data publishing (with JSON and jQuery)

    Facetator is an open source tool for publishing lists such as recipes, journal entries, favorite movies. With Facetator, this kind of data is easily browsable (via faceted navigation) and searchable. Because it is a client-only JavaScript application, you don't even need a special server to use it. A demo is online. The JSON data needed by Facetator can be produced programmatically or manually via Hyena.

    Mac OS X tip: upgrade to the latest version of X11

    Apple’s XQuartz is always a few version numbers ahead of the standard Mac OS X version. It pays to upgrade, as the latest version offers more (directly configurable) preferences, mainly for clipboard handling and windowing behavior (clicks etc.).

    Video: Requirements for web applications and GWT

    The video “Google Wave: Powered by Google Web Toolkit” is a great overview of what features web applications need and where GWT currently meets the requirements or soon will.

    Earth is one big ant colony

    The article “Ant mega-colony takes over world” describes how humans helped create one large pan-global ant colony whose scale of world domination is similar to humanity’s. [Source: doggdot.us]

    السبت، 11 يوليو 2009

    Do you need a software license?

    Software licenses are necessary evils in this modern law-driven world. There are two instances where you need to be at least aware of them:
    • As a content producer: You have created a web page or a program and want to make sure that people use it the way you want them to.
    • As a content user: You need a picture for your web site and are not sure where to find one that you are allowed to put online.
    As a content producer, you can choose from an abundance of licenses. They even have names that sound partially familiar: Eclipse Public License, Apache License, BSD License, … But the licenses that are best explained for mere mortals are the Creative Commons Licenses: The summary looks as follows:
    A separate page then explains what the icons mean. The site provides several ways of including a license: as a button for web pages, as a text file for file archives, etc. You can also choose your license in a wizard-style manner.
    An important idea in software licensing is copyleft (the reversed C icon above): You don't exert any copyright over your work, but force derived work to do the same. The latter requirement has led to Microsoft calling copyleft “viral” (a term that has since lost its negative connotation).
    So how about you wanting to use a picture? There, Creative Commons (CC) helps you, too: If you do an advanced search on Flickr, you can choose the CC license a picture should have. The same holds for the search options of Picasa Web Albums (when the results are displayed). I usually link back to the picture page underneath the picture or make the picture itself a hyperlink. Wikipedia pictures also carry a CC license. Lastly, the CC site has a search page to search for liberally licensed content.

    الأربعاء، 8 يوليو 2009

    Beware of Google Groups

    I love the Google Groups user interface: It is easy to understand and you can get started right away (quicker than with all alternatives that I’ve seen so far). It is a great tool whenever teams need to collaborate, because it gives members a choice between RSS, email, and online reading. I’ve used it often when working with groups of students.



    Alas, it also shows Google’s modus operandi of running things on auto-pilot. Almost a year ago, out of the blue, Google Groups banned me from their site. Some kind of automatic trigger went off; I was never given a reason. Now, on one hand, I cannot manage my own groups. On the other hand I cannot access any information stored anywhere in Google Groups. If I’m logged in, that is. Thus, I now use Firefox for browsing the web (where I’m logged into Blogger, Google Calendar, etc.) and Safari (where I’m not logged into any Google web apps) whenever I need to look up information that is stored in Google Groups.



    I did try many things to fix this: I sent an email to the Google accounts help desk, posted in the Google Groups help groups (well, I sent it to my brother who posted it for me) where this is a frequent topic of discussion, even sent a fax to Google headquarters. All to no avail.



    So Google does share a trait that is common in big companies: it does not listen to its customers. Or only when it suits them. Granted, they are popular, have a lot of customers, and are free, but this is still very frustrating. Losing control over one’s own data makes “free” services very expensive.



    Alternatives to Google Groups that I know of:


    Update 2010-12-23: John Resig (creator of jQuery, among other things) writes about why he abandoned Google Groups in “Google Groups is Dead”.

    الجمعة، 3 يوليو 2009

    الخميس، 2 يوليو 2009

    What is the appeal of Ajax and GWT?

    Ajax does have its detractors. Their argument goes as follows: Why reinvent everything that has already been done on the desktop on an inferior platform? I do agree that the attraction of Ajax is subjective (i.e., not based on technological arguments). This is obvious whenever I’m excited about something web-based, show it to non-developer friends and their only reaction is boredom. Then I realize that while I’m excited about what’s possible on the web, they have already seen it on the desktop. But—there are some good arguments in favor of Ajax. My reasoning goes as follows:
    • I love web applications (because I use 3 different computers having data travel with me is great).
    • I’ve always disliked Applets and Flash. With advanced browser use (tabs, drag&drop of links, etc.), anything that is not well integrated feels constricting.
    • Mobile applications: Web applications are currently the best solution if you need something that runs on the smartphone platforms Android, iPhone, Palm Pre, and Blackberry. The browsers of all of these platforms are WebKit-based, making testing less of a chore. Windows Mobile 6 is out there, too, but feels dated now, and I'm not sure how capable its browser is.
    • There is tremendous momentum behind the browser as a platform. New user interface ideas are constantly being tried out, JavaScript is getting really fast, gains lots of APIs (geolocation comes to mind), etc.
    Using GWT to write Ajax applications has the following advantages:
    • Compared to desktop Java: GWT makes programming web applications almost as simple (in some cases simpler) as programming Swing. So why not use it?
    • Compared to other Ajax solutions: GWT has Java's superior tooling, one has a single code base for client and server, and GWT’s compiler produces highly optimized code (due to Java’s static nature).
    [Further reading: “What should be the platform of your next application?”]

    الجمعة، 26 يونيو 2009

    GWT's future: 2.0 and my wishes

    Programming web applications with GWT has been a revelation. Having mature tools and a single code base for client and server is great. In this blog post, we'll first look at the new features of the upcoming version 2.0 of GWT. Then I'll list a few wishes that are still unanswered by 2.0.

    New features in GWT 2.0

    GWT 2.0 has some incredible features in store:
    • In-browser hosted mode: see your hosted mode webapp in a real web browser. This obviates many needs for compilation. Plus both compilation and starting hosted mode will become faster.
    • Developer-guided code splitting: you tell the compiler roughly were to split to lazily load code and the compiler figures out how to package your code.
    • Better layout: the GWT team seems to have worked on better CSS-based layouts. I'll believe it when I see it, but if this works, it will fix one of the biggest Ajax problems.
    Get more details about GWT 2.0 at “GWT Can Do What?! A Preview of Google Web Toolkit 2.0”.

    Open wishes

    Alas, a few of my wishes are still unfulfilled. I've collected them below, they are the result of my experiences while implementing Hyena. If all of these wishes were to come true, then this would make web applications true competitors to desktop applications (well, one would still have to figure out packaging and access to desktop features; Trephine is very useful here, but an even cleaner solution would be nice).
    Platform
    • Server-side image generation: generate a JPG, PNG or SVG image on the server, send it to the client, display it in an image. Right now, the work-around is to use a data: URL with base-64 encoded binary data and assign it to an image. But that wastes space and does not work with SVG in a cross-browser fashion.
    • @Ignore annotation for methods: This would mark server-only methods and prevent client-side code from being generated. The current work-around is to move server-only code to static methods in a different class.
    • Swapping a server-only implementation of an interface with a client-side place holder: With custom field serializers you can control how a class is serialized but not what class is instantiated. This is a problem whenever you have a nested data structure that contains server-only implementations. I currently do my own reflection-based traversal and swap implementations to solve this problem (directed by annotations). Hardly a simple solution.
    • True dynamic loading of client-side GWT code: would be the perfect client-side complement to server-side OSGi modules. Then OSGi modules (or even just plug-in JARs) could bring their own client-side code. Currently this does not work, because GWT always compiles the reachable code of all used modules into a single monolithic "binary". The kind of code splitting that is planned for GWT 2.0 seems to be almost there, but serves a different purpose.
    • GWT API for Bespin's widget library: This widget library is completely drawn by JavaScript in the canvas tag. Sounds crazy, works really well, because JavaScript has gotten so fast.
    Language
    • Full client-side regular expressions (preferably with an API that works server-side, too).
    • Non-static GWT.create(): It would be nice if class objects could be sent to the client for instantiation. Currently, the only work-around is to register serializable factories (that actually do the instantiation, statically) and send those to the client.
    • String.format(): is useful, easy to implement, and should work on the client.
    • Class.getSimpleName(): same as above.
    GUI
    • Better layout: Hopefully GWT 2.0 delivers on this front. What I miss is to be able to specify “take up as little space as possible” (as opposed to * or fixed spaces). Vertical spacing is often tricky, too.
    • Better widgets: The scarcity of widgets is still one of GWT's weak spots. Mappings to JavaScript widget libraries are possible, but then one does not profit from GWT's small code size. A few widgets I'd like to see are:
      • A more flexible suggest box (that can make suggestions anywhere and has a configurable trigger character; both things are relatively easy to add to the current suggest box).
      • A tab bar where one can add widgets to the right of the tabs (right-justified).
      • A span-based HTML widget.
      • Tables: a table that can be translated back to a model (with the incubator's ScrollTable, row numbers change when sorting), a table with grouping (see SmartGwt), and a tree table.
      • More events: an OnEnterKey event for TextBox and onChange events that are fired whenever a change happens; not just when un-focusing a TextBox or TextArea.

    الأحد، 21 يونيو 2009

    I think I figured out Apple's Java 6 strategy

    Apple has been really negligent with Java: First there wasn't a Java 6 for ages, then it only ran on 64 bit machines. And while all current Macs are 64bit, this excludes a lot of Intel Macs. Thus, targetting Java 6 on the Mac was not practical. Fortunately, one of the WWDC 2009 sessions was “Java 6 on Snow Leopard”:
    As Snow Leopard moves to Java 6, learn modern techniques for the best possible Mac experience while maintaining cross-platform compatibility using the latest version of Java. Find out how Mac OS X continues to build on its strong Java support with new UI enhancements, new APIs, and a next-generation Java Applet browser plug-in.
    Now I think I understand Apple's Java 6 strategy:
    • Don't support PowerPC, ever.
    • Initially support Java 6 as quickly as possible on currently sold Macs (with the limited resources Apple has allocated to Java). This meant support for 64bit Intel only.
    • Eventually support all Intel Macs. Well, at least I don't see any other way of interpreting the WWDC session (if Java 6 is standard on Snow Leopard and Snow Leopard runs on all Intel Macs...).
    And while I'm still underwhelmed, this is acceptable. What is not acceptable is not having communicated this strategy for years.

    الاثنين، 8 يونيو 2009

    JavaFX authoring tool

    The blog post “JavaFX Authoring tool demo at JavaOne 2009 (with video)” shows two videos of a prototype of the JavaFX authoring tool in action. Very nice, the binding stuff reminds me a bit of the Mac OS X interface builder. I still wonder though, how useful binding is in multi-threaded settings.

    الجمعة، 5 يونيو 2009

    Microsoft and netbooks

    The same old anti-competitive tactics: Microsoft strikes back at Linux netbook push. Sad, really. And all that while they have a reasonably strong offering with Windows 7 and it's not clear how much mainstream appeal Linux will ever have (I've heard good things about the latest Ubuntu, though). [Source: dzone.com]

    الأربعاء، 27 مايو 2009

    Eclipse E4 is getting interesting

    I initially was very sceptical of Eclipse E4: in a lot of ways it smelled like design by committee. Eclipse's main problem has always been its heavy coding style (factories everywhere, downcasts, code snippets that expose the innards of the platform, hard-to-reach service objects, etc.) and it seemed like E4 was continuing that trend.
    Thankfully, the latest information on E4 paints a more positive picture:
    • I have been thinking a lot about how to write applications that work well as both web applications and as desktop applications. E4 is trying to go in the direction of a universal platform. I used to think that this was just a gimmick (as most multi-target GUIs, that I've seen, are), based on their preference of RAP. But it turns out that they are considering all kinds of options, including GWT, Bespin, and Flex.
    • The E4 team also reported that, when cross-compiling to other platforms, the snippets are a major hindrance and thus will probably go away in the long run.
    • They really seem to be eager to remove some of the cruft. For example, dependency injection is going to work wonders for discoverability of the API.
    More information:

    الجمعة، 1 مايو 2009

    Multiple dispatch: a fix for some problems of single dispatch (Java etc.)

    Almost all well-known object oriented languages (Java, C#, JavaScript, Python, Ruby, ...) have single dispatch: Methods are chosen depending on the (single) receiver of a message. On the other hand, there is multiple dispatch which is an interesting mix of functional method selection with mutable state. It is used in less-known object-oriented languages such as Common Lisp.



    In this article, we'll first look at Java's single dispatch and Java's overloading and then use what we have learned to understand multiple dispatch and how it solves some design dilemmas that can't be solved with single dispatch.



    Let's start with dynamic dispatch:

        public class Empty extends Object {

    @Override
    public String toString() {
    return "Empty";
    }

    public static void main(String[] args) {
    Object empty = new Empty();
    System.out.println(empty.toString());
    }
    }



    What is the output of this program? It is “Empty”. If this seems obvious, it is because you are already very familiar with dynamic dispatch: Java determines at runtime what class an instance belongs to and chooses the appropriate, possibly overridden, method. For the example above, this means that we don't use the toString() method from class Object, but the toString() method from class Empty. In some languages, such as C++, you have to explicitly state that you want dynamic dispatch.



    Now on to overloading, another way of picking a method implementation.

        public class Printer {
    public void print(String str) {
    System.out.println("String: "+str);
    }
    public void print(Object obj) {
    System.out.println("Object: "+obj);
    }
    public static void main(String[] args) {
    Object obj = "abc";
    new Printer().print(obj);
    }
    }

    Here the output is “Object: abc”. The method implementation is chosen statically, at compile time: Internally, the compiler uses the static types of the method arguments to disambiguate the method names. This time, the result is unexpected, even really good Java programmers that I've asked get it wrong. Due to dynamic dispatch feeling so natural for the receiver of a message (=“this”), we expect it to work the same for the arguments. There is a kind of asymmetry between the receiver and the arguments of a method and that asymmetry is reflected in the invocation syntax, too.



    With multiple dispatch, methods become top-level constructs. This is similar to implementing a single dispatch method “foo” with two arguments as a static method:

        public static void foo(this, arg1, arg2) {
    if (this instanceof A) {
    ...
    } else if (this instanceof B) {
    ...
    } ...
    }

    The message receiver “this” becomes just another argument and all variations of the method are united in a single place (having this kind of view on a method helps with understanding implementations that use polymorphism, but I digress). Instead of the myObj.foo(x,y) you now invoke foo as foo(myObj,x,y). This is still single dispatch. Multiple dispatch nests instance-of checks for arg1 and arg2 inside the checks for “this”. Only after checking the types of all arguments do we decide which variation of the method to use. Common Lisp calls foo a generic function and the code snippets inside it methods.



    Note that the if statements were for illustration only, languages with multiple dispatch have efficient algorithms for performing the checks and selecting a method.



    What advantages does this have?



    A generic function can “belong” to several classes. This helps whenever method arguments are not true parameters (data), but rather collaborators (that offer services) for an algorithm. For example, if you have a method Database.export(Filesystem,UserFeedback), this method might contain as many Database invocations as Filesystem invocations. The special case of binary operators as methods exhibits the same difficulty: Should the operator “String + Integer” be considered part of class Integer or part of class String? It is for a reason that UML has special diagrams for collaborations and that these diagrams cross-cut classes.



    One more example of collaborating objects is the visitor pattern: It is a clumsy simulation of multiple dispatch with single dispatch. What you have at its core is the object for the algorithm collaborating with the object for the data. With multiple dispatch, things are much simpler, there is less code to write and the data objects do not have to be prepared for visitors. Interestingly, even the explicit object for the algorithm disappears, because the generic function replaces it.



    Another area where the asymmetry of single dispatch shows is with the null value. For example, "abc".equals(null) is OK while null.equals("abc") causes an exception (and is not even directly syntactically correct). If you introduce null checks as selection criterion for methods, then handling null values is simple with multiple dispatch.



    Extending a class is trivial with multiple dispatch, just create a new generic function that accepts instances of that class as its argument. With Java, people often overlook external static methods that actually extend a given class, because they don't know where to look. For example, if you don't know Java well, you might be puzzled as to why List has no sort() method. If you do, you know that the class Collections has a static method sort(List) that you have to use. In languages with multiple dispatch, one already assumes that in general, a generic function is relevant for several classes. The development tools help one with finding all functions that apply to a given class, making sure that code is re-used instead of re-invented.



    Having code tightly integrated with the data is less desirable in settings where you serialize objects. With generic functions, code and data are separate and it is easier to use the same data structures on the server and the client. The server can host a lot of code that generates or modifies data. The client only has to display the data and lets the server handle the more complicated stuff. This is a frequent scenario when doing client-server communication with the Google Web Toolkit. As Java does not have generic functions, the server-only functionality has to be moved to external static helper methods. Consequently, things are even less encapsulated, slightly messy and one loses polymorphism.



    Predicate dispatch



    A generalization of multiple dispatch is predicate dispatch. With multiple dispatch, the methods of a function are selected based on the types of the arguments. With predicate dispatch, more complex conditions can be specified. This simplifies changing the behavior of an instance depending on its state and obviates the need for the strategy pattern. For example: Let's assume that an instance of class Bar has to behave differently if an error flag is set to true. The relevant generic functions will contain one method that is invoked if the flag is true and another one if the flag is false. Attached to the first method is an explicit selection condition such as myBar.error. The second method has a condition such as !myBar.error. These selection conditions are additional ways of classifying instances. One could say that myBar changes its class depending on the value of its field error.



    Conclusion



    We have seen that multiple dispatch can do several things that single dispatch can't. But I think that both are complementary. Message passing is a nice and clean metaphor for method invocation that works well with distributed computing. It views objects as components that provide services. On the other hand, objects-as-data result in phenomena (binary operators etc.) that are best implemented with multiple dispatch.


    Further reading



    The basics in depth




    Advanced topics




    Languages close to Java with multiple dispatch


    Breathing and the sympathetic nervous system

    The “Alignment Yoga” blog has a nice article on breathing and how it relates to the sympathetic nervous system.

    الخميس، 30 أبريل 2009

    Live augmented reality and card tricks

    Nicely done. A guy performs card tricks and enhances them visually with live special effects. And you can see that he is having fun while doing so.



    [Source: Engadget]

    الأربعاء، 29 أبريل 2009

    Taskfox: a GUI command line for the web

    The idea of GUI command lines is cool: you have a text field where you enter textual commands with your keyboard. The results are displayed as a graphical user interface with buttons, images, etc. This is fast, because typing is usually quicker than clicking; it scales well, because one does not have the commands to make them accessible; and it is easy to discover the available functionality, because one can use the GUI to show possible completions for what has been entered already, or to browse the commands by category etc.
    These GUI command lines have a long history whose examples include Emacs, Oberon, and Quicksilver. The latest ideas come from Mozilla: Taskfox is a GUI command line for Firefox. If you want to find out more, I recommend a video introducing Taskfox and the Taskfox home page.

    Jamendo and Podiobooks: free audio content

    For private users, listening to the music on Jamendo and downloading it is free, for commercial users (restaurants, video content producers), it is an interesting alternative to the GEMA rights management association. Artists that put their content on Jamendo have no up-front costs (which makes it very appealing for less popular artists) and their contract is non-exclusive, they are free to persue other revenue streams. Artists and Jamendo make money in several ways:
    • Commercial use: Jamendo gets 50% (which is relatively high, but no up-front costs and non-exclusivity often make it worth it). Note that if a commercial user wants popular hits, she still has to turn to the more expensive GEMA in Germany.
    • Donations: Jamendo gets 50 cents (Euro) per transaction.
    • Advertising in audio streams and on web pages: the artist gets 50% (this is a new revenue stream for artists).
    Related: Podiobooks hosts free audio books.

    السبت، 18 أبريل 2009

    Analog clock that adapts to daylight savings time

    Even though this design is not too practical, I still like the idea: Tilt the clock to switch daylight savings time on and off. Without having to change the hand. After reading the comments at Engadget, one additional drawback (apart from the missing hour numbers) became clear: the clock changes 1 hour plus/minus 5 minutes, not 1 hour when tilted.

    [via Engadget]



    Flattr

    الجمعة، 10 أبريل 2009

    What should be the platform of your next application?

    I'm currently thinking about the next steps for my information manager Hyena. It exists in two versions, as an Eclipse plugin and as a GWT-based web application. Having to maintain two versions is a major burden, so I've been thinking: What would would be the ideal platform on which to base one's application?

    My wishes for such a platform are as follows:

    • Simple deployment: Nothing beats pure webapps in this regard. Having a webapp available everywhere is cool, too.

    • Extensibility: For larger applications, if you want someone to code new functionality, doing it as a plugin is very elegant.

    • Development tools: With inadequate tools, implementing and maintaining an application becomes much more work. It should be easy to find one's way around a platform and source code should be easy to change and navigate.


    Technology-wise, times have never been better for developers. A lot of exciting stuff is available, for free:

    • Eclipse: I love its GUI (which is remarkably clean considering how much functionality it has), but am not too fond of its innards. They always felt harder to understand than necessary, slightly overengineered, and include anti-patterns that make it difficult to discover things (see “Eclipse 4 wishes: simplification first, then innovation”). I'm also not sure that the pride of amassing frameworks serves Eclipse well. This leads to design by committee, instead of a single tight overarching vision. Lastly, Eclipse seems to pin its hopes for web enabledness on RAP (or something like it). What I've seen so far of RAP did not instill confidence: It is slow, its UI awkward, and it will never work in offline mode.


    • OSGi: Very useful and powerful if you need extensible software. Still a bit complex but that will hopefully change as it finds its way into the Java language.


    • GWT: I was long very sceptical and wrote my own JavaScript, but now I am a convert, because having a single language and the power of the Java tools leads to a lot of productivity. Even though writing GUIs with GWT is almost as simple as with, say, Java Swing, one problem remains: layout. Many things that are easy in Swing or SWT are difficult or impossible in a browser.

    • DWR: Nicely done. But I've tried it (together with Dojo) and maintaining two code bases (client + server) is not much fun. Plus, JavaScript development tools are not yet at the level of the Java tooling.

    • Appcelerator: Intriguing option for turning a web application into a desktop application. I'm not sure coding the UI and the application in two different, usually not well integrated languages works. Thus, I can imagine using it with GWT or with JavaScript.

    • Trephine: Brings desktop features such as the clipboard or file system access to web applications via a small signed Java applet.


    • Bespin: Ajax application that draws its own UI via the canvas API (see picture below). Very impressive and indicative of web browsers soon being superior deployment platforms. I would also assume that by being canvas-based, rendering and UI differences between browsers are less of an issue.




    So where does that leave one when writing the next application that should be web-deployable? I see the following options:



    • GWT plus


    • Running GWT on OSGi could deliver extensibility, but I'm not sure how well the client side could be extended, since GWT cannot currently dynamically instantiate classes. GWT.create() only works statically. That means that plugins cannot contribute code to the client side of a GWT application.


    • Pure JavaScript: That is client-side JavaScript and server-side JavaScript. Currently, neither language nor tools nor (non-canvas) browser-based UIs are there yet. But they probably will be eventually.

    • Applets, Flex, Silverlight: either don't integrate well with web browsers or have inadequate development tools or don't integrate well with web servers (meaning that it is useful if server and client can share data structures easily, having to define the same class and/or tool functions twice is unnecessary overhead).

    Other inspiring technologies that are interesting, but not (yet) relevant for me:

    • Newspeak: Takes discoverability and clean but powerful language design to a whole new level.


    • Lively Kernel: Sun Lab's go at a pure JavaScript runtime environment. Still feels a bit strange to use and I'm not sure about their server story. But a cool project none the less.

    • Mobile webapps: When it comes to mobile devices, the predominant browser is Webkit, so it is really easy to write cross-platform applications as webapps there. Google leads the way via its mobile versions of GMail and GCal.

    Am I missing something? Did I misjudge some of the technologies?



    Related reading:

    السبت، 28 مارس 2009

    Unit testing with Eclipse and converting a Map to String

    When testing with JUnit, one often has to compare the expected result of a computation with the actual result. A convenient way of doing this is to turn the actual result into a string and then compare two strings. On one hand, the convenience is because converting the actual result to string is often simpler than constructing an object for the expected result (the final decision between these two options depends on which one of the two has applications beyond unit testing). On the other hand, Eclipse helps with string comparisons in two ways:
    • Preference “Java → Editor → Typing → Escape text when pasting into a string literal”: Allows one to quickly turn blocks of text into Java string literals for the expected result.
    • Built-in diff for assertEquals(): If assertEquals() fails for two strings, Eclipse shows a nice diff of the results. This makes it easy to figure out what went wrong.
    Obviously, the output has to be deterministic which is a problem for, say, HashMaps. With this motivation in mind, now a question: What is the quickest way of turning a Map into a string where the keys are sorted?
        public static <K extends Comparable<? super K>, V> String toStringSorted(
    Map<K, V> map) {
    return new TreeMap<K, V>(map).toString();
    }
    Select the text between the braces to make it visible.

    الجمعة، 20 مارس 2009

    Proposed features for SPARQL

    The W3C has published a wiki page with proposed features for the RDF query language SPARQL. My favorite is “Parameterized Inference”: I've always found how inference is done in RDFS and OWL very cumbersome (i.e. by creating statements). My needs for inference have always been very basic, but just having transitivity available directly in SPARQL would be great.
    Other interesting proposals:
    I am missing two things:
    • A way to get matches that are only in the default graph. One can do graph-based restriction, but only for named graphs. That is, the variable involved in the GRAPH construct always has to be bound. A work-around that I use in Hyena is to look for matches in all graphs and then exclude a match if it also appears in a named graph.
    • A more object-oriented way of returning query results. That is, one should be able to return one resource per row, where some columns (“all values of rdf:type”) contain multiple values (are in non-first normal form). LIMIT per resource mentions this feature, but does not go into detail.
    Update: To clarify the work-around.
    Query: all subjects that *only* exist in the default graph.
    SELECT DISTINCT ?subj
    WHERE {
    ?subj ?pred ?obj .
    OPTIONAL {
    GRAPH ?__graph__ {
    ?subj ?pred ?obj .
    }
    }
    FILTER( !bound(?__graph__) )
    }
    A simpler version would be (where one does not have to write the same pattern twice which quickly becomes cumbersome with larger patterns):
    SELECT DISTINCT ?subj
    WHERE {
    GRAPH ?__graph__ { ?subj ?pred ?obj . }
    FILTER( !bound(?__graph__) )
    }

    الثلاثاء، 17 مارس 2009

    Thunderbird, Mac OS X, and vCards

    IMAP problems forced me to temporarily switch from Apple's Mail.app to Mozilla Thunderbird (at work, I use it all the time under Linux). Trying to get my Mac OS X address book contacts into it, I did some research:
    • Thunderbird 3.1 Beta supports the Mac OS X address book.
    • The extension MoreFunctionsForAddressBook can import vCards into the Thunderbird address book (and you can select multiple Address Book entries and export them as a .vcard file).
    Alas, Mail.app still does not support tagging. It would be nice to have an interoperable standard here (GMail's labels are implemented differently from Thunderbird's tags).