Tuesday, March 31, 2009

Comment on: BeanShell, Rhino and Java -- Performance Comparison

These are my comments on an old performance test by Pankaj Kumar on BeanShell, Jython and others (http://www.pankaj-k.net/spubs/articles/beanshell_rhino_and_java_perf_comparison/index.html).

There are some notable problems with the benchmarks reported in above Blog:
1) When a time comparison is done, you chose the best possible implementation of an algorithm in that language. Evidently this is not the case. For instance, in case of BeanShell, ArrayList is used to represent an array of Strings and not a normal array. This introduces additional overheads especially calls to get() method.
2) If you use inbuilt methods to do the sorting: i.e. array.sort() for Jython and java.util.Collection.sort(array) for BeanShell the results are totally different, and it seem to show Jython to be 13 times slower than BeanShell for array if size 1000. Which is bizarre.

In short, I find all such benchmarks as misleading, and should not be used as the mere metric for choosing a particular scripting language, or for that matter any other programming language. And Pankaj does seem to make this comment at the end of his article.

Another reason to fool around with MeTA Studio: Python support

Well yes! Many had asked for it so now here is it!

First a bit of history. When I started developing MeTA Studio, I did evaluate Jython (Python implementation for JVM) along with BeanShell and many others. But then finally decided that BeanShell would be the first class scripting interface for MeTA Studio with provision for adding any other scripting language that is targeted for JVM. There were couple for reasons for this decision:

- Jython is too heavy. At about 3 mb (with no debug info). My modified BeanShell is 800kb while if u compile it with no debug info it boils down to a mere 200kb!!
- Prototype-to-production. Python code, though easy to write, doesn't translate easily to Java code. It is very easy to prototype in BeanShell and put it into Java.
- Speed. While BeanShell can run at native speed of Java (i.e. after you compile the code for a target JVM), Jython is purely interpreted, and it was definitely orders of magnitude slower than BeanShell. When I tried Jython the first time many years ago it was about 40-50 times slower than BeanShell, enough to keep me away form making it the primary scripting interface for MeTA Studio. In recent times though Jython has improved substantially. In many cases faster, but not as flexible as BeanShell in terms of the earlier point(s).
- License. It is not LGPL/BSD... So I will only distribute it as a separate addon package (maintainers are needed here ;) !)

and why it is included now:
- IBM supports Jython in their enterprise apps like websphere, I want to impress them ;) With rumours of them taking over Sun.. (Glee .. Well now wondering on that as Oracle plans to buy them instead!)
- I want more developers and users for my platform!!
- Proof that other languages can be easily supported, with out changing anything within the core IDE!
- I want to have fun ;)

Well the complete Jython support for MeTA Studio was added with about 4 days of work, which largely involved writing appropriate wrapper functions akin to BeanShell. And thanks to ways to add external library and widgets framework in MeTA Studio, there were no changes made to the core IDE specifically incorporate Jython support.

So you wanna give a try? Here is how:
The installation instructions are same as previous, but again ..
0) Ensure u have v 2.0.01042009 or a higher version installed. Project URL: [http://code.google.com/p/metastudio/]
1) Unzip metajython.zip (download from: Jython support file on Skydrive) in meta/lib/ext
2) Shut down MeTA Studio if it is already running
3) from command line:
meta/bin >$ java -jar MeTA.jar --addlibs jython
(you can skip this step, if you have already done so with the previous builds)
4) Start MeTA Studio, open the code editor. Then open jythonWidget.bsh from meta/lib/ext/meta-jython directory
5) Click on Make Widget to get the Jython widget on the the widget panel

Now you can either use the shell (like the usual python shell) or use the editor to write code in python as you would normally do for BeanShell scripts.

I will be putting up user guides on how to use the Jython support in MeTA Studio at: http://code.google.com/p/metastudio/wiki/PythonSupportForMeTAStudio. You are also strongly encouraged to contribute to the wiki, just drop me in a mail if you want to!

Now that Jython support is out, would like to state few things about future of this Jython support of MeTA Studio:
- Firstly, BeanShell will always be the primary scripting interface in MeTA Studio. Meaning that all new releases of MeTA Studio will come installed by default with BeanShell as has always been the case.
- Jython will never be distributed along with binary distribution of MeTA Studio. This support will always be available as an external download as is provided above.
- Since this project is getting big day-by-day, it would be really nice if some one can take up the responsibility of maintaining the Jython support in near future. Though I would maintain it with a bit less priority till I can get a maintainer for this port.

Fool around ;-)

Monday, March 30, 2009

MeTA Studio bug fix release

Another online release is available (MeTA Studio version 2.0.31032009). This is primarily a bug fix release. But it also includes a test geometry minimizer based on MM/UFF being written by Josh. To use this Right Click in MoleculeViewer, Choose Tools -> Minimize. Again note that the minimizer is an experimental code, and may not give you expected results!

And yes, suggestions are also welcome for the modified project page at: http://code.google.com/p/metastudio/

Have fun!

(Quick Update: as usual, found some last minute bugs after I uploaded the online update, so now the latest version is 2.0.01042009)

Tuesday, March 24, 2009

MeTA Studio SVN repository

Starting from today, daily source updates of MeTA Studio will be available via the SVN repository: http://code.google.com/p/metastudio/source/browse/

Note that I will still release stable source tar balls as earlier (http://code.google.com/p/metastudio/downloads/list), but the current source will give a preview of things to come. I do not recommend using any of the APIs in the current source to write scripts or applications of your own! These are subject to change on day to day basis.

On a side note: I hate SVN :(

Enjoy!

Saturday, March 21, 2009

A reboot on Photography

Well this time at a different place in the world… Oz, the “island continent”, place of kangaroos.

When I got my first digital camera, I had been regularly with my photography interest. But I soon hit into how much I can stress with my very minimal HP camera with 3x optical zoom. Most of times I am interested in either far away objects or macro shots. For either of these I have to strain a lot with my HP camera to get good shots. I also tried things like putting extra lenses for macro shoot and also a telescope for getting a closer look at the moon.

In any case, my interest in photography has not gone done, least because I can not yet afford a good quality DSLR ;-)

So, I decided to go about my photography again with my HP camera, this time a new place. All the photos here are in fact indoor photos, in that me and the camera were both inside my home or on a balcony at a friends place, but what was shot was all outside ;-)

IM000825

On my backyard, the clouds begin to appear…

IM000826 

they are a bit shy ;-)

IM000830

and then they are all over!

IM000827

and the rain…

IM000828

and the storm was hard for this branch…

IM000829

no one out there, its raining there !

IM000833

IM000832

and I try to cook in the mean time… Those potatoes stacked up on their own, I didn’t do it :-)

IM000835 

IM000846

IM000848

and at the end there was this wonderful rainbow. All shots are taken with different EV exposure settings.

And then, I go to play tennis on weekend these days… but since my games is very bad, I though its better to shoot some thing that looks better than my self ;-) which now really makes for  the outdoor photography :D All these photos were taken on my mobile (Nokia e51) camera.

23012009(001)

23012009(004)

Then we went to a small (but quite steep) waterfall near Canberra

25012009(001)

25012009(002)

and some of the photos on Bateman bay

27122008(001)

27122008(002)

27122008(004)

27122008(006) 

That is it for this photo story ;-)

Have fun!

Tuesday, March 17, 2009

My parents fixed the PC at home!

This was an experience!

For the last one month or so my parents have been complaining that my PC at home some times suddenly refused to start up. This was strange to me as the PC in question is a Dell machine and is about an year and a half old. Though I have opened it up and added a few memory modules and a graphics card to over the time.

Now I have absolutely no physical access to my machine @ home, but I heavily depend on it to talk to my parents. The only rational thing I could figure out most of the time was that the power plug was loose and you just need remove it from UPS and fix it back. Though I was pretty sure that it was not the real problem as I have never seen it to be loose before.

And one fine day, i.e. on a Monday (March 9, a holiday for me and had planned a cycling session to a near by lake for the day), my mom calls me and tells me that my computer is broke!! It is giving strange beeps and there is no power on keyboard! From which I could only make a vague guess that there is some memory problem or some of them have gone loose for some strange reason.

That was pretty good observation by my parents, I must admit, as they are not really used to computers as I am. Though my dad has worked on third-generation computers, but that was quite a while ago.

Ensuing this was a real ordeal from my and my parents side, beginning by telling how to open the machine. Thank god it was a Dell machine, and you can easily open the side cover without using screwdrivers! To make them open the cabinet did not take much of a time it was done with some five minutes of instructions.

The real hard part was telling them where the RAM was installed! I tried giving all sorts of rubbish analogies. First I made sure that they know what board to look into (motherboard). And then finally settled on to this one: there are 3 "ruler-like" strips placed next to each other, which are perpendicular to the motherboard and are placed on "white" strips. Lol, I have never had had to tell any one before how a RAM chip looks like :)

After this, they told that yes, they can see it. Next, it was easy to tell them how to remove one and then test whether the system powered on. My system back home has a 2GB, 1GB and a 512MB chip. One-by-one they removed the chips and checked, but all was in vain. So next, I asked them to put back the chips one-by-one, this was more harder to tell them, as you need to put them back properly (they go only one way in) as also you need to press the chips somewhat hard to place them firmly on the holder. It didn't work for the first two times. So I was almost gonna give up and in between I called up my computer guy back in Pune to ask if he could to be free to drop in at home that same day and fix up the things. He told that he would call me back in 10 mins and let me know! This was pretty surprising reply by any standards!

But in the mean time they could properly figure out how to place the chips and started the PC. Next I was able to remotely connect to it and could figure out that only one module was properly fitted. So I again called them and asked them to properly fit the other two. And viola, the next time I connected remotely, every thing was back to perfect and normal.

All of us were pretty happy for this. But I was pretty amazed, my parents fixed the PC!! and this was the first time ever they had opened it by themselves, though they have seen me doing this countless number of times :)

And to add to all the amusement, the computer guy form Pune called back, I am still recovering from this! Any way so I told him that my parents fixed it, though you might be needed some other time ;)

Ha and on the downside, its was all a 3 hour "fixing time", and cost me 500 INR for all the conversation we had, and well I stayed home for the whole day. But what the heck, it was worth it!

Wednesday, March 11, 2009

MeTA Studio online update

A new version is available (2.0.12032009).

Two reasons for this version:
- First, it is a bug fix release with a few new features added. You can also note changes in graphics APIs (which are far from complete). MapReduce is now more simpler to use with wrapper functions, essentially it boils down to:

res = mapreduce("/home/ganesh/meta/scripts/map.bsh",
"/home/ganesh/meta/scripts/reduce.bsh", data);
print(res);

- Second, its a special day ;)

Have fun!

GMail times

Some days ago I noticed that GMail is giving weird timing information. This is related to what is shown on the top of the message (yyy minutes ago). Most of the time now they turn out to be negative!! I think they have started using clock reading from the user's computer to stamp their mails. So in case if some one has a time set in future, it gives -ve date. I dont think it was this way earlier, the time stamps *should* be taken from a known, correct source! Google please change this!!

Wednesday, March 04, 2009

4:44, 22 C




.. numbers are interesting, aren't they?

At times they can get serious too: Recipe for Disaster: The Formula That Killed Wall Street . Check out this interesting article on wired.com :)

Sunday, March 01, 2009

MeTA Studio update: MM/UFF, map-reduce and bug fixes

An online update for MeTA Studio is available (v. 2.0.02032009).
If you have not followed the instructions in the previous updates as put in (http://tovganesh.blogspot.com/2009/02/meta-studio-update-map-reduce-editor.html), kindly go through that before applying the current update.

There are some interesting things happening behind the scene with MeTA Studio development:
- Josh Milthorpe, a Ph.D. student at ANU, is actively contributing code and bug fixes to MeTA Studio. So hope to have some quite interesting contributions from him in near future :)

- Current version includes a very basic implementation of MM/UFF by Josh in MeTA Studio, but is not fully integrated yet. First plan is to get it working with the MoleculeEditor. To test out you can use some thing like the following from bsh prompt:

mmEnergy(readMultiMoleculeFile("/home/ganesh/tmp/ch4.xyz").get(0));

Note the APIs here are at a very primary stage, and may change as we progress.

- There is a major upgradation of map-reduce implementation. Now this supports handling of node failures as well as has multi-core support. Next plan is to get some useful application on this platform. All ideas in this respect are welcome!

- This version also includes stable release Apache math-commons lib (http://commons.apache.org/math/), which supplements and enhances math APIs that are already a part of MeTA Studio.

- As usual, the update includes many bug fixes. You may also spot some organisational changes in graphics rendering APIs, which is being slowly re-factored. If you have not written any script that explicitly depends on these very raw APIs (and I presume this is highly unlikely) nothing would break.

As always, if you have any issues / suggestions feel free to post them at: http://code.google.com/p/metastudio/issues/list

Have fun!

( Update: Found out some last minute bugs with the way the node failures are addressed in map-reduce implementation in MeTA Studio and is subsequently patched today with version (2.03032009) ..

This version also adds some enhancements to MM/UFF by Josh.

The number 03032009 seems to be interesting though ;)
- two 3 s
- one 2
- 3 x 3 = 9
- 3^2 = 9
...
)

Wednesday, February 25, 2009

Vibrational analysis widget for MeTA Studio

Many had asked about the support for visualizing frequency data from GAMESS/ Gaussian output in MeTA Studio. The short answer was: not out of box.

The long story: you and write a widget, and well good thing is that I myself wrote it ;) You can get the widget here [freqViewWidget.bsh].

To use this widget:
- make sure you have the latest version (2.0.24022009) or higher
- download the above script
- use the Add/Remove Widget button on the Widgets panel to install the widget
- Optionally open it in code editor (in meta studio) and click on "Make Widget" button
- the widget should appear in the Widgets panel.

- next open a molecule file as usual in meta studio
- then click on select molecule in widget, select the molecule with freq data
- then i guess its pretty straight forward ;)

So how does it look?



And I guess the graph (generated from jfreechart API which are shipped with MeTA Studio), looks pretty too .. try it out and let me know!



Have fun!

Sunday, February 22, 2009

MeTA Studio update and re-factoring plan

First on the re-factoring plan:

After much of though, I have decided to re-factor the graphics engine for MeTA Studio so as to make it more flexible and enable it to use multiple rendering engines at the backend at the same time providing complete UI integration with existing IDE. This will take some substantial amount of time and hence I plan not to update the source release till such time. Only on-line updates will be provided till such time. Any changes to APIs will be reflected in the API documentation that would be shipped with the on-line update.

Current version is more of bug fix release with some new APIs:
- GAMESS/ Gaussian reader now reads more additional information
- Some of these can be see by: Right Click -> Tools -> Additional Information in the MoleculeViewer, there are a number of usability bugs in this code though at the moment.
- Molecule.AdditionalInformation class is updated
- there are other API additions and modifications in org.meta.molecule package (refer to IDE help for mode details).

During the time when graphics engine re-factoring is being done, any features that use graphics framework (for example Frequency visualisation) will be shipped as user scripts, and at a later stage would be integrated into the IDE.

The current version is: 2.0.23022009
The usual UAC note to Vista users apply, you need to start MeTA Studio in admin-mode to update (I plan to fix this in the next full binary update).

Have fun!

(Update: some necessary small updates made the current version to 2.0.24022009)

Monday, February 16, 2009

Cooliris (PicLens) is great even on small screens and netbooks :)

Some time ago I wrote a short post advocating for a wonderful piece of software called Cooliris (here). Back then I was using my high powered desktop but currently am on move and only have access to my MiLeap. Even on this small screen and pretty basic graphics hardware , Cooliris seems to just work very smooth, and the UI also scales pretty well :)

coolris_small

Thursday, February 12, 2009

Windows 7 WritePad supports saving as ODF!




Windows 7 WritePad seems to support saving in ODF format!! Which is totally surprising .. it also supports writing in OOXML format. In simple tests that I did with saving to ODF format, I could open the files written in WritePad in OpenOffice without any glitch!

Sunday, February 08, 2009

MeTA Sudio: minor update

A minor update (bug fix and jrman) update is available. The version number is (2.2.0.09022009).

Please read this post before applying this update.

This update brings the jrman library to the latest version, this makes rendering images much better than what was available with previous versions. However, it removes many jrman classes that are really not required for rendering (UI and some test classes). Also there is a scuttle change in the JRMan rendered image within MeTA Studio: the background of the images is always transparent. This behaviour may be modified in future.

Again no source update yet ... the next source update will include changes to the jrman lib as used in MeTA Studio... but this will be after quite some time ;)

Have fun!

Thursday, February 05, 2009

Reporting and Blogs: Blatant errors!

I am not sure how you take this when some blogger in PC World announces that Malaria is a Viral infection!!

Even a 10th grader student would know that Malaria is not a Viral infection but is a caused by protozoan parasites, generally Plasmodium vivax, which is *not* a virus! It is simply ridiculous that people don't try to atleast verify what they are writing, or atleast update it, when there are comments telling that how wrong they are!!

Wednesday, February 04, 2009

The point for Rs 500 laptop (or shall I say sub Rs 1K device?)

OK. So now Hindu has a more reasonable story about the device (I will not call this a laptop any more) with a bit hazy picture of it.

And potentially it seems to have got bashing from every where (here, here and here)!

.. well including me. The problem was with calling the device a "laptop". A "laptop" as is commonly seen in the tech world as a completely different device as opposed to what was shown in Tirupati. But, I still feel that every one missed the point, because of the device being labelled as "laptop". Does any one remember Cherry PC? To me this is an Indian competitor for the same... only probably a lot less cheaper, and may be a less capable too. It would be fantastic if for example you could connect this device to the TV (they are in many many Indian households), and get a cheap keyboard, and a wireless or a wired broadband connection... and viola you have the whole Internet, or the as the education ministry wants it to be...

As against what many people say, this device has a potential, but only time will tell if this does not turn into another "vapourware" like well Simputer or Mobilis (although they are not "vapours" but their cost is extremely high as compared to what they were originally predicted to be).

Tuesday, February 03, 2009

Rs 500 laptop followup

As I speculated earlier in this post, this device (aka "laptop") doesn't have a display (http://timesofindia.indiatimes.com/Hyderabad/10-laptop_proves_to_be_a_damp_squib/articleshow/4072417.cms)

.. But I am still awaiting more details on what actually it is. But it is definite that it cannot be called a laptop ... pretty safely!

.. So I can continue to dream on my netuter design ;)

Monday, February 02, 2009

MeTA Studio update: map-reduce, editor, bug fixes

New online update is available (version 2.0.03022009) [accessible via. Help->Check for Updates with in the IDE].

Before any thing,
Very Important:

After applying this update remove the following file from metastudio settings before restarting:
~/.meta2.0/launcherConfig.xml

Note that depending on the OS, ~ should be appropriately replaced. For Windows Vista this is in C:\Users\< user-name >, for earlier windows its C:\Documents and Settings\< users-name >, for UNIX/Linux this is usually /home/< user-name >, for OSX it is /Users/< user-name >.

This is required because the way MeTA Studio is launched has completely changed from this version to allow purely non-gui MeTA Studio demon (using --daemon command line switch) to be running, even on machines that do not have graphical environment.

Future additions to the current version:

- The Molecule option in IDE now provides and additional option to create a new molecule using in built (yet to be complete) MoleculeEditor. This is highly experimental and its functionality is going to change over time. Don't complain at this stage ;) but suggestions are welcome :)

- The mapreduce framework is now usable, but not yet complete. To test out this framework you can use the scripts from http://tovganesh.googlepages.com/mapreduce.zip, try running mapreduce.bsh from IDE [Tools -> Open Code Editor]. Every thing else, at this point, I guess is self explanatory ;)

The current mapreduce framework has a slow start and does not yet handle node failures. Note of security: mapreduce involves remote execution of BeanShell scripts. By default MeTA Studio prompts for any action relating to Federation framework (mapreduce is implemented over the Federation APIs). This can be appropriately configured as suited from with in IDE [Preference -> Federation Security Rules].

- Includes a usual list of bug fixes
- But does not include updated help for the new mapreduce APIs and no source update yet ... I plan to do this in the next iteration.

have fun!