Tuesday, February 16, 2010

One, two, three, MD

Some exciting developments over at the Molecular Workbench (MW) blog run by MW author Charles Xie. I have several blog posts on MW, but it was necessary to install MW to check it out for yourself. Now it is possible to embed a MW applet in web pages (and blog posts!) like the one here (just push the play button!):
I think this is a big step forward for MW. While it is easy to download and install MW, it still removed MW a few clicks from the user and made it "appear to be yet another kind of annoying pop-up" and Charles notes. It's very easy to do this. The screencast below shows how I made the simulation above in MW. Note that it literally takes one minute (and 5 seconds). When you hit save you get two files: md.cml and md$0.mml. I transferred these to my web server where I had also put the MW applet (mwapplet.jar). The html code is <applet code="org.concord.modeler.MwApplet" archive="mwapplet.jar" height="300" width="100%"><param name="script" value="page:0:import md.cml"></applet> To include it in a blog, where mwapplet.jar is not installed, add the server address in front of mwapplet.jar and md.cml, e.g. http://myserver.edu/md.cml.

11 comments:

Anonymous said...

Hi Jan:

Somehow the applet embedded in your blog worked for the first time but failed after I revisited it. I am on Windows XP.

I am pretty sure that this is a problem with the blog as it always works for me if I embedded the applet like this:





Since we are not allowed to post an applet in a comment,
I had to append an 'x' to the end of the applet and param tag in order to bypass this restriction.

Charles

Anonymous said...

Oh well, the entire thing was ignored in the above comment. So I am trying it again below:

<applet id="applet1" archive="http://propka.ki.ku.dk/~jhjensen/mwapplet.jar" code="org.concord.modeler.MwApplet" width="100%" height="240">
<param name="script" value="page:0:import http://propka.ki.ku.dk/~jhjensen/md.cml"/>
</applet>

Anonymous said...

I meant if I put the above code in an HTML file, it always works for me. Pasting it to my blog, it also works. Not sure what happened. Judging from the Java error it threw out, it appeared to be a Java Virtual Machine error.

Anonymous said...

Here is something interesting. If one goes straight to the URL:

http://molecularmodelingbasics.blogspot.com/2010/02/one-two-three-md.html

it always works.

But if one goes to the main one:

http://molecularmodelingbasics.blogspot.com

It shows an error and the applet doesn't load.

This doesn't happen on my blog. And I can reproduce this on both Windows and Mac. Interesting. Perhaps the codebase is messed up.

Charles

Anonymous said...

I know what now. If I clicked the labeled link:

http://molecularmodelingbasics.blogspot.com/search/label/molecular%20workbench

It won't work. I took back my words that it won't work for the main URL: http://molecularmodelingbasics.blogspot.com

The prime suspect is the search engine that may not mess up with the code base.

Jan Jensen said...

Charles,

yes, I have the same problem, thanks for pointing it out. Any ideas on how to solve it?

By the way, my Jmol scripts don't have that problem.

Another question: to increase the loading speed of a page I would like to load a picture, which then links to the applet, like I do for Jmol. Example.

It should be possible to do this with mwapplet.jar, right?

Jan Jensen said...

PS: my current efforts, which does not work, can be found here.

Charles Xie said...

I figured that it needs to be:

<img src="chymo.gif" onClick="insertMW('rablen','100%',240,'entropi.cml')">

100% is not recognized. You either use a number or enclose the percentage with single quotes.

Jan Jensen said...

That's it!! Thank you! Jan

Charles Xie said...

I just did an update of mwapplet.jar that sets the look-and-feel to the system's. You may want to redownload so that Mac users will see the applets as Mac native, and Windows users will see them as Windows native. No one seems to want Java's native look-and-feel. :-)

Jan Jensen said...

Done, thanks! Jan