Archive for March, 2006

The libebook Weekend

Tuesday, March 21st, 2006

A long weekend just passed, with Paddys Day falling on the friday. So I got three days of substantial enough coding in. My time was spent refamilarising myself with jni by writing Java bindings to the evolution libebook library and to a lesser extent the libedataserver library. It was very successful, by Sunday I had my Java Gnome Contacts application reflecting evolution. With some documentation, feature completition work, examples and memory management I may even have something useful to pass on.

Also, spent some time getting gallery2 and mediawiki up onto thecentric. Chrikey; CSS is a nightmare. Everything was going fine until I opened this site up in I.E. – the css tip: margin 0px !important was invaluable for fixing relative positioning differences between firefox and I.E.

Had a drink with moley in the dandelion on St. Stephens green. Expensive Smithwicks!

Gallery2 & MediaWiki

Monday, March 20th, 2006

I stumbled across a blog who had integrated gallery, wordpress and mediawiki. By integrated I mean there was a seamless transition from clicking between his gallery/wordpress/wiki installations. They all shared a custom theme written by himself. It made me instantly envious – there are indeed three dyanmic types of data that I would like to publish online – 1. thoughts and diary via this blog. 2. image / video content via gallery 3. various homes for projects: with downloads, updates and documentation perhaps via a wiki. So instead of finishing some of the projects I wanted to release over the weekend I spent the last few hours getting what I wanted; wordpress, gallery2 & wikimedia working under a common theme :) .

I’ve few images uploaded right now – and few entries in the wiki – it would take a while to get up all my back catalog up. But here is the gallery and here is the wiki.

Also; I do like the navigation embedded into the header above…

A Quick Look at db4o

Tuesday, March 14th, 2006

I had a very naive quick look at db40 – but had a complete working repository implementation up and running for my contacts app up in less than 5 minutes (now that’s an impressively intuative API!). With speed being far superior to serialization! I don’t know what I was expecting but it looks great.

The Drag And Drop Java Gnome Weekend

Monday, March 13th, 2006

Was at home by myself this weekend, Anna was at a birthday in Galway. Decided not to go – wanted to catch up on some episodes and get a patch for drag and drop in java-gnome in. Didn’t manage to get the patch together – spent alot of time reading the bindings and figuring out what I could regarding it’s memory management. Very late sunday; I finally managed to figure out why dragging as a source in Java Gnome wasn’t working. It’s a little tricky – but I hope to get a patch for that and setting the data bytes of SelectionData before the end of today.

I watched Battlestar Galactica Season 2 finale over the weekend. It was a cracker! Lay down your burdens part II – a 90 minute episode that really broke all the rules with the ending. I’ll be ordering the Box Set as soon as it comes out and am considering buying a ‘So Say We All’ T-Shirt…

Java Gnome Contacts – 0.0.1 Preview deb

Friday, March 10th, 2006

I’ve created my first .deb binary! It’s a preview release of my contacts application and depends on java-gnome or more preciously libgnome-java (>= 2.12.1-0ubuntu1) – which can be installed using the repository below. On Ubuntu: breezy/dapper add

deb http://www.natemccallum.com/uploads/debs/ ./

to your /etc/apt/sources.list and run

apt-get install libgtk-java libgnome-java libglade-java libgconf-java

Once you’re set up with java gnome download contacts and run:

dpkg -i java-gnome-contacts-0.0.1preview.deb

The command JavaGnomeContacts should start the application – let me know if it works!

Contacts, GCJ, Retroweaver

Thursday, March 9th, 2006

I spent some time today getting my Java Gnome Contacts application compiling and running with GCJ. It went really well in the end; but there were lots of gotchas that I’d like to talk digress into.

Firstly I decided to prioritize this over feature additions as a result of a quick communication with a Java Gnome hacker. The spirit of getting Java Gnome applications running with gcj is obvious… Free Software. I’ve taken this to heart; and will endeavour to have an automated gcj build of my apps alongside all my future Java Gnome development.

Contacts uses Java 1.5 language features. I’m not going to change this as I like my for each loops and my generics too much. Given that gcj does not currently support 1.5, I first looked into Retroweaver as a means to get my 1.5 classes to a 1.4 binary compatibility state.

After placing the Retroweaver library in my ant/lib directory, I run the following ant target.

<target name="retroweave">
    <taskdef name="retroweaver"
             classname="com.rc.retroweaver.ant.RetroWeaverTask"/>
    <retroweaver classpathref="modular-build.path">
        <fileset dir="${modular-build.dir}">
            <include name="**/*.class"/>
        </fileset>
    </retroweaver>
</target>

presuming
Where ${modular-build.dir} is the root of my modular build folder… essentially containing my existing 1.5 classes and modular-build.path is a classpath reference to a list of package dependencies – jdom / junit / commons-codec / java gnome / etc…

It worked perfectly after making a number of code changes:

  • Removing all String.contains calls; I replaced with a StringUtils.contains() call
  • Removing all String.replace(CharSequence target, CharSequence replacement) calls; I replaced with the regex replace method
  • I was using the BASE64Encoder class in sun.misc; Instead I replaced with commons-codec calls

It successfully reports weaving and verifying X number of classes; so I trust it – and move on to getting a gcj target up and running. Gcj will take and compile java source files; but in my case I’ve already got compiled classes… which isn’t a problem as gcj will happilly support classes as input too.

To make things easy on myself the next target was actually a jar task that packages all my little modules into one grand java-gnome-contacts-all.jar

I’m new to gcj; so finding the correct damned compile command took me a while. When using gcj 3.x.x one needs to compile all package dependencies as shared libraries with something like the following command:

gcj -shared jdom.jar -o libjdom-1.0.so

… and then in turn link against the libjdom-1.0.so with -ljdom-1.0 when you’re compiling your own application. The dream turns into a nightmare when you realize you also need jaxen which depends on xom/dom4j/xerces and all those in turn have their own dependencies. What I didn’t realise was gcj 4.x.x has a cool magic flag -findirect-dispatch which according to the man page when used: ” the resulting object files do not need to be directly linked against their dependencies. Instead, all dependencies are looked up at runtime.” Now I’ll be honest and dont fully understand what looked up at runtime means – but I’m presuming that as long as the package dependency jar is in the CLASSPATH at runtime – all will work fine.

In the end the gcj compile command was as simple as the following:

gcj --main=com.excentric.contacts.Main java-gnome-contacts-all.jar
-findirect-dispatch -o JavaGnomeContacts

I have resources that I need in a relative working directory… so once I place the binary just beneath the resources directory and export my CLASSPATH correctly… Java Gnome Conacts runs… Wahey!

All in all, I’m very impressed with both Retroweaver and obviously more so gcj. I can now see a path to where I can throw a contacts binary into a local apt repository and expose it to the world.

On a side note: contacts currently uses java serialization to persist until I settle on a db. (db4o is what I’m going to look at next, recommended to me by Java Gnome’s AfC) And it appears that the serialization and deserializationis is very slow in gcj compared to when I run it under a jvm.

Java Gnome Contacts – Preview 0.0.1 Upload

Wednesday, March 8th, 2006

I’ve uploaded a preview of Java Gnome Contacts here. Its a linux binary and requires you’re running Gnome 2.12 at least. Try it out! I dare you!

Stephen Fry Treasure Hunt

Tuesday, March 7th, 2006

I had a dream Stephen Fry lead, the company I work for, NewBay on a treasure hunt around Dublin. Stephen was very witty, and I laughed out loud a number of times.

Java Gnome Contacts – Preview Screenshots

Tuesday, March 7th, 2006

I’ve finally got around to putting some polish on my Java Gnome Contacts application. Screenshots below! Drag and Drop from evolution works. Export and Import vcards. Full 2.1 VCard parser implementation. Gets very slow with alot of contacts… performance & bug searching next… then maybe some binaries!





If anyone is actually reading this and wants to take a look at the source… drop me a mail.

The Hope Davis Weekend

Monday, March 6th, 2006

Myself and Anna are together six whole years! Our anniversary was over the weekend and we celebrated in our usual tradition of cinema with popcorn. We got through 3 films in all; The Matador, Proof and The Weather Man. I enjoyed The Weather Man the most – it evoked a true ineasiness in myself, but was worth it. The other two were just alright. All three films starred Hope Davis, a name and face I’m destined to unfortunately remember (valuable neuron real esate etc…). We ate at a noodle house on Saturday and took a Bombay Pantry take away home on Sunday.