My goal is to send data from a PC to a Viewing Station (running Linux, on the same network) so that the user at the Viewing Station (VS) can view a graph of the data. I am not allowed to install any applications on the Viewing Station but it does have a browser (something like Firefox or Chrome).
The only way I could think of doing this is to create a java applet which is opened in the browser (on the viewing station), which reads data from the IP address/ port on the viewing station.
Is this possible? How can I go about doing this? Thanks
edit: I cannot send the data to be graphed, outside of the local network. The data is sent from the PC to a local IP address where the viewing station is located.
Scenario:
PC starts sending data to be graphed, to a fixed IP address (where the viewing station is located).
User opens up a browser in the viewing station and opens something that shows the graph. The graph should contain the data received from a predefined port/IP address.
New values are added every 240ms.
edit2: We have shelved this feature for now so I am unable to try any of the mentioned solutions. Thanks for the input though
If a server-side solution is not practical, I'd look to implement simple graphs using JS and the HTML 5 canvas. For more complex graphs, find a JS API.
If a server-side solution is practical, use JFreeChart (or JCharts etc.) to produce an image on the server-side, then provide that image to the client.
Although browsers may be installed on the client, it does not necessarily mean that Java is installed & enabled in those browsers.
Use JCharts. It allows you to make graphs and charts and display them via servlet, applet, or standalone UI. Code it up into some servlets on your server side and then you can view them on the client browsers.
The main problem with your plan is that you cannot 'push' data to your viewer unless there is a service there to accept it. If you cannot install such a service, your options are limited.
1: Map a network drive. The 'producer' dumps the data here, and the 'viewer' can read it. It is unlikely given your restrictions that you will be allowed to do this.
2: Use any of the graph libraries suggested by others and configure your webserver to restrict access to a whitelist of hosts. Your 'producer' runs a webserver which will only serve pages to a specific IP or subnet, your 'consumer' connects to said webserver. See here or here for setting up a webserver which only allows access from a specific IP.
Related
I have a native (installable) Java program that constantly generates certain data (only numbers and text). I want to send that data to the browser. I am looking for something similar to node.js with socket.io
I want to send data (text and numbers only) from java stand alone application running on the client's PC to the client's browser and display this data as a standard website (HTML CSS and JS).
Take a look at this image. How would you approach this problem?
Take a look at this image as well.
So
1 - Everything work on the PC
2 - principal concept: if you choose to use a browser, the control comes from the user + browser (which can choose to retrieve data, push buttons, etc.). Nothing outside can decide to send data to a browser if it didnt ask it. Function of a browser is to browse.
one solution:
you production app build the data and put it in some file, it can format it in HTML : format option 1 (or raw data : format option 2)
the data produces can be put on a local file (store option 1), or to be used by a web server (store option 2), even with the same file.
store option 1: just use your brower to browse your directories:
something like that: file:///C:/truc.html
store option 2: you need a local web server:
instal some (heavy for each PC): tomcat, or glassfish
it can deliver static page for format option 1 (same result as store option 1)
or it can proces with a java/jsp program which retrieve raw data and show it as html (format option 2)
You dont need sockets, or network functions.
In your schema: the background process:
can work with the webserver (or event read or change some datas in the database).
dont have to talk with the browser. The browser needs only to talk with the server, which works with your background process.
your background process can be hosted in the server. It can be scheduled by quartz on glassfish (tomcat, or other web servers). In this design, you finally only need a browser and a client.
I have created database in one application and that application is installed in multiple devices.My requirement is that if i change the value in database of one device then,that changes in database should reflect in another device of same application.I need it without server/third api.
Thanks in advance...
This is precisely when one does need a sever.
Stop and consider what it is that you are asking for. You need a way for a phone to notify all other phones that hold the same application about a change. Phones are not directly addressable to each other via the web, which makes any kind of peer to peer algorithm tricky. SMS texts is the closest form of direct addressing that phones do support, thus it could be used to build a peer to peer protocol, but that would be tricky, unreliable and is unlikely to be beneficial.
A server on the other hand is the standard approach to solving this problem, the server acts as a shared agent that all phones that connect to the web can address easily. Even if the server is just an FTP server on a freebie hosting site.
You need to implement a server functionality in your android application.
What is a server : A server is a running instance of an application (software) capable of accepting requests from the client and giving responses accordingly. Servers can run on any computer including dedicated computers, which individually are also often referred to as "the server".
For further information,I would like to provide this link which will clarify you about communication between two devices Android - communicating between two devices (Use of bluetooth etc.)
I am trying to develop a Spring MVC based web application with following requirements.
User will swipe his/her magnetic strip or chip card on a card swiping machine.
The machine will read card information on card and will transport the same to my web application.
My questions are.
Is it possible to transport information from swipe machine on internet (Obviously the machine is connected to internet)
How do I configure the swipe machine to so it would transport information to my web application (should I expose a rest web service).
How do I decode the data which is transported by swipe machine in my Spring controller or web service
Thanks you very much for any help
Anant
Reading a mag strip (there are 3 of them in a card) is a simple job and you can rely on the driver that comes with the machine, or if you feel adventurous, break out the RxTx java library.
It is basically a bunch of letters and numbers - check wikipedia for the format of the CRC - but back to your questions:
Yes. Done that. Pretty simple. The machine has configurations that allow it to dial up or open a secure connection with a server.
Which number it will dial up or which service it will call is all configurable. Merchant will require you to provide your own machine and won't let you touch their existing machines.
Decoding is simple. The swiper comes with a driver and you can use it. However, if you have your own machine (which you will need) then decoding is not needed. The swiper will either call a server at the merchant (the case for restaurants or supermarkets) or it will open an HTTPS connection with the server and send all the data that it is in the card. Your server will get the data in plain text, so no need to read it manually.
Is it possible to transport information from swipe machine on internet (Obviously the machine is connected to internet)
The machine has to have output somewhere, where it does send data when doing something.
How do I configure the swipe machine to so it would transport information to my web application (should I expose a rest web service).
In documentation for machine, there should be info about what does it send and how. Everything else depends on this.
How do I decode the data which is transported by swipe machine in my Spring controller or web service
Same answer as for previous question.
I am posting this in order to confirm if it is possible for PHP to get a user's machine hardware information when connected to a website?
In my case I am developing an Intranet which requires one user - one machine login. Which means a user assigned to his/ her machine can only login, others cannot login from that particular machine. In this regard, my database and PHP Code is already up and running without machine dependency.
I presume it is not possible because PHP is a Server Side code which requires none of the User's system resources to get in touch with. To get system's hardware information - some application must be installed in user's machine to get it done. But is this possible in any regard for example a PHP Desktop application (though not in development) or any Java application to check machine's information and get appended it to Normal user's login.
Awaiting experts solutions...
It depends what information you need. The HTTP Headers contain the user agent (what browers/OS) of the origin, the IP address and a few other things that the server needs in order to process the request, but you can't get for instance the brand of keyboard connected to that machine.
Simple: IMPOSSIBLE! As php will output text to a browser and the browser can gather some data, but only a little (like screen resolution, colors, IP and things that are not vurnelable.). But no, PHP cannot access hardware information.
You can use the IP address to know which machine it is only if your DHCP does not change the IP at each deconnexion.
You can also use the REMOTE_USER_AGENT super global to know more informations. Apart from an ajax request that can send datas that your security policy allows the browser to get, I see no solution for your problem.
I wanted to code a web application, where one user can choose a file and other multiple users can download that specified file off of that user's computer. That user would have to leave his computer on and leave the web page open.
I dont want to have a big main server that has to handle all that traffic. That user's computer is the server, persay. I understand I'll use torrent.
All this has to be done on a website.
Will a web socket work?
Please and Thanks.
This really isn't possible for a variety of reasons:
Firewalls / NATs
Dynamic IPs
No "server" running on the user's machines
Permissions on the user's machine
What happens if the user simply deletes the file on their machine?
To actually make it work you'd have to:
Convince the user to install the app on their machine (you'd need a windows/linux/... EXE)
Get the user to open a port in the firewall (or use some library to enable NAT passthru)
Have the user's PC ping your server in the event the user's IP changes
On the server side, you'd have to keep several database tables, here are few I can think of off the top of my head:
A user's table (user ID [PK], Current IP, Communications Port, (maybe some other tracking things))
Available downloads table (download ID [PK], user ID [FK])
Then when someone wants to go off and download, you have to (probably) launch your app with the requisite arguments (remote user's IP/port/file ID) and have that do the work of the download.
This is by no means an easy feat.
If by WebSockets you mean the HTML5 variety, I'd stay away from that. http://en.wikipedia.org/wiki/WebSockets#Browser_support
The the computer that has to stay on, is basically your server. Even if it isn't a big server somewhere.
My suggestion would be to install apache or some other small web server on each users computer and have have a dyndns address for each computer so you can find each other. it would be much easier than coding something. especially if it has to be through a web page.
You could use a c# client library to interface to bittorrent or etc and use this mode to upload/leach. As far as NAT/Firewall issues go they are well documented and a function of the protocol being used, ie deal with it.