Developing J2ME on Apple OSX

April 30th, 2008

Recently, we started a small mobile programming project with my colleague. We both have Intel based MacBooks, and we were willing to use these for J2ME development. However, a SUN Wireless Tool Kit (WTK) is not supported for Darwin platform. After some Googleing, I found from Javablog a tutorial on how to develop J2ME on OSX. Below is a screen shot showing an J2ME application running on my MacBook.

Microemulator on OSX 

The first experiences were all positive, and Antenna tasks were straightforward to set up by following the tutorial. However, be warned, the emulator does not correctly implement the HTTP(S) Connection as defined in JSR-118 MIDP API. Even the HTTPConnection of J2ME should not do automatic redirects, running our code did some redirecting on Microemulator. This may not be major issue for simple development, but forced us to continue development on Linux using SUN’s WTK where the HTTP connections worked as expected.

N800 Flash Storage Performance Revisited

February 1st, 2008

Inspired  by some visibility in storagemojo.com, I decided to provide some more plots on the Flash storage performance.

Thanks for many comments.We begin our observations on measuring the write performance by Nokia N800 on its Flash storage device. The data is written and read on blocks of 512 bytes, to achieve good performance. This time I decided to use standard Linux tools for the benchmarking. 

n800 write performance  

So, the first observation is that we achieve write performance close to 1Mbit/s for small (less than 1 MB) files. In the write performance test the Linux command dd was used to copy files from /dev/urandom to a destination file in the Flash storage. The operation was timed by using /usr/bin/time, since the default dd command on N800 did not provide timing statistics.

n800 read performance  

The above figure shows the read performance from the N800 Internet tablet. For the read test I used dd to transfer data from a file on the Flash storage to /dev/null. Now we can see that the read bandwidth is in the order of 250 Mbit/s.So what can we conclude from the graphs. We are looking on just a single device, and especially a mobile device where the processing power of the device may prevent us from achieving the highest performance provided by the Flash storage. So the results are not very generic. Also, the read performance is much better than for writing and is certainly enough to play movies. The write performance instead, is poor and would not allow the user to receive large files with the full bandwidth achievable by the device’s WLAN.For now, this should be it for the N800 benchmarking, since we have already the great new N810 at hand.

Flashing N810 with OSX

January 22nd, 2008

The new N810 which I got last week, could not install Skype application because of some old Hildon libraries. So re-installing the operating system on N810 was needed.

To flash the OS on Intel based MacBook, you can still use the old flasher application available here. Then you should follow the N810 instructions form here. With one exception, there is a trick on the order of doing the stuff. First, connect the USB. At this point, change execution rights for the flasher, enter the command to start the flasher as sudo (either sudo su, or do something as sudo, so that you won’t need to stop to type the password later when there is only seconds of time to act). Now, enter the command and be ready to hit the “Enter” (but do not hit it yet). Now plug the power cable to start the N810, and when you will see the USB logo in the N810 hit the enter. You see the flasher to complete and you are done - have fun!

New Nokia N810 - First Experiences

January 22nd, 2008

Hmm, away from blogging for a while. Just got my brand new Nokia N810 last Friday. Waiting to get developing on the gadget. The first impressions are that THIS IS THE PRODUCT. The gadget arrived with very nice packaging. Pulling the nicely finished aluminum chassis out from the leather pocket gave luxurious feeling. The user interface was superb. All-in-all, the first impression is that this is the travel replacement for your laptop. In addition, the N810 makes the older N800 look like a prototype, including the protecting pocket which has changed from the cheap fabric to nice leather. And the maps are Terrific!

The evolution from N770 to N810 via N800 illustrates nicely how to make a consumer product.

However, the manufacturer has still something to improve. Trying to start the Skype application resulted in information which leas to firmware update (some Hildon framework libs are not anymore compatible with the latest Skype.). This kind of “need to do some hacking” stuff should not appear when you pull out your new shiny device from the nicely finished box.

And final notes: My PSU (thermaltake 420W) blew up during the Christmas holiday, and I am waiting for the replacement to arrive. After, the benchmarks on Flash performance will be published. This time I used real *nix kin of methods (/usr/bin/time, /dd, and like) to do the measurements. Let’s get back…

Flash Storage Performance on a Mobile Device

October 25th, 2007

I have been following writings on flash storage performance from storagemojo blog. Now, that I had a little time to sit down and a Nokia N800 at hand it was time to do a small experiment. I ran some benchmarks with a Java program that creates random data (in chunks of kilobyte) and writes the data to a file. For comparison I ran the same program with the cheapest Intel based MacBook available using Java 1.4. I used the same source level and the same Java binary that I used on N800 running Java CDC.

So, the comparison does not measure only storage performance, but also Java. Anyways, storage performance counts often only when some application is using the storage, and this application might as well be written on Java. In the tests, each size of file was created consecutively 10 times and average was calculated. For file size of 0 kB I measured only time to create an empty file. So here we go with the results:

Flash storage performance N800

Update: After seeing a post referring to my benchmark, I felt urgent need to look into an independent benchmark and see whether I had been writing nonsense or not. Using my home desktop and connecting via a WLAN router I copied several files of different sizes (100kB to 1MB as in the above benchmark) by using secure copy over ssh. Now, the average bandwidth of 10 transfers was 278 KB/s. From this, we can calculate copy time of 1.84 s for 512KB file and 3.68 s for a file of 1 MB. These figures have very similar order of magnitude than my earlier measurements with mobile Java.

Today, the tests only included local file creation but there is more to come. I am interested on looking into combined wireless download and write performance (and to compare this somehow with iPod Touch) as well as read performance the applications experience from the local storage.

Mobile Java, Logging, and Reflection

October 24th, 2007

I started porting a Java client application on Nokia N800 on which I had installed Java CDC (binary). Quite soon after starting the building, I noticed that the log4j libraries are not going to work on CDC device because of lack of support for reflection API. For this I removed (with some python scripting and manual fixing) all the logging information from the project, and managed to build and run the project without log4j dependency.

However, some of the libraries in my project used commons-logging library, and I was very lucky to find a patched version, which enables running commons-logging on J2ME (Java CDC) device.

You can find information on how to build Java projects to run on different platforms, from here. I modified the javac task, by adding compiler, source and target definitions as follows to make code that runs on CDC Java.

<javac srcdir="${src.dir}" debug="true" destdir="${classes.dir}"
                  compiler="javac1.4" source="1.4" target="1.4">
</javac>

Blog is Back & Flashing Nokia N800

October 17th, 2007

Just a small post to inform that the blog is not totally dead yet, even there has been a long break. Today, notes on updating N800 was published at its first form. The purpose is to share a links page for easy access to basic software development tools, easy way to get started after an upgrade.

Our Blog is Now Available for Offline Access

August 15th, 2007

Google Gears users can now read and browse our blog even while not connected to network. The Gears is an extension to Browser that stores the contents of website locally on a machine where the browser is used. Then even the network connection is lost, the browser can access the parts of the page from locally stored copy (architecture) and the user is able to use the website as usual.

To enable offline access we used wp-offline plug-in with WordPress. The setup procedure was very easy and straightforward. However, as the Gears uses same origin security policy, we had to do small reconfigurations to our website. We mapped everything under delaytolerant.com to appear under domain www.delaytolerant.com. The mapping was easily done by manipulating .htaccess file according to good instructions for web redirecting.

This far, it is only possible to read the blog but we are looking forward to future where the users are able to also write posts while not online, and synchronize them after they become connected. If you have Gears installed, you should see a link to start with just above the search box on the right-hand side.

Power-save is Bad for Running Servers on Mobile Devices

August 7th, 2007

UPDATE: With new OS (with skype and everything!) the slow ssh server functionality has disappeared.

Some time ago we installed an ssh server on Nokia N800. It was quite a surprise how long tie it took to establish an ssh session from laptop to N800. Some google searches revealed that the problem lies in the power-save properties of the device. When not used for some time the wireless goes into power-save mode and it takes some time to get the network up and running. The issue does not really exists when you are browsing the net with the gadget since the network interface is kept in ready state when user input is given. However, if no user input is given and the network goes into sleep, the server applications are not terribly rapid on responding on the connections. In the following we measure response time by looking on how the N800 responds to pings.

n800-sluggish-server

The figure shows how the first ping is always slower than the consecutive ones. We started series of 10 pings (each with one second intervall) after one minute was elapsed from last series. This results in from network interfaces power-save properties. Once the network is woken and under constant communication the working is much faster. We plotted the average of ten runs with the standard deviation which shows that in addition to slowness the response for one ping is more un-predictable.

Well, this gives just a small example on one device. Still, it illustrates nicely how the mobile devices have their own particularities which should be taken into account when applications are developed.

Developing Web Applications for Offline Access

July 12th, 2007

Google has released a beta version of Google Gears which is a toolkit for developing offline applications. The client part of Gears is a web browser plug-in which installs with simple single click install (so simple that is definitely worth trying). Then user is able to store web sites locally for later offline access. One could e.g. store travel information to a laptop and then later while on the road access the site without network connection.

The Google Gears architecture uses local data storage to store the website data locally on the machine which runs web browser. When the network connection cannot be used to access the server, the Gears may provide the web resource from local data base in the user’s own machine.

Dojo Offline Toolkit is an extension on top of Google Gears that advertises to make the using of the Gears more easier, worth checking out.