MathGroup Archive 2010

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

Search the Archive

Re: DynamicModule not saving reliably a variable between

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106651] Re: [mg106797] DynamicModule not saving reliably a variable between
  • From: Ariel Sepulveda <sepulveda.cuevas at gmail.com>
  • Date: Wed, 27 Jan 2010 01:43:18 -0500 (EST)
  • References: <201001231237.HAA16510@smc.vnet.net>

Dear Hannes:

The amount of details in your posting may be affecting the number of
responses to your question.  In any case, if your objective is to create a
job scheduler I want to share with the group that I have created an
application for that purpose (
http://www.prontoanalytics.com/products/schedules.htm).  This application
can be used for scheduling any type of Mathematica command or job.  In this
application the user can use the interface to define starting date,
frequency, and job priority for each job.  I can provide more details to
those interested.
-- 
Ariel Sepulveda, Ph.D.
__________________________
President, Pronto Analytics Inc.
Tel. 787.354.6947
ariel.sepulveda at prontoanalytics.com
http://www.prontoanalytics.com
On Sat, Jan 23, 2010 at 8:37 AM, Hannes Kessler
<HannesKessler at hushmail.com>wrote:

> Hello,
>
> I have a rather complex dynamic notebook GUI with several TabView,
> Button, InputField and other objects that does not save reliably a
> variable "jobs" between Mathematica sessions. The basic structure of
> the GUI is a follows:
>
> DynamicModule[{jobs = {}, ...},
>  ...,
>  TabView[{..., "Edit jobs" -> Dynamic[jobDefinitionPanel
> [jobs_, ...]], ...}],
>  Initialization :> AbortProtect[
>   Needs["context1`"];
>    Needs["context2`"];
>    ...]]
>
> where jobDefinitionPanel has the attribute HoldAll and contains a
> button for adding an object Job["name"->...,"item 1"->..., "item 2"-
> >..., ...] to the list of jobs
>
> jobDefinitionPanel[jobs_, ...] := DynamicModule[{..},
>   ...;
>    Column[{
>      Dynamic[Length[jobs]],
>      ...,
>      Button["Add job", jobs = Append[jobs, makeJob[ ...]], Method ->
> "Queued"]
>      }]];
>
> makeJob[ ...] returns _Job objects of the form given above:
>
> makeJob[name_String, item1_, item2_, ...] :=
>  Job["name" -> name, "item 1" -> item1, "item 2" -> item2, ...]
>
> In a given Mathematica session everything works fine: After adding
> several job objects, Dynamic[Length[jobs]] shows the correct length of
> the jobs list. Exporting the list with CellPrint[Cell[BoxData[ToBoxes
> [jobs]]]] from the GUI to its notebook shows the jobs list {__Jobs}
> with all _Job elements. But saving, closing and reopening the notebook
> always gives a shorter jobs list, sometimes it is even empty. The _Job
> objects are rather large due to one item which is a 15x15 matrix of
> elements None or FA[...]. The problem does not occur if I do not add
> this item to Job-objects. It looks as if a size limitation exists for
> saving dynamic objects in the notebook cell containing the dynamic
> expressions.
>
> Does anybody have an idea what the reason might be and how to fix this
> problem?
>
> My current workaround is to additionally save the jobs list to a file
> jobs.m
>
> Button["Add job", jobs = savedJobs =..; Save["jobs.m", savedJobs],
>  Method -> "Queued"]
>
> and to load this file during initialization
>
> DynamicModule[{jobs = {}, ...},
>  ...,
>  Initialization :> AbortProtect[
>   Needs["context1`"];
>    Needs["context2`"];
>    Get["jobs.m"];
>    jobs = savedJobs;
>    ...]]
>
> Thanks in advance and best regards,
>
> Hannes Kessler
>
>



  • Prev by Date: Re: Re: FromCharacterCode
  • Next by Date: Re: NotebookGet/Read/EvaluateSelection Issues
  • Previous by thread: DynamicModule not saving reliably a variable between sessions
  • Next by thread: Can't solve :(