Client Server Application with SigmaJS in Java - java

I want to make a client/server application with SigmaJS in Java. I make the server file which create the JSON file. Do you known how can I "call" SigmaJS application with the JSON file to create the graph?

Have you take a look at this example : https://github.com/jacomyal/sigma.js/blob/master/examples/load-external-json.html ?

Related

reading logs and displaying them on a web browser using Java

I have logs in folder /home/a/b (located in a remote server)
I want to display logs in my web browser using Java. To get data in the folder /home/a/b and to display them on my web page, what are some methods(API) I can use?
The simplest approach I can imagine is using a SSH API like JSch,
but I don't know how performatic this is.
Anyway, here goes a good example:
https://stackoverflow.com/a/9019095/7528396
Note that you can read the remote file and render line by line.

IOS Application Fetch data fro MySql Database

I'm practicing some IOS coding in Swift 2 which consists in an app fetching information from a MySQL database.
However, I'm confused in the concept. So currently my idea of how to accomplish this is that somehow the IOS App connects to the Apache Tomcat. To be able to do this, I though about creating a Java application that connects to the MySql using JNDI. With this I fetch the data and store it in a JSON object.
However this is where I get stuck. Should I return this object to the IOS application or store it in a text file or JSON file and have the IOS application read it from there?
If I had to return the object, how can I do this? I've looked around but most examples are fetching information from an API and currently I want to do it locally.
The easiest way is to create a PHP file to connect and retrieve data from MySQL, and then you call this file by swift.
You will find a useful information in the following link :
How to make an HTTP request in Swift?

Java http server and web folder

does anyone know how to create HTTP server in Java, but set default folder for web and than load files from it? I want to use com.sun.net.httpserver class.
For example, I have folder named abc next to my java file. The java file runs HTTP server under port 8080. And if I open address http://123.123.123.123:8080/ I want to see list of files from folder abc. In folder abc are some files, eg. image.jpg. So I want to open in my browser address to image file, like http://123.123.123.123:8080/image.jpg. This way I can open all other files from folder abc (also subfolders, files in subfolders etc.).
Is it possible to create this HTTP server?
Would it be somehow possible to run PHP files in the folder?
Thank you very much for your answers.
Why not using embedded Jetty? I am pretty sure that with it you can accomplish what you are looking for.
If you want to execute PHP from within Jetty, refer to http://docs.codehaus.org/display/JETTY/Jetty+and+PHP
Once you have created your server object, you need to register some handlers for the path you want the user to use to fetch documents.
HttpServer server = HttpServer.create(new InetSocketAddress("localhost",8080));
HttpHandler myDocsHandler = new MyDocsHandler();
server.createContext("/abc", myDocsHandler);
There are no built in default handlers, so you will need to write the MyDocsHandler class that implements the HttpHandler interface to handle any requests coming into your server at http://localhost:8080/abc.
The handler requires a single handle method that takes an HttpExchange argument that gives access to the request data and the response stream. It is your responsibility at this point to do what needs doing. So if you wanted the actual files to be located on your hard driver at /usr/local/abc your handler would need to open the requested file using standard file io and stream it back to the user.

What is the best way to send data from Java to PHP?

I want to access a MySQL database from Java, but remote connection is disabled by the host.
So I will send the data to PHP and then PHP will locally access the database.
The data is pretty big (about 2~4kb)
I've never done this before.
What should I do?
Probably the best way would be to write a web service in PHP that you call from Java.
Another somewhat easier way would be to use the HttpURLConnection class to simply do a POST of the data to the PHP page.
If the PHP page is publicly accessible, you'd want to make sure you have some kind of authentication mechanism in place and use HTTPS as well.
Http web-services
Sounds like your only option is to create a Web Service. You can use Apache's HttpClient in Java to create requests and have your PHP return a response that you can easily parse. Depending on what you are trying to do, an XML response might be overkill. I've used JSON in the past if I know exactly what I am getting back.
I assume the Java program will be the client. I think the simplest would be to just create a simple PHP page, POST any possible parameters to that page from Java, and return the data as a JSON structure.
There are a number of JSON tools for Java and PHP listed on JSON page: http://json.org/
You might want to have a look to Thrift:
http://incubator.apache.org/thrift/
Are you saying that you are going to run java from php, so that php has the handle to the mysql database and you will pass the data to java?
check out java php bridge

Java + MS Exchange: how to retrieve .msg files

I've created a Java program with which I can retrieve mail from an Exchange mailserver. Problem is: the mail is in EML format and I need the MSG format!
Right now I'm retrieving mail through the web access part of Exchange, using the Apache Slide project... is it possible at all to use java to retrieve msg files from an Exchange server?
I've seen examples of C# code, .NET code etc.. isn't it possible somehow to integrate these pieces of code with Java so I can use it to retrieve mail?
Greets,
Cesar
I've done this in Java using Dmitry's RDO library, which is a sub-part of his Outlook Redemption library. See http://www.dimastr.com/redemption/rdo/default.htm. The library builds on top of MAPI. You will need a COM library for this also for which I've used JACOB (Java COM Bridge). See http://sourceforge.net/projects/jacob-project/

Categories

Resources