Apr 23, 2009

Setting the Locale in the WTK Emulator

Sometimes it is useful to how your MIDlet works with different locale settings. One solution is to install the MIDlet on a phone and change its locale. This should be easy to do on most phones. However it is useful to do this on the emulator as well. This article teach youo how to do it.

You have basically two ways to do this:
  1. Change the locale of your operating system
  2. Change the locale manually in your wireless toolkit.
I have Windows Vista and I have not get the first way to work. There is a dialog called "Regional and Language Options". All the settings are set to Sweden/Swedish, but still the emulator does not change its locale. I have not found out what I am doing wrong. Fortunately the second option is fairly easy to perform.

First you have to find the emulator.properties file. In Sun's Wireless Toolkit this is found in C:\WTK2.5.2\j2mewtk_template\wtklib and in Sony Ericsson SDK it is found in C:\SonyEricsson\JavaME_SDK_CLDC\WTK2\wtklib.

Then you should search for this property:
microedition.locale

In my installation it locked like this:
microedition.locale: en-US

The code consists of two parts; the language code and the country code. These are separated by a dash ('-'). Notice that this is not as in Java SE, where it is separated by and underscore ('_'). The language codes are defined in ISO-639 and the country codes in ISO-3166. In my case I changed it to:
microedition.locale: sv-SE

All you have to do now is to save the file and restart the emulator. Notice that this does not change the locale of the emulator, it only changes what is returned by System.getProperty("microedition.locale"); In my current project we use this to load the correct resources. Thus we need to test how the different strings are looking in different languages and screen resolutions.

Apr 16, 2009

Microlog Recent Updates

It feels like I have spent ages on re-factoring the Microlog code. When I look in the rear mirror I see two things that has caused the slow progress. First of all there has been a lot of hard decisions that has been made. For example, how should the setup of the logging hierarchy work like? Should I use the same approach that is used in Log4j or should I invent a new and clever way? The answer is that I used the Log4j way, but adopted it to Microlog. The second problem has been the lack development time. Not much to say about that, Microlog is a project that I do on my spare time. Last but not least, everythings seems to take more time than originally planned.

But what has happened? The biggest change must be the new configuration. The configuration has been centralized and I use dependency injection to inject my properties into Microlog. The properties are fetched using Microproperties. This is in fact the first project where I have used Microproperties. This is good since I managed to improve the Microproperties source code along the way. I have spent many hours writing tests for the logging hierarchy and improving the code along the way. As always, I have commited the source code very often. As such the code in the source repository is very much in flux. Do not expect the API to be stable for yet a couple of weeks.

The coming days I plan to adopt all the Appender classes to comply to the new configuration. A nice side effect is that the code will be smaller. Also I will test out the HttpAppender. It is implemented as it is now, but not tested against a server. This is a much awaited feature. I am really looking forward to make this code available for all Microlog lovers.

Please be patient! I am certain that the new version of Microlog will be worth waiting for.

Apr 5, 2009

Manifesto for Software Craftmanship

This week I signed the Manifesto for Software Craftsmanship. When I read the book "Software Craftsmanship: The New Imperative", it kind of rocked my world. The book dissects most of the accepted software engineering principles and offers an alternative view. Since I was fostered in the software engineering school, the book questioned all that I believed in. But I really liked the book and its pragmatic view of software development. The manifesto is built on the ideas in the book.

The Manifesto for Software Craftsmanships looks like this:
  • Not only working software,
    but also well-crafted software
  • Not only responding to change,
    but also steadily adding value
  • Not only individuals and interactions,
    but also a community of professionals
  • Not only customer collaboration,
    but also productive partnerships
If you wish to sign the manifest, just visit the homepage. There is also a Software Craftsmanship group at LinkedIn.

What do you think of the manifesto?