I've been trying to put together a palette of useful functionality garnered from this site. There is useful stuff scattered all over the place, for example:

As an ugly, yet functional, way of putting them together, I have something like:

    OpenerView[{"Duplicate Active Notebook", duplicating}, True],
    OpenerView[{"Pasting a table", pasting}, True],
    OpenerView[{"Copy for StackExchange", copyForStackExchange}, True]
    (* etc *)
  WindowTitle -> "mathematica.stackexchange.com"];

where the definitions inside each OpenerView are slight modifications of the code from the above links. (Usually just stripping off any existing palette stuff is all that is required. I did find that a single button seemed to require ImageSize -> Automatic so it would display properly.)

So the question is, what else can I add to this?

Are there any procedures you use regularly that are suitable for a palette? Things that have made your mathematica experience easier and more productive?
Is there any enlightening information that could be continually displayed on a palette? E.g. progress bars, memory usage, cursor position?
Are there any tips and hints for beginners that could be nicely presented on a palette?

  • $\begingroup$ This looks a bit like our famous toolbag question on SO/Mathematica. You'll find contributions of many of the top users there. It is closed though, as questions like these and yours not really adhere to the rules for admissible questions. $\endgroup$ – Sjoerd C. de Vries Aug 23 '12 at 6:36
  • 1
    $\begingroup$ I like the question (+1) but it must be community wiki. $\endgroup$ – Mr.Wizard Aug 23 '12 at 12:20
  • 3
    $\begingroup$ @SjoerdC.deVries Agree ... but we should find a place to collaborate on these. If we can't find another way, I vote for bending the rules somewhat. $\endgroup$ – Dr. belisarius Aug 23 '12 at 14:22
  • $\begingroup$ @belisarius i agree $\endgroup$ – AimForClarity Feb 23 '13 at 4:59

I used to think that Mathematica was an incorrigible memory hog until I visited this site and discovered the wonders of $HistoryLength. This seems to be a common complaint that is easily remedied. Below is a scattering of buttons that show the current value and allow it to be easily changed:

historyLengthButtons := Grid[{Dynamic[Button[#, $HistoryLength = #, Background -> 
   If[$HistoryLength == #, Yellow, Automatic]]] & /@ {0, 1, 2, 3, Infinity}
 }, Spacings -> 1]



A memory usage graph:

memoryInUse = ConstantArray[MemoryInUse[], 60];
frontEndInUse = ConstantArray[MemoryInUse[$FrontEnd], 60];
  memoryInUse = Append[Rest@memoryInUse, MemoryInUse[]];
  frontEndInUse = Append[Rest@frontEndInUse, MemoryInUse[$FrontEnd]];
, 5];

memoryUsagePlot := Dynamic[Grid[{{Overlay[{
  ListPlot[memoryInUse, PlotRange -> All, Joined -> True, AspectRatio -> 1/5,
    Axes -> False, Background -> Black, PlotStyle -> Green, ImageSize -> Small,
    GridLines -> {12 (Range[6] - 1), None}, GridLinesStyle -> Darker@Gray],
  ListPlot[frontEndInUse, PlotRange -> All, Joined -> True, AspectRatio -> 1/5,
    Axes -> False, Background -> None, PlotStyle -> Red, ImageSize -> Small]
 Style["Kernel", Darker@Green], NumberForm[N[Last[memoryInUse]/10^6], {9, 2}], "MB"},
 Style["Front End", Darker@Red], NumberForm[N[Last[frontEndInUse]/10^6], {9, 2}], "MB"
 }}, Alignment -> {Center, Center}]]

As per Silvia's suggestion, a memory profile:

myByteCount[symbolName_String] := 
  Hold[x__] :> If[MemberQ[Attributes[x], Protected | ReadProtected], 
  Sequence @@ {}, {ByteCount[Through[{OwnValues, DownValues, UpValues, SubValues, 
  DefaultValues, FormatValues, NValues}[Unevaluated@x, Sort -> False]]], symbolName}]];

memoryProfileButton := 
  Button["Memory profile", CreateDocument[
  Style[With[{listing = myByteCount /@ Names[]}, 
  Labeled[Grid[Reverse@Take[Sort[listing], -100], Frame -> True, Alignment -> Left], 
  Column[{Style["ByteCount for symbols without attributes Protected and" <>
  "ReadProtected in all contexts", 16, FontFamily -> "Times"], 
  Style[Row@{"Total: ", Total[listing[[All, 1]]], " bytes for ",
  Length[listing], " symbols"}, Bold]}, Center, 1.5], Top]],
  ShowStringCharacters -> False], WindowSelected -> True, 
  WindowTitle -> "Memory profile"], ImageSize -> Automatic]

Put it all in one section:

  Column[{historyLengthButtons, memoryProfileButton, memoryUsagePlot}]}, True]



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.