Bob, I followed the example you provided and introduced a time delay
(100 ms) when loading a total of six applets on a page (I am using
jmolAppletInline to support display of retrieved mol2 structures). It
works, but as before I am having applets die occasionally (in the
sense of freezing and being unresponsive to further updates).
Do I also need to introduce a time delay when updating the structures?
Currently my update code includes this:
for( i = 0 ; i < hitNames.length ; ++i )
{
if( mols[i] == '' )
{
showText( "WARNING -
Some structures are missing!" ) ;
}
else
{
position = i +
1 ;
jmolLoadInline(mols[i], position ) ;
}
}
- where 'position' is the label of the applet and 'mols[i]' the
structure text. I would assume that the function jmolLoadInline
returns only when it's finished with its business, so that introducing
a time delay would be immaterial?
Any advice appreciated,
Randy
P.S. Below is the pair of functions that load the applets, one that
displays a query structure display, and which then calls the function
that loads the hit display applets. 'createResultApplets()' is called
when the page loads. I would be happy to give you all the javascript,
but it is long ...
function createResultApplets()
{
jmolInitialize("./jmol-11.7.27/");
jmolSetDocument(0);
document.getElementById("viewJobQueryPanel").innerHTML =
jmolAppletInline(210,
"empty.mol\n\n\n 0 0 0 0 0 1 V2000\n", "",
0 ) ;
setTimeout( "createHitApplet(1)", 100 ) ;
return ;
}
function createHitApplet( n )
{
document.getElementById( "hitStructure" + n ).innerHTML =
jmolAppletInline(180,
"empty.mol\n\n\n 0 0 0 0 0 1 V2000\n", "",
n ) ;
if( n <= 4 )
{
var m = n + 1 ;
setTimeout( 'createHitApplet('
+ m + ')', 100 ) ;
}
}
Begin forwarded message:
From: Randy Zauhar <artemisdiscov...@me.com>
Date: March 6, 2009 11:47:51 AM EST
To: jmol-developers@lists.sourceforge.net
Subject: Re: [Jmol-developers] JMol applets dying at random
Reply-To: jmol-developers@lists.sourceforge.net
Bob, I get the idea. I had at one point tried to do something like
this by adding script elements to the DOM that contained the
appropriate text, but it did something weird (loaded a new page, I
think). I will give this a whirl.
I should add that by reducing the number of applets to six, things
have gotten dramatically better, with only an occasional hiccup.
Also, with the new jmol version, if the applet does die the window
is blank, which is much better than displaying frozen old data. At
this point I can live with things as they are, even if an occasional
page reload is needed.
Anyway I will implement along the lines of your suggestion below.
Many thanks!
Randy
On Mar 6, 2009, at 9:58 AM, Robert Hanson wrote:
If you still end up having problems with the loading, there are
solutions where you create one applet only when the previous one
has loaded so that multiple applets are not being created
simultaneously. This is illustrated at http://chemapps.stolaf.edu/jmol/docs/examples-11/sequence3.htm
, which simply looks like this:
<html>
<head>
<script type="text/javascript" src="Jmol.js"></script>
<script type="text/javascript">
AppletScripts = new Array("load data/caffeine.xyz","load data/
1crn.pdb", "load data/1blu.pdb", "load data/quartz.cif {1 1
1};unitcell off")
function nextApplet(app) {
if(app < AppletScripts.length)setTimeout("createApplet("+app+")",
100)
}
function createApplet(n) {
if (n == 0) {
jmolInitialize(".")
jmolSetDocument(0)
}
document.getElementById("appDiv" + n).innerHTML =
jmolApplet(100,AppletScripts[n] + ";javascript nextApplet(" + (n +
1) + ")")
}
</script>
</head>
<body onload=createApplet(0)>
<div id=appDiv0></div>
<div id=appDiv1></div>
<div id=appDiv2></div>
<div id=appDiv3></div>
</body>
</html>
Randy J. Zauhar, PhD
ArtemisDiscovery, LLC
Independents Hall
32 S. Strawberry Street
Philadelphia, PA 19106
EMail: artemisdiscov...@me.com
Phone: 267-303-4766
University:
Depts. of Chemistry & Biochemistry, and
Bioinformatics & Computer Science
University of the Sciences
600 S. 43rd Street
Philadelphia, PA 19104
EMail: r.zau...@usp.edu
Phone: 215-596-8691
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San
Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the
Enterprise
-Strategies to boost innovation and cut costs with open source
participation
-Receive a $600 discount off the registration fee with the source
code: SFAD
http://p.sf.net/sfu/XcvMzF8H_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers
Randy J. Zauhar, PhD
ArtemisDiscovery, LLC
Independents Hall
32 S. Strawberry Street
Philadelphia, PA 19106
EMail: artemisdiscov...@me.com
Phone: 267-303-4766
University:
Depts. of Chemistry & Biochemistry, and
Bioinformatics & Computer Science
University of the Sciences
600 S. 43rd Street
Philadelphia, PA 19104
EMail: r.zau...@usp.edu
Phone: 215-596-8691
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers