Wednesday, May 20, 2009

New Binary installer for MeTA Studio

A new binary installer for MeTA Studio is released for public download. The current version is 2.0.20052009.

New in this version:
- Updates to UFF, HF APIs. HF APIs, in particular, have changed substantially to provide better access to individual parts of the algorithm.
- Improved optimiser APIs
- HF analytical gradients (seems to work, but needs to be tested thoroughly!)
- Gradual changes in graphics backend.
- Support for JNA, simplifying interfacing of native code with in MeTA Studio. The native code libraries can now be easily interfaced from BeanShell or Jython support for MeTA Studio. Expect more information on this in coming days.
- Number of added scripts in 'scripts/' directory
- Numerous bug fixes, as usual ;-)
- And a Linux (x86) installer
- Windows installer on Vista and Windows 7 no longer requires UAC prompt.

Note: If you are compiling MeTA Studio from source, you would need to update the dependent libraries (bsh.jar and jna.jar). While there are substantial changes to BeanShell library (bsh.jar), jna.jar is newly added to support calling native code.

Get all the code here:

enjoy this version!

(Update: There were some glitches reported with the binary distribution, especially missing jna.jar in the Windows installer. I have subsequently updated all the binary distributions to v 2.0.27052009)
(Another Update: Found some really nasty bugs, and had to fix them, so the latest is now v 2.0.04062009 .. this binary release turns out to be a bit expensive, given that I am yet to move to a new online-update mechanism).

Monday, May 18, 2009

Deep in Java: fiddling with Java bytecodes

Even though I heavily program in Java, I have not really felt the need to manipulate at bytecode level for most of the applications that I write. Even for MeTA Studio, which offers scripting interface via. BeanShell and Jython (at present), I used to just use these interpreter packages. Currently BeanShell is (and will probably will always be) the primary scripting interface to MeTA Studio. However, there has been no development on the BeanShell ( since long time and I needed some improvements to be put in it which were tailored towards MeTA Studio. So some time back, I forked the BeanShell code for MeTA Studio. Subsequently, I also fixed some minor bugs in the interpreter which affected functionality in MeTA Studio. Later, I also updated the ASM package to the current version, which is used by BeanShell to actually generate bytecodes. All this time, I never ever felt the need to fiddle around JVM bytecode specifications.

However, while finding a best way to call native libraries with in the programmable framework of MeTA Studio (what?? ... yes, but for reasons behind this you will have to wait for subsequent posts, when I get some stuff working) I stumbled upon a JDK incubation project called JNA. JNA, in fact, provides a very clean way to call native libraries without going through the pain of generating JNI stubs.

In fact, its pretty cool. For instance, you can call a C function sqrt like this:

import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Platform;

public interface CLibrary extends Library {
double sqrt(double v);

// and use it as:
CLibrary clib = (CLibrary) Native.loadLibrary((Platform.isWindows() ? "msvcrt" : "m"),

Look ma, no JNI, pure Java!

Now, the above code worked fine if I compile using standard Java complier. But failed to run at all via the BeanShell interpreter with the following error:

java.lang.ClassFormatError: Illegal class modifiers in class CLibrary: 0x201

At first glance, I had absolutely no idea of what this meant. Long time ago, when I was in my graduation, I had fiddled around a bit with JVM specification in the hope to write a JVM for a 16-bit DOS environment. Needless to say, it never materialised ;-) But this some how made me check back the JVM class format again to look for possible solution. I also checked the BeanShell code that was generating the bytecodes, and essentially tracked it down to the following lines in bsh.ClassGeneratorUtil

public byte [] generateClass() {
int classMods = getASMModifiers( classModifiers ) | ACC_PUBLIC;
if ( isInterface )
classMods |= ACC_INTERFACE;

This too made not much sense, until I read the following in JVM class format specification:
"If the ACC_INTERFACE flag of this class file is set, its ACC_ABSTRACT flag must also be set (§2.13.1) and its ACC_PUBLIC flag may be set. Such a class file may not have any of the other flags in Table 4.1 set."

So the solution was simply to modify classMods |= ACC_INTERFACE | ACC_ABSTRACT; which worked great, except that I got another error:

java.lang.ClassFormatError: Interfaces must have java.lang.Object as superclass in class CLibrary

It appeared that BeanShell somehow did not do this correctly, and possibly the ASM interface would also have changed. I was not sure of the reason behind this, but I knew how to fix this :

if ( isInterface ) {
try {
interfaces = new Class[]{Class.forName(superClassName.replace('/', '.'))};
} catch(Exception e) {
throw new UnsupportedOperationException("Super class " +
superClassName + " is not varifiable for interface : " + fqClassName);
superClassName = "java/lang/Object";

The above seems to do the trick, though am not very sure if this is the correct way to do it. And well in the end, I enjoyed doing this :-) .. and now calling native methods from with in MeTA Studio scripting environment is a lot easier and intuitive, well should I say its pretty cool ;-)

Note that all the source changes for the above are available from MeTA Studio SVN repository:

The above changes are not yet reflected in the binary package. But I hope to provide a full binary update too in coming days.

Have fun ;-)

Thursday, May 14, 2009

Who ate that byte of apple ? ;-)

Out of enthusiasm and out of sheer curiosity, I wanted to own an Mac. So I got one, not a shiny new one, an old, but an equally shiny white, iBook G4. After about 5 months of continuous usage of the default OS that came with it (OSX 10.3 aka Panther), I bid it a farewell. No regrets, I spent only $260 for it...

Though I found the software (OSX) to be all crap, for a number of reasons listed below, I found the hardware to be actually too good to just dispose of. So things were reborn.

Why I found OS X to be not good for me?

Reason #1:
To get an update to the Java virtual machine, you need to upgrade the whole OS! This is the most sanest thing I have ever experienced.

Reason #2: If you want to use the latest XCode, you will need to ... yes you gessed it, upgrade the OS! As I had got a second hand Mac, I did not get the installation media with it so could not install the gcc suite that came with the OS. But there was now way to get the earlier version of XCode from apple developer connections site that was compatible with Panther either. The same is true with every other piece of development tools I use: Apache server, PHP etc. .. the list is countless. I simply have no money to invest in an OS like this!

Reason #3: In general, the application support is nothing but. Most of the recent versions of the applications (including OpenOffice and FireFox) are not supported, which is nothing but weired.

Reason #4: The same is the case with drivers. My 3 mobile broadband modem is not supported on this version of the OSX .. but is apparently supported on even antique versions of Windows! Same is the case with my webcam. I tried using macam, but the result was nothing but a poor video resolution.

Reason #5: The general window management in OS X is not at all productive. The only feature I liked in the window manager the ability to directly close an application while using Apple+Tab. I had used OS X before, but at those times I simply used to be amazed with all the jazz that comes along, and hardly ever worried about its usability. However, when I was using this on a day to day basis for more than five months now, I found it to be hardly productive. When I compare OSX with GNOME, Standard Windows or even the latest Superbar in Windows 7 or the KDE4 ... all of them turn out to be much more productive when handling multiple windows. The "Expose" functionality, to me is nothing but of not much use at all.

Who ate that byte of apple?

The iBook G4 that I bought, is not that new. But has fair amount of hardware if I compare with my MiLeap. It is an 800 MHz PPC processor with 640MB RAM, 30 GB HDD, WiFi, 2USB ports and 32MB ATI mobility card (more specs here).
:-) Have you seen a penguin eating an apple? It probably never liked it so it ate only a bite ;-)

Switching from OSX (10.3) to Ubuntu 9.04 :)

So, I made up my mind. No OS X, ever. And then decided to try either Kubuntu / Ubuntu or Fedora. Since Fedora 11 was not yet released, and required me to download a whole DVD to test it, I decided to give Kubuntu a first try. I had tried KDE 4 when it was released, and didn't have a pleasant experience. This time it had improved a lot but still was tempted to install plain Ubuntu instead. And so the switch happened.

Installation was easy as is usually with Ubuntu. I did not have to worry about partitioning hard disk as I was doing a full format, in the process completely removing OS X. I had to boot off from the live CD using live-powerpc video=ofonly option though.

After installation, the login screen looks pretty decent and neat (see above, in the backdrop is MiLeap running Vista).

Here goes some of the screen shots:

What worked out of the box?

Every stuff that matters most works: Most hardware is detected (including the WiFi and my 3 wireless broadband modem), there are some problem with AGP acceleration (more on this later). Most of the software that I need just works: Latest Firefox, OpenOffice, Pidgin, GIMP, GCC. What was not already there: Java and codecs were easy to obtain from the Ubuntu repositories. There is no Adobe official support for Linux-PPC so I use the default evince for viewing PDFs and Gnash as Flash plugin. Though evince is fairly good at handling most of my PDFs, Gnash is not that great in handling all the YouTube videos.

Since I could get the latest JVM (1.6) working on PPC without much trouble, MeTA Studio also worked pretty good. The only downside is that the JVM (icetead) does not currently have a HotSpot VM for its PPC version, so Java applications are not as snappy as on x86 box.

What did not work out of box?

3-D acceleration via the ATI card was not working by default on 9.04, but this happened to be a known bug with the current Ubuntu kernel for PPC and has an easy fix (listed here).

What I miss from OS X?

Big nothing. But being heavily depended on Skype makes me miss that, which obviously is not available on Linux PPC. I have been trying to use Ekiga instead, so if I am successful in using it will put it up as a separate post.

And finally, in the spirit of the "I am" advs:

I am PC (on Windows) and I am Linux (on Mac) ;-)

PS (update):

The compiz has some troubles handling windows that are using OpenGL rendering. For instance, the following is a screen shot which incorrectly overlays the glxgears display with desktop composition. I am not sure if this is a general problem, or problem with the PPC port.

Just for the note at the end, this post was entirely written and edited using Ubuntu 9.04 on Mac.

Friday, May 08, 2009

quick review of windows 7 on eee pc 1000 H

Over the last week, apart from being quite busy with my work (he he working hardly ;)) .. I did some major changes to my computing environment (and my friends). For my self, I installed the latest Ubuntu 9.04 on iBook G4 Mac, completely removing OSX 10.3 (more on this pleasing experience in the next post :-) ).

My friend, who was not quite happy with default Windows XP that came pre-installed with Eee PC, wanted to test out Windows 7. So, I first ran the upgrade advisor for Windows 7 (beta available at: This required me to install the .Net runtime which was not installed by default on Windows XP. The upgrade advisor suggested that I can safely install Windows 7 :) On the side note, I also ran this on my MiLeap and my Dell machine back home. For it was quite obvious that MiLeap didn't meet the basic Windows 7 requirements (so would stick to using Vista on it, for the moment), on my Dell machine it noted that I need to update OpenOffice to work well with Windows 7, which seemed reasonable.

So I downloaded the DVD image of Windows 7 RC from ( Next, as Eee doesn't come with a DVD drive and I didn't have an USB pen drive at my disposal, I downloaded Daemon tools (, that allows you to mount .iso images. Well from here it was pretty easy and straight forward to install Windows 7 side by side with Winddows XP. I did not have to worry about disk partitioning too as Eee already had two partitions with one of them being free.

So how does it fair? I am quite impressed. The aero effects are all very pleasing and surprisingly more useful than what was there with Windows Vista. Though the graphics is not very smooth (as compared to my desktop), the speed is quite acceptable, given than I have Nvidia 8500 GTX with 512mb dedicated card for my desktop contrary to the default Intel chipset graphics that comes with Eee for the moment. I would not put any screen shots for pleasing you though (as all these are quite prominently there at various sites on the Internet, and also official videos at

Apart from all the (pleasing) reviews that have gone into Windows 7, I like some small but wonderful changes to basic Windows applications:
1) Paint: All the interface changes aside, the default format in which the images are saved is PNG and not BMP. I just like this.
2) Write: Again all the pretty interface changes (finally!!) but good this is that it directly supports OpenOffice Writer formats (opening as well as reading). Though the default options is RTF still, which is OK.

I have not yet tested any third party apps on this installation, but have tested many on my virtual machine setup (including my MeTA Studio ;-)) so I see no problem with major applications that are used daily, with an exception of OpenOffice. It seems there are some issues with 3.0 version but the latest OpenOffice 3.1 seems to have resolved these issues as the Windows 7 upgrade advisor doesn't complain about it.

So the short story is: In most likely hood, when windowd 7 is released, I will upgrade my desktop back home (only the OS)... am not sure though what will happen to my MiLeap ... which is most likely to still run Vista (SP2) ;-)

And well finally, look back for my post on installing Ubuntu on my Mac ..

Have fun!

PS: This post (as usual) was written using Eee running Windows 7 with IE 8.