JSON Visualization

20. June, 2011

If you have some JSON (possibly broken) and need to know how the browser sees it: JSON Visualization


Two Awesome Browser Demos

16. June, 2011

HTML(5) is starting to take off.

aqu4rium is a demo for a GWT based game framework which mimics an older IE9 demo Fishietank. My numbers: 250 fish, ~56FPS, load 0.1.

ro.me is a 3D music video with interactive effects. After the video, you’ll be redirected to a page with lots of technical details, source and example code.


Reading On the Samsung Galaxy II

13. June, 2011

A couple of days ago, I got a new toy: The Samsung Galaxy II. Along came a “readers hub” which I didn’t use. The contract says something about “additional charges might be incurred.” “Might” surely isn’t a word that I like to see close to “money.”

So I got the Amazon Kindle reader for Android. Everything else aside, Amazon is the largest book seller on the planet and the prices are better than anywhere else. Which leads to the question: Are the prices worth it?

On the plus side, reading on the Galaxy II is a nice experience. The text is clear and easy to read. Flipping pages by tapping or swishing over the screen is easy enough. The device is smaller than normal book and the weight is comparable to a 400 page paperback. Since it’s smaller than the book, it’s easier to hold “open” then the book. My fingers are long enough to wrap around the whole backside, so with a bit of strain, I can tap the right side of the screen with my middle finger without moving my hand at all. It shows much less text per page, so you need more tapping but it was very easy to get used to that.

In fact, I completely forget about it. When a piece of the story makes me stop (like “huh? That doesn’t seem to match to what I’ve read before”) and I start to “leaf” back, I’m usually surprised how many “pages” I have to go back to find something I’ve read “just before”.

Another neat gadget is the dictionary. If I press the finger on a word, the dictionary entry for it pop up. Especially useful if your English is as good as mine but not perfect – what was “lambent” again?

On the negative side, with the Kindle and similar tools, I don’t get much for my money. I surely don’t get a book – just the right to read one. Until someone decides different. So to ask a similar price for less service feels like a rip-off. For example, the paperback for David Weber‘s “A Mighty Fortress” costs EUR 5,50. The eBook goes for 5,22. The list price makes it look better: For the paperback, that would be EUR 11,- while the eBook is EUR 8,45 – 23% less.

But that’s without postage and packing and the fact that I get the book right away. So in reality, I get the book for about 40% less and I can get it as soon as I discover it.

But I can’t lend or sell it. Being an author, I usually don’t lend or sell my book, so that’s not a big deal for me. It still irks me. On the other hand, have all my books with me at all times. All of them.

Which leaves the only major drawback: There are two big, competing formats: Kindle and EPUB. And the Kindle doesn’t support EPUB (for obvious reasons). And I’d be surprised if, after one format “won,” you would be allowed to convert all your old books to the new format. OTOH, Amazon isn’t going to drop support for the Kindle format and the EPUB format is open (so anyone can implement a reader), that means your books won’t be worthless.

Until the seller goes bankrupt, of course. Or a lawsuit happens. Or crackers wipe their databases. After that, all your books will be unreadable.


Solutions for Common Xtext Problems

10. June, 2011

Jens von Pilgrim compiled an excellent list of common errors when using Xtext 1 in his blog: When your MWE2 workflow is not working…


Composite Oriented Programming With Qi4j

9. June, 2011

Qi4j LogoComposite oriented programming (COP) addresses one of the short comings of OO: That the meaning of an object depends on the context.

In most OO languages today, it’s hard to change the type of an object. Actually, Object Oriented Programming should be called Class Oriented Programming because the class (the type) is the core feature which we use to build application.

But in the real world, objects can have several types. This isn’t polymorphism. It means that COP allows you use the data in an instance within the context of several classes.

For example, in Java, we have two methods which should be context sensitive: toString() and equals(). When I call toString(), I want a certain conversion but that can change depending on in which context I call it. In a debugger, I might want all fields. In the debug log, I might just want the name. In the UI, I will want a nice, user-configurable conversion.

equals() is a similar beast. Different contexts need different equals() methods that work on the same instance. For example in Hibernate, equals() should use the business key. Which is stupid: As soon as a primary key is assigned to the instance, it would be much faster and precise to use that to check for equality. But if you write a tool to compare graphs, your needs will be vastly different.

DI and IoC tools try to fill the similar gaps: At a certain point in time, your code needs a service and you can’t know ahead of time which implementation will be executing the service. While that works somewhat, it’s just a workaround for a fundamental flaw in todays OO languages: Type rules, instances are part of the problem.

Qi4j tries to solve this fundamental problem. Instead of writing huge classes that do everything, the application is created from small building blocks.

The typical case is names. A lot of instances have a name. Instead of writing this code once and using it everywhere, 10 lines of code are copied into every class: The field definition, getter and setter. And maybe you want to set the name from the constructor, so you need 8 more lines (one default constructor and one with the name parameter).

In Qi4j, you define this once. After that, you just add “extends NamedObject” in all the places where you need it. Almost no duplication. Since NamedObject is just an interface, you can collect several of these building blocks in your entity.


Access WordPress Like a File System

7. June, 2011

With FUSE, it’s pretty simple to access something like a file system.

Joseph Scott wrote a driver for WordPress: pressfs.


Hacking for Humanity

6. June, 2011

Random Hacks of Kindness is an event where hackers (the good guys; what you read in the papers are crackers but journalists usually don’t care) present software that saves lives. Examples include:

  • Android software to mobilize disaster response teams “with possibly unstable network conditions”
  • HelpMe – a guided first aid emergency and calling app” which collects vital information like time, number of injured people, type on injuries. It also gives first aid tips to those at the site.
  • Or how about wheelmap, a site which finds you restaurants or stores that are accessible with a wheelchair.

More Eclipse Projects Moving to Git

6. June, 2011

With Indigo, more Eclipse projects will move to Git.

Kudos go to the Git Task Force.

I’m especially happy that BIRT and the Eclipse platform is on the list.


Googling Stack Traces

4. June, 2011

How often did you run into a problem, googled for it and eventually found a solution because someone else had had the same problem?

In this process, the key issue is to find a good query for Google.

Wouldn’t it be nice if your computer would support you here?

It wouldn’t even be hard to implement: When an error happens, programming languages have context, say, a stack trace. Some programs like the H2 database and Maven already use something like that: Every error message contains a URL where you can find additional information.

So what we would need is a wiki for stack traces.

And a plug-in for our favorite IDE to find similar stack traces in this wiki.

Kudos go to Marcel Bruch for the idea.


Don’t Use Class.forName()

1. June, 2011

If you use Class.forName(), then you should read this: What You Should Know about Class Loaders