الخميس، 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__) )
}