Thursday, September 20, 2007

Polish revisited

Now I've played with J2MEPolish for a while, and it it has been an interesting experience. There are some very good ideas there, like using stylesheets and providing a basic GUI that actually looks nice. It is also quite simple to glue third party code into Polish code (when you finally find out where to put the libraries, see previous post about NetBans and Polish).

There are some things that are not so nice. I tried to glue the iLabs XMPP interface to Polish to produce a Jabber/Google Talk chat client. Functionally this worked like a charm, but I discovered that it is impossible to create tabbed forms dynamically. I wanted to make a new tab for each chat session I opened, but nooo, that's not possible: You have to decide in advance how many tabs your application needs, allocate them up front, and keep them for as long as you run your application. To be blunt: This sucks.

Monday, September 17, 2007

William Gibson's "Spook Country"

The short version: "Spook Country" sucks in the same ways that all of his previous novels sucks, but the plot is less compelling than just about any of them since "Mona Lisa Overdrive" (the final book in the "Neuromancer" trilogy). There is too much form and not enogh content in them all, with one exception: "Pattern Recognition". PR was a brilliant book, in strange way reminding me of the movie "Lost in translation". In "Spook Country" some of the people and a little of the environment is recycled from PR, but it just doesn't work. Why does this matter? Well, even at his worst Gibson is able to make my mind go "whiirrr" and spawn new ideas so I'll probably read everything he publishes, even when it sucks :-)

Monday, September 3, 2007

Netbeans & Polish

This is the kind of thing that can take forever, and annoys me to no end: In Netbeans I set up a dependency from my project to another project. The editor recognizes the dependency, and correctly looks up the appropriate .jar file and lets me syntax check my files from the editor.
Nice. I then try to compile, and the paths are all F**** UP. They seem correct enough (and as I said, the NetBeans editor is capable of using them), but none of my libraries are actually located by the compiler.

On days like this the thought of spending the rest of my days as a monk somewhere in the Himalayas seems quite attractive.

Now, when solving this problem a natural place to start is to read the fine manual :-) On page
45 in the complete guide to j2mepolish it says:

J2ME Polish normally calls the Java
compiler normally with the appropriate
classpath as well as bootclasspath for
the current target device.


Well, don't believe it. It's just not true. You can add libraries and projects to the buildpath generated by NetBeans, it simply won't be used. What you have to do is to look at page 182, where the real story is told on "How to Integrate a Binary Third Party API":



When a third party API is only available in binary form, they can
be integrated with the “binaryLibraries” attribute of the element
in the “build.xml” file. This attribute can point to jar or zipfiles
or to a directory containing third party libraries (either jarfiles,
zipfiles or classfiles). Several libraries can be separated by
colons ':' or semicolons ';'. When the libraries are situated
in the “import” folder, only the name of the libraries need to
be given (instead of specifying the full path).

Turns out what you have to do is to stick the files in an "import" directory in the project's top level directory and then put a reference to that into the "build" construct in the antfile . I won't tell you how many hours it took to figure this one out, it's just too depressing.

Friday, August 31, 2007

Painting feels very similar to writing code.

I´ve never been particularly good at painting or drawing, but during the last several years I have found great joy in it. Yesterday when I was working on an acrylic painting (I won´t discomfort you by showing an picture of it ;) it struck me: Painting this picture feels -very-much- like writing code: There is the great picture (literally), all the details you can see, all the details you can´t see, all the technique you chose to use, and chose not to use but is still considered and thus part of the mental process of the painting etc. But most of all it is exactly the same feeling of intense joy seeing an abstract idea turning into reality with some degree of persistence.

In contrast, playing an instrument (I play several) feels quite different from writing code. When playing the level of concentration is so high, and the result lacks the same kind of permanence that code or a painting does, so the feeling of accomplishment when getting a passage right on the instrument is different from the feeling one gets when getting a data structure right, the latter being quite similar to the good feeling one gets when painting a nipple that looks quite realistic (when squinting, in a dark room :-).

It´s not exactly the biggest of revelations, but it felt rather powerful when it struck me yesterday ;)

Thursday, August 30, 2007

Getting Polish up&running

I recently looked at the blueme chat client. It seems quite interesting. GPL2 code, available on SourceForge. However, it uses the J2ME-Polish library, so I needed to get that up& running. The installation guide for NetBeans wasn't all I needed, so this is what I did to get it up & working.

  • Follow instructions on page 21 in "The Complete Guide to J2ME Polish"
  • Install Nokia series 60 emulator (if you like, Sun WDK 2.5.1. is perhaps even better).
  • Click on properties, use defaults wherever possible (except as described below)
  • If NetBeans gripes about being unable to find libraries, add all polish-supplied jar (enough*.jar) files to property jars (this is probably overkill, but just adding the enough-j2mepolish-client.jar file wasn't enough)
  • Selecting "Generic/Midp2Cldc11" as configuration will trigger use of the Sun WDK 2.5.1. emulator, which is nice, and usually works pretty well.

Then I was able to run & debug apps. We'll see what comes out of it ;))

The purpose of this blog

This blog is a personal, informal lab diary.

I'll log some of the things I do, some of what works and some of what doesn't. I'll mix both work and private projects. In most work settings this kind of mix wouldn't be a good idea but since just about all the coding work I do professionally is done on open source projects, I think it's ok :-)

I work as a research scientist at Telenor's Research & Innovation, in the iLabs (innovation labs) project . Our most important project is probably the ilabs mobile toolbox. Another project I've been working on is the "RestRoom" storage server (it stores files, and it uses a REST protocol :-) The RestRoom server is used by the facebook and blogger clients in the mobile toobox project.