Analog clock service for web apps

I’m nowadays working in an international company which has offices in multiple countries. I was looking for a way to get our Confluence, Enterprise Wiki, to display current time in all of our offices in one page. I didn’t find any simple solutions as lots of services just provided me a chunk of HTML that I could add to my page to create a dynamic clock but wiki syntax doesn’t really let me do that.

I’m a great fan of Google Charts API. Developers at Google have developed a really nice URL based API for the charting purposes. This was inspiration for me when I created Clock Service API for my own needs.

Clock Service is a simple servlet implementation that generates an image with the specified parameters. API can be used to define image size (s=100), timezone (tz=zone), title (t=Helsinki) and 12h/24h format (f=24). With this I can use the following URLs to produce three different clock images for three different timezones.

/clockservice/clock?tz=America/New_York&s=150&t=Atlanta&f=12
/clockservice/clock?tz=Europe/Helsinki&s=150&t=Helsinki&f=12
/clockservice/clock?tz=Australia/Sydney&s=150&t=Sydney&f=12

If you use those URLs in IMG tags then the result would look like this:

Clock (Atlanta)Clock (Helsinki)Clock (Sydney)

The images above aren’t created dynamically as I don’t have any public servlet container available.

The code behind the service is really quite simple. There are only two classes ClockServlet and Clock. Servlet implementation is only used for parsing the parameters from the request and writing the bytes from Clock.getImageData(..) to the web response.

Timezones are handled using the Java’s Calendar and TimeZone classes like this:

  1. TimeZone tz = TimeZone.getTimeZone("Europe/Helsinki");
  2. Calendar cal = Calendar.getInstance(tz);
  3. int hour = cal.get(Calendar.HOUR);
  4. int minute = cal.get(Calendar.MINUTE);

You can find the source code and compiled WAR package from the application page, here. Application is distributed under the Apache License v2.0.

Test driving NetBeans IDE 6.1 Beta

I’ve been using NetBeans IDE for quite a few years now. It has improved very nicely over the years and it have became a top player in the IDE field. If you are a Eclipse or IDEA developer I’d suggest you to at least try it out as it is not the same as it was year before.

NetBeans IDE 6.1 Splash Screen

I’m eagerly waiting for the actual release as it is packed with useful features that will truly improve the development flow. Here are some of the features what I’m waiting for the most:

  • JavaScript support with semantic highlighting, code completion, type analysis, quick fixes, semantic checks and refactoring
  • Spring framework support with features such as configuration file support, code completion and hyperlinks to speed navigation
  • New MySQL support in the Database Explorer to make it easier to create, launch and view MySQL databases
  • +lots of other features

See some of the highlights in action after the jump.

Continue reading

Mobile Trail Explorer v1.9

I’m proud to announce the release of Mobile Trail Explorer v1.9. Big thanks for all contributors and team members. This version should fix some of the issues with the Sony Ericsson phones and add bunch of great features such as:

  • Trail is now projected using the mercator projection
  • Both trail and map are now zoomed with same keys (1 and 3)
  • File browser for importing trails and selecting export path
  • Logger can now write to the filesystem
  • Signal strength SNR key to Sky View and updated help screen
  • Change screen on space key as well as 0 key
  • Export and import waypoints

One of the most wanted feature is the support for the internal GPS devices such as Nokia N95 and E90. This is now implemented in this version and it can be activated from the menu:

Settings > Development Menu > Use JSR179 (if available)

It would be great if N95, E90 and other JSR-179 device owners could test out this feature and report how it is working for them. This is something that will get me buying N95 (or N96) if we get it working correctly.

Go ahead and download the latest binaries from here or download the whole source from here. Don’t forget to send your feedback either to this blog post or to the Google Group of Mobile Trail Explorer.икони