MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: question on security warning message "this file contains potentially unsafe dynamic content" with Manipulate notebook

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123846] Re: question on security warning message "this file contains potentially unsafe dynamic content" with Manipulate notebook
  • From: John Fultz <jfultz at wolfram.com>
  • Date: Thu, 22 Dec 2011 04:29:36 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Comments inline...

On Wed, 21 Dec 2011 06:57:04 -0500 (EST), Nasser M. Abbasi wrote:
> I am finally able to reproduce this message that I get once in a while.
>
> This in on V8.04, on windows 7.
>
> While trying things, I found how to make Mathematica generate the above
> message when I open a notebook with Manipulate in it.
>
> I will show the code that generated this message, and have
> a follow up question on Dynamic module inside Manipulate.
>
> First the error message screen shot:
>
> http://12000.org/tmp/dec_20_2011/error_message.png
>
> I now hit 'enable dynamics' and all seems well. But each time
> I reopen the notebook, I get the message again.
>
> So I do not understand this warning message, and why it comes up.
>
> The code to generate it is:
>
> --------------------------------------
> Manipulate[
>
> DynamicModule[{p},
> p["x"] == 0;
> Row[{Dynamic[
> Refresh[p["x"]++; Row[{"p[x]==", p["x"]}],
> TrackedSymbols -> {n}]]}]
> ],
>
> Button["update counter", n++],
> {{n,0}, None}
> ]
> -----------------------------------------
>
> The above is on its own notebook, with nothing else in the notebook.
>
> I close M, then start it, then open the notebook, and I see the above
> message.
>
> Now, to remove the message, I found out that the use of p["x"] is
> what seems to be causing it. Because I closed the above notebook, and
> made a new notebook with this code:
>
> -------------------------
> Manipulate[
>
> DynamicModule[{p},
> p == 0;
> Row[{Dynamic[Refresh[p++; Row[{"p==", p}], TrackedSymbols -> {n}]]}]
> ],
>
> Button["update counter", n++],
> {{n, 0}, None}
> ]
> -----------------------------
>
> Then closed M, and started it again, and opened the above notebook,
> and now I do not see the warning message.
>
> The only difference is that one has p["x"] and the other has just p.
>
> So, why is using p["x"] causing the security warning message?

That is a bug, which has already been fixed in development sources.

>
> p["x"] is an indexed object as explained in this page:
>
> http://reference.wolfram.com/mathematica/tutorial/MakingDefinitionsForIndexe
> dObjects.html
>
> And now for the follow up question: In the second example above, where
> the warning do not show up, I noticed that the value of 'p' is not saved
> when I close the notebook.

This, however, is not a bug.  Your expectation is that  values will be saved
when the notebook is closed...that's incorrect.  Values will be saved when
notebooks are *saved*.  They can, however, be closed without warning if you 've
only changed DynamicModule variables, and that's by design.  Maybe not in your
case, but for many notebooks, putting up the "do you want to save" warning every
time you simply moved a slider would just be too annoying.

Sincerely,

John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.

>
> So that when I start the notebook again, I was expecting the counter,
> which is the value of p,to be at the value it was before I closed
> the notebook. This is because 'p' belongs to a DynamicModule[] (just
> like Manipulate control variables keep the same state when one
> closes the notebook and open it again.)
>
> What do I need to change in example 2 above to achieve this? I must
> be doing something silly, I just do not see it now.
>
> thank you,
> --Nasser




  • Prev by Date: Re: question on security warning message "this file contains potentially unsafe dynamic content" with Manipulate notebook
  • Next by Date: Re: Fast vs. Slow NonlinearModelFit models
  • Previous by thread: Re: question on security warning message "this file contains potentially unsafe dynamic content" with Manipulate notebook
  • Next by thread: DatabaseLink Example for DB2 and Mathematica 8