Archive for the 'Software & Programming' Category

Java/Midlet Environment IBM J9 *with* JSR-75 support (updated)

Monday, June 30th, 2008 at 2:17 pm

This is an updated entry of the original post from November 2006. This article deals with the installation of the Java environment on mobile devices.

I have received a lot of feedback, a few comments as well as supporting requests that are concerned with Java on mobile devices. Recently I also received a comprehensive update from Fred Gnuechtel (IBM) regarding the Java environment on mobile devices. See below.

First of all: IBM J9 is from my point of view the best and most complete Java Runtime for mobile devices. So that’s good news ;)

Palm users have an easy life to install this: They can easily download and install a fully maintained IBM J9 directly from Palm for 5$ or so, including the JSR-75 file I/O framework. are left out of the game and Java is no longer available: http://www.palm.com/us/support/jvm/index.html. Too bad, sorry!

For Windows Mobile users it was more difficult in the past to have a working IBM J9 installation, since it was down to the vendors whether they installed IBM J9 or not, which unfortunately did not happen too often. In the past I provided a small tutorial here on how to get J9 installed from IBM’s open source development environment.

However, according to Fred Gnuechtel from IBM it seems to be not a legitimate way to do things and IBM has removed the most visible J9 sources. I was not aware of this and have removed the tutorial for obvious reasons.

But there are very good news for you still: Handago.com offers now a IBM Java environment for various Windows Mobile phones. Sounds like not too much “tinkering” to get a IBM J9 installation! Super :)
Kudos to IBM and Handago for making J9 available to the end-user now.

Information provided by Fred Gnuechtel (IBM):

I can provide the links, but Handango tends to reorganize their WEB site about once a quarter and then i have to do on a WEB safari to find where they went. So please be aware that you may have to update them from time to time. They also force you down a path of selecting a device and then telling you that J9 is not supported on it. You have to ignore this. Again, this is part of the Hanango WEB sites effort to reduce their support cost and returns. Here is a copy of the note that i send when someone contacts me either from the IBM site or sites like yours…..

IBM’s “Websphere Everyplace Micro Environment” (WEME) conforms to the Java ME specification and is available in both of the JavaME defined configurations. For small volumes business deployments low volumes ( 1- 10’s) and individual copies for personal use, the IBM Java ME virtual machine (WEME) may be purchased from our business partner, Handango for $25 USD per license (device).. All of our Java runtimes that are available from Handango are Java ME certified and we provide solutions for various Java ME profiles and operating systems. These are made available “as is” – no support. (this means you will be on your own using forums on the web). WEME is based on IBM’s J9 Virtual Machine technology.

Our WM5 runtime works just fine on PocketPC 2003, PocketPC 2003 SE and WM6. Our WinCE 5 runtimes will run on WinCE 4.2 but NOT on WinCE 6.

There are actually 2 Java ME configurations and IBM supports both of them. It is important to use the one that supports your application and specific device type.

CLDC+MIDP (for Midlets)
or
CDC+Foundation+Personal ( for Applet/Applications)

Note that we no longer support CDC 1.0, Foundation 1.0 and PPro 1.0. We have moved up to the 1.1 versions.

Also, we do support Smartphone (button navigation – no touch scree) but only with MIDP. Our PPro implementation requires a touch screen.

Our Windows Mobile JVM’s are written to the ARM instruction set and will work on any ARM based processors such at the Intel PXA 2xx, TI OMAP, Freescale and Samsung processors that run WM5/6 or WinCE.

Please note that these runtimes from Handango are provided “As Is” with no warranty or support expressed or implied. Our Business Partners can provide Licenses and support for a fee.

MIDP 2.0 for Windows Mobile 5 Smartphone
(button navigation – no touch screen):
http://www.handango.com/PlatformProductDetail.jsp?siteId=1&osId=855&jid=121FDF13D35AC718E2C9768DDFFC3E5X&platformId=11&N=4294921609&Ntt=websphere&R=203653&productId=203653

MIDP 2.0 for Windows Mobile 5 PDA and Phone Edition devices with QVGA Screen Resolution
(PDA style touch screen device – low or standard resolution screen 320×240):
http://www.handango.com/PlatformProductDetail.jsp?siteId=1&osId=849&jid=121FDF13D35AC718E2C9768DDFFC3E5X&platformId=2&N=4294923386&Ntt=websphere&R=203649&productId=203649

MIDP 2.0 for Windows Mobile 5 PDA device with VGA Screen Resolution
(PDA style device – high resolution touch screen 640×480):
http://www.handango.com/PlatformProductDetail.jsp?siteId=1&osId=807&jid=121FDF13D35AC718E2C9768DDFFC3E5X&platformId=2&N=4294926649&Ntt=websphere&R=203654&productId=203654

Personal Profile 1.1 for Windows Mobile 5 PDA device with Touch Screen
(PDA style device – touch screen) :
http://www.handango.com/PlatformProductDetail.jsp?siteId=1&jid=734756B7A126CXFF4483XD5B5D82CEA4&platformId=2&N=0&productId=204403&merch=more_author_titles&HDGO_ad=mat_204403&HDGO_au=1&HDGO_ae=c

Personal Profile 1.1 for Windows CE 5.x PDA device with Touch Screen ( WinCE 5 Professional – not WinCE Core)
(PDA style device – touch screen):
http://www.handango.com/PlatformProductDetail.jsp?siteId=1&jid=734756B7A126CXFF4483XD5B5D82CEA4&platformId=2&N=0&productId=212765&merch=more_author_titles&HDGO_ad=mat_212765&HDGO_au=1&HDGO_ae=c

When downloading from Handango, you may get a warning that says this is incompatible with your device. Please ignore this warning and click though to complete your transaction.

The file you download is a Windows/x86 Install shield (EXE) that you must run on your PC. It presents you with the License Agreement and then copies the files to your PC. You then have to manually copy the LIB and BIN directories to your device using ActiveSync. Unfortunately, we do not provide a CAB files on some of our runtime packages. This is also something that our Business Partners could provide.

Unfortunately, you are correct about the Palm JVM.

IBM does not have the licensing rights to distribute the PalmOS version of Websphere Everyplace Micro Environment (WEME) the JavaME JVM. The port was done under license by PalmSource who was acquired by Access in Japan. several years ago. I believe that Palm’s license with Access has now run out and that is why Palm has removed the runtime form their WEB site. On top of this, Access has also dropped their agreement with IBM.

Regards, Fred

And some extra information:

A lot of the people that install the CDC-PPro JVM don’t realize they have to create a LNK file to get their application loaded and running. Here is the note I send for that:……….

Here are a couple examples of Windows Mobile shortcut (LNK) files…..

This link will open a console window so you can check for any errors:

255#\path\bin\j9.exe -jcl:ppro11 -cp \path\my-app.jar my-app-main-class

These example links will run without a console window:

255#\path\bin\j9w.exe -jcl:ppro11 -cp \path\my-app.jar my-app-main-class

255#”\my path\bin\j9w.exe” -jcl:ppro11 -cp “\my path\my-app.jar” my-app-main-class

If the JVM files are organized into a path structure of:
\path\bin\jvm-exe-dll-files
\path\lib\jvm-class-library-files
then paths to the jvm class library files are not required in the LNK file.

All LNK files must conform to the following rules….
1 – if any parm includes a space char then the entire parm must be inside double-quote marks
2 – the entire command line must be on 1 single line, multi-line LNK files are not permitted
3 – the entire LNK file must be no more that 255 bytes max, must shorten commands or paths if longer

Regards,
Fred

by markus

Mac OS X applications (update)

Saturday, January 26th, 2008 at 12:34 am

I am using the OS X system now for about 2 year. Before, I was for many many years on Linux (Debian), but the ongoing "tweaking" addiction was too time consuming. Once I started with my PhD I thought it might be a good idea to cut down on this this and focus on the real work ;)

My initial 2-3 month on OS X where not that great, considering that I was expecting a Linux with a nifty interface. Some things are just different, but after the initial hurdle I like the system today. A Unix which just works. Nice in a way.

Here is “my essential applications” list; some of them are OpenSource, some are commercial. Surely, OpenSource is a wonderful thing and I contribute to a few projects myself, but I am still willing to pay for good commercial applications!

System:

  • MacPorts project (all the great stuff from the OpenSource world)
  • Fink (too outdated, use MacPorts)
  • Quicksilver (the most essential tool you need handy; connects with many apps)
  • Jumpcut Clipboard Buffering (the name says it all, it is great)
  • Growl (notification system inter-connecting with most apps)
  • SimplyBurns (nice CD/DVD burning interface; better than onboard tools)
  • SuperDuper (perfect backups, but I don’t use it since I have TimeMachine)
  • Chicken of the VNC (only if you want to work remotely on other machines via VNC)
  • Microsoft Remote Desktop Connection (RDC) (only if you want to work remotely on other MS machines)
  • GrandPerspective (perfect for getting an idea of how HDD space is occupied)
  • MenuMeters (great tool informing you about HDD, CPU, memory & network status)
  • KeePassX and/or TrueCrypt (passwords to save ?)
  • VMware Fusion (virtualisation)
  • CoconutBattery (inspect the performance of you laptop battery)
  • Font Book (inspect your installed fonts)
  • Key Codes by Peter Maurer (find out about key mappings)
  • pearScriptKeys (make you own global hot keys)
  • TinkerTool System (various system level maintainance stuff)
  • sshfs (transparently connects a remote files system via SSH to your machine, handy)
  • ExpanDrive (faster and a bit more reliable than sshfs, but commercial)
  • iDefrag (fragmented hard drive ? Use this tool. However, HFS+ hardly fragments in the first place :)
  • LittleSnitch (personal firewall)
  • RCDefaultApp (assign default applications for certain file types; System preferences)
  • GnuPG & GPGMail (gpg mails & texts)
  • MondoMouse (mouse super power – that’s what they claim)
  • Tech Tool Deluxe (part of Apple Care Protection Plan)
  • Rember (a frontend of memtest; unlike memtestosx free of charge)
  • Spanning Sync
  • Typinator
  • Default Folder X (a must have!)
  • ToggleHiddenFiles
  • Name Mangler
  • Service Scrubber
  • Lab Tick
  • MarcoPolo
  • OpenTerminalHere

Work:

  • Evernote, CircusPonies Notebook 3
  • Bookends (reference management; Papers is a good alternative apparently)
  • OmniGraffle (Awesome application for vector graphics, e.g. for making posters etc)
  • Keynote (do you need to present your work, then this is for you)
  • LaTeX packages, TexShop, LaTeX2rtf
  • Mellel (great for technical and scholar writing; I use it for papers where LaTeX is over the top)
  • OpenOffice 3.1 (horrible big beast, but at times you need to open Office documents)
  • Skim (the very best pdf viewer ever)
  • Apple Development Tools (essential if you do any development on your machine)
  • Your favorite programming languages, myself Java, Perl and bit of Ruby & C++
  • IntelliJ and Eclipse (both good IDEs for Java, I use the latter also for Perl & C++)
  • TextMate, MacVim (my favourite text editors)
  • MySQL, DbVisualizer (database stuff)
  • R project (the ultimate free statistics environment)
  • XMind
  • AntiRSI (keeps you healthy – sort of)
  • iFlash

Media:

  • Adobe Photoshop CS3 (thankfully students get better rates :)
  • Adobe Lightroom (great for working dynamically on RAW camera files)
  • DNG Profile Editor
  • iMovie HD (the old version 6 – forget about the new crippled iMovie versions)
  • NeatImage PS plugin (get rid of noise in your pictures)
  • Spyder3 Elite (do you need a calibrated monitor ? This set works well)
  • HoudahGeo (geo tagging)
  • RouteConverter 1.11 (converting various GPS files; only the old version works on Java 5)
  • exiftool (A command-line interface to Image::ExifTool)
  • Google Earth
  • VLC (plays literally every media file)
  • iShowU (screen cast program)
  • Audacy (some audio work to do ? Record from the mic ?)
  • ImageJ & API (nice if you do imaging with Java, used it in one of my science projects)
  • Last.fm (the new form of radio these days ?)
  • Comic Life (the need to draw a comic quickly ?)
  • Incscape

Web stuff:

  • Firefox, Camino, Opera & Safari
  • Cyberduck (FTP & SSH; itegrates with Textmate)
  • Paparazzi! (screenshots of a certain URL, can be handy)
  • Skype (text, voip & video chat)
  • GalleryRemote
by markus

Remote printing via SSH

Thursday, July 5th, 2007 at 5:21 pm

Ever thought it would be a good idea to print via SSH maybe because you cannot connect to your favorite printing machine in any other way ?

It is straight forward to do; you establish a ssh tunnel to your machine, e.g. via a ssh gate into your company or institute:

ssh -L2222:internal.machine.name:22 -l userName gateAddress

Now you can simply run any command on the remote side and hence can trigger a printing job:

cat document.pdf | ssh -p 2222 localhost "acroread -toPostScript | lpr -PprinterName"

DONE :)

PS: acroread works much more reliable than pdf2ps, I don’t now why. psf2ps screws up with some documents.

by markus

Howto install QT 4.2 and QtRuby 1.4.6 on Mac OS X Tiger

Monday, October 16th, 2006 at 6:30 pm

I had some (minor?) trouble to get QtRuby 1.4.6 and QT 4.2 running on my Mac (PowerPC, 10.4.8). However, with some help from Richard Dale (thank you!) and the Korundum forum I got it working.

Install QT 4.2

First, download QT 4.2 for your Mac. Unpack it and configure it with at least the “-no-framework” option, the remaining parameters are as far as I know up to you. And DON’T use the -prefix option (some people recommended this to put it in /Developer/qt), otherwise QtRuby 1.4.6 won’t find the QT stuff (Default installation path of QT is currently /usr/local/Trolltech/Qt-4.2.0).

>  ./configure -no-framework -system-zlib -qt-gif -qt-libpng -no-debug \
            -no-stl -no-exceptions -fast
 
>  make
>  sudo make install
>  export QTDIR=/usr/local/Trolltech/Qt-4.2.0
>  export PATH=$QTDIR/bin:$PATH</code>

Install QtRuby

Note: This is only to get version <=1.4.6 to work !!!

  • Fix missing headers – don’t link them, copy them (otherwise the build script will fail!)
    > sudo cp /usr/lib/ruby/1.8/universal-darwin8.0/*.h /usr/lib/ruby/1.8/powerpc-darwin8.0
  • Check out some updates of kalyptus we need to add to QtRuby Release 1.4.6
    svn co -r 588725 svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebindings/kalyptus/
  • Download qt4-qtruby 1.4.6 and unpack
  • Copy from the previous svn checkout the files “kalyptus” and “kalyptusCxxToSmoke.pm” into the kalyptus folder of qtruby
  • According to this article we need to comment out the main() function of qtruby/bin/qtrubyinit.cpp
  • In the root of qt4-qtruby you run:
    > ./configure --with-smoke="qt" --enable-mac --with-qt-dir=/usr/local/Trolltech/Qt-4.2.0 
    > make
    > make install
    > cd /ruby/lib/ruby/site_ruby/1.8/powerpc-darwin8.0 
    > sudo mv qtruby.so qtruby.bundle
  • Test your Qt installation:
    > irb
    irb(main):001:0> 
      require 'Qt'
      a = Qt::Application.new(ARGV)
      hello = Qt::PushButton.new("Hello World!", nil)
      hello.resize(150, 50)
      hello.show()
      a.exec()

Enjoy playing with QtRuby ;)
Thanks to all developers making this possible and thanks for the support!

by markus

R from an OO perspective: modifiers / mutators

Monday, October 2nd, 2006 at 2:36 pm

WARNING: I am completely new to R and I might be wrong here, so please be aware ;)

The reason for this post is, that I haven’t found a throughout short example of a S4 class with methods able to change slots aka. fields (mutator methods).

THE main annoyance with R (IMHO) is that there are no ways to pass values by reference. You need some “tricks” to be able to modify the slots of an object (otherwise you just end up with changing the slots of a copy of the actual object ;).

This short example should give you an idea of how we can modify slots of an object in R which allows mutator methods. Browsing some mailing lists I basically found two ways of doing so: setReplaceMethod which returns the object copy and replaces the original object or the “eval.parent(substitute( … ))” trick. But see yourself:

#define a pythagoras class as an example, holding a, b anc c as numeric values.
setClass("Pythagoras",
   representation = representation(a="numeric", b="numeric", c="numeric"),
   prototype = prototype(a = 1, b = 1, c = sqrt(2))
)
 
 
#define a method to calculate the hypotenuse given a and b 
setGeneric("Pythagoras.hyp", 
function(x) standardGeneric("Pythagoras.hyp"))
 
#implement this method
setMethod("Pythagoras.hyp", signature(x="Pythagoras"), function(x) {
	eval.parent(substitute(
		x@c <- sqrt(x@a^2 + x@b^2)
	))
})
 
 
#define a method to set value a and also update the hypotenuse accordingly
setGeneric("Pythagoras.setA<-", 
function(x, value) standardGeneric("Pythagoras.setA<-"))
 
#implement this method
setReplaceMethod("Pythagoras.setA", "Pythagoras", function(x, value) { 
	x@a <- value
        Pythagoras.hyp(x)
	x
})
 
 
#define a method to set value b and also update the hypotenuse accordingly
setGeneric("Pythagoras.setB<-", 
function(x, value) standardGeneric("Pythagoras.setB<-")) 
 
#implement this method
setReplaceMethod("Pythagoras.setB", "Pythagoras", function(x, value) { 
	x@b <- value
        Pythagoras.hyp(x)
	x
})
 
 
#tests
p = new("Pythagoras")
 
p
 
Pythagoras.setA(p) = 5
 
p
 
Pythagoras.setB(p) = 5
 
p

Beaware: Copy and paste sometimes doesn’t work as the double quotes are no real double quotes!

Give it a try. It will be self explaining by then …
If you have any comments, please let me know!

by markus

J2ME development on OS X: Emulation and JSR-75 – solved!

Saturday, September 23rd, 2006 at 10:08 pm

You want to develop J2ME applications with a Mac OS X operating system ?
This is not as easy going as one might think:

SUN unfortunately provides the “Java Wireless Toolkit” not for OSX (for whatever reason) and their emulator therefore does not work. I think there would be more potential J2ME developers under OSX, but this is actually their (bad) decision. Furthermore, they provide their latest stuff only for Windows :( The only way to get it going on a Linux system is using the old WTK2.2 – nice uh ?

However, there was light at the end of the tunnel:
The mpowerplayer SDK is an emulator (and more…) which is supposed to work on an Apple computers. Well, it does, but there is another catch: No support of the JSR75 fileconnection API so far.

Now and finally one very nice guy implemented the specification and provides a CLDC.jar for mpowerplayer which now allows file input/output !!! This is great news. Thanks for all the effort again! You can see the discussion and also a link for the download of the file here (I think you have to be logged in to view it).

Now and finally my MiniPauker stuff can be developed on my Mac. Nice – very nice indeed.

If you use J2ME-Polish and want to migrate your stuff to OS X, there is one more thing you have to change in your ANT build task:
the preverification of the code is not working with the WTK (the Linux version) – modify your build section and point it to the MPowerplayer subdirectory osx:

 *snip* build preverify="/Applications/mpp-sdk/osx/preverify/preverify" *snip*

Enjoy your Midlet development!

by markus

MiniPauker feature complete

Monday, August 21st, 2006 at 9:04 pm
* WPG2 Plugin Not Validated *

My MiniPauker application is now feature complete for its future stable release.

You ask what MiniPauker is all about? Here it is:
MiniPauker is a flash card based learning application for mobile devices and handhelds. It is based on the leitner cardfile system and is compatible with Pauker (http://pauker.sf.net, the desktop version of this software). MiniPauker uses a combination of ultra-shortterm, shortterm, and longterm memory. You can use it to learn all the things you never want to forget any more, like vocabulary, capitals, and important dates.

Following changes were incorporated:
Cards can now be drawn randomly. Cards which are not learned in “ultrashort-term” go back to be relearned immediately in the next round. UTF-8 was fixed (for Sony Ericsson). The progress bar was fixed. Exception handling in background tasks was fixed. Umlauts were fixed. The code was cleaned up. The UI was polished. Import/Export works now – hopefully – on all devices which support the file connection API JSR-75; exception are those (stupid) mobiles which need a code signing certificate *AAAAAAArgh*. If JSR-75 is not available on a particular phone the im-/export functionality is disabled completely which is not misleading users.

My personal summary of J2ME:
J2ME alone is very very limited in general, but this is on purpose; we shouldn’t forget that it was designed for very limited (mobile) devices. J2ME-Polish helps to improve J2ME significantly and at the end of the day you can do some useful stuff in the way you want it.

Personally the most annoying and frustrating “ISSUE” with J2ME is that it behaves differently amongst various devices. It almost always works in the way you want it in the SUN WTK emulator, it also works great in the IBM J9 implementations for Palm and Pocket PCs … but for the rest of the world it is a lot of trouble. The last weekend I managed to fix some more bugs which only (!) occurred on Sony Ericsson phones, and I am sure there are some more bugs with other brands too. It seems the specifications are not always implemented correctly – and this makes live different – at least if you are used to work with SUNs well behaved standard SDK :)

Anyway … I will continue maintaining the MiniPauker application. I quite like it these days. It does its job nicely and it seems people out there like it as well. If you want to provide feedback, please feel free! Thanks!

Posted in (Mini)Pauker
by Markus

maildir to mbox

Tuesday, July 25th, 2006 at 4:27 pm

I simply wanted to convert my maildir from KMail to a standard mbox format, e.g. to be able to import it in Apple Mail, Mail.app under OS X. However, I found only complex scripts, none worked for me and I was about to start writing my own script until I found this very easy and neat solution from Christian Zagrodnick – works perfectly:

import sys
import email
from email.Errors import BoundaryError, HeaderParseError
from mailbox import Maildir
 
maildir = sys.argv[1]
 
md = Maildir(maildir, email.message_from_file)
 
while True:
    try:
        mail = md.next()
    except (BoundaryError, HeaderParseError):
        continue
    if mail is None:
        break
    print mail.as_string(True)

Call it via (“python scriptname.py pathToMailDirFolder > file.mbox“) and enjoy!

Thanks to Christian Zagrodnick who made this simple script available at:
http://www.gocept.com/Members/zagy/maildir2mbox/view?searchterm=maildir

by Markus