# Tag Info

23

Typically, Mathematica contacts the license server every 2 minutes. If you have a license which supports a very large number of processes, that interval can grow (to help MathLM to scale better). It will never be more than 30 minutes. If three consecutive license checks fail, then Mathematica will instead revalidate the entire license file on what would ...

14

Maybe NotebookDynamicExpression is what you are looking for: SetOptions[EvaluationNotebook[], NotebookDynamicExpression :> Refresh[ SetDirectory[NotebookDirectory[]]; nbs = {"one.nb", "two.nb", "three.nb"}; For[i = 1, i <= Length[nbs], i++, Block[{nb = NotebookOpen[NotebookDirectory[] <> nbs[[i]]]}, FrontEndTokenExecute[nb, ...

11

You can use the global AutoOpenNotebooks setting to give a list of notebooks that must be opened on startup. The default path where it looks for these notebooks is $UserBasedirectory/SystemFiles/FrontEnd/TextResources. Now every time you open Mathematica, that notebook will be opened (in my case, tile.nb). 11 I don't know anything about mathStatica, so I can't comment on specifically what it's doing. But I can comment on the various moving parts of the system. The init.m file is created by the paclet manager. It must be that the mathStatica palette is part of a paclet which is under active management by the paclet manager. The paclet manager, as part of its ... 10 I think I found it but I'd be more than happy to look at other alternatives if any provided: Shift + Ctrl + O to open Options > Notebook options > Evaluation options > Global preferences from the drop down menu at the top Change InitializationCellEvaluation to True and InitializationCellWarning to False The next time the .nb file is launched, the ... 8 Cause The problem is due to a bug involving Catch and init.m that occurs in (at least) Mathematica versions 7, 8 and 9. It has been reported to Wolfram Support and they have acknowledged it as a bug. At time of writing, WRI has offered neither diagnosis nor workaround for this problem. Reproduction Steps and Analysis To reproduce the issue, place the ... 8 I think that Mike has a point: it is always good to start with something simple. Here is a very simple example which shows the main problem you have: the Initialization-code is evaluated only after the body of the DynamicModule has been evaluated. This might be surprising considering its name but I think is in agreement with the documentation, which is ... 8 One way to go about this is read in the file names - this way you don't have to explicitly check to see if they exist. path = SystemDialogInput["Directory", NotebookDirectory[]]; fileNames = FileNames["*.txt", path]; allFiles = Table[Import[fileNames[[num]]], {num, 1, Length[fileNames]}]; This reads the names of all files (in the specified path ... 8 mathStatica does not alter, nor seek to alter, the MenuSortingValue. In fact, mathStatica does not alter or seek to alter, in any way, how or where the mathStatica palette is listed in the palette menu... this is left entirely to default Mathematica behaviour. The reason the mathStatica palette appears out of alphabetical order in the Palettes menu seems to ... 8 As J.M. pointed out, this can be achieved by using an init.m file. init.m files are loaded on startup. The documentation can be found here. To load the VectorAnalysis package on each startup, you can write the init file using Export. The snippet below will append a Needs["VectorAnalysis"] to the kernel init.m file: initFileName = ... 6 Take a look at: Programmatically quitting the FrontEnd or running without one? I asked some similar questions and the answers have some good strategies to do this although most of them as workarounds outside of the Mathematica front end. A simple but key thing, adding NotebookSave[] to the end of your initializations cell can avoid some of the ... 6 A bit of an extended comment, but using a package makes all the sense in the world for a situation like you describe. You can see a specific example at this earlier question: What is a good coding style for setting and changing application level constants? In the above answer, a package provides a way to supply constants to any other notebooks. While ... 6 I think it is more convenient to use NotebookEvaluate. We can do NotebookEvaluate[filename, EvaluationElements-> "InitializationCell"] Confusing here may be that this has the same result as NotebookEvaluate[filename, EvaluationElements -> Automatic] Even though if we simply do NotebookEvaluate[filename] all the cells get evaluated. 5 I'm questioning AND answering this because I was looking for a feature like this for a while and now stumbled across FrontEndToken["EvaluateInitialization"] which does exactly what I wanted. Here is the code to make it work: filename = SystemDialogInput["FileOpen"]; nb = NotebookOpen[filename]; FrontEndExecute[FrontEndToken[nb, "EvaluateInitialization"]]; ... 5 This is possible, at least in version 7, but as rcollyer supposed there is a Global security option which cannot be set from within the Notebook (automatically, that is). First change the Global option: SetOptions[$FrontEnd, GlobalInitializationCellWarning -> False ] Then in the Notebook you need: SetOptions[EvaluationNotebook[], ...

4

According to the documentation, To suppress the loading of kernel initialization files, use the kernel command-line option -noinit. To specify another file to be used for kernel initialization in addition to init.m, use the kernel command-line option -initfile file, where file is the additional initialization file.

3

It's probably a good idea to look at this question more more information about writing CDF-happy notebooks. In brief, Initialization cells won't function properly in the CDF format. For example if we have the following initialization cell: a = 1; And subsequent cell that is not an initialization cell Manipulate[b + x, {x, 1, 10, 1}] Manipulate[a + x, ...

3

On Mathematica 7 (at least) DeclarePackage doesn't work first time on this Curl example: DeclarePackage["VectorAnalysis", {"Div", "Grad", "Curl"}] v := {3 Xx^2 + 2 Yy + (a - 3 b) Zz, (b - 7 a) Xx - 5 Yy - Zz, 2 Xx + c a Yy + 7 Zz} Curl[v] {0, 0, 0} But strangely when v is defined again and run it works: v := {3 Xx^2 + 2 Yy + (a - 3 b) ...

3

This is too long for a comment. I don't really have time to pull this code apart but if the objective is to learn DynamicModule wouldn't a simpler piece of code be a better start? If you look at what variables have been created after the first ENTER this is a small sample of what you get I think it would be best to pull your code apart and figure out why ...

2

One possibility would be to (programmatically) add dynamic options to all cells. E.g., one cell could look like : Cell["1-1", "Input", Evaluatable->Dynamic[eval], CellOpen->Dynamic[open], Background->Dynamic[bcolor]] Then, if you evaluate in a subsequenc cell (or by Button) this: eval = True; open = True; bcolor = LightGray the Cell becomes ...

2

This question seems to be slightly different from Globally loading packages while using a CellGroup as the default context (which I just posted an answer for). Probably the simplest method would be to define your init.m functions in the System context itself as this is always accessible no matter the CellContext. For example: Systemhex[n_] := ...

2

As I understand, three things are needed: Explicitly list the contexts of the functions that are in the package. For example, if you are using the function f in package test call it test`f[] instead of just f[]. Call Needs on the package inside the initialization option for the Manipulate that makes up your CDF. I would recommend calling needs with the ...

Only top voted, non community-wiki answers of a minimum length are eligible