Sunday, December 4, 2011

Using native applications remotely

Wouldn't it be nice if you could run applications like OpenOffice in the cloud and access them from anywhere? During the past six month I've created a software solution to access native applications that are running on a remote host.

Loading player...

This demonstration shows a Windows desktop and the windows of OpenOffice. The application is not running on the same local machine, but on a virtual machine in Amazon's Compute Cloud. The user agent running on the Windows machine seamlessly integrates the remote windows to make it feel as if the application was installed locally. Elements like pop-up, menus and tool-tips are all treated as individual windows. They can extend beyond the borders of the window they belong to (go to position 01:02). Remote windows can be moved and positioned arbitrarily and independent of the real application running in the virtual machine, which is a big advantage over traditional remote desktop solutions.

Considering that it is the first version of the system, it already shows a decent performance. The window content's are currently compressed using H264. There are still many features missing and I didn't do any optimization yet. For instance, there is a lot of potential to decrease the latency further.

Let me know what you think.

Thursday, November 17, 2011

UnsatisfiedLinkError Hell

I believe in the last few hours I have been through all possible variations of the dreaded UnsatisfiedLinkError. I build a native library and wanted to integrate it using JNI.

java.lang.UnsatisfiedLinkError: no xxx in java.library.path

This is an easy one. Just set the path of the library in the java.library.path system property and don't add a „lib“ prefix or „.dll“ / „.so“ suffix in the System.loadLibrary call.

java.lang.UnsatisfiedLinkError: xxx.dll: Can't find dependent libraries

This one is a bit trickier. Unfortunately Java doesn't tell what is missing. On Windows use a tool like Dependency Walker to identify what is missing. I also had to load all the dependent libraries with System.loadLibrary calls (in correct order) before loading my own library.

You're likely to hit another problem if you're on Window and build a DLL with Eclipse CDT / Cygwin / minGW. If your code tries to call a native method you get yet another UnsatisfiedLinkError with the name of the native method as the error message. It means that this JNI function was not found in the native library. You have to use the GCC linker flag „-Wl,--kill-at“ to build the DLL in a JNI conform way.

On Linux make sure that you have compiled the library with the -fPIC flag.

Hope that helps someone.

Saturday, September 17, 2011

Embed Image in Google Form

In this post I'll present an easy way how to style a Google Form and embed images.

If you need to conduct an online survey, Google Forms is a great and free alternative to commercial products like surveymonkey. However, the possibilities to style your Google Form are quite limited. In particular, it's not possible to add images.

There are other ways around these limitations using some JavaScript magic as suggested on other blogs. But these tend to break or get rather complicated when form validation is involved or your survey has multiple pages.

This solution uses a simple PHP script, which should run pretty much everywhere. It proxies the requests to Google and makes any changes to the form you'd like to have. Instead of calling the Google Form directly, your visitors have to call the PHP script. As demonstrated here.

To configure the script you only have to add the replacements you like to make in this array.

$replacements = array(
 "<link href='/static/spreadsheets" => "<link href='
 "IMG001" => "<img src=''/>"

In this case, we'll replace the token IMG001 with an image. Done! This also works when form validation is involved or your survey has multiple pages.

The PHP script survey.php (updated version 1.1).

Wednesday, August 10, 2011

NoSQL databases

NoSQL databases have become an interesting alternative to traditional relational databases. This paper (in German) gives an introduction to the topic.

NoSQL-Datenbanken sind zu einer interessanten Alternative zu herkömmlichen Datenbanken geworden. In diesem Paper erkläre ich die dahinter liegenden Konzepte, illustriert an Cassandra und CouchDB. Das Ganze wird abgerundet mit einem Stärken/Schwächen-Vergleich zu den relationalen Datenbanken.

NoSQL-Datenbanken.pdf (in German)

Tuesday, April 5, 2011

Using a properties file in an object-oriented way

The PropertiesTree class allows you to use a properties file in an object-oriented way. It is inspired by Groovy/Grail's config objects but doesn't require Groovy.

For instance, this makes it easy to read a set of properties in a loop. Imagine you like configure a number of data sources and your config file contains this:

You can use your config like this:
PropertiesTree config = ...;

for (PropertiesTree dataSourceConfig : dataSources.getChildNodes()) {
 String url = dataSourceConfig.getLeafValue("url");

PropertiesTree database2settings = config.getNode("dataSources.database2.settings");
System.out.println( database2settings.getLeaves().toString() );

The method getChildNodes() returns a list of child nodes and getLeafValue() or getLeaves() gives you the data of a node.

You can download the class here:

Thursday, January 6, 2011

Travel Blog Software

Heureca, I have published my first open source project! Look here

It's a blogging software designed to write a travel blog. A travel blog that runs everywhere and independent of a commercial service. It's implemented with the Google Web Toolkit (GWT).

Features: What you don't easily get with standard blogging solutions...

  • Runs anywhere. Your blog can be stored on a simple free web space provider or run from your local hard drive (i.e. no application server or database needed)
  • You're not dependent on a commercial service to store your postings, pictures and videos which may shutdown at some point in the future. Your travel experiences will be available forever.
  • You could even burn your blog on DVD!
  • You can store pictures and movies in perfect quality.
  • Google Earth integration! You can store geo coordinates for each blog post. You can then display your journey on a map.
  • Possibility to write private entries which are not visible to anyone (not even the server admin).