Sharing or Sending complex Data to Coldfusion From Java - java

I am writing JavaClass which reads Excel files and it creates a Collection object.
What will be the best possible options to pass a Structure from Java to Coldfusion?

Have the java class return a java.util.Map. CF will automatically convert it to a structure which can be used with any of the CF structure functions.
That said, Craig makes a good point. If you are using CF9 or Railo, both have spreadsheet functions available. You might want to investigate using those rather than rolling your own.

Related

Spark Model to use in Java Application

For analysis.
I know we can use the Save function and load the Model in Spark application. But it works only in Spark application (Java, Scala, Python).
We can also use the PMML and export the model to other type of application.
Is there any way to use a Spark model in a Java application?
I am one of the creators of MLeap. Check us out, it is meant for exactly your use case. If there is a transformer you need that is not currently supported, get in touch with me and we will get it in there.
Our serialization format is solely JSON/Protobuf right now, so it is very portable and supports large models like RandomForest. You can serialize your model to a zip file then load it up wherever.
Take a look at our demo to get a use case:
https://github.com/TrueCar/mleap-demo
Currently no, your options are to use PMML for those models that support it, or write your own framework for using models outside of Spark.
There is movement towards enabling this (see this issue). You could also check out Mleap.

Expectation-Maximization in Weka for custom objects

I'm planning to use the Java Weka library's EM algorithm in order to assign probabilities to objects to be in a certain cluster and then, work with these probabilities.
Furthermore, the properties of those objects will be loaded from a database, so I would like to load them into the clusterer directly from memory, instead of dumping them to an arff file as in the examples I have found around the web (e.g. Serialization).
Firstly, I would like to know if the Weka library is the proper one for my purpose of there exists another one such as Apache Commons Math.
Secondly, is there any example which does not manage any file in order to create Instances?
I would be grateful for any help.

How do I export/import a java object(JList) to/from a java program?

I am writing a java program and I would like for it to at startup make a JList(of strings) from a pre-made file(text file?) and then do changes here and there during the program and then re-save it at the end to be accessed again later.
I am new to java and it seems like there are many ways to read and write files and I don't known which way is best.
Is there a general way to save java objects to files that I can re-use later on, maybe with strings?
http://www.javapractices.com/topic/TopicAction.do?Id=42
http://www.java-samples.com/showtutorial.php?tutorialid=330
http://www.caveofprogramming.com/java/java-file-reading-and-writing-files-in-java/
This link provides you different types of reading and writing text files
And there is no general way to write an object to a file, as the object can have any structure. So we have to write the implementation for the way a file is written in java.

Simple Filesystem/Database Abstraction in Java?

Basically, I am looking for a simple way to list and access a set of strings in stream form in an abstract manner. The only issue is that Java's file-accessing API can only be used for listing and reading files, and any sort of non-filesystem storage of the data uses a different API. My question is whether there is some common API I could use (whether included in Java or as an external API) so that I could access both in an abstract manner, but also somewhat efficiently.
Essentially I want a set of lazily streamed text files. Something like Set might be reasonable, except on a filesystem, you would have to open the text streams even if you don't end up wanting to access that file.
Some sort of api like
String[] TextStorage.list()
InputStream TextStorage.open(String elementname);
which could abstractly be used to access either filesystems or databases, or some other storage mechanism I invent in the future (maybe fetching something across the internet).
Is there a library which already does this? Can I do this with the already existing Java API? Do I need to write this myself? I'd be surprised if no-one has encountered this problem before, but my google-fu and stackoverflow searches don't seem to find anything.
you might use HSQL
http://hsqldb.org/

VBA/excel to dll/exe for Java

I have an Excel file with manual input functions, which use an add-in from a third party. I want to use the functionality of the Excel file in Java. I could think of two ways of doing it:
code the functions in VBA, or VB with Excel reference, then generate .dll or .exe files for Java to use.
Feed data to an Excel file using jxl (would Excel file update automatically when it receives new data?), then read the new result every time from the Excel file.
I don't have much experience with Excel or VBA. I want to know which method is more doable and faster.
As your code is invoking a third-party add-in and is needs that for correct operation, then you will need to go the VB route or access Excel via the Automaton API (from Java, using for example, Com4j).
The reason is that the pure-java excel readers (jxl, Poi, xlSQL etc..) all use java to emulate the built in functionality of excel, but of cousre they cannot emulate third party add-ons.
Reading excel files using com4j is discussed in this thread.
Obba allows you to make calls from an Excel cell to a Java virtual machine (which may run on a different computer, if necessary). The JVM has to run Obba server (provided as a Java with main() method). The Obba server can load other JARs an instantiate objects via functional calls form the Excel sheet.
You could also use Obba to pass values, results to a Java code (or server).
(You may contact me, if you are interested in exploring this and need assistance (I work on Obba).

Categories