Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: Stumped on debugging what is causing Dynamic to re-evaluate.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119753] Re: Stumped on debugging what is causing Dynamic to re-evaluate.
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Mon, 20 Jun 2011 19:37:33 -0400 (EDT)
  • References: <itek4n$s7r$1@smc.vnet.net>

On 17/06/2011 05:11, W Craig Carter wrote:
> Hello Group,
> I've been stumped on something for a few days.
>
> The example is far too long to cut and paste---which is the preferred
> mode for asking questions in this group.  So, I am hoping only for
> advice on how to find what is causing unexpected re-firing of a Dynamic.
>
> I have something of this form:
> --------------
> With[
> {symbolsToBeUsedByKernel=constantThings},
>
> DynamicModule[
> {valuesSetByControlObjects,
> a,
> b,
> c,...},
> PopupMenu[Dynamic[a],"choice1","choice2"];
> InputField[Dynamic[b]];
>
> Dynamic@slowComputationGraphicsObject[symbolsToBeUsedByKernel,a,b]
> ]
>
> ]
> ----------------
>
>
> In the actual example, I have many such Dynamic Control objects.
>
> If I use a "dummy" =
> slowComputationGraphicsObject[symbolsToBeUsedByKernel,a,b], there is no
> re-firing of Dynamic@slowComputationGraphicsObject.
>
> If I use my "500-line---mutliple module---calls several packages---CPU
> intensive" ComputationGraphicsObject, an infinite loop of re-firing
> takes place (and the FrontEnd becomes unresponsive).
>
> How does one start going about finding the cause of the re-firing????
>
> I've buried all of the list-like controls in the
> With[{i=i},Table[InputField[var[[i]],{i,n}]] paradigm.
> I've tried limiting the TrackedVariables.
> I've tried Synchronous and ASynchronous updating.
> None of these work.
>
> I can solve the problem with a Button to fire the computation and taking
> away the Dynamic---but this isn't very satisfying.
>
> Any general advice?
>
> Thanks, Craig
>
>
>
>
Why not try to create some code that reproduces the problem in a small 
example - maybe create an array of objects (if this is necessary), and 
an expensive calculation that just consists of a suitably large loop. 
Working with a sample that definitely goes wrong, is usually much more 
productive than trying to guess how to make the program fail, before 
trying to fix the failure!

I did once create a notebook with about 2000 buttons (most of which were 
out of view at any one time) with some dynamic colouring, and I got a 
hang that was possibly similar to the one you are encountering. I gave 
up in the end, and coloured them using a less elegant method that did 
not use Dynamic.

David Bailey
http://www.dbaileyconsultancy.co.uk



  • Prev by Date: Re: Why doesn't TrueQ return True here?
  • Next by Date: Meshshading
  • Previous by thread: Stumped on debugging what is causing Dynamic to re-evaluate.
  • Next by thread: webMathematica Export