Tuesday, August 28, 2012

GWT and lightweight mapping with Leaflet

There is a lot of webmapping toolkits out there.  Some are feature rich, other limited to desktop browser, and very few of them are first class citizens of Google Web Toolkit. Current state of mapping support in Google Web Toolkit is, let us just say, not optimal. Support for Google Maps v2 is marked as as deprecated, and support for Google Maps v3 is still in the works, but not adopted into gwt-google-apis yet. To make things worse, the Google Maps terms of service does not allow you to use third-party base maps without a Google Maps base map also being present. Not good news if you want to implement a transparent mapping solution with offline support.

There are other mapping toolkits for GWT, like gwt-openlayers and gwt-esri, but I wanted something more lightweight and more modern, which also supports mobile devices. One project which stood out of the "mapping-jungle" was Leaflet,

... a modern open-source JavaScript library for mobile-friendly interactive maps. It is developed by Vladimir Agafonkin of CloudMade with a team of dedicated contributors. Weighing just about 27 KB of gzipped JS code, it still has all the features most developers ever need for online maps, while providing a smooth, pleasant user experience.

So I went to it, and made gwt-leaflet, a first class citizen mapping toolkit for GWT. It wraps Leaflet using JSNI and Type Overlays, which expose Leaflet API as Java interfaces and classes. It is still early days, and some work remains before all relevant parts of Leaflet API are exposed in GWT. For the technical inclined readers, I have prepared a short summary at github, which goes a bit further in explaining the technical aspects of the project. The nice map below is the example project running as a Google app at appspot.com.

Saturday, July 7, 2012

Script for installing Oracle JVMs on Linux

Java developers sometimes need to change the default java installation. On Linux this is pretty easy with update-java-alternatives. This however, will only work with JVMs which are registered properly, typically by some linux package manager. Since Canonical no longer supply any packages for Oracle JVMs due to licensing issues, and Oracle does not provide any support for registering their JVMs with update-java-alternatives, I was recently "inspired" to make a script for managing Oracle JVMs on Linux platforms. It should work with all distributions which have bash support, but I have only tested on Ubuntu 12.04 LTS.

The script is named update-oracle-jvm and you can download a self-extracting binary from github. Just follow the instructions and you should be able to install Oracle JVMs with update-java-alternatives support from the command-line fast and reliably. This is a screen bump of the command "update-oracle-jvm -h":

I hope this small contribution make life easier for fellow java developers on linux. If you encounter any bugs, please use the issue system at github and I'll do my best to resolve them in a timely manner.

Tuesday, June 12, 2012

Changing Default Gist Styles

Default Gist styles are not that pretty, and the lack of layout and content options is a bit annoying. Thanks to Joe Petterson, an interaction designer and UI developer at Digital Science, a simple solution to this problem is available, called Pretty-Gist. You can read more about it on Joe's website, or just follow the instruction at github.