September 24th, 2009 by mat.i.am
tagged with development, J2ME, Java, MIDP, mobile
This is going to be a series of articles about things that don’t go smooth when moving from J2SE to developing for J2ME in my case especially MIDP. It’s not intended to blame the guys behind J2ME and the MIDP APIs for what they’ve done – instead it’s intended to be a collection of common problems or traps developers used to J2SE could fall in.
First up: Simple often-used utility functions:
static boolean Boolean.parseBoolean(String s) missing
The lack of this method is really annoying once you have to cope with reading in configuration values. Many of them will be in boolean-like format but you will have no method to parse them into booleans.
A very simple re-write of this method could look like that:
public static boolean parseBoolean(String s) {
return s.equalsIgnoreCase(“true”) || s.equalsIgnoreCase(“yes”);
}
Since it could be so easy to write this function (and Integer.parseInt() still exists which seems more complex to me) I don’t understand why it has not been included.
String[] String.split() missing
Every now and then one will have to parse some input – and this is where split() comes in handy. Would have come. Luckily String.indexOf() exists which allows for the following re-implementation of String.split():
public static String[] split(String source, String separator) {
Vector nodes = new Vector();
int index = source.indexOf(separator);
while(index >= 0) {
nodes.addElement(source.substring(0, index));
source = source.substring(index + separator.length());
index = source.indexOf(separator);
}
nodes.addElement(source);
String[] result = new String[nodes.size()];
if(nodes.size() > 0) {
for(int i = 0; i < nodes.size(); i++) {
result[i] = (String)nodes.elementAt(i);
}
}
return result;
}
All in all this might not sound too bad since both “re-implementations” were pretty easy to write. But: Since Boolean and String are declared abstract you can’t subclass and by that extend those. So you will have to declare a “tool”-class for them – not the most elegant way in my opinion.
So these are methods I think many developers will use very regularly but J2ME/MIDP doesn’t provide them.
Posted in Java, mobile | No Comments »
September 23rd, 2009 by mat.i.am
tagged with Apple, FAIL!
Yesterday there appeared a screenshot containig a nice localization problem in fscklog:

Christian in iTunes 9 - fscklog.com
So what’s the problem: the user who submitted this screenshot is named “Christian” – you’ll see the consequences.
Another cool thing that happened to me:

iTunes 9 Deutschrock-Mix
“Franz Ferdinand” in my “Deutsch-Rock-Mix”? Well, as well as two Rogers don’t make a right – two German names don’t make it German music.
By the way: Genius mixes is really awesome!
Posted in Apple, web | No Comments »
September 22nd, 2009 by mat.i.am
tagged with Android, Blackberry, development, iPhone, Java, mobile
In early September I started working in a new team. The main reason for this step was change itself. Since I’m still in training it’s always great to see something different and new. This helps me complete my picture of software development and also takes me to another company with business processes slightly different from those I’m used to.
I’m still a software developer. But the kind of software I’m developing has changed and so have my experiences and learnings. Of course they did not change completely – but they changed focus. For the last year I’ve mostly been developing server side applications combined with HTML/CSS/JavaScript. Although I would not see them as very large they were certainly more complex and more demanding on hardware than what I’m developing now. That thing which I’m entirely new to is development for mobile. This basically means developing for devices like the iPhone, Blackberry or Android. For me, this is a great opportunity. It’s helping me a lot to fine-tune my programming skills. Here are some examples of things I had already expected and some things I just experienced:
- memory and processing power is so limited compared to desktop or even server environments (iPhone 3G: ~400MHz, 128MB of RAM, no swap! – Desktop: multi-core 1-2GHz, GB’s of RAM)
- (only for the iPhone) memory management can be a tricky if you’ve always been developing in a garbage collected environment like the Java platform
- SDKs like the iPhone SDK or Android SDK rely heavily on software design patterns. A developer using those SDks is at a loss if he’s does not only understand those but is also able to extend and re-use them
There are many things that come with this change for developers. First: one must be very careful with creating objects. Very careful! Even if you’re on platforms like Android or Blackberry which feature Java and by thus automatic Garbage Collection! Every object counts.
Those limitations and the way you deal with them really help developers get more experienced. By that it’s a great deal for both the company and me.
I’m looking forward to what comes next – and rest assured I will keep you updated about any further developments.
Posted in Java, common, development | No Comments »
August 31st, 2009 by mat.i.am
After upgrading this morning to the last major release of Apple’s Mac OS X I decided to share with you what my first impressions of the new system where.
I did an “in-place-upgrade” on my early-2008 MacBook Pro which was previously running Leopard in version 10.5.8. The upgrade took place in about 45 minutes and there were special things to note. This was my first upgrade from one version of Mac OS X to another version and it turned out to be as hassle-free as anything else on this platform. In no way comparable to upgrading Windows.
Let’s break the following down in positive and negative experiences:
Positive:
- My system runs noticeably smoother, not to say “faster” now. Applications like Mail are snappier than ever. Another example would be iTunes: when scrolling through the album artwork everything is now very very smooth. Same with Aperture which now deals with thousands of RAW-shot photos like this was nothing…
- I gained about 12 GB disk space by that installation – pretty well done!
- None of my killer apps was removed or didn’t work. (see below for not so important exceptions)
- Mac OS X now has a default monitor gamma of 2.2 instead of 1.8 in previous versions and though I had already fixed that for myself the colors now look far vibrant than ever
- the upgrade again was a proof of fact that things in “the Mac world” are much easier than anywhere else and I again noticed that I was mostly worrying too much and thinking too complicated about things like upgrading and so on
- lots of little refinements: things like “Put back” in the trash or to know how far Time Machine is with checking what it has to back up (which by the way is done faster than ever before) and many many more that I just have started to discover…
Negative:
- After the upgrade the first thing I noticed was that LittleSnitch was not starting (would have been great to at least be notified that it’s not compatible with Snow Leopard and I have to update it)
- the only peripheral that didn’t work is my ExpressCard-eSATA-adapter which is not so nice because I used this for my backup volume which made it much faster than using USB – and at the moment there is no update of the Mac driver in sight :-(
- all my system alert sounds (which I had always left on the Leopard default) were gone after the upgrade because due to whatever system sounds were enabled but set to zero volume in System Preferences – weird!
- Spotlight had to reindex all of my disk which made it impossible to use it as a program launcher for that 30min. And it has still not gotten that confident at finding my things like the one on Leopard – but this will only take some time.
- the new Cocoa-based Finder is great but sometimes very buggy when dragging items around the place and using the spacebar.
Conclusion
All in all I have to say that the upgrade was worth every cent! For 29€ this is just great.
And from what I experienced with OS upgrades in the past: it’s not usual to have a system that is faster and snappier on less weight (both memory and disk space) when upgrading on the same hardware. But the propably best thing after all is: this release set Mac OS X up for the next years – allowing even more and even cooler features in the future.
Well done Apple!
Posted in Uncategorized | 2 Comments »
August 12th, 2009 by mat.i.am
tagged with development, Eclipse, Grails, Groovy, Java, performance
For a very long time developing Grails applications in Eclipse using the Groovy-Eclipse-Plugin was everything but enjoyable for me. Matthias Käppler summed it up best when he wrote:
Grails and Eclipse: Not So Groovy
In fact I struggled to get the Groovy-Eclipse-Plugin installed those days, and after finally having done that I found out that developing Grails applications in Eclipse was really painful for me.
But now with the first pre-M1 release of the next version of the Groovy-Eclipse plugin many things are better than ever. I finally got around using Grails and Eclipse for some of my projects at work but on the Mac at home I still prefer the combination of TextMate and Console.app. I’m looking forward to the final release which should improve UI performance in Eclipse, especially when using Code Assist.
Posted in Grails, Java, development | No Comments »