Computing question: Java or something else?

New Topic
This topic has been archived, and won't accept reply postings.
 MG 26 Jul 2012
Computing question

I have a application I have written in Matlab that takes input interactively from users and plots some graphs. I want to turn this into a webpage that does the same thing. I will need to learn some new programming language to do this it appears and as I far as I can see Java is the obvious choice.

1) Does this sound correct?
2) Am I right in thinking this means my webpage won't work on Android and mobile Apple devices?
3) Is there a better choice that avoids the problem of 2)?
 ajsteele 26 Jul 2012
In reply to MG:

Python might work, it can be used for most things and is simple to learn. It definitely works on webpages, wouldn't have a problem with android or apple devices and getting user input and displaying it as a graph should be pretty simple.
 Paul Robertson 26 Jul 2012
In reply to MG:
1) Java is one of quite a few choices
2) Native apps for Android are written in Java. iPad and iPhone apps are written in something else (Objective C)
Simple web pages should work on any device with a browser
3) You should look at Python, or you could look at writing some PHP code to do the work on the web server. There is a graphics library (php-gd) available, which can draw graphs.
In reply to MG:

As ever in computing the answer is: it depends.

Are you proposing to do this in the browser or on the server?

Doing it in Browser your options are basically a Java applet or HTML5 canvas (depending on what you you want to do SVG might also be an option). Javascript is what you need for these latter two.

Server side would depend on what your hosting is based on - is it Windows hosting or Linux? ASP or PHP respectfully with user input/display update done via AJAX.

For something like this I'd go the server side/AJAX route - let the server do the heavy lifting and simply return an array of data for the AJAX callback to turn in to a graph. AJAX just means that you are only redrawing the graph each time not the whole page.

Note that it's Flash that won't work on Apple mobile devices, as far as I know Java applets will still work.

ALC
OP MG 26 Jul 2012
In reply to a lakeland climber:

> Note that it's Flash that won't work on Apple mobile devices, as far as I know Java applets will still work.


Thanks for the advice so far. It's things like this

http://www.makeuseof.com/answers/access-javabased-website-android-phone/


that make wonder if Java works on Android. Can anyone clarify?
 EeeByGum 26 Jul 2012
In reply to MG: By and large there are two sides to web development. You can do stuff server side which allows you to do a load of fancy things in the background whilst spoon-feeding HTML to the browser. Languages in this domain are things like PHP (nightmare), ASP and ASP.net (which uses Visual Basic, C# and more besides).

The other way is to do it client side using Javascript (not Java) which is certainly the simplest way to get into things because it does not require infrastructure. That said, different browsers interpret Javascript differently and some of the mobile browsers may be a bit lacking in this department.

Good luck!
 Milesy 26 Jul 2012
In reply to MG:
> I have a application I have written in Matlab that takes input interactively from users and plots some graphs. I want to turn this into a webpage that does the same thing. I will need to learn some new programming language to do this it appears and as I far as I can see Java is the obvious choice.

As a Java programmer I would do it as follows:

1. Take user input through an HTML form.
2. The form is submitted to the server back end (Running Java)
3a. Back end algorithm can be written in pure Java to accomplish the exact same as what the Matlab algorithm.
3b. Back end can fork of another process to communicate with Matlab
4. Render your graphs/plots a JPG images
5. Serve the images back to the user with whatever other info you require.

This would be platform independant and any browser whether that be PC based or phone based which has a browser would be able to use.
OP MG 26 Jul 2012
In reply to Milesy: Thanks.
In reply to MG:

You can embed an Excel spreadsheet with charts into a webpage if you store the spreadsheet on Skydrive. It's quick and easy to do, but I don't know about Android / Apple compatibility, and the spreadsheet needs to be shared publicly.

http://office.microsoft.com/en-us/excel/embed-an-excel-spreadsheet-on-a-web...
needvert 26 Jul 2012
In reply to MG:

I'd suggest Python, with all the work done server side.

Of course almost any language would do.
In reply to Turdus torquatus:

I think the OP's requirement is for multiple users to be able to manipulate their version of the original Matlab program and see the results. Having a single shared spreadsheet wouldn't fulfil that role as any one change would be propagated to other users.

To me, the proposed Java solution looks like "if you have a hammer then every problem looks like a nail". Step 4 is very bandwidth heavy for example - why return a few tens of bytes for the browser to deal with when you can send 200Kb?

ALC
OP MG 26 Jul 2012
Right, I am going to spend some time with Javascript and see what happens. If it doesn't work I'll blame you lot
 Milesy 26 Jul 2012
In reply to a lakeland climber:

A jpg with a very limited number of colours can be really small. Bandwidth issues are not as much as they used to be. Less an issue than needing a cross platform front end capable of rendering the data (say through a JSON response itself)
OP MG 26 Jul 2012
In reply to Milesy: Some the graphs are dynamic (e.g. each trace draws itself) so I think your solution would require a lot of jpgs to be transferred, which sounds like it might be a bit slow?
 Milesy 26 Jul 2012
How do you define dynamic? What causes a change in the graph? Is it something initiated by a change in user input? If so then how often does this happen? Unless you are talking about say down to the second or less than it is not really a massive bandwidth issue. If it is something which needs to redraw automatically.

New Topic
This topic has been archived, and won't accept reply postings.
Loading Notifications...