Dear Jonathan and others,

I am a webwork developer, though not one of the main developers.  I
have been successful at displaying a SAGE generated 3d plot from
within webwork using the Jmol applet provided that the plot data file
uses no pmesh input files.  Sage generates a zipped plot data file
sage0...stuff...zip which contains a SCRIPT file and may contain
several pmesh data files.  I am able to get Jmol to read the SCRIPT
file, but the lines in the SCRIPT file that load the pmesh files are
not executing correctly.  I have emailed Robert Hanson (the upstream
Jmol contact) about this, and his advice was as follows

---------- begin email correspondence --------------------

Jmol opens and reads selected files within a zip file. To do this,
just use "|" to specify directories within the zip file:

script cylinder-jmol.zip|SCRIPT

since the other files are in that zip file as well, you also have to
indicate a default path:

set defaultdirectory "cylinder-jmol.zip|"

Note the vertical line to indicate we want files within the zip file's
main directory.

then when you execute

script SCRIPT

it works.

---------- end email correspondence ----------------------

I am guessing that the SAGE developers have already figured out how to
make this "defaultdirectory" issue work for zip files in remote
directories, and if you would be able to describe to me how you make
it work, that would be greatly appreciated.  I like your idea of
having a single input file for Jmol that is "portable" in the sense
that it can be put anywhere, read as input to Jmol, and it will work.
However, I also think that there ought to be a way to make the current
system of zip files work (even though I haven't fully figured it out
yet).

I have been able to get things to work correctly when loading the zip
file locally (from my own computer) but not remotely (from the webwork
server).  Here's what I have done.  Get the zip file with the SCRIPT
and pmesh files from

http://math.webwork.rochester.edu/webwork2_course_files/fall08mth142/cylinder-jmol.zip

and save it to a local directory that contains "Jmol.js" and
"JmolApplet.jar".  Notice that the first line of the SCRIPT file was
added by me and uses verbatim the advice from Robert Hanson about
setting the default directory.  Create a html file in that same local
directory with the following code:


-------------------  begin html ----------------------------

<html>
<head>
<script type="text/javascript" src="Jmol.js"></script>
</head>
<body>
<!--
<script>
jmolInitialize(".",useSignedApplet)
</script>
-->

<!-- read cylinder-jmol.zip locally -->
<script type="text/javascript">
jmolApplet(["450","450"],"script cylinder-jmol.zip|SCRIPT")
</script>

<!-- read cylinder-jmol.zip remotely -->
<script type="text/javascript">
jmolSetAppletColor("white");
jmolApplet(["400","400"],"script
http://math.webwork.rochester.edu/webwork2_course_files/fall08mth142/cylinder-jmol.zip|SCRIPT")
</script>

</body>
</html>

--------------------- end html -------------------------

You should see a closed cylinder with some vectors on the left from
the local copy, and a blank Jmol applet (except for the word Jmol) on
the right from the remote copy.  The output from the Java Console is
given below, in case you're interested in tracing the errors.


----------------------------------------  begin output from Java
Console -----------------------

Java Plug-in 1.6.0_17
Using JRE version 1.6.0_17-b04 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Pearson_p
----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
l:   dump classloader list
m:   print memory usage
o:   trigger logging
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
x:   clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------


urlImage=jar:file:/C:/Durango/www/Jmol/JmolApplet.jar!/jmol75x29x8.gif
urlImage=jar:file:/C:/Durango/www/Jmol/JmolApplet.jar!/jmol75x29x8.gif
Jmol applet jmolApplet0__3128490663424304__ initializing
Jmol applet jmolApplet1__3128490663424304__ initializing
AppletRegistry.checkIn(jmolApplet1__3128490663424304__)
AppletRegistry.checkIn(jmolApplet0__3128490663424304__)
applet context: -applet
appletDocumentBase=file:/C:/Durango/www/Jmol/trial-local.html
appletCodeBase=file:/C:/Durango/www/Jmol/
applet context: -applet
appletDocumentBase=file:/C:/Durango/www/Jmol/trial-local.html
appletCodeBase=file:/C:/Durango/www/Jmol/
(C) 2008 Jmol Development
Jmol Version 11.6.16  2008-11-24 13:39
java.vendor:Sun Microsystems Inc.
java.version:1.6.0_17
os.name:Windows XP
memory:1.7/5.2
useCommandThread: false
appletId:jmolApplet1__3128490663424304__
(C) 2008 Jmol Development
Jmol Version 11.6.16  2008-11-24 13:39
java.vendor:Sun Microsystems Inc.
java.version:1.6.0_17
os.name:Windows XP
memory:1.7/5.2
useCommandThread: false
appletId:jmolApplet0__3128490663424304__
defaults = "Jmol"
defaults = "Jmol"
backgroundColor = "white"
backgroundColor = "white"
language=en_US
language=en_US
FileManager opening 
http://math.webwork.rochester.edu/webwork2_course_files/fall08mth142/cylinder-jmol.zip
FileManager opening file:/C:/Durango/www/Jmol/cylinder-jmol.zip
FileManager.openStringInline()
The Resolver thinks Xyz
ModelSet: haveSymmetry:false haveUnitcells:false
haveFractionalCoord:false
1 model in this collection. Use getProperty "modelInfo" or getProperty
"auxiliaryInfo" to inspect them.
ModelSet: autobonding; use  autobond=false  to not generate bonds
automatically
data "model list"
13
empty
Xx 0.0 -6.0 -6.0
Xx 6.0 0.0 -6.0
Xx -6.0 -6.0 0.0
Xx -6.0 -7.0 -6.0
Xx 0.0 -7.0 -6.0
Xx 6.0 -7.0 -6.0
Xx 7.0 -6.0 -6.0
Xx 7.0 0.0 -6.0
Xx 7.0 6.0 -6.0
Xx -7.0 -6.0 -6.0
Xx -7.0 -6.0 0.0
Xx -7.0 -6.0 6.0
Xx 5.5 5.5 5.5

end "model list";
FileManager opening file:/C:/Durango/www/Jmol/cylinder-jmol.zip
reading pmesh data from file:/C:/Durango/www/Jmol/cylinder-jmol.zip|
obj_264530.pmesh
FileManager opening file:/C:/Durango/www/Jmol/cylinder-jmol.zip
reading pmesh data from file:/C:/Durango/www/Jmol/cylinder-jmol.zip|
obj_878432.pmesh
FileManager opening file:/C:/Durango/www/Jmol/cylinder-jmol.zip
reading pmesh data from file:/C:/Durango/www/Jmol/cylinder-jmol.zip|
obj_877928.pmesh
script ERROR: io error reading
http://math.webwork.rochester.edu/webwork2_course_files/fall08mth142/cylinder-jmol.zip|SCRIPT:
java.security.AccessControlException: access denied
(java.net.SocketPermission math.webwork.rochester.edu:80
connect,resolve)
eval ERROR:
----line 1 command 1:
         script >> "http://math.webwork.rochester.edu/
webwork2_course_files/fall08mth142/cylinder-jmol.zip|SCRIPT" <<


---------------- end output from Java console -------------------



Thank you for all of your help.

Best Regards,

Paul

On Dec 6, 4:34 pm, Jonathan <gu...@uwosh.edu> wrote:
> Paul,
>   1)  Removing the flicker idea is good.  We'll see about implementing
> that.
>   2) Tell me if the following is what your envision.
> *You want a link you can use to download the file generated for Jmol
> in SAGE.
> *You want that file to work in the Jmol application (or is it the
> applet) no matter where you put it.
>
> The first part is really easy.  The second part is a bit harder.  Jmol
> can generate this kind of file from loaded data, but we will have to
> rewrite the SAGE code that generates the files for Jmol to get those
> kinds of files on the server.  That is why I suggested the signed
> applet.  Since they are allowed to write to the local disc if the user
> agrees, they can take whatever data is in them and generate a file you
> can move around.  If you are doing this all inside a web application,
> there are other ways to do this from javascript.  You would just have
> to move data generated in javascript to the server.  Jmol can generate
> a "state" script, which would point to all the necessary data on the
> server (assuming it is the same one, otherwise you have to use the
> signed applet).  That script is all that would have to be moved into
> the homework.  The other issue is getting Jmol to behave within the
> WebWork framework.  I don't know what those requirements are.  I know
> from discussions with other people that you have to be very careful
> when embedding Jmol in things like Moodle and Wiki sites.
>
> Jonathan
>
> On Dec 5, 5:47 pm, Paul Pearson <paultpear...@gmail.com> wrote:
>
> > Dear Jonathan and Marshall,
>
> > Thank you for your help.  My ultimate goal is to be able to include 3d
> > graphics generated by SAGE and displayed by JmolApplet.jar in the
> > online homework system WeBWorK.  The main reason I wanted an easier
> > way to get the 3d plot data file is to make it easy for people (other
> > than me) to generate interactive graphics in SAGE and use them in
> > webwork homework questions they write.
>
> > Personally, I don't mind signed applets, but signed applets may be
> > utrusted by other SAGE users.  Can a 3d plot data file generated by
> > the signed applet be displayed using the unsigned applet (I'm new to
> > this stuff)?  The signed applet would cause issues for webwork users
> > and their professors (student's who don't know whether they should
> > trust a signed applet will probably email their professors and drive
> > them nuts).    Actually, if a SAGE notebook user has a way to generate
> > a link to the zip file containing all of the 3d data plot info which
> > is as simple as the current "Get Image" link, that would probably be
> > as good as anything (it could even be a plot option, so that it is not
> > displayed unless the user wants it).
>
> > On an old message board, I found a slightly easier way than reading
> > the html source code to get the 3d plot data file. Here "easier"
> > doesn't mean easy, but at least this other method has a small number
> > of steps that can readily be described and followed by others.  Search
> > for "a.txt" on the page
>
> >http://markmail.org/message/vznxl4j34mrwoxv4
>
> > I would like to make a suggestion to cut down on the "flicker" of the
> > screen when scrolling a page with a Jmol applet displaying 3d
> > graphics: set the applet background color to white (the default is
> > black).  With a white background as the default state, as the applet
> > redraws it does not switch the background color from white (drawn
> > state) to black (default state) to white (drawn state).  See the code
> > below.
>
> > <script type="text/javascript">
> > jmolSetAppletColor("white");
> > jmolApplet(["450","450"],"script cylinder-jmol.zip|SCRIPT")
> > </script>
>
> > Best Regards,
>
> > Paul
>
> > On Dec 2, 7:04 am, Jonathan <gu...@uwosh.edu> wrote:
>
> > > Paul,
>
> > > I'm a Jmol developer who is trying to help with the Jmol interface in
> > > SAGE.  Would the following server your needs?
>
> > > Jmol can generate a file that the Jmol application can read to
> > > regenerate the display on your local machine.  I could add that kind
> > > of export to the web interface I am working on.  This would be in
> > > addition to generating an image that can be saved (already in the
> > > present interface).  This proposed facility will involve changing to
> > > the signed applet and will require the user to "trust" the applet, so
> > > that it can write to their disk.
>
> > > Let me know what you think, so that I can try to incorporate your
> > > wishes in the new interface.
>
> > > Jonathan
> > > On Dec 1, 1:00 pm, Paul Pearson <paultpear...@gmail.com> wrote:
>
> > > > Hi,
>
> > > > Is there an easy way to get the plot data file (the file that is
> > > > displayed by Jmol) from SAGE (preferably from the free online SAGE
> > > > notebook)?  I have figured out how to do get the plot data file (by
> > > > looking at the source code to get the appropriate URL for the
> > > > compressed plot data file), but would like to know if there is an
> > > > easier way.
>
> > > > Thanks!
>
> > > > Paul

--

You received this message because you are subscribed to the Google Groups 
"sage-edu" group.
To post to this group, send email to sage-...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-edu+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-edu?hl=en.


Reply via email to