# Tag Info

20

I've implemented a java program using the JavaMail API to only fetch unread emails from a particular user (and mark it as read). This will allow you to periodically get emails from your ship traffic service. This is inspired by this blog post on Stephen Wolfram's email analytics. 1. Java code to fetch unread email from a sender Below is the java code, ...

18

Here are a few pointers. For question 1 you can find information, for example here and here. There are some user stories on that page. Other companies/products in that area (and there are many more) are for example UnRisk or RapidBusinessModeling. Concerning point 2, yes unit testing is available via Wolfram Workbench UnitTesting. In fact most of ...

15

To call Mathematica from Clojure, you will want to use Clojure's Java interop to access the Wolfram JLink classes to script Mathematica access. Start by launching Clojure with a classpath that includes the JLink.jar, for example with this batch file: @echo off set MATHEMATICA=C:/M/9.0 set JLINKJAR=%MATHEMATICA%/SystemFiles/Links/JLink/JLink.jar java -cp ...

14

Note that ListContourPlot3D takes the coordinates to be the position indices by default. If you want to keep the coordinates used in generating the data, then you have to include it. data = Flatten[ Table[{x, y, z, x^2 + y^2 + z^2 + RandomReal[0.1]}, {x, -2, 2, 0.2}, {y, -2, 2, 0.2}, {z, -2, 2, 0.2}], 2]; plot = ListContourPlot3D[data, Contours ...

11

Here is a more general approach. It is based on the 2D method from here. It assumes the polyhedron is not self-intersecting but imposes no requirement of convexity or even connectedness, other than that it be closed and bounded. Strictly speaking, I think this will work for an unbounded polyhedron provided it contains no vertical ray. For ease of exposition ...

9

Preamble In fact, the relevant example can be found in the documentation, here, in the "Sample program" section. To make this useful also for folks who don't have experience with Java development in WorkBench, I will illustrate how this can be done from within Mathematica, by using the interactive Java reloader from this post. You will have to figure out ...

9

By default the frontend will automatically launch the kernel; this is just a preference setting for the default 'Local' kernel. It's on by default since at one point or another, a user is likely going to want to start a kernel to do computations with Mathematica, and even if not, there are many services in the frontend which require the kernel (even the ...

9

Here is a fast method that will "often" work. Roughly, it requires that the convex polygon have no sharp angles between faces. Preprocessing goes as follows. Create triangles from the polygons. So a 5-gon with vertices {a,b,c,d,e} would become the set of triangles {{a,b,c},{a,c,d},{a,d,e}}. For each vertex we average it's star (set of points connected by ...

8

We can start by creating the parts using the same code as the question: partSource = JavaNew[ "org.apache.commons.httpclient.methods.multipart.ByteArrayPartSource", "mmagraphics.png", MakeJavaObject["abcdefg"]@toCharArray[]]; part1 = JavaNew[ "org.apache.commons.httpclient.methods.multipart.FilePart", "filename", partSource]; ...

8

As far as I know, JLink is used at least in PacletManager, for operations like loading data on demand etc. The documentation system also uses Java. Perhaps, other uses as well. I don't think that Java is used a lot for the core language though. This code can make it a bit more quantitative: allNames = Flatten[Names[#<>"*"]&/@Contexts[]]; ...

8

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 ...

7

A few ideas: If it's a package that is to be used regularly, I'd put it in one of the standard locations where M searches for packages, such as e.g. $UserBaseDirectory/Applications. SetDirectory doesn't affect the search locations for packages. SetDirectory sets what's called the "working directory", while Get searches only those locations which are ... 7 I also encountered this problem. Not an authoritative answer, but here is one blind guess to what is happening. JLink has its own classloader, JLinkClassLoader.java, which calls another one, JLinkClassLoaderHelper.java. The latter is a sub-class of URLClassLoader.java. Both are used in the class JLinkSystemClassLoader.java. The second part of this story is ... 7 For your first question you can look at the customer stories in finance and analytics. You might also be interested in the recordings from the Wolfram Finance Platform virtual workshop. 6 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 you need. You can remove the rest of the files. Here is a minimal demo. Needs["JLink"] ReinstallJava[ClassPath -> "/full/path/to/jar/file/gs-core-1.1.2.jar"] g = ... 6 I did not try it yet, but Clojuratica may be what you need. The project seems to no longer be maintained though (although I may be wrong). No idea how much of a problem this is, given changes in the Clojure since the time Clojuratica was released. Of course, Seth's talk was also great and is a great resource as well, as Joel mentioned. 6 The question is a little broad. In my shop, we routinely use Mathematica for risk analysis and portfolio reporting, also for hypothesis testing and a variety of other front-office tasks. We have a master library of functions that we have created for these purposes over the last six years or so, and we also created the MathematicaLinkToBloomberg package that ... 5 If you'll accept solutions involving other technologies, then how about using sed? On a unix system, to read in file1, delete row n and output to file2, you'd do: sed -e 'nd' file1 > file2 The quotes in 'nd' are not necessary in this case, since there is only one instruction. However, if you're doing more complicated stuff with regular expressions, you ... 5 Comment I've placed a Notebook version of this post on my webspace here: http://facstaff.unca.edu/mcmcclur/polylineDecoder.zip The Notebook is actually contained in a ZIP file that also contains all the Java class files necessary to get this code to work. The Notebook sets the Java class relative to it's own directory using ... 5 MUnit will absolutely work for testing Mathematica code in J/Link projects. The J/Link project does indeed setup some paths and things, and you should be able to go ahead and write MUnit tests that use Mathematica code that calls Java without any trouble. When I setup your project as you stated here, and then right click on the test and either run or debug ... 5 You don't need JLink for this, because MINE program (Java version) seems to not be able to transmit the results by any data transfer protocol. Rather, you launch it from the command line, as a Java executable (jar file). It takes the name of the input data file as one of the command line parameters, and it writes its output into another file. I will ... 4 Enumeration value names are accessible using LoadJavaClass to load the enum class. However, this particular case is complicated by the fact that the enum class Form is an inner member of the class Normalizer. To load it, we must reference Form by its so-called binary name: LoadJavaClass["java.text.Normalizer$Form"]; Now we can reference the enum values ...

4

First off, this is really just a warning, not an error. The package will still function normally because at run time the J/Link classes will be found. Workbench is just warning you that it cannot find them at development time. You can avoid this problem if you check the "Add JLink.jar to the classpath" box when creating a new JLink project (I don't know why ...

4

MUnit testing is surely supported on JLink projects (I used it in JLink projects which also contained Java classes, without problems). In fact, MUnit is all about Mathematica, so you just follow the usual procedure. I actually never bothered to create configurations etc. I just took your code, created a J/Link project, and run the unit test file as Run As ...

4

If anyone has an hour or two to spend on this, here is a starting point. Actually having had a look at the python script MINE.py I think it probably wouldn't be too much work (but still more than I'm willing to invest now)... Needs["JLink`"]; AddToClassPath["C:\\Temp\\MIME\\MINE.jar"]; analyzeClass = LoadJavaClass["main.Analyze"] Methods[analyzeClass] ...

3

you can try to add the dll to your path list. Window->Preferences->Java->Installed JREs. Then choose your current JRE(JDK) or the one you are using and click Edit. Fill Default VM Arguments: -Djava.library.path="the pathhhh of dll" or Under Linux set LD_LIBRARY_PATH. Under Windows set PATH.

3

Once setup you should be able to do all of what you want from Mathematica without resorting to shell scripts. This isn't Apple specific, but hopefully this will get you most of the way and uses the Remote Kernel method rather than the lightweight grid manager: Create an ssh key if you haven't already, using ssh-keygen Copy that key to all the remote hosts ...

3

I recommend you check if the licensing terms even allow you to do that. Last time I checked (and my knowledge on this is a bit outdated), it was not permitted to use M in a web/network environment. If you do, the webM license immediately applies. You are basically trying to implement a feature that is substantially similar to a core feature of webM: slave ...

3

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 ...

2

What I suspect is happening is that your flavor of Linux either lacks certain libraries which we considered standard, or has versions of those libraries which are in conflict with some of the ones we ship with the internal R distribution. Unfortunately, it is not easy to diagnose exactly which libraries are problematic, but I will try to follow up on this. ...

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