Open Science Project : Jmol


The OpenScience project is dedicated to writing and releasing free and Open Source scientific software. The OpenScience project is managed by a group of scientists, mathematicians and engineers who want to encourage a collaborative environment in which science can be pursued by anyone who is inspired to discover something new about the natural world.

Among the six interrelated projects pursued is Jmol, an Open Source Java/Swing based molecular dynamics viewer.

caffeine screenshot

Voronoi Fractal

A Voronoi diagram is created from a set of points by dividing the plane into regions, where each region consists of the area closest to one of the points. Ken Shirriff published a paper about voronoi fractals ten years ago. Frederik Van Houtte from Belgium created a nice applet with the processing language to generate online voronoi fractals.

Click the applet to generate a new fractal.

A description of the project and the source code are published on Frederiks weblog under a  a Creative Commons license.

Julia applet, object, classid, codebase, …

The tags “embed” and “applet” are deprecated and even dropped in the new browser standards like XHTML 1.1. To embed objects within a document, the tag “object” should be used. The main attributes of “object” are:

  • classid : This attribute contains a URL for an object’s implementation. The URL syntax depends upon the object’s type. With ActiveX controls (Internet Explorer), the value of this attribute is not a URL, but an object-id with the prefix clsid. The way to access a Java applet is to use classid=”java: classname.class”. The pseudo-URL java: is used to indicate a Java applet.
  • data : This attribute contains a URL for data required by an object.
  • archive : This attribute contains a URL for the location of an archive file. An archive file typically is used to contain multiple object files to improve the efficiency of access.
  • codebase : This attribute contains a URL to use as a relative base to access the object specified by the classid attribute.
  • codetype : This attribute specifies an object’s MIME type.
  • type : This attribute specifies the MIME type for the object’s data.
  • declare : This attribute declares an object without instantiating it. This is useful when the object will be a parameter to another object.
  • name : Under the Microsoft definition, this attribute defines the name of the control so scripting can access it.
  • standby : This attribute contains a text message to be displayed while the object is loading.
  • width, height : the size of the object

The tag “param” specifies the parameters that are needed by the object to run. Most attributes exist also as parameter elements, but should never be used duplicated, except for the codebase attribute. In the “object” tag, the codebase attribute represents the location from which to download the object (for instance the Java plugin) when it is not found on the local machine. In the “applet” tag, the codebase attribute represents the location from which to download additional class and jar files. To resolve this conflict, the codebase attribute is mapped into a “param” codebase in the “object” tag.

Specific parameters are the following:

  • scriptable : Specifies whether the applet is scriptable from the HTML page using JavaScript or VBScript. The value can be either “true” or “false”.
  • mayscript : Specifies whether the applet is allowed to access “netscape.javascript.JSObject”. The value can be either “true” or “false”.
  • code : Specifies the name of the Java applet or JavaBeans component witout the extension “class”. It cannot be used with “param” element “object” nested inside the same “object” tag.

Microsoft Internet Explorer handles the “object” tag differently than other browser like Firefox, mainly due to the different implementation of the “classid” attribute. To provide multiple browser support, it is necessary to program a conditional settings of the “object”  tag by nesting the tags for IE and for other browsers. An example is shown below with the tiny Julia applet (128 bytes)  created by the russian programmer Konstantin Victorovich Morshnev (alias MoKo).

A detailed tutorial about (Multiple Browser Supported) Java applet using XHTML ‘object’ tag is given by Shayne Steele. A user guide to embed applets in documents with the “object” tag is published by Sun.