Friday, November 17, 2006, 12:41 PM
- Java
And more pain! In the last two days I've been trying to deploy Axis2 as an OSGI bundle, and it has proven almost completely impossible.
The reason for this was the general idea that axis2 should be better than axis1 (see, it goes to 11, eh, to 2) and the developers are very excited about it, saying "Axis2 is very much straight forward and friendly to use than it's predecessor.". Now after two days and no hair left I wish I had googled "Axis2 sucks" earlier, cause it gave me this jewel of an article: Axis2 - why bother.
Read it all, but I have to pull out this quote:
[..blah, it sucks..] It really is a gift that keeps on giving. Deployment brings its own special joy sauce to burn your eyes out with and make your bottom cry rivers of brown sadness. Everything is hardcoded to a specific context path, and deploying the simplest hello world service is more likely than not to result in a jbossian stacktracefest.
PS: This post included no sensible or useful information, sorry.
[ add comment ] | permalink |




( 3 / 2991 )Tuesday, March 21, 2006, 08:34 PM
- Java
(I try again, with considerably less love than last time)
Opening files in their "natural" application was something I knew had to be done sooner or later for aperture/gnowsis/nepomuk, but I put it off for as long as possible because I had a horrible feeling that to get it to work on all platforms it would be long and messy and maybe involve nasty C code.
Imagine my surprise when in a few hours today I got it working for files, directories and web links, and this on both windows, macosx and linux (kde/gnome). All without leaving the world of Java. The code is so short I will paste it here (beautifully formatted by code2html!)
private void windowsopen(URI uri) throws IOException {
Runtime.getRuntime().exec(
new String [] { "rundll32", "url.dll,FileProtocolHandler",uri.toString() });
}
private void linuxopen(URI uri) throws IOException {
// TODO: I don't know how reliable this is.
// It's set correctly for kde/gnome on my machine
if (System.getenv("DESKTOP_SESSION").toLowerCase().contains("kde")) {
//kde:
Runtime.getRuntime().exec(new String [] { "kfmclient","exec",uri.toString()} );
} else {
//Default to gnome as it complains less if it's not running.
Runtime.getRuntime().exec(new String [] { "gnome-open",uri.toString()} );
}
}
private void macopen(URI url) throws IOException {
try {
Class macopener = Class.forName("com.apple.eio.FileManager");
Method m = macopener.getMethod("openURL",new Class[] {String.class});
m.invoke(null,new Object[] {url.toString()});
} catch (Exception e) {
throw new IOException("Could not open URI: "+url+" - "+e);
}
}
This is for opening http links, but the file code is almost identical, KDE and Windows doesn't like file:// URIs so I convert them to filenames first, and launching things in Windows is done by executing "cmd /c blah" instead (Thanks Michael Sintek!).
Still damn easy. It's not very well tested yet - but it works on my three instances of each OS! If anyone feels like testing it the code is in the aperture cvs repos, FileOpener.java and HttpOpener.java (although it's only just committed so it'll take a while for the sourceforge cvs mirrors to catch up)
[ 2 comments ] ( 44 views ) | permalink |




( 3 / 2066 )Thursday, March 9, 2006, 04:00 PM
- Semantic Desktop, Python, Java
Plan for Today: write an Aperture datasource for the thunderbird addressbook, this to pass time before lunch while I didn't have my mac, and should be quick and easy. Fast forward till lunchtime, where I've found that Thunderbird uses the MORK format for it's addressbook. Mork is a "barely machine readable", "stupidest file format I've ever seen", "look-ma-I-wrote-a-DB" excuse for a DB format.
It was designed by some netscape engineer in the 90s who then disappeared and now no-one knows how it works. It looks a bit like this:
<(91=2)(81=Test)(82=Bob)(83=)(84=Test Bob)(87=bobnickname)(85
=bob@tester.com)(88=bobby@serial.co.uk)(80=0)(89=workphone)(8A
=homephone)(8B=faxphone)(8C=papegerphone)(8D=mobphone)(8E
=bobscreenname)(8F=441048b8)(86=1)(90=bill)>
{1:^80 {(k^BF:c)(s=9)}
[1:^82(^BE=2)]
[1(^83^81)(^84^82)(^85=)(^86=)(^87^84)(^88^87)(^89^85)(^8A^85)(^8B^88)
(^8C=)(^8D=)(^8E=0)(^8F=0)(^90^89)(^91^8A)(^92^8B)(^93^8C)(^94^8D)
(^95=)(^96=)(^97=)(^98=)(^99=)(^9A=)(^9B=)(^9C=)(^9D=)(^9E=)(^9F=)...
Luckily someone else has sort of reverse-engineered it, and there exist partial perl parser and one python version.
I've now added to the madness by converting the python one to Java. It sucked and took all day. (And someone pointed out I could have done it with jython, oh well). To make up for it I'm going to share it with the world.
Here download a jar with src/binaries and some examples:
UPDATED! The old version did not handle encoding of non-ascii characters too well - like everything else in mork this was pretty badly done, but now it's working.
http://www.dfki.uni-kl.de/~grimnes/2006 ... st-0.2.jar
[ 3 comments ] ( 111 views ) | permalink |




( 3.1 / 4790 )


