Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #3198

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

From David Bailey <dave@removedbailey.co.uk>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Stumped on debugging what is causing Dynamic to re-evaluate.
Date 2011-06-20 23:37 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <itoljs$eqr$1@smc.vnet.net> (permalink)
References <itek4n$s7r$1@smc.vnet.net>

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Stumped on debugging what is causing Dynamic to re-evaluate. W Craig Carter <ccarter@mit.edu> - 2011-06-17 04:11 +0000
  Re: Stumped on debugging what is causing Dynamic to re-evaluate. David Bailey <dave@removedbailey.co.uk> - 2011-06-20 23:37 +0000

csiph-web