Tag Info

New answers tagged

7

Nice answer by Mohsen, +1. I am continually impressed by the quality of the J/Link and .NET/Link expertise on this site. I have a couple remarks and then an example program. The question asked about some general tips for getting started with J/Link. This GraphStream library provides a perfect example for the typical workflow of a J/Link project. The ...


6

You definitely should not rely on this behavior. There is one and only one proper way to get dynamic behavior for the rhs of a front end option, and that is to wrap Dynamic around the entirety of the option. The only exceptions to this rule at present are certain options which will assume the Dynamic if one doesn't exist, such as CellDynamicExpression and ...


8

I am writing this answer for a person who is familiar with Mathematica and has a good understanding of computer programming, but not so familiar with Java programming language. Using GraphStream is not so different from using any other Java library. You need to download the GraphStream core files from here and extract it. gs-core-1.1.2.jar is the only file ...


1

I'm not sure if this fully answers your question, but here is a method of using the Dynamic to check if a dialog is already open and reopen it if it has been closed: DynamicModule[{nb = CreateDialog[Dynamic@y]}, TogglerBar[ Dynamic[y, (y = #;If[Not@MemberQ[Notebooks[], nb],nb = CreateDialog[Dynamic@y]]) &], Range[5]]]


8

My take: toward[p1_, p2_, v_: .05] := p1 + v Normalize[p2 - p1]; {n, r} = {4, 3}; DynamicModule[{pts, history}, pts = r {Cos[#], Sin[#]} & /@ Range[2 Pi/n, 2 Pi, 2 Pi/n]; history = {pts}; Print[Dynamic[ListPlot[Transpose@history, AspectRatio -> Automatic, Joined -> True, PlotStyle -> Directive[Thick, CapForm["Round"]], ...


2

Seems no holdon, but to achive the same effect is easy too. Add a Joined->True, looks like a joined curve now Clear["`*"]; forward[{x1_,y1_},{x2_,y2_},v_: 5]:=Block[{alpha},alpha=Switch[Sign[x1-x2],-1,ArcTan[(y2-y1)/(x2-x1)],1,Pi+ArcTan[(y2-y1)/(x2-x1)],0,Pi/2,_,-Pi/2];{x1+v 0.01 Cos[alpha],y1+v 0.01 Sin[alpha]}]; list={}; ...


2

I've also noticed this bug, although buttons/drop down menus do continue to work, for me only sliders become unresponsive after suspend (Ubuntu 12.10/Mathematica 9.0.0.0 x86 64 bits). A possible workaround is thus to change all parameter controls to buttons/dropdown menus by providing a finite list of values the parameter is allowed to take: ...


1

Here's a guess at what you're after: SeedRandom[1]; data = Accumulate[RandomReal[{-0.2, 0.2}, 300]]; thirds = Partition[data, 100]; interps = Interpolation /@ thirds; myplot = ListLogLinearPlot[thirds]; DynamicModule[{pos = MapThread[{Log@#, #2[#]} &, {{5, 16, 50}, interps}]}, LocatorPane[ Dynamic[pos, (pos = MapThread[ Function[{pt, ...


2

Often I do something kludgy like Dynamic[foo; data] <<"filepath.mx"; foo++ It's somewhat similar to Albert Retey's first solution. However, foo is a global variable and data can be an arbitrary piece of code. Here's a way to dress it up. It does the same thing, but it reads better. ClearAll[dependsOn, update]; SetAttributes[dependsOn, HoldAll]; ...


2

I have no insight into the internals but have found several situations where for whatever reasons the automatic determination of the necissity to update fails. I would wish there would be a programmatic possibility to tell Mathematica that a ceratin symbol has changed, but don't know about that. Of course you could do something stupid like this to inforce an ...


3

Perhaps something along these lines could help? $PrePrint= # /. Except[Null] :> With[{line = $Line}, DynamicSetting@Dynamic@In[line]] /. DownValues[In] &; After running this, everything you evaluate is automatically wrapped in Dynamic so its value is updated automatically. I haven't tested it much so there may be issues. (Be careful ...


3

You can try Dynamic(by the way, l = 2 + 5 won't make l >= 5 to be False…): In[20]:= l = 1 + 3 Out[20]= 4 In[19]:= Dynamic[l >= 5] Out[19]= False


2

You can use the second argument to Dynamic: DynamicModule[{fValues, msg, processChanges}, fValues = {Null, Null, Null, Null}; msg = "No change yet"; processChanges[field_, oldvalue_, newvalue_] := msg = Row[{field, " was changed from ", oldvalue, " to ", newvalue}]; {Table[With[{i = i}, (InputField[ Dynamic[Part[fValues, i], processChanges[i, ...


1

A rough straightforward implementation is to find all of the subpaths in your path, and generate a button that allows setting a new path at that level for each such subpath. Here's an implementation that generates the list of files/folders when you press the menu to ensure it's up to date. pathParts[path_] := ...


1

My solution is only prototype but I'll update it later. It differs from Yours approach becouse my function is blind. A priori it does not know the structure of file's tree. And there is also ActionMenu not PopupMenu. :( This version is not very elegant but I'm going to improve this. Lets start and set main directory and create function for each menu: dir ...


2

Perhaps this is what you want: data = Range[1, 100]; Column[{ Slider[Dynamic[n], {0, 10000000, 1}], Pane[ TableForm /@ Dynamic[n + data], ImageSize -> {200, 200}, Scrollbars -> True]}] Update Perhaps this is what you're seeking: data = Range[1, 1000]; Row[{ Column[ {Slider[Dynamic[m], {0, 10000000, 1}], Pane[TableForm /@ ...


6

[Edit 2: I've added further analysis and modified some of the explanations, esp. with respect to Refresh. Still far from complete, I fear.] First of all, I find if I set SetSystemOptions["DynamicUpdateInterval" -> 0.005], then I cannot perceive a difference in performance with or without the Animator running. I see a very few hiccups in both scenarios, ...


0

Use like this in your program Part[Setting[dummyBackgrounds], 1, 1] instead of Setting[Part[dummyBackgrounds, 1, 1]]]



Top 50 recent answers are included