Reputation
8,731
Top tag
Next privilege 10,000 Rep.
Access moderator tools
Badges
32 56
Newest
 Yearling
Impact
~37k people reached

Jan
26
comment MathLink linking error after OS X 10.9 (Mavericks) upgrade
Just a note that, in 10.4 (coming probably in a month or so), the default MacOS MathLink library will be switched to use libc++ by default. The framework will continue to host the older, libstdc++ version of MathLink using Apple's standard framework versioning scheme.
Jan
1
comment Docked cell showing keystrokes and mouse buttons actions
@P.Fonseca I mean that, the way Mathematica implements its event handling (which is fairly standard), the operating system steals the keyboard event before Mathematica sees it and transforms it into a menu command event. It's not that it's impossible to capture the keyboard event before it's transformed...it's that there's no very compelling reason for Mathematica to do otherwise (and bear the extra complexity, risk of bugs, extra developer hours contributed to this, etc.).
Dec
31
comment Panning with Mouse + Moving A Curve
I have some code you might be interested in. It's not a proper answer to this question because it doesn't allow for dragging of curves. But what it does do is to allow arbitrary panning, by interactively changing the variable range and PlotRange. So, unlike the other solutions here, you won't hit a wall if you pan too far. It also, somewhat amusingly, supports "throwing". I don't have it anywhere at the moment, but if there's interest, I could maybe throw it up on a Github gist or something.
Dec
31
comment How to have an Input cell that doubles as an Output
Another possibility is the use of a template notebook to generate the notebook you wish to redistribute. The template notebook does exactly the sort of transformation (output replacing input) that you describe, but as part of a deployment step rather than an interactive widget like the one you describe. If the non-interactive, deployment-based approach is appealing to you, I could write it up as an answer.
Dec
31
comment How to have an Input cell that doubles as an Output
Sometimes people ask questions which, even if properly and successfully answered, wouldn't represent the best solution to the actual problem they're experiencing. That's why I want to understand your problem, and why one existing solution to that problem was not sufficient for you. Given your problem, I would have gravitated toward a tagging-based solution...perhaps to the end of automatically reverse-closing the appropriate cell groups. It's unclear from your description whether you would find such a solution adequate and, if not, why not.
Dec
31
comment Docked cell showing keystrokes and mouse buttons actions
Some limitations could be dealt with by cleverer coding than I was willing to put the effort in for here. Perhaps somebody would like to follow up with an answer that builds on mine and improves it. But the limit of not having a "KeyUp" event handler is very problematic. And perhaps not too difficult to resolve in a future version of Mathematica. But the limitation of it not showing things like Ctrl+Z because the operating system snatches the event...that's more fundamental, and seems less likely to see a solution in the foreseeable future.
Dec
31
comment Overlay vs Show for plots?
Your statement about rasterization is not true. Overlay never rasterizes anything. The point is that Show called on multiple Graphics objects will always return something with head Graphics that has effectively merged the primitive list and options, while Overlay returns a thing with head Overlay that merely shows the items (which need not be graphics) visually stacked.
Dec
31
comment How to change default font for all existing notebooks at once?
Out of curiosity, which operating system were you on?
Dec
31
comment How to have an Input cell that doubles as an Output
I would have thought that the ability to close a cell group, alternatively on the Input cell or reverse-closing on an Output cell, would have been pretty close to what you're looking for without trying to invent a new interface. Certainly I see reverse-closing as a very common way of hiding implementation in notebooks.
Dec
31
comment Optional throws error when called from a package. Workaround?
I agree that the StandardForm ToExpression output seems wrong. I couldn't find an existing bug report about this, although it's likely to be an old bug. I've opened the bug report. Any licensed user who is interested in being notified when this bug is resolved can ask Tech Support to attach their contact information to bug 305932.
Oct
8
comment How to run existing mathematica nb from Java
@KonstantinStolpovsky, in the short run, you're probably going to have to work with Szabolcs' solution, which is to use a package file. Because of bugs I mentioned in my previous comment. But that having been said, your code has a completely unnecessary reference to EvaluatePacket in it. You may wish to correct it in your question.
Oct
8
comment How to run existing mathematica nb from Java
Actually, @Szabolcs, I would claim that this code should work. But it is an unfortunate truth that the history of NotebookEvaluate running from a standalone kernel is a troubled one. I believe the relevant issue here is that there is a known and reported bug that, if a kernel has a parent link other than the FE, then UsingFrontEnd[NotebookEvaluate[...]] can fail. I partially fixed this for 10.3, but troubles remain. That having been said, there is a minor bug in the code here. See next comment.
Oct
8
comment What is the point of Refresh if Dynamic has an UpdateInterval option?
@RolfMertig, Refresh is not widely deployed in v10. It is deployed where necessary. Your speculation about widespread slowdowns, if warranted generally, is not applicable to a connection with Refresh specifically (particularly since v10 has nothing new in regards to Dynamic).
Oct
8
comment What is the point of Refresh if Dynamic has an UpdateInterval option?
@AlbertRetey, I'm talking about a situation where a developer is making f available for your use by users. If I don't have end-to-end control, then I have to anticipate any usage. It's not reasonable for me to tell users to hack around my problems. That having been said, this certainly does not arise in many functions. Functions developed with no side effects (which is quite a lot of them) won't exhibit this behavior. For example, in 10.0.0, there was an infinite Dynamic triggering bug in GeoGraphics. The solution finding the accidental side effects and removing them, not Refresh.
Oct
8
comment What is the point of Refresh if Dynamic has an UpdateInterval option?
@Kuba Dynamic evaluates to a thing with head Dynamic. Refresh evaluates to its contents. If you are implementing a function which can be used anywhere, but which must not trigger any enclosing Dynamic unnecessarily, the only way to do this is Refresh. It is literally impossible to do this with Dynamic. Consider, for example, a function which memoizes its results. Inside of a Dynamic, such a function triggers twice because the act of memoization produces a global side effect in the symbol table which will retrigger enclosing Dynamics. Refresh can stop that dead.
Oct
7
comment What is the point of Refresh if Dynamic has an UpdateInterval option?
This is an underrated answer. We do this all the time in Mathematica code. If you have any function which modifies any non-localized symbol for any reason, this is the only way to prevent it from non-stop tickling parent Dynamics. I have, many times, reported bugs to developers around the company for which the fix is to wrap their code in Refresh[#, None]&. Such a change has no effect outside of Dynamic, but exactly the desired effect inside Dynamic.
Aug
14
comment Reference to multiple stylesheets
@Kuba, my last paragraph indicates that multiple stylesheets lets you mix in "new styles". What I mean by this is stylenames which have not been previously defined. Input/Output are defined in Core.nb, which is ultimately inherited by nearly every stylesheet in the system. Not many styles you've heard of get defined in Core.nb because we don't want to insert hard-coded stylenames into effectively every stylesheet. So, you won't find Section or Title or Code, for example. But Input and Output are so universal to the way the system works, it seemed better just to put them in Core.nb.
Jun
26
comment Reference to multiple stylesheets
That having been said, your statement that multiple stylesheets "don't work" is not strictly true. They don't work for your purposes. But they do work. You can use multiple StyleData[StyleDefinition->...] cells to mix in new styles. So if, in your example, "StyleSheet2.nb" has styles which don't exist in "StyleSheet1.nb", then they will be amalgamated together in your new stylesheet. So it does do something, just not what you were hoping for. Sorry for the multiple commenting, but I don't feel like I'm actually answering your question. Unless you'd accept "no" as an answer. :)
Jun
26
comment Reference to multiple stylesheets
...and these particular computations, although we cache them as much as possible, are one of the most expensive computations in the system. Not to mention the amount of effort to implement which, as has been pointed out in this thread, has a very low payoff because very few people would ever use this feature.
Jun
26
comment Reference to multiple stylesheets
If I have two versions of "Title" inherited from different stylesheets and they define FontColor differently, it is no longer acceptable for me to just take the first one. I must figure out where the information came from for each style. If both stylesheets inherit from Default.nb, but only the second stylesheet overrides Default.nb's version of FontColor, then I must choose the second. If only the first overrides, then I must choose the first. This necessity to not just track option settings, but the precise provenance of each and every option setting is expensive...(continued)