Re: Problem displaying user-created .cdf files
- To: mathgroup at smc.vnet.net
- Subject: [mg122985] Re: Problem displaying user-created .cdf files
- From: Gary <gpalmerlv at gmail.com>
- Date: Sat, 19 Nov 2011 06:47:15 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <ja2pvl$mak$1@smc.vnet.net>
I took John's suggestion and added SaveDefinitions --> True to the Manipulate[] options. This seemed to solve the problem, in that I was able to save a notebook as a cdf file and display it in both the CDF Player and on a web page on a remote server where I have an account <faculty.unlv.edu/gbp/mma/rotate_on_arbit_axes.html>. I won't guarantee to leave that page up indefinitely, but I will leave it for a week, but you may not be able to access it anyway for reasons that follow in (1). But solving this problem seemed to lead to other problems, to wit: (1) The site mentioned above does not always work. It worked for me the first couple of times and it worked for a friend. But I now find that it somes up with a dialog and a button which disappear before I can read or select them, leaving me with a gray square. I tried deleting cookies and history in Firefox, with the result that opening the cdf web page now produces a solid black page in that browser. Is it possible that in creating a very large display (width = 1400 height = 1100) I exceeded the capacity of the browser or the Player? I have reduced the display dimensions in the web page now to 600 x 400, and it tries to display, but leaves only the gray panel after the permissions dialog flickers twice. (2) On opening Mathematica Home Edition 8, I now find that the Open... link on the opening panel doesn't work. This is not a big deal, because I can still open files from the File menu, but it is a nuisance. The Wolfram CDF Player functions properly. (3) More problematic, I find that the Open Option Inspector button in the Preferences --> Advanced panel is now grayed out and dysfunctional. Since the file I was working with had the brackets hidden with Display Options --> ShowCellBrackets --> False, that file is now practically uneditable because I need the brackets to profile the cell boundaries. Furthermore, I have no way of setting other options or of knowing which options are set. Is there a way to restore the function of this important button? In attempting to fix these problems, I repaired disk permissions with the Disk Utility and reinstalled Mathematica 8 from the diskette. That produced no improvement. The Open... and Open Option Inspector buttons still don't work. The browsers appear to be working well on all other sites that I use. What now? Have these problems been seen before or am I uniquely talented at unintentionally disorganizing a perfectly good computer program? Mathematica Home Edition 8, iMac, OS X 10.6.8, Chrome, Firefox On Nov 17, 6:08 am, John Fultz <jfu... at wolfram.com> wrote: > Does the content appear in a *fresh* session of Mathematica, after you've newly > opened the notebook and have evaluated no cells at all (including initial ization > cells)? > > One common failure that happens in this regard is that the CDF relies on some > state in the kernel which is not automatically established, but requires > Shift+Enter evaluations to establish. Here's a very simple example: > > (* Bad!! *) > f[x_] := Sin[x] > Manipulate[f[x], {x, 0, 10}] > > The definition of f will be lost in any new session of Mathematica or Player. > But, of course, it will appear to have worked while you were authoring it. > > In the specific case of Manipulate, there are generally two ways to resolve > this. You can use the "automatic" method...the SaveDefinitions option: > > (* Good example #1 *) > f[x_] := Sin[x] > Manipulate[f[x], {x, 0, 10}, SaveDefinitions->True] > > This works quite nicely, but for very complex examples (particularly when > packages need to be loaded), SaveDefinitions automatic methods can either fail > or produce an unnecessarily large (in terms of file size) result. > > The other method involves making sure that you properly localize everything. > Depending upon your code, this might involve the use of DynamicModules, > Initialization options, or other devices. In this case of the example I > provide, it's a fairly straightforward Initialization option: > > (* Good example #2 *) > Manipulate[f[x], {x, 0, 10}, Initialization:>(f[x_] := Sin[x])] > > I am guessing a bit as to the exact nature of your problem based upon your > description. It's possible that it might be some other sort of issue which I > didn't describe, like for example a limitation of the sandbox environment that > the web browser plugin runs in. If my explanation above didn't help, then what > you really need to send for people to help debug your problem is the CDF itself. > > Sincerely, > > John Fultz > jfu... at wolfram.com > User Interface Group > Wolfram Research, Inc. > > > > > > > > On Wed, 16 Nov 2011 04:46:46 -0500 (EST), Gary wrote: > > The cdf. files that I create do not display properly. They can be > > opened, viewed, and manipulated with Mathematica, but CDF Player is > > able to display them only partially, even after enabling Dynamics. The > > same problem occurs when they open in a web page. > > > I get the right size box and properly labeled axes, but a tan > > background (the intended one is light yellow). The four sliders appear > > properly labeled above the display window, but none of the real > > content (a disk, three arrows, and a sphere) of the demonstration > > appears. The slider buttons slide, but since there are no objects in > > the display, they can't do anything. > > > To the best of my knowledge, I followed all the instructions for > > preparing the .cdf file: close unwanted cells, hide brackets, enable > > Deployed in Cell Options --> General Properties --> Deployed, making > > sure that the file "rotate_demo.cdf" was selected in the menu of the > > Options for Global Preferences dialog. I saved the file as .cdf using > > the menu choice in the save dialog. I tried each of the following two > > html tags in a web page. > > > <script src="http://www.wolfram.com/cdf-player/plugin/v1.0/ > > cdfplugin.js" > > type="text/javascript"></script><script type="text/javascript">// <= ! > > [CDATA[ > > var cdf = new cdf_plugin(); > > cdf.addCDFObject("rotate_demo_applet", "rotate_demo.cdf", 800, 800); > > // ]]></script> > > > <embed src="rotate_demo.cdf" width="1000" height="1000"> > > > Files downloaded from Wolfram's demonstration .cdf files and opened in > > in either a browser or the CDF Player display and operate properly, so > > it seems the error must occur when the files are created. Any ideas? > > > Mathematica 8, iMac, OS X 10.6.8, Chrome, Firefox