Hot answers tagged

22

Here is a list of the most important differences: webMathematica is a server side technology (the Mathematica code runs on the server) while Mathematica code contained in a CDF-Document runs on the client, either in the standalone player or the browser-plugin. This of course has many important consequences, see the sections below for more details. The UI ...


22

Here are the two ways I have successfully used MongoDB with Mathematica. AFAIK much of this would also apply to similar DBs such as CouchDB. A. Easy way One working example used a third party Mongo supplier such as 28msec.io and use URLFetch e.g. With this supplier you can both read from and write to the database using HTTP GET and simple query strings. ...


16

Maybe it is worth mentioning that webMathematica sites can be viewed without downloading and installing the 197 MB plugin. A lot of users (in companies, banks, institutions) just are not allowed to install anything at all and IT departments do not like big uncertified plugins. Furthermore a webMathematica page you can view on a any tablet or mobile phone. ...


14

Depending on the total size of the files, CDF may or may not be a good option. A file of a few MB is probably still ok, 10Mb or more is probably not. That said, this looks like a case for WebMathematica to me. It is fairly easy to set up, and looking at your description, you won't need an awful lot of interactivity (which, had you needed it, would be one ...


12

What you did with setting the "com.wolfram.jlink.libdir" property will work. Perhaps you didn't enter the correct path, or you used the wrong JLinkNativeLibrary.dll file (meaning you used the 32-bit one from JLink/SystemFiles/Libraries/Windows, instead of the 64-bit one from JLink/SystemFiles/Libraries/Windows-x86-64, or vice-versa). But you really shouldn'...


12

You cannot use CDF for this because you have textual import fields and these are not supported when you embed online. You will just get a big grey box. InputField cannot accept strings (non-numeric) for online CDFs unless you are Wolfram Research and can override it. (I'm guessing you don't want to pay many thousands for CDF Pro.) You also cannot import and ...


12

Mathematica can also connect to Neo4J via the REST API. Instructions for use on OS X: 1. Install Neo4j 2. start the webserver $ sudo apachectl start 3. start Neo4j (installation in usr/local/bin) $ neo4j start 4. Make sure all is working 127.0.0.1:7474 Examples: URLFetch["http://localhost:7474/db/data/node", {"StatusCode", "Content"}, "Method"...


9

For MongoDB instead of using the Rest interface using urls as suggested by Mike, you can use the Java driver. Here's the proof of concept that should allow a lot of fruitful things ... I'm still amazed by the possibilities offered by JLink. Prerequisites Install MongoDB, for example on Windows http://docs.mongodb.org/manual/tutorial/install-mongodb-on-...


8

The different HTML entities are stored in System`Convert`MLStringDataDump`$HTMLEntities on version 9 and from here, it's a simple StringReplace: StringReplace["<select></select>", System`Convert`MLStringDataDump`$HTMLEntities] (* "&lt;select&gt;&lt;/select&gt;" *)


8

I just made my MongoDB Mathematica driver open-source here: https://github.com/zbjornson/MongoDBLink. There are quick setup instructions and an overview in the readme. It's built on the official Java driver, like @faysou's answer, but it's optimized to reduce the JLink overhead when serializing/deserializing many documents. It also transparently maps some ...


7

Here is one example of how to create a neo4j connection using JDBC driver from this git. The steeps are: 1- Put the JAR file (neo4j-jdbc-2.0.1-SNAPSHOT-jar-with-dependencies.jar) together with other jar drivers in: FileNameJoin@{ $InstallationDirectory, "Contents/SystemFiles/Links/DatabaseLink/Java"} 2- Restart you Mathematica 3- Now, using Movie Graph ...


7

Inspired by @eldo's ContourLabels, a variation that gives color-coded points for labels: ListContourPlot[RandomReal[1, {10, 10}], InterpolationOrder -> 3, PlotLegends -> Automatic, Contours -> 10, ContourLabels -> (Tooltip[Graphics[{PointSize[.02], Hue[#3], Point[{#, #2}]}][[1]], Column[{Row@{"{x, y} = {", #, " , ", #2, "}"}, Row@{"z = ", #...


6

Trigger an external event Edit Don't you dare to close this question! :) I've to say, that for the Java/MathPackage part of this answer I've used Workbench plugin within eclipse/Juno and again I've to agree with @halirutan that this is not a time saver at all. It took me more time to configure this etc. than to write the code. I am already a user of the ...


6

From Oleksandr's comment: This usage is not permitted by the Mathematica license: you need webMathematica, even if technically you don't. Practically speaking, it's not possible with no extra software at all since Mathematica has no facilities to work with TCP sockets, but you can use Java, a .Net language, or C to fill in the gaps. The ...


6

You probably shouldn't put that package into the $InstallationDirectory, there are $BaseDirectory for system wide installations of packages and $UserBaseDirectory for user specific installations (As Alexey Popkov has indicated these did supersed $AddOnsDirectory and $UserAddOnsDirectory of earlier versions. These still exist for compatibility, but probably ...


6

Something like: ExportString[Cell[TextData["<select></select>"],"Text"],"HTML","FullDocument" -> False] produces: <p class="Text"> &lt;select&gt;&lt;/select&gt; </p> which might also be a good start.


6

After @Hans comment, get much more clear how to do it in webMathematica. It could't be simpler. IMO, the best way to see how it works, after install webMathematica, is going into: tomcatDirectory\webapps\webMathematica\Examples\AJAX. Let's see for example the ReturnDate.jsp file: <msp:evaluate> If[ $$fullDate === "true", DateString[], ...


5

Since it appears that you wish to use live input for your Timeline, webMathematica will be the best solution. CDF cannot accept anything but input from what is in the file itself. Documentation can be found here: http://www.wolfram.com/products/webmathematica/ User Guide is located here: http://reference.wolfram.com/mathematica/webMathematica/tutorial/...


5

In this case, I assume you want both, dynamic interactivity and pull large datasets from a database in real time. This can be done with a CDF notebook, and it doesn't require WebMathematica unless your notebook really needs to do much more computationally intensive work than your example code indicates. So here are the steps: Server Save your dynamic ...


5

"Any engine compatible with Servlet 2.4 or later, such as Apache Tomcat" http://www.wolfram.com/products/webmathematica/technology/?tab=Specifications I really don't know much about Geronimo, but it seems to support servlet 2.5 (via Tomcat.)


5

You can read the documentation of PlotStyle under Details. Using Thickness, Dashing and RGBColor or Hue may help. Here for 80 distinctive styles. Block[ { styles = Flatten[ Table[ {Hue[h], Thickness[t], Dashing[{d1, d2, d3}]} , {h, 0, 0.9, 0.2} , {t, {0.001, 0.003}} , {d1, {0.01, 0.02}} , {d2, {0.005, 0.02}} , {d3, {0....


5

Is this what you had in mind? data = {{1, 1, 1, 1}, {1, 2, 1, 2}, {1, 1, 3, 1}, {1, 2, 1, 4}}; ticks = {#, ToString[# t]} & /@ Range[4] ListDensityPlot[data, Frame -> True, FrameLabel -> {"a", "b"}, FrameTicks -> {ticks, ticks}]


5

I believe this is a duplicate. I just note that Grad can provide all the partial derivatives in one step. I just post this not to encourage all multiple rule lists but to limit typing: rep = {{x -> 1, y -> 3, z -> 0}, {x -> 0, y -> 1, z -> 2}, {x -> 0, y -> 0, z -> 6}, {x -> 7, y -> 6, z -> 8}, {x -> 7, y -&...


4

In webMathematica there is already MSPGetMessage[] So if you do something like mess = MSPGetMessages[]; you have a list of messages. E.g., if you had an error for 1/0 "1\nPower::infy: Infinite expression - encountered.\n 0" Notice that $MessageList gives just {HoldForm[Power::infy]}


4

data = Table[ Sin[i + j^2], {i, 0, 3, 0.1}, {j, 0, 3, 0.1}]; ListContourPlot[data, Epilog -> {PointSize[Large], Red, Point[{{5, 15}, {10, 5}}]}]


4

Framed[ContourPlot[Sin[x y], {x, 0, 2}, {y, 0, 2}, Contours -> Join[Range[0, 0.9, 0.1], Range[0.91, 1, 0.01]], Frame -> {{True, False}, {True, False}}, ColorFunction -> "Pastel", ContourStyle -> Join[Table[Directive[Brown, Thick], {10}], Table[Directive[Dashed, Thin], {9}]], ContourLabels -> Function[{x, y, z}, Text[Framed[z], {x,...


4

You could try using f[x_, y_, z_] := x^3 + y*z + z^2*x Derivative[1, 0, 0][f][x, y, z] %/.{x->1,y->3,z->0} Derivative[0, 1, 0][f][x, y, z] Derivative[0, 0, 1][f][x, y, z]


4

I suppose this is what you need. So the first thing is to use Module since With injects values into held expressions. Moreover PrePrint is probably to late to catch "5+7". So I'd go with $Pre: $Pre = Function[expr, Module[ {expr$ = ToString[Unevaluated[expr], InputForm]}, MSPToExpression[expr$] ], HoldAllComplete ]


3

Put a 2 in MSPConfiguration.xml like explained here <KernelNumber> 2 </KernelNumber> and then your kernels are used efficiently in that sense that if one kernel is busy serving one request, then another one is available if another request happens at the same time the first kernel is still running.



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