Opened 9 years ago

Last modified 9 years ago

#12299 closed enhancement

Advance Jmol Interactive Features in Flask Notebook — at Version 91

Reported by: gutow Owned by: jason, mpatel, was
Priority: major Milestone: sage-5.4
Component: notebook Keywords: Jmol, 3D, notebook
Cc: novoselt, strogdon, ppurka, kini Merged in:
Authors: Jonathan Gutow Reviewers: Karl-Dieter Crisman, Steven Trogdon, Punarbasu Purkayastha
Report Upstream: Fixed upstream, in a later stable release. Work issues: doctests,switch to generic error
Branch: Commit:
Dependencies: #11080,#11078,#11503 Stopgaps:

Status badges

Description (last modified by gutow)

This ticket provides the following advanced interactive features to Jmol in the notebook:

  1. Initial display is a static image created by Jmol (if a javaVM is available on the server) or Tachyon. This means all browsers and devices will at least be able to see a 3-D image.
  2. The live applet can be loaded by clicking on a "Make Interactive..." button.
  3. Colors can be changed without recalculating
  4. spin on checkbox
  5. high quality checkbox
  6. Meshes can be displayed without recalculating (no sparkles either :))
  7. Transparency can be adjusted without recalculating
  8. Applet size can be adjusted
  9. Applet can be displayed in its own window
  10. Can download a file that the Jmol application can open to recreate the exact view shown on the web page. This allows for more sophisticated manipulation and the semi-automatic creation of web pages that include this live 3-D image.
  11. Solves memory problems associated with opening too many Jmols at once, by automatically putting Jmols that are not being used to sleep.

If you just want to try: Go to TestServer and create yourself an account. I will try to keep it up-to-date and running, but it may be down when I am coding.

Explicit Installation Instructions: (tested against 5.0)

1) Install the flask notebook by following the instructions in #11080. I recommend installing the optional OpenSSL package. I have not been getting consistent behavior using the system install on all my different machines (probably a path issue).

2) Then do the following to apply the patches and install an updated version of Jmol. The first two commands close any Hg queues left open by the flask install (doesn't hurt to do that even if all the queues are closed).

./sage
sage: hg_sage("qfinish -a")
sage: hg_sagenb("qfinish -a")
sage: hg_sage.apply("http://trac.sagemath.org/sage_trac/raw-attachment/ticket/12299/trac_12299_plot_3D_static_img.patch")
sage: hg_sagenb.apply("http://trac.sagemath.org/sage_trac/raw-attachment/ticket/12299/trac_12299_adv_jmol_nb.patch")
sage: hg_sagenb.apply("http://trac.sagemath.org/sage_trac/raw-attachment/ticket/12299/trac_12299_old_wksht.patch")
sage: hg_sagenb.apply("http://trac.sagemath.org/sage_trac/raw-attachment/ticket/12299/trac_12299_server_sync_and_UI.2.patch")
sage: exit
./sage -f  "http://www.uwosh.edu/faculty_staff/gutow/jmol-12.3.27.p0.spkg"
./sage -b

Notes:

If you are doing this in a different way you need to know:

The development version of Jmol is necessary. Install this .spkg: http://www.uwosh.edu/faculty_staff/gutow/jmol-12.3.27.p0.spkg

Four patches are necessary:

A patch to plot3d in Sage: attachment:trac_12299_plot_3D_static_img.patch

A patch to a number of files in sagenb: attachment:trac_12299_adv_jmol_nb.patch

Patch so old worksheets with Jmol load without error (path fix): attachment:trac_12299_old_wksht.patch

Server sync and UI tweaks patch: attachment:trac_12299_server_sync_and_UI.2.patch

These patches include all the changes in #9238 plus.

Change History (96)

comment:1 Changed 9 years ago by gutow

  • Description modified (diff)

comment:2 Changed 9 years ago by gutow

  • Description modified (diff)

comment:3 Changed 9 years ago by gutow

  • Description modified (diff)
  • Status changed from new to needs_review

The second patch is very big, but I think it is best to do it as a patch to make sure that I haven't somehow rebased against the wrong versions of the files.

comment:4 Changed 9 years ago by novoselt

  • Cc novoselt added

comment:5 Changed 9 years ago by strogdon

  • Cc strogdon added

comment:6 Changed 9 years ago by gutow

Rebasing the patches to 5.0.beta6 and fixing issue of p0 versus p1 level patches.

comment:7 follow-up: Changed 9 years ago by strogdon

I've tried these patches on top 5.0.beta6 and #11080. I believe the patch to jmol_lib.js in trac_12299_adv_jmol_nb.patch appears twice. If I delete the first occurrence everything applies and the png images generated by Tachyon appear in the notebook. If I click the "Make Interactive" button then the 3-D jmol images appear. I noticed that the first image to always appear, even if a cell is reevaluated, is the png generated image. "Make Interactive" must be clicked to get the jmol image. If a jmol image is present in a cell, reevaluating that cell will display a png image. "Make Interactive" must be clicked again to recover the jmol image. If after clicking "Download this view" from the "Advanced Controls" and saving the jmol image there then appears in the lower right corner of the applet a "Jmol_S" the wasn't present initially. When clicked this gives a jmol menu. I believe this is part of jmol. I've seen it on sage-on-gentoo where jmol-12.0.45 is used. I'm not sure why it suddenly appears after the indicated action. This all looks very interesting.

comment:8 in reply to: ↑ 7 ; follow-up: Changed 9 years ago by gutow

Replying to strogdon: You are correct about the error in the adv_jmol_nb.patch. I have manually deleted the extra patch to jmol_lib.js and uploaded a correct version. I've been having trouble patching on top of #11080 patches. I believe I ran afoul of unfinished queues. Anyway, I think this correction is the last fix related to that.

Comments:

1) The red "Jmol_S" logo in the bottom right corner indicates that the signed applet has been loaded and has access to the user's directory tree. I believe I can turn it off, but think it is a bad idea. I want to be reminded that I am using an applet that can send stuff from my disk to the server. The menu is the same as the right-click menu that is always available with Jmol.

2) If we want to have an image as the default so that all devices will see something, users will have to deal with requesting it become interactive each time the cell is recalculated. The notebook+sage presently insists on reloading Jmol each time a recalculation is done. In order to do this properly we would need to have a separate div in the notebook for applets and not kill the applet unless it is not being used. Then Jmol would not revert to the starting over state each time a recalculation is done. I think that is another ticket for after these changes go in.

3) Would reloading with a static image be less of an issue if the .png was the same quality as the Jmol image? I'm working on generating static images using Jmol on the server if a Java Virtual Machine is installed on the server. Many details like graceful fallback, probably to Tachyon, are still being worked out.

Does this answer your questions or generate in suggestions for what needs work?

comment:9 in reply to: ↑ 8 Changed 9 years ago by strogdon

Replying to gutow:

Comments:

1) The red "Jmol_S" logo in the bottom right corner indicates that the signed applet has been loaded and has access to the user's directory tree. I believe I can turn it off, but think it is a bad idea. I want to be reminded that I am using an applet that can send stuff from my disk to the server. The menu is the same as the right-click menu that is always available with Jmol.

That explains things. For a sage-on-gentoo (s-o-g) build I had noticed from the jmol menu that the applet was signed but didn't associate this with the "_S". From the s-o-g install it would appear that the applets are always signed. I'm not sure it's possible for it to be otherwise. But that's a minor thing and not Sage related.

2) If we want to have an image as the default so that all devices will see something, users will have to deal with requesting it become interactive each time the cell is recalculated. The notebook+sage presently insists on reloading Jmol each time a recalculation is done. In order to do this properly we would need to have a separate div in the notebook for applets and not kill the applet unless it is not being used. Then Jmol would not revert to the starting over state each time a recalculation is done. I think that is another ticket for after these changes go in.

I suspected another layer of action was necessary to accomplish this or else it would have been done. My main interest was in getting it to work as intended.

3) Would reloading with a static image be less of an issue if the .png was the same quality as the Jmol image? I'm working on generating static images using Jmol on the server if a Java Virtual Machine is installed on the server. Many details like graceful fallback, probably to Tachyon, are still being worked out. Does this answer your questions or generate in suggestions for what needs work?

I think a high quality static image would be nice. It's true that if a notebook has a lot of applets then reloading that notebook can consume significant resources. Any attempt to mitigate this is desirable. FWIW, as far as I can determine, the s-o-g install of the new notebook functions exactly like the vanilla install. I have been using it here on top of Sage-4.8.

comment:10 Changed 9 years ago by gutow

  • Milestone changed from sage-5.0 to sage-5.1

comment:11 Changed 9 years ago by gutow

  • Description modified (diff)

comment:12 Changed 9 years ago by gutow

  • Description modified (diff)

This rebases everything to sage-5.0, updates Jmol,refactors the static imaging code to be more object oriented, and adds some doctesting of static image creation. Now that the flask notebook has been positively reviewed it is time to get this reviewed.

Last edited 9 years ago by gutow (previous) (diff)

comment:13 Changed 9 years ago by kcrisman

  • Cc ppurka added

Adding someone who has been using the new notebook and Jmol stuff for a while, as far as I know.

I personally won't be able to test this until the changes ahead are merged in Sage, as I'm too lazy to follow the instructions to get the Flask notebook in. But #9238 worked pretty well the last time I tried it a year ago!

comment:14 follow-up: Changed 9 years ago by kcrisman

Scarily, I managed to actually get the new notebook installed. Apparently.

Some comments:

  • I think you have to update trac_12299_plot_3D_static_img.patch. I see three different changesets to plot/plot3d/base.pyx, all of which seem to do something similar (namely, ask plot3d to make a Tachyon picture if Jmol fails). My guess is that you just exported the patches on top of each other; that's happened to me in the past too.
  • In fact, I think the same thing has happened (again!) with the sagenb patch as strogdon indicates happened before.
  • Sadly, even the __init__ method needs at least a minimal docstring and test in your new interface class. There are also some extremely minor formatting issues in that file, but clearly no need to work on that until the rest has been reviewed.

comment:15 follow-ups: Changed 9 years ago by kcrisman

My first attempt at getting this to work showed that

  • the Tachyon "placeholder" evaluates fine, though I agree with strogdon from #9238 that it's annoying to always have to make it interactive, though I understand the reasoning
  • Nothing else worked - lots of messages about restarting Jmol and so forth. At one point I even got a JmolData java applet starting outside the browser window.

Too late now to see what I did wrong, but wanted to let you know all was not flawless :( sorry.

comment:16 in reply to: ↑ 15 Changed 9 years ago by gutow

Can you add some more information as I'm not sure I understand what you are seeing?

Replying to kcrisman:

My first attempt at getting this to work showed that * the Tachyon "placeholder" evaluates fine, though I agree with strogdon from #9238 that it's annoying to always have to make it interactive, though I understand the reasoning

1) Are you running locally or from a server? 2) Is this a tachyon image or a Jmol image (Jmol looks just like what you would see in Jmol, the Tachyon image has no axis ticks/numbers)? This is important, because your problems may relate to how I am handling the case where the server does not have a JVM installed.

  • Nothing else worked - lots of messages about restarting Jmol and so forth. At one point I even got a JmolData java applet starting outside the browser window.

If you are running locally you should see the JmolData? application launch to generate the static image. So I think that answers my question about your test environment (local with a JVM available, right?). What browser are you running and did you run the notebook in secure mode? I assume you are getting the "Trying to launch JmolApplet#X?..." dialogs? This means your browser is not getting the applets from the server or is taking a very long time to load them. Any more details you have would be useful (OS, flask notebook version, etc...).

Thanks for the report.

comment:17 in reply to: ↑ 14 Changed 9 years ago by gutow

Replying to kcrisman:

Scarily, I managed to actually get the new notebook installed. Apparently.

Some comments:

  • I think you have to update trac_12299_plot_3D_static_img.patch. I see three different changesets to plot/plot3d/base.pyx, all of which seem to do something similar (namely, ask plot3d to make a Tachyon picture if Jmol fails). My guess is that you just exported the patches on top of each other; that's happened to me in the past too.
  • In fact, I think the same thing has happened (again!) with the sagenb patch as strogdon indicates happened before.

This is odd. I only see one patch in the file...I'll check it again. I also don't understand how you can get multiple patches if you only make one commit. Is something finicky about hg within sage?

  • Sadly, even the __init__ method needs at least a minimal docstring and test in your new interface class. There are also some extremely minor formatting issues in that file, but clearly no need to work on that until the rest has been reviewed.

I will work on the doctest. That's not a big deal. Thanks for pointing it out. I missed that one.

Changed 9 years ago by gutow

update to remove duplicate patches

comment:18 Changed 9 years ago by gutow

  • Description modified (diff)

comment:19 Changed 9 years ago by gutow

  • Description modified (diff)

comment:20 Changed 9 years ago by gutow

  • Description modified (diff)
  • Milestone changed from sage-5.1 to sage-5.2

comment:21 Changed 9 years ago by gutow

  • Description modified (diff)

comment:22 Changed 9 years ago by kcrisman

  • Authors changed from gutow to Jonathan Gutow
  • Report Upstream changed from N/A to Not yet reported upstream; Will do shortly.
  • Reviewers set to Karl-Dieter Crisman
  • Status changed from needs_review to needs_work
  • Work issues set to create upstream pull request

Okay, I will still have to look at what happens if "old" Jmols live in a directory, but at least it does, in fact, work.

I have to say that it is already, even after limited testing:

  • Really cool to be able to do the mesh, color, spin, everything from that advanced screen immediately - I don't think three.js will do all that right away. I remember this from testing last summer, too, but it's still nice it still works. And the extra features of the right-click menu - setting x, y, z spin separately? Nice.
  • Really annoying that even the very first Jmol on a worksheet, even a new one I create on a new worksheet (!) has the clunky "make active" thing which takes ages. We have to wait a while for 3D graphics anyway; let's not make it longer. Is there any way to make at least the first Jmol detected be a real Jmol, or is that a pipe dream?

Other minor things noticed thus far:

  • If you resize the applet using the right-click menu (say, to 200%) then the advanced menu on the right does not resize with it, which can lead to things being not very visible. Also makes it very hard to find the right-click menu.
  • Thinking out loud... should even more things from the right-click menu be on the advanced menu? That could be another ticket, but if it's really easy to do. Especially showing the axes would be REALLY nice as an option, since the axes Sage provides are (as we discussed at #9238) just plain wrong.
  • I think the right-click menu needs to be reorganized. In particular, "View" to me implies I will get to pick things to view - like axes and boxes. Now that I see what it actually does, it's really cool, but maybe "Views" would be better for that, and "Show" for some of the other options in "Style". That said, some of the things under "Style" do make sense.
  • In the right-click menu, why can't "Color" do the color of the plot itself? I was ambivalent about "Color" being a top-level one, but if it can only color the subsidiary objects, that's probably not ideal to have at the top level.
  • Sometimes I've had trouble on the right-click menu "making it over the hump" between sections; I've had to click explicitly, rather than have the submenus show up. It seems like this only happens after the first click on the menu after the right-click for the menu to appear. The subsubmenus also require explicit clicking. I have a suspicion there isn't much you can do about this.
  • So I don't remember the "high quality" button from last summer. What exactly does that do, and why wouldn't one want this to be a default? This is a very naive question, just because "high quality" sounds like it's, well, higher quality, and it doesn't seem to take any more computation time.

Okay, this is all based on pretty much just testing ONE applet. I have not tested worksheets with hundreds, or even twos, of applets. But the basic functionality is fine as before, so hopefully we can get this in for Sage 5.2 along with the new notebook - let's keep our fingers crossed. strogdon, if you're out there, this would be great to test.

Finally, I will put this as "needs work" for two reasons:

  • First, because it looks like your stuff for the sagenb has not been reported upstream and made a pull request. I know, you just learned Mercurial, and now they're making you use Git... I truly feel your pain, and am very annoyed about it. Apparently the saving grace is that in the mid-term future, it will make it possible to submit patch requests from your browser. But for now it gives me great growing pains as well, aargh.
  • Second, although I mentioned it obliquely in comment:14, I think I was too subtle - trac_12299_adv_jmol_nb.patch is also still "double-committed". This happens, if I recall correctly from when I've done it myself, when one doesn't remove the original patch foo.patch and then does hg export tip > foo.patch - apparently > must concatenate, not replace, the file, though everything I find online about bash indicates it shouldn't do this.
Last edited 9 years ago by kcrisman (previous) (diff)

comment:23 follow-up: Changed 9 years ago by kcrisman

  • Work issues changed from create upstream pull request to create upstream pull request, double patch

comment:24 in reply to: ↑ 23 ; follow-ups: Changed 9 years ago by gutow

Replying to kcrisman: OK, I see the double patch in the notebook patch...I'll fix it. I've also opened an issue on git, but I don't think that is what you meant by a pull request. Do I need to make a branch?

comment:25 in reply to: ↑ 24 Changed 9 years ago by ppurka

Replying to gutow:

Replying to kcrisman: OK, I see the double patch in the notebook patch...I'll fix it. I've also opened an issue on git, but I don't think that is what you meant by a pull request. Do I need to make a branch?

These are the steps you can follow:

  1. If you don't have a fork of the sagemath/sagenb github, then go to this page and click on "fork" on the top right. This will create a fork of this git repository inside your account.
  2. In your own machine, clone your fork using
    git clone git://github.com/<your username>/sagenb sagenb-github
    

In particular, you can follow the directions here if you don't have a git repo.

  1. Next, make the changes to the files you want (for instance you may apply your patch manually) and then commit your changes using
    git add <filenames> # In case you have introduced new files
    git commit -a -m "commit message"
    
  2. Then push your changes to your own github repo using
    git push -u origin
    
  3. Finally go to your github page and click on "Pull Request" on the top. This will create the pull request to sagemath/sagenb repository.

You can commit and push changes to the github page and the pull request will be updated automatically with your new changes. Because of this feature you can also decide to create a separate git branch and put a pull request only from that branch, so that other changes that you are working on don't get affected or included in the pull request.

If you are unclear about anything, just ask. I, kini, ohanar, are available on #sagemath too and will be glad to help. If you already know how to use git and github, then sorry for wasting your time. :)

comment:26 in reply to: ↑ 24 Changed 9 years ago by kcrisman

  • Report Upstream changed from Not yet reported upstream; Will do shortly. to Reported upstream. No feedback yet.
  • Work issues changed from create upstream pull request, double patch to double patch

OK, I see the double patch in the notebook patch...I'll fix it. I've also opened an issue on git, but I don't think that is what you meant by a pull request. Do I need to make a branch?

Well, in principle as long as you have a patch based on that sagenb, someone like kini or ppurka can do the rest :)

This is issue 54 at the sagenb github.

Changed 9 years ago by gutow

update to remove duplicate patches

comment:27 Changed 9 years ago by gutow

  • Work issues changed from double patch to pop-up menu?

comment:28 follow-up: Changed 9 years ago by strogdon

I've finally installed the flask notebook and the patches from this ticket on top of Sage-5.0. At one point things were changing too quickly for me to keep up but the situation now seems to be fairly stable. I have the following observations:

  1. The png images I see when a worksheet is first loaded are of much higher quality than what I observed with previous versions. This is nice.
  2. Occasionally, when an applet is made Interactive and the controls are toggled to "Download this view", if the download is cancelled then the Advanced controls disappear. The cell has to be re-evaluated to recover the controls. This usually happens after a first "Make Interactive" request for any one applet. Subsequent requests to Download do not seem to cause the Advanced controls to disappear.
  3. When a download is requested I get two requests to save when I cancel saving the jmol file.
  4. Is anyone able to get the grid to appear on the small red sphere for
x, y = var('x y');W = plot3d(sin(pi*((x)^2+(y)^2))/2,(x,-1,1),(y,-1,1), color='purple', opacity=0.8);S = sphere((0,0,0),size=0.3, color='red', aspect_ratio=[1,1,1]);show(W + S, figsize=4)

If no objections, I'll set myself as a reviewer also (provided I can figure out how to do that) since I've spent some time understanding and implementing items from the ticket.

comment:29 Changed 9 years ago by strogdon

  • Reviewers changed from Karl-Dieter Crisman to Karl-Dieter Crisman, Steven Trogdon

comment:30 in reply to: ↑ 28 ; follow-up: Changed 9 years ago by gutow

Replying to strogdon:

  1. Occasionally, when an applet is made Interactive and the controls are toggled to "Download this view", if the download is cancelled then the Advanced controls disappear. The cell has to be re-evaluated to recover the controls. This usually happens after a first "Make Interactive" request for any one applet. Subsequent requests to Download do not seem to cause the Advanced controls to disappear.

This is some kind of communication issue. Probably associated with switching from unsigned to signed applets. What do you think about always using the signed applet? This will generate that warning about access to your computer the first time it is launched.

  1. When a download is requested I get two requests to save when I cancel saving the jmol file.

Yeah, that is annoying. It's something about the Java use of the save dialog. If I can catch Bob Hanson not working on something interesting, maybe we can fix that. We do know about it.

  1. Is anyone able to get the grid to appear on the small red sphere for
x, y = var('x y');W = plot3d(sin(pi*((x)^2+(y)^2))/2,(x,-1,1),(y,-1,1), color='purple', opacity=0.8);S = sphere((0,0,0),size=0.3, color='red', aspect_ratio=[1,1,1]);show(W + S, figsize=4)

I believe the sphere is a sphere object, which is not a surface defined by a bunch of vertices and triangles, thus there is no mesh to display. If Sage were to calculate it as a pmesh surface rather than use the Jmol builtin, then there would be a mesh.

comment:31 in reply to: ↑ 30 Changed 9 years ago by kcrisman

strogdon - you have totally been reviewing this, quite a bit, in fact!

  1. Occasionally, when an applet is made Interactive and the controls are toggled to "Download this view", if the download is cancelled then the Advanced controls disappear. The cell has to be re-evaluated to recover the controls. This usually happens after a first "Make Interactive" request for any one applet. Subsequent requests to Download do not seem to cause the Advanced controls to disappear.

This is some kind of communication issue. Probably associated with switching from unsigned to signed applets. What do you think about always using the signed applet? This will generate that warning about access to your computer the first time it is launched.

I really like not having to deal with that. Given that most people will not be downloading the view, the current behavior seems ok.

I believe the sphere is a sphere object, which is not a surface defined by a bunch of vertices and triangles, thus there is no mesh to display. If Sage were to calculate it as a pmesh surface rather than use the Jmol builtin, then there would be a mesh.

I don't know how Jmol does it, but you are right that we have primitives for things like spheres.

comment:32 in reply to: ↑ 15 ; follow-up: Changed 9 years ago by kcrisman

My first attempt at getting this to work showed that

  • the Tachyon "placeholder" evaluates fine, though I agree with strogdon from #9238 that it's annoying to always have to make it interactive, though I understand the reasoning

You were right, it was the Jmol placeholder. I really find that annoying.

  • Nothing else worked - lots of messages about restarting Jmol and so forth. At one point I even got a JmolData java applet starting outside the browser window.

Too late now to see what I did wrong, but wanted to let you know all was not flawless :( sorry.

I had the same problems on the same worksheet. This worksheet had only five Jmols, but took a million years to load (well, over a minute) and then I get the following.

Jmol Applet #0 is having trouble loading.  Will retry once.

Second attempt to finish launch of Jmol Applet #0 failed.  Recommend reevaluating the cell manually.

Same for all Jmols. Some didn't even make the static images. Even re-evaluating doesn't help at all - it does create the image, but as soon as I make it "live" I get the same horrible messages.

Note that in the new worksheet, I am just fine, and the little Jmol logo shows up properly in the upper left corner - not ever in this old worksheet, or only with the briefest of appearances. Notice that in old interacts everything works fine, presumably because these are indeed newly generated!


Question about implementation. How much work does Jmol have to do to generate all those static images every time that one opens a worksheet? In theory, once there is an image (png, I guess) generated, it should just stay in the cell's folder and be displayed; we certainly don't want to create a new one each time, any more than we do this for 2D plots. Though even with a largish sheet it doesn't seem to take super long, a little delay.

Have you tried using this on "old" worksheets with Jmols? This seems to be the problem I have, consistently; any Jmols from the old notebook (by which old Jmol is presumably meant) don't work.


More minor issues.

  • When I sleep an image, it doesn't come back with the advanced controls if I had them up. Is there any way to "save" that state, or is it too hard?
  • Although it's pretty clear by the content, it's a little hard to see which tab you are on in the advanced controls sometimes. Maybe the shading could be slightly different.
  • In interacts, I think there is no point to having the initial static image. I have no idea if there is a way to detect this, but presumably one wouldn't have asked for this to be evaluated if one wasn't going to use it.
  • The opening of the "JmolData" app each time is a little annoying.
  • When doing
    implicit_plot3d(x^2+y^2+z^2==16,(x,-5,5),(y,-5,5),(z,-5,5),color='green',plot_points=200)
    
    I got
    viewer handling error condition: java.lang.OutOfMemoryError: Java heap space
    
    Maybe I'm being overoptimistic; the docs don't even have any with 100 plot_points.
  • On the plus side, the thing where only four Jmols are active at a time is working fine. I notice that it deactivates the one furthest down or something, not the oldest one.

I have to say that I'm by far the most concerned about the "old worksheets" issue. Second is the "automatically every image is static" - couldn't at least the first one be "live"? - but nearly everything else could be considered an enhancement request. Let me know what stuff I've mentioned is worth discussing here.

Last edited 9 years ago by kcrisman (previous) (diff)

comment:33 Changed 9 years ago by kcrisman

  • Work issues changed from pop-up menu? to old worksheets don't work

comment:34 Changed 9 years ago by kcrisman

Update: at least sometimes re-evaluating seems to remove the problem. But it isn't consistent, needs more testing.

comment:35 in reply to: ↑ 32 ; follow-up: Changed 9 years ago by gutow

Replying to kcrisman:

My first attempt at getting this to work showed that

  • the Tachyon "placeholder" evaluates fine, though I agree with strogdon from #9238 that it's annoying to always have to make it interactive, though I understand the reasoning

You were right, it was the Jmol placeholder. I really find that annoying.

We potentially could get rid of this with significant browser detection and a complete reworking of how Jmol is called for when a cell is recalculated. The problem is related to the fact that the applet is completely reloaded each time a cell is recalculated, rather than just passing it new data. This means it is very easy to get out of sync with what the server is sending to the applet. Many of the problems with the old Jmol relate to this. One of the problems I consistently have using the old format where Jmol loads live in interacts is that the interact starts calling for a new applet before the previous one is finished loading. I have had some discussions about putting the applet in a special div that does not get zapped each time a recalculation is done. That's probably the correct thing to do, but not high on people's list when the notebook was undergoing major revisions. I would prefer to put this off as an additional enhancement.

  • Nothing else worked - lots of messages about restarting Jmol and so forth. At one point I even got a JmolData java applet starting outside the browser window.

As your comments below suggest this appears to be a problem with old worksheets that have not been reevaluated. We might be able to put something into the notebook code that puts up a message suggesting the worksheet be re-evaluated if it does not have the data necessary for static images. I tried to put a message in the "alt" field for the images, but most browser now seem to ignore that. I think I can put a check into the cell code that would deal with this. I even have some ideas for generating images without reevaluation...I'll look into this.

Question about implementation. How much work does Jmol have to do to generate all those static images every time that one opens a worksheet?

Jmol only generates the image when a cell is evaluated. When you open a worksheet that was previously evaluated using these enhancements the images are already there.

More minor issues.

  • When I sleep an image, it doesn't come back with the advanced controls if I had them up. Is there any way to "save" that state, or is it too hard?

Hadn't thought about this. I will look into it.

  • Although it's pretty clear by the content, it's a little hard to see which tab you are on in the advanced controls sometimes. Maybe the shading could be slightly different.

I'm using Sage default CSS. I suppose we could define something custom.

  • In interacts, I think there is no point to having the initial static image. I have no idea if there is a way to detect this, but presumably one wouldn't have asked for this to be evaluated if one wasn't going to use it.

As I explained above, only simple interacts where the user does not call for lots of recalculations work reliably with the present model of loading Jmol live. Things with sliders are really bad.

  • The opening of the "JmolData" app each time is a little annoying.
  • When doing
    implicit_plot3d(x^2+y^2+z^2==16,(x,-5,5),(y,-5,5),(z,-5,5),color='green',plot_points=200)
    
    I got
    viewer handling error condition: java.lang.OutOfMemoryError: Java heap space
    
    Maybe I'm being overoptimistic; the docs don't even have any with 100 plot_points.

The application can certainly handle more. I'll see if I can change the memory allocation to allow for larger images...That is a little odd as we use Jmol in web pages to look at things with many more points, atoms and surfaces...

  • On the plus side, the thing where only four Jmols are active at a time is working fine. I notice that it deactivates the one furthest down or something, not the oldest one.

Actually it picks the one farthest from the cell you most recently evaluated that includes a Jmol. It can be above or below the cell you are working on.


I have to say that I'm by far the most concerned about the "old worksheets" issue. Second is the "automatically every image is static" - couldn't at least the first one be "live"? - but nearly everything else could be considered an enhancement request. Let me know what stuff I've mentioned is worth discussing here.

I agree that this should be a priority. I think there are solutions. What behavior would be best: 1) A pop-up suggestion to reevaluate old worksheets to update 3-D plots; 2) Attempt to update plots without reevaluation; 3) Automatically reevaluate worksheets with 3-D plots in them?

comment:36 in reply to: ↑ 35 ; follow-up: Changed 9 years ago by kcrisman

We potentially could get rid of this with significant browser detection and a complete reworking of how Jmol is called for when a cell is recalculated. The problem is related to the fact that the applet is completely reloaded each time a cell is recalculated, rather than just passing it new data. This means it is very easy to get out of sync with what the server is sending to the applet. Many of the problems with the old Jmol relate to this.

Right, and I assume that passing it new info would be a pretty sizable change in how we use it.

I would prefer to put this off as an additional enhancement.

Now that I understand the technical issue better, I guess I would agree in some sense, but I figure it's buyer beware on the @interact cells. Having to do an extra click every time would get really old really fast with them. Maybe we could ask on sage-devel about the tradeoff, though perhaps (as usual with polls on sage-devel) we wouldn't get many takers...

As your comments below suggest this appears to be a problem with old worksheets that have not been reevaluated. We might be able to put something into the notebook code that puts up a message suggesting the worksheet be re-evaluated if it does not have the data necessary for static images. I tried to put a message in the "alt" field for the images, but most browser now seem to ignore that. I think I can put a check into the cell code that would deal with this. I even have some ideas for generating images without reevaluation...I'll look into this.

We definitely need to fix this. Again, I even had trouble with some worksheets even after re-evaluation.

It should be pretty easy for you to test this. Just open an old Sage, make a new worksheet with Jmols, close it, stop Sage, restart your new Jmol Sage, and see what happens. I figure you have more diagnostic tools than I will.

Jmol only generates the image when a cell is evaluated. When you open a worksheet that was previously evaluated using these enhancements the images are already there.

Great.

The application can certainly handle more. I'll see if I can change the memory allocation to allow for larger images...That is a little odd as we use Jmol in web pages to look at things with many more points, atoms and surfaces...

No, it's 100 points per axis, so one million points are evaluated and the presumably however many of them are on the sphere must be plotted. I think that's why we don't even have it in the docs, because it would take a long time. But it does seem to work in the old Jmol in Sage (just tried it in vanilla 5.0).

I agree that this should be a priority. I think there are solutions. What behavior would be best: 1) A pop-up suggestion to reevaluate old worksheets to update 3-D plots; 2) Attempt to update plots without reevaluation; 3) Automatically reevaluate worksheets with 3-D plots in them?

Definitely not 3. 1 also seems less than desirable unless it was only when there had been a Jmol before, and one could reliably detect it was from an earlier version of Jmol. How would 2 work?


Some dumb generic review questions.

  • So far I've not been able to use this except on Safari on OS X because of some default I can't get around and logins. What have you tested this on? In the past you had done some pretty extensive testing. I figure we should at least test on Safari, FF, Chrome on Mac, FF and Chrome on Linux, IE and FF on Windows. I don't know how easy that will be for me unless you set up a remote server again, which I figure would be quite a pain.
  • What problems should one be looking for with secure=True? It sounds like you are thinking that there could be different issues in that case, maybe because of the applets being applets?

comment:37 Changed 9 years ago by gutow

  • Description modified (diff)

comment:38 in reply to: ↑ 36 ; follow-up: Changed 9 years ago by gutow

Replying to kcrisman:

Some dumb generic review questions.

  • So far I've not been able to use this except on Safari on OS X because of some default I can't get around and logins. What have you tested this on? In the past you had done some pretty extensive testing. I figure we should at least test on Safari, FF, Chrome on Mac, FF and Chrome on Linux, IE and FF on Windows. I don't know how easy that will be for me unless you set up a remote server again, which I figure would be quite a pain.

I will keep a server up as best I can for the time being. Go to TestServer and create yourself an account. I will try to keep it up-to-date and running, but it may be down when I am coding. Linux and MacOS, I can test pretty well, but I really need feedback on Windows as I do not have a recent version.

  • What problems should one be looking for with secure=True? It sounds like you are thinking that there could be different issues in that case, maybe because of the applets being applets?

The major issue I am worried about is reliability of the applets when an unsigned applet is used in a secure environment. Browsers and Java are getting much more finicky about mixed modes. I've seen some cases where the applet will not launch under https if it is not signed. I need to know whether this is enough of a problem to spend some time on.

comment:39 in reply to: ↑ 38 ; follow-up: Changed 9 years ago by kcrisman

  • So far I've not been able to use this except on Safari on OS X because of some default I can't get around and logins. What have you tested this on? In the past you had done some pretty extensive testing. I figure we should at least test on Safari, FF, Chrome on Mac, FF and Chrome on Linux, IE and FF on Windows. I don't know how easy that will be for me unless you set up a remote server again, which I figure would be quite a pain.

I will keep a server up as best I can for the time being. Go to TestServer and create yourself an account. I will try to keep it up-to-date and running, but it may be down when I am coding. Linux and MacOS, I can test pretty well, but I really need feedback on Windows as I do not have a recent version.

  • What problems should one be looking for with secure=True? It sounds like you are thinking that there could be different issues in that case, maybe because of the applets being applets?

The major issue I am worried about is reliability of the applets when an unsigned applet is used in a secure environment. Browsers and Java are getting much more finicky about mixed modes. I've seen some cases where the applet will not launch under https if it is not signed. I need to know whether this is enough of a problem to spend some time on.

Is the test server you link to with secure=True or False? I guess since it's http, not https, it's False?

comment:40 in reply to: ↑ 39 Changed 9 years ago by gutow

Replying to kcrisman:

Is the test server you link to with secure=True or False? I guess since it's http, not https, it's False?

Correct. Let's get other issues dealt with before the signed issue.

comment:41 Changed 9 years ago by strogdon

So I have a situation here that I hadn't notice previously. I have 12 applets in a worksheet. I'm not sure if the number is important but probably at least 4 are needed. If I start the notebook and load the worksheet things seem normal; I can "Make Interactive" applets throughout the worksheet with 4 interactive ones. So applets are put to sleep as new ones are made interactive. Now if I "Toggle Advanced Controls" on one of the applets, proceed to "Download this view" and cancel the request; I'm left with 3 interactive applets. As I toggle the advanced controls now to make applets interactive there are never more than 3 interactive applets. At some point in the clicking process to make applets interactive I get a pop-up with

Could not find jmolApplet#

where # is some number. After the pop-up is closed, things get frozen. I'm unable to make applets interactive unless I put to sleep an already interactive applet. I've tried this, at leas 4 times with the same result. Now I'm doing this over nfs. I wouldn't think that nfs would cause this. What seems to recover things is the sequence; Actions -> Delete All Output and then Actions -> Evaluate All. I can then get 4 interactive applets again, all of which are now signed. If repeat the procedure to "Download this view" and cancel the request with these signed applets the worksheet doesn't freeze.

comment:42 follow-up: Changed 9 years ago by strogdon

In trying to isolate exactly what triggers the above I found that if I don't try to recover the Advanced Controls on the applet that was used to download the view as a jmol file (Download this view) then the worksheet doesn't seem to freeze as I make other applets interactive. And eventually this applet that was used to download the view as a jmol will be put in a sleep state that can then be made interactive. So, it seems that if an applet is unsigned and one wishes to save the view in a jmol file, to avoid freezes the best thing to do is to not re-evaluate its cell.

comment:43 in reply to: ↑ 42 Changed 9 years ago by gutow

Thanks. This gives me a sequence I can follow to see what is happening. I believe there is a collision between signed and unsigned applets. I may have to convert all open applets to signed...This may take a while to figure out, but I think it is important. Replying to strogdon:

In trying to isolate exactly what triggers the above I found that if I don't try to recover the Advanced Controls on the applet that was used to download the view as a jmol file (Download this view) then the worksheet doesn't seem to freeze as I make other applets interactive. And eventually this applet that was used to download the view as a jmol will be put in a sleep state that can then be made interactive. So, it seems that if an applet is unsigned and one wishes to save the view in a jmol file, to avoid freezes the best thing to do is to not re-evaluate its cell.

comment:44 Changed 9 years ago by gutow

  • Work issues changed from old worksheets don't work to old worksheets don't work, signed and unsigned applet collision

comment:45 Changed 9 years ago by kcrisman

Here's an interesting thing I wasn't expecting.

More than 9 Jmols have been launched on the worksheet since it was last openned. Unable to get a static image from Jmol#0 You might want to try Chrome as this problem does not exist with Chrome on MacOS.

And indeed, a few have a little message to that effect, and no static image. Looks like something added on the previous ticket, though I'm using Safari, not FF, on Mac.

So one could sort of jam up a worksheet. I was able to get all the plots to vanish by playing a little game where I chased them around, and then got the advanced menu to try to generate a static image, which would (intentionally, I guess) fail. What is the story behind this? Can Jmol not detect that there are no longer any live images, and hence try again to generate a static one, or would this be hard to work around?

I do note that quitting and reopening the page gives normal behavior. But just restarting inside the worksheet doesn't.

I tried to recreate strogdon's signed applet issue. I couldn't get exactly that, but I did note that once the signed applet has been requested (not downloaded, as in his), there doesn't seem to be any way to go back to the unsigned applet - even reevaluating the cell doesn't do it.


I also tried to see if I could get away from the problems with old Jmols, but try as I might it wouldn't work. Re-evaluating will sometimes generate a png for the next time one opens the page, but I can't get it to consistently "just work". Now sometimes even new cells in this old worksheet give the same error message. It's puzzling and frustrating.

comment:46 Changed 9 years ago by kcrisman

I am trying with secure=True. Other than a few extra messages, I don't notice any difference. The only thing is that once I try to download an applet, then all the applets I wake up after that point have the big red Jmol_S thing that strogdon noted above. But otherwise there doesn't seem to be a problem on Safari 5, at least.

I like this enough, even with the work issues, that I'm going to ask on sage-devel if anyone cares about having to wake things up by default. If there is enough outcry, this would have to be dealt with somehow.

comment:47 Changed 9 years ago by gutow

Replying to kcrisman:

Here's an interesting thing I wasn't expecting. More than 9 Jmols have been launched on the worksheet since it was last openned. Unable to get a static image from Jmol#0 You might want to try Chrome as this problem does not exist with Chrome on MacOS. And indeed, a few have a little message to that effect, and no static image. Looks like something added on the previous ticket, though I'm using Safari, not FF, on Mac. 

This is a limitation of Safari memory allocation, that I haven't double checked on in a while. Your problems indicate that it has not changed. I will check, but I do not think I can fix it. It appears to be a memory leak in MacOS Safari. This is why you get the suggestion to switch to Chrome, which does not have this problem. The symptom I saw was If you open more than a certain number of java applets on a page in sequence, even if they are not left open, things get messed up.

I also tried to see if I could get away from the problems with old Jmols, but try as I might it wouldn't work. Re-evaluating will sometimes generate a png for the next time one opens the page, but I can't get it to consistently "just work". Now sometimes even new cells in this old worksheet give the same error message. It's puzzling and frustrating.

I have found the problem. There is a change in the way the flask notebook provides information about the path to the cell data. This effects the command script that launches Jmol. I hope to have time tonight to write a fix. I haven't tested this yet, but I think that you should see the same problem with old worksheets in the flask notebook without the enhancements from this ticket.

Changed 9 years ago by gutow

fix Jmol errors on loading pre-flask worksheets

comment:48 Changed 9 years ago by gutow

  • Description modified (diff)
  • Work issues changed from old worksheets don't work, signed and unsigned applet collision to signed and unsigned applet collision

In the old worksheet patch I chose to generate static images if they do not exist. An alternative is just to fix the path so Jmol loads and print a message suggesting the cell be re-executed to generate a static image. Even without the image the interactive Jmol should now load properly. The advantage of the alternative is that no calls to the sage server would be necessary. The image generation depends on Sage+Jmol. It is not done by the notebook.

Last edited 9 years ago by gutow (previous) (diff)

comment:49 follow-up: Changed 9 years ago by kcrisman

  • Work issues changed from signed and unsigned applet collision to signed and unsigned applet collision, old worksheets may not work all the time

No luck. I get the same error messages, re-evaluating doesn't help. I also get a new message, quite a while after the original messages recommending re-evaluating etc.

could not find applet jmolApplet0

I suppose it could just be this one worksheet, but at any rate this definitely needs more testing. I should point out that your new patch seems to only affect the generation of the static images, from how I read it, and that part is fixed, they are fine. Maybe there also is trouble finding the live applets in a similar way?

Last edited 9 years ago by kcrisman (previous) (diff)

comment:50 in reply to: ↑ 49 ; follow-up: Changed 9 years ago by gutow

Replying to kcrisman: e-mail me the worksheet please, (gutow@…). This is odd.

comment:51 in reply to: ↑ 50 Changed 9 years ago by kcrisman

e-mail me the worksheet please, (gutow@…). This is odd.

I uploaded it to the test server first. I tried to share it with you, but maybe you didn't have an account on it. I'll email it as well. It doesn't work right there, either.

By the way, I got

Jmol Applet #0 is having trouble loading.  Will retry once.

on the test server for a new worksheet, but then it eventually did come up fine and so forth.

Remind me why we aren't loading the "High Quality" view right away? I'm sure there's a good reason, but it just looks so much nicer that I'm surprised we don't just use it by default.

comment:52 Changed 9 years ago by kcrisman

Also, sometimes timing seems to be off. On the test server, I made a cell on a page with an already-functioning Jmol image, and got

script ERROR: script ERROR: io error reading
/home/sagetest/.sage/sage_notebook.sagenb/home/__store__/9/9e/9eb/9eba/k\
crisman/0/cells/3/sage0-size500-747143461.jmol.zip|SCRIPT:
java.io.FileNotFoundException:
/home/sagetest/.sage/sage_notebook.sagenb/home/__store__/9/9e/9eb/9eba/k\
crisman/0/cells/3/sage0-size500-747143461.jmol.zip (No such file or
directory)

But then when I re-evaluated it, all was well. Maybe this is unavoidable in any case with a remote server on occasion.

comment:53 Changed 9 years ago by kcrisman

Different note. It's possible to mess things up (empty Jmol areas, unable to load messages, dying areas) by clicking to wake up applets really quickly, six or seven in a row. I don't think that's really a regression, because before they would have just been awake and taking up memory, but at any rate I wanted to let you know. This is on FF on Mac, the worst-case scenario (though it does work despite the nasty-sounding warning message I get!).

On Chrome on Mac, no problems.

comment:54 follow-up: Changed 9 years ago by kcrisman

Trying a (virtual) Windows XP right now.

  • IE 8 - no dice. I do get the "If no image appears ..." message about the 3-D viewer being updated, but re-evaluating does not help.
    • Jmol does work on the non-flask notebook (I tried a server I have access to)
    • Jmol does work on sagenb.org, which has the flask notebook but not this particular update
    • I updated Java, but that didn't seem to help.
  • FF3.5 (the newest I have on that machine) it seems to work fine.
  • Chrome works fine. On both of these it didn't like my old Java but allowed me to click through.

Weirdly, I do not have trouble with my suspect worksheet in certain cases! All on the test server:

  • Using Chrome on XP
  • Using FF on XP
  • Using FF on Mac

But it still doesn't work with Safari on Mac (just the old worksheet, and just that one).

comment:55 in reply to: ↑ 54 Changed 9 years ago by gutow

Replying to kcrisman:

Trying a (virtual) Windows XP right now.

  • IE 8 - no dice. I do get the "If no image appears ..." message about the 3-D viewer being updated, but re-evaluating does not help.

Since this seems to be related to issues of IE8 handling jquery functions differently depending on where they are on the page, I don't think I can fix this easily.

Did you at least get the warning that things were not likely to work? It should have read something like: "Many of the advanced 3-D viewing functions DO NOT work in Internet Explorer..." Or are things failing before then?

comment:56 follow-up: Changed 9 years ago by kcrisman

Regarding IE 8 on XP, as I said I get the "If no image appears" message and something about re-evaluating. I did not get the message you report.

Weirdly, I do not have trouble with my suspect worksheet in certain cases! All on the test server:

  • Using Chrome on XP
  • Using FF on XP
  • Using FF on Mac

But it still doesn't work with Safari on Mac (just the old worksheet, and just that one).

Update: gutow discovered this was due to a weird Geogebra applet embedding attempt left in that particular worksheet that for some reason was causing the trouble.

Also, based on the sage-devel discussion, sounds like people are ok with not having immediate interaction, and obviously Jonathan is worry about overlapping requests to Jmol. I'm still not sure this is advisable, but be it on their heads.

I'd still ask for some reorganization of the menus but that is probably for another ticket, given the current state of the applet in 5.0 being much more difficult to follow than this new one, which only needs tweaking.

At least some people are reporting success on FF on Linux. Apparently some Opera has trouble there. But maybe Linux is okay, then, at least many of them.


What remains to look at:

  • Someone to do at least brief testing on Windows 7. I will eventually be able to do that, but I'm not sure when yet.
  • The signed/unsigned issue.
  • The secure/insecure notebook issue, if it needs more testing.
  • Someone has to create an upstream pull thingie - the ticket is already open on github. I think that it would be easiest for kini to do this :) but maybe we should wait until it otherwise has positive review.
  • Anything else? This is looking good, it would be great to get it in 5.2 along with the new notebook.

comment:57 in reply to: ↑ 56 Changed 9 years ago by gutow

Replying to kcrisman:


What remains to look at:

  • Someone to do at least brief testing on Windows 7. I will eventually be able to do that, but I'm not sure when yet.

I may be able to do that at work tomorrow...

  • The signed/unsigned issue.

I cannot reproduce the problem...so I think this will have to wait until we get more info.

  • The secure/insecure notebook issue, if it needs more testing.

I think this is resolved. I cannot reproduce the hangs I sometimes saw. There is no question that loading an unsigned applet causes the initial load to slow down, but after that there seems to be no trouble.

  • Someone has to create an upstream pull thingie - the ticket is already open on github. I think that it would be easiest for kini to do this :) but maybe we should wait until it otherwise has positive review.

I was going to try, but see a problem. This ticket requires changes to both the notebook and Sage. The pull would just be for notebook, right?

  • Anything else? This is looking good, it would be great to get it in 5.2 along with the new notebook.

I'm going to clear the two work issues and replace with "decide default display quality". See this google thread 3D plotter.

comment:58 Changed 9 years ago by gutow

  • Work issues changed from signed and unsigned applet collision, old worksheets may not work all the time to decide default display quality

comment:59 Changed 9 years ago by kcrisman

Followups now that I've had time to think.

  • Somehow the 'needs work' was not fixed, sorry.
  • Responding to

    Did you at least get the warning that things were not likely to work? It should have read something like: "Many of the advanced 3-D viewing functions DO NOT work in Internet Explorer..." Or are things failing before then?

    You're right, it's failing before that.
  • We do need the final doctests - can be very skimpy.
  • Jonathan, I'm wondering whether it's worth creating a new error class for this one specific error of not having the JVM. I mean, your string is so informative, you could just raise a very generic error with that message. Also, it would eliminate two needed doctests :)
  • As for the upstream pull, you would only create one for the notebook, that's right, and that could be merged upstream at the same time. I've asked about the process for that there, in case there is anything weird.

This is looking really close to ready, though.

comment:60 Changed 9 years ago by gutow

  • Work issues changed from decide default display quality to decide default display quality, doctests,switch to generic error

comment:61 follow-up: Changed 9 years ago by strogdon

I've been able to reproduce the "signed/unsigned" applet issue under comment:41 and comment:42 on ubuntu 12.04. I don't ususally use ubuntu but had access to an installation. The behavior was observed with FF and chromium. I know there are quite a number of Sage users that install from ubuntu. I was not able to get the "Download this view" to a jmol to work at all unless I manually installed oracle-java-jre. Ubuntu only provides the icedtea-java-jre. Without the oracle jre, when I clicked the "Download this view" there appeared in the applet pane

File reader was not found:org.jmol.adapter.readers.molxyz.XyzReader

and there were similar complaints in the terminal window from which Sage was started. After this happens no applet can be made interactive. A grep of the sagenb tree doesn't reveals that XyzReader? isn't called from Sage so I'm guessing it's embedded somewhere in the icedtea jre. As I mentioned the only work-around for me was to manually install oracle. Here is, I think a minimal sequence of steps to reproduce things:

  1. load a worksheet with at least 5 applets
  2. make the first applet interactive
  3. click "Toggle Advanced Controls"
  4. click "Download this view" and cancel all requests (the applet will change to "signed")
  5. re-evaluate the cell to recover the advanced controls
  6. make the applet interactive again
  7. click through the remaining applets to make them interactive

I'm able to make 2 additional applets interactive, but not the 3rd and subsequent applets. An applet can only be made interactive after I put to sleep an already interactive applet. Now I used the applet spawed by that code given in comment:28

comment:62 in reply to: ↑ 61 Changed 9 years ago by gutow

Replying to strogdon:

Here is, I think a minimal sequence of steps to reproduce things:

  1. load a worksheet with at least 5 applets
  2. make the first applet interactive
  3. click "Toggle Advanced Controls"
  4. click "Download this view" and cancel all requests (the applet will change to "signed")
  5. re-evaluate the cell to recover the advanced controls
  6. make the applet interactive again
  7. click through the remaining applets to make them interactive

Thanks. I'll try again. So far I haven't been able to reproduce this on MacOS or Linux. If I can reproduce it I'll have a chance of fixing it.

As to the IcedTea?, I think we just have to wait for them to finish fixing things. Some people have reported that the applet mostly works with IcedTea? (see 3D plotting discussion).

comment:63 Changed 9 years ago by kcrisman

I've submitted a new pull request with this same code at this Github pull request, because I couldn't figure out how to attach code to the old one. Apparently it introduced a few whitespaces, but that's really not my concern. Hopefully the patches won't need updating, or I'm in trouble; this took hours for me to figure out how to do from scratch.

Last edited 9 years ago by kcrisman (previous) (diff)

comment:64 follow-ups: Changed 9 years ago by strogdon

Another scenario that leads me to believe what I'm seeing is not a "signed/unsigned" applet issue:

  1. load a worksheet with 5 applets
  2. make the applets interactive buy starting from the top and working to the bottom of the worksheet - the applets will be unsigned.
  3. the first applet should now be sleeping, re-evaluate the second applet's cell (this applet should not be sleeping) and make the applet interactive. Here is where I get the problem. I get a pop-up and nothing more can be made interactive.

This can be reproduced if the applets are singed as well. Yet another approach that may shed some light provided someone can get it to behave as here:

  1. load a worksheet with 5 applets
  2. make the applets interactive, from top to bottom, in the order 1 - 5 - 2 - 4 - 3
  3. the first applet should be sleeping but the second one should be interactive
  4. re-evaluate the second applet's cell and make the applet interactive
  5. Here I only get 3 interactive applets, regardless of how many are made interactive.

This is a linux install from a gentoo-prefix where the host OS is debian. The browser is FF.

comment:65 in reply to: ↑ 64 Changed 9 years ago by kcrisman

  1. load a worksheet with 5 applets
  2. make the applets interactive buy starting from the top and working to the bottom of the worksheet - the applets will be unsigned.
  3. the first applet should now be sleeping, re-evaluate the second applet's cell (this applet should not be sleeping) and make the applet interactive. Here is where I get the problem. I get a pop-up and nothing more can be made interactive.

I can reproduce this on Mac OS with Safari.

could not find applet jmolApplet1

After that once in a while I was able to get one to show up interactive, but most just have

Loading Jmol 3-D viewer...

where the applet would be, and then of course eventually, as it's Safari,

More than 9 Jmols have been launched on the worksheet since it was last openned. Unable to get a static image from Jmol#1 You might want to try Chrome as this problem does not exist with Chrome on MacOS.

which incidentally has a typo (extra "n").

comment:66 in reply to: ↑ 64 ; follow-up: Changed 9 years ago by gutow

  • Work issues changed from decide default display quality, doctests,switch to generic error to applet ID when cells re-evaluated,decide default display quality, doctests,switch to generic error

Replying to strogdon:

Another scenario that leads me to believe what I'm seeing is not a "signed/unsigned" applet issue:

  1. load a worksheet with 5 applets
  2. make the applets interactive buy starting from the top and working to the bottom of the worksheet - the applets will be unsigned.
  3. the first applet should now be sleeping, re-evaluate the second applet's cell (this applet should not be sleeping) and make the applet interactive. Here is where I get the problem. I get a pop-up and nothing more can be made interactive.

Thank you now I've got it...This may take a bit to fix. It appears to be a discrepancy between the server and javascript applet numbers. There are many places where the update could be getting messed up. At least I know what to look for now. And you are correct, this should have nothing to do with whether the applets are signed or not.

comment:67 follow-up: Changed 9 years ago by kini

I've transferred the sagenb-related patches to a github pull request. Feel free to write more patches, and I'll put them there too, if you like. (Please don't overwrite old patches, that makes it more complicated.) Or I can put any other branch you like onto the pull request - just ask.

Please CC me in the future if you want me to transfer patches to github. If you're interested, here's what I did:

$ cd ~/src/sagenb # go to my sagenb repo
$ git checkout master # get on master
$ git pull # my master is set up to track sagemath/master, i.e. the latest upstream
$ git checkout -b trac_12299 # create a new branch called trac_12299
$ # download the patches to the current directory
$ git am --whitespace=fix trac_12299_adv_jmol_nb.patch
Applying: Trac 12299: add interactive Jmol controls in notebook
/home/fs-boone/src/sagenb/.git/rebase-apply/patch:15: trailing whitespace.
    for particular browser/OS combinations.  Problem systems FF/MacOS (intermittent), 
/home/fs-boone/src/sagenb/.git/rebase-apply/patch:18: trailing whitespace.
	
/home/fs-boone/src/sagenb/.git/rebase-apply/patch:30: trailing whitespace.
Jmol.js 
/home/fs-boone/src/sagenb/.git/rebase-apply/patch:37: trailing whitespace.
        the evaluate_cell() call and others that delete cell output must be modified 
/home/fs-boone/src/sagenb/.git/rebase-apply/patch:41: trailing whitespace.
        where a 
warning: squelched 37 whitespace errors
warning: 42 lines applied after fixing whitespace errors.
$ git am --whitespace=fix trac_12299_old_wksht.patch
Applying: trac 12299: fix jmol in old worksheets
/home/fs-boone/src/sagenb/.git/rebase-apply/patch:41: trailing whitespace.
        
/home/fs-boone/src/sagenb/.git/rebase-apply/patch:44: trailing whitespace.
            # Note: this is problematic in the notebook as it uses tools from Sage to 
/home/fs-boone/src/sagenb/.git/rebase-apply/patch:51: trailing whitespace.
            f.write('set defaultdirectory "%s"\n' %path) 
/home/fs-boone/src/sagenb/.git/rebase-apply/patch:68: trailing whitespace.
                #print script 
/home/fs-boone/src/sagenb/.git/rebase-apply/patch:72: trailing whitespace.
            
warning: 5 lines applied after fixing whitespace errors.
$ git log -2 --stat
commit 32be06d65240aac183b391ef24e8149b52eabaea (HEAD, refs/remotes/origin/trac_12299, refs/heads/trac_12299)
Author: Jonathan Gutow <gutow@uwosh.edu>
Date:   Mon Jun 11 20:44:10 2012 -0500

    trac 12299: fix jmol in old worksheets

 sagenb/notebook/cell.py |   46 +++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 43 insertions(+), 3 deletions(-)

commit 1971a68138c14e7057e468802a598b05760bb733
Author: Jonathan Gutow <gutow@uwosh.edu>
Date:   Sun May 27 08:48:59 2012 -0500

    Trac 12299: add interactive Jmol controls in notebook

 sagenb/data/sage/js/jmol_lib.js     | 1233 ++++++++++++++++++++++++++++++++++-
 sagenb/data/sage/js/notebook_lib.js |    7 +
 sagenb/notebook/cell.py             |    7 +-
 3 files changed, 1223 insertions(+), 24 deletions(-)

The last command was just for me to check that the author/date/etc. looked correct, as well as the number of lines added/removed and number of files changed. There was a minor discrepancy in the larger patch, but it looks like it was just an instance of trailing whitespace being added which disappeared when git fixed the whitespace changes.

comment:68 in reply to: ↑ 67 Changed 9 years ago by kcrisman

> $ cd ~/src/sagenb # go to my sagenb repo
> $ git checkout master # get on master
> $ git pull # my master is set up to track sagemath/master, i.e. the latest upstream
> $ git checkout -b trac_12299 # create a new branch called trac_12299
> $ # download the patches to the current directory
> $ git am --whitespace=fix trac_12299_adv_jmol_nb.patch
> $ git am --whitespace=fix trac_12299_old_wksht.patch

This is some of what I was talking about in other locations, except now how does one use this in an actual "working" Sage install? (Before pull 63 on github sagenb, I mean.) From other discussion it looks like plopping this new sagenb in a Sage that already has #11080 and friends applied would suffice?

comment:69 follow-up: Changed 9 years ago by kini

Yup. In the instructions on #11080, replace the step "install the sagenb spkg" with "clone the sagenb repo into devel/sagenb (or symlink devel/sagenb to a clone of the sagenb repo), and then run sage -python setup.py develop inside devel/sagenb". You need to run sage -python setup.py develop only once (unlike sage -b for the sage library) - it is the step which pulls in all the dependencies and installs them into your $SAGE_LOCAL.

comment:70 in reply to: ↑ 69 Changed 9 years ago by kcrisman

and then run sage -python setup.py develop inside devel/sagenb". You need to run sage -python setup.py develop only once (unlike sage -b for the sage library) - it is the step which pulls in all the dependencies and installs them into your $SAGE_LOCAL.

Ah, this is the part I was probably missing.

comment:71 in reply to: ↑ 66 ; follow-up: Changed 9 years ago by gutow

Replying to gutow:

Replying to strogdon:

Another scenario that leads me to believe what I'm seeing is not a "signed/unsigned" applet issue:

Thank you now I've got it...This may take a bit to fix. It appears to be a discrepancy between the server and javascript applet numbers. There are many places where the update could be getting messed up. At least I know what to look for now. And you are correct, this should have nothing to do with whether the applets are signed or not.

I think I've fixed it. I found quite a few places I missed where the server could get out of sync with the browser. Please try my test server TestServer before I make a patch. Thanks.

comment:72 in reply to: ↑ 71 Changed 9 years ago by strogdon

Replying to gutow:

I think I've fixed it. I found quite a few places I missed where the server could get out of sync with the browser. Please try my test server TestServer before I make a patch. Thanks.

With your changes I'm unable to get a worksheet to freeze or act oddly. This looks good to me. And the original issue, that spawned all this, in attempting to download a jmol is no longer an issue.

comment:73 follow-up: Changed 9 years ago by kini

I went to the test server, created an account, plotted x^2+y^3 over (-1,1)×(-1,1), clicked "make interactive", and firefox immediately crashed. Does that count as "acting oddly"? :)

I doubt this is caused by jmol in particular or anything in this code. FWIW it's running the Sun Java 6 plugin on Debian wheezy amd64.

comment:74 in reply to: ↑ 73 ; follow-up: Changed 9 years ago by kcrisman

With your changes I'm unable to get a worksheet to freeze or act oddly.

Great!

I went to the test server, created an account, plotted x^2+y^3 over (-1,1)×(-1,1), clicked "make interactive", and firefox immediately crashed. Does that count as "acting oddly"? :)

Surprisingly, it doesn't! I think acting oddly is different from acting badly :)


I've been messing with the "high quality" issue. So, it does look enough better that it's hard not to want it, especially since memory should not be an issue at this point. I do see the speckles with the mesh on. However, they only appear with the mesh, and only with the black mesh - I can't get it with any other mesh, not even the darker grays.

Maybe we could keep the high-quality if the mesh defaults to one of those colors? Or is there an "xor" we could set, not allowed to use high quality and mesh at the same time if the color is so and so? That seems to be a little limiting, though.

The black mesh speckles have their value too - we could hypnotize people at the Joint Meetings booths...

comment:75 Changed 9 years ago by kcrisman

  • Work issues changed from applet ID when cells re-evaluated,decide default display quality, doctests,switch to generic error to decide default display quality, doctests,switch to generic error

comment:76 Changed 9 years ago by kini

I tried it again after restarting firefox - this time it seemed to work. Still takes several seconds to load the first interactive plot (which I guess is inevitable since it's a Java applet), but loading subsequent plots only takes one or two seconds each.

comment:77 follow-up: Changed 9 years ago by kini

I did notice some yellow warning icons flickering about when I opened the context menu. I'm not sure what that's about.

comment:78 in reply to: ↑ 77 Changed 9 years ago by gutow

Replying to kini:

I did notice some yellow warning icons flickering about when I opened the context menu. I'm not sure what that's about.

Maybe the way your software is reacting to all the warnings applets now flash when they make separate windows. This also depends on your Java and browser security settings. If you choose the download option, which causes you to switch to the signed applet, you should get a dialog which actually requires you to make a decision.

comment:79 Changed 9 years ago by gutow

  • Cc kini added

comment:80 follow-up: Changed 9 years ago by ppurka

There seems to be some problem with the help window at least in firefox on linux. The help window that can be popped up from within jmol actually has mouse scroll disabled and also lacks a scroll bar. But pg up/down works and shows that there is more text present once scrolled down.

I had a look at the spkg and I think inserting a css rule like this in the patches/appletweb/JmolHelp.html might do the trick. Unfortunately, I can't seem to figure out how to do live page edits in firefox, so I can't test this right away.

html {
     overflow: -moz-scrollbars-vertical;
     overflow-y: scroll;
}

comment:81 Changed 9 years ago by ppurka

And I concur with kini. I always see yellow warning signs on right click menu (and the right click menu is slow too). But that is also with the current jmol in sage-5 (in opera/firefox), so I didn't think much about it. I almost never need to use the right click with jmol anyway.

comment:82 in reply to: ↑ 74 ; follow-up: Changed 9 years ago by gutow

Replying to kcrisman:

I've been messing with the "high quality" issue.

Maybe we could keep the high-quality if the mesh defaults to one of those colors?

This is a great idea, which works! I suggest we use the darkest of the blues as that is very close to black. If there are no objections I will change the default.

comment:83 in reply to: ↑ 82 Changed 9 years ago by ppurka

Replying to gutow:

This is a great idea, which works! I suggest we use the darkest of the blues as that is very close to black. If there are no objections I will change the default.

Anything to get pretty pictures!!

comment:84 in reply to: ↑ 80 Changed 9 years ago by gutow

Replying to ppurka:

There seems to be some problem with the help window at least in firefox on linux.

Try it now. I think I've forced it to have a scrollbar (it does on FF/linux for me).

Replying to ppurka:

Anything to get pretty pictures!!

I've made the change see if you like it.

comment:85 Changed 9 years ago by ppurka

Thanks. Scroll works now, and pictures look good :)

comment:86 Changed 9 years ago by gutow

  • Work issues changed from decide default display quality, doctests,switch to generic error to doctests,switch to generic error

Changed 9 years ago by gutow

Fix server<->Jmol syncing and tweak UI (no more sparkles and better vocabulary).

Changed 9 years ago by gutow

Fix server<->Jmol syncing and tweak UI (no more sparkles and better vocabulary).

comment:87 Changed 9 years ago by gutow

Oops! Now there are two patches. Since the first one gave a trac error on upload, use patch 2. Although patch 1 looks OK by eye.

comment:88 Changed 9 years ago by kcrisman

  • Report Upstream changed from Reported upstream. No feedback yet. to Workaround found; Bug reported upstream.
  • Reviewers changed from Karl-Dieter Crisman, Steven Trogdon to Karl-Dieter Crisman, Steven Trogdon, Punarbasu Purkayastha

Don't worry about the error, that is this whole Trac overloading thing. They should be identical. Unfortunately, I can't view either of them right now, Trac is still acting up.

Good call on the scroll, ppurka; I just ignored it because I'm used to things like that in other software :) but we shouldn't be like them.

Jonathan, nice work on changing the defaults; things look great on the server. The change to opacity makes more sense as well. The other stuff with the deletes is presumably in comment:71, so I say positive review on that patch, now just need to do the doctest stuff.

comment:89 Changed 9 years ago by kini

I pushed the new patch to the pull request.

comment:90 Changed 9 years ago by strogdon

Well, no joy here. I applied the new patch and locally I basically get the same behavior as reported in first scenario from comment:64 even though from the TestServer? things were fine. There is a caveat that indicates something has changed. Once I get the pop-up and click to remove it I have

Loading Jmol 3-D viewer...

in the present applet and there are 3 interactive applets and 1 that is sleeping. If the sleeping applet is made interactive things "seem" to be resolved, but I'm left with 2 sleeping applets and one of them cannot be make interactive.

I'm wondering if there is something server-side that's not predictable across platforms that's causing this. Let's see what Karl gets. I didn't mention previously but the version of FF I'm using is 13. I'll also try this later on an ubuntu machine.

comment:91 Changed 9 years ago by gutow

  • Description modified (diff)
Note: See TracTickets for help on using tickets.