I wish to control my computer (and usb devices attached to the computer) at home with any computer that is connected to the internet. The computer at home must have a program installed that receives commands from any other computer that is connected to the internet. I thought it would be best if I do this with a web interface as it would not be necessary to install software on that computer. For obvious reasons it would require log in details.
Extra details: The main part of the project is actually a device that I will develop that connects to the computer's usb port. Sorry if it was a bit vague in my original question. This device will perform simple functions such as turning lights on etc. At first I will just attempt to switch the lights remotely using the internet. Later on I will add commands that can control certain aspects of the computer such as the music player. I think doing a full remote desktop connection to control my device is therefore not quite necessary. Does anybody know of any open source projects that can perform these functions?
So basically the problem is sending encrypted commands from a web interface to my computer at home. What would be the best method to achieve this and what programming languages should I use? I know Java, Python and C quite well, but have very little experience with web applications, such as Javascript and PHP.
I have looked at web chat examples as it is sort of similar concept to what I wish to achieve, except the text can be replaced with commands. Is this a viable solution or are there better alternatives?
Thank you
VNC
SSH
Remote Desktop (Windows)
You can write a WEB APPLICATION. The encryption part is solved by simple HTTPS usage. On the server side (your home computer with USB devices attached to it) you should use Python (since you're quite experienced with it) and a Python Web Framework you want (I.E. Django).
While it is an interesting programming question, perhaps you should ask it on ServerFault instead? There you can probably get a lot of nice input on web-based administration / control tools.
Unless this is a "for fun" project for you, there are about a jillion things out there that already do this. And if you want to control a computer from a web browser, be prepared to require installing some kind of custom plugin - since browsers can't touch arbitrary files on the local filesystem, execute local applications, or do other things that are flagrant security risks.
I've been using VNC for over a decade - free and easy.
http://en.wikipedia.org/wiki/Virtual_Network_Computing
Well, I think that java can work well, in fact you have to deal with system calls to manage usb devices and things like that (and as far as I know, PHP is not the best language to do this). Also shouldn't be so hard to create a basic server/client program, just use good encryption mechanism to not show commands around web.
I you are looking for solution you could use from any computer anywhere in the worls without the need to install any software on client pc, try logmein.com (http://secure.logmein.com).
It is free, reliable, works in any modern browser, you don't have to remmeber IPs and hope they won't change, ...
Or if this is a "for fun project" why not write a php script, open port 80 in your router so you can access you script from outside, possibly dynamically link some domain to your IP (http://www.dyndns.com/). In the script you would just login and then for example type the orders in textfield in some form in your script. Lets just say you want to do some command prompt stuf, so you will basically remotely construst a *.bat file for example. Then the script stores this a fromtheinternets.bat to a folder on your desktop that is being constantly monitored for changes. And when such a change is found you just activate the bat file.
Insecure? Yes (It could be made secureER)
Fun to write? Definitely
PS: I am new here, hope it's not "illegal" to post link to actual services, instead of wiki lists. This is by no means and advertisement, I am just a happy user. :)
Related
First of all, I am extremely new to coding and I just learned the basics of java. I want to do an android app as my first project. The idea of the app would be to have buttons on your phone which would work as keyboard macros. I was wondering if I also needed to create specific windows drivers for it or if I could just make it run on the default windows keyboard drivers? As I said I am super new to all of this (about 10hrs of programming experience), so feel free to correct me and educate me as much as you want! I won't take it personally, I'm looking to learn :)
You would need to set up some sort of communication between the app and your PC. You wouldn't need to do anything with the keyboard drivers. Java has something called the "Robot class" which allows you to simulate a keypress.
Here is the documentation on the robot class: https://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html
As for the communications, you will need to create a server/client connection. One of your devices will act as the client (probably your phone) and one will act as the server (probably your PC).
This is just a rough idea of how it would work but:
When you tap the button on your phone, it would send some specified data to your server that is running on your PC. You should set the data that gets sent from the client to the server as the key(s) keycode that you would like it to simulate so it will be easier to implement. When the server gets data from the client, it should send that data to the robot.keypress(data) function.
This honestly sounds like it will be a big project for your skill level but I wish you the best of luck on this. This will probably be a frustrating experience but don't let it get the better of you.
Now, I have some problems here:
I looked several times in Google and so on, but I can't find an "easy" way to get this done. And currently having a migraine... not helping me... though
I have a java eclipse program (Swing application to be a "controller" for production-machines).
I need to design an Android app, which needs to take data from the eclipse program in a wireless network (and also send them back).
Just found solutions like JPARSON or setting up a real server, but that is way too complicated... i donĀ“t need?! (or want :D ) to set up a whole website with php or something...
Can someone of you help me out with a better solution? It doesn't need to be code-specific, I just want to exchange like 10 strings for these machines.
If you want to exchange data you need a communication medium. The easiest way to do this is via TCP/IP protocol suite. If you decide on having a Server-Client architecture, your serwer has to listen for what phones have to say. He can do this by listening on specified port and you would have to handle "protocol", or you can use somewhat easier approach which is to write php script, or Java Servlet. PHP script is easier becaouse there is like a gazzilion php hosting providers and it's cheap. If you would like to write your own serwer, you wold need some sort of Virtual Private Server, and deploy your app there. Plus it would be helpfull if you explained a little more your environment and what you are trying to achive.
There's built in httpserver http://docs.oracle.com/javase/6/docs/jre/api/net/httpserver/spec/index.html so you can easily implement a simple webservice in standalone java. Then just use URLConnection from android to post/get data, probably in json or your own format.
I'm trying to figure out if it's possible to access a Midi device (like a piano/keyboard or electronic drum set) that is plugged into to a clients USB port over the web.
Obviously the browser security model makes this impossible using just javascript and while it looks like the emerging html5 device standard might help in the future it's apparently not there yet.
So what about flash, silverlight or java? The closest I've found is that silverlight seems to be able to do it if the app is trusted, but that's not a very easy thing to convince a user to do.
Any options?
Yes, this is possible, at least in Windows and MacOS.
I'm not sure how to post a link here, but you can google for "Jazz-Plugin"
The only practical way (that I know of) to achieve this using Silverlight, is platform invocation. This requires Silverlight 5 and the app to run in full trust mode, which makes sense because the app can do pretty much anything with P/Invoke. If a web app allows the developers to access information on a client's computer, then there will have to be some warning or user sign-off (like Silverlight's full trust).
I'm thinking about making a physical controller (device?) with knobs, buttons, and LEDs. I'd like to interact with it using Java (respond to the knobs, light up LEDs, etc). The reason I mention Java is two-fold: first, I know Java well1. Second, I've written the rest of the program I need to interface with in Java (though there are ways to talk to the Java program from another language).
I would like the device to connect via USB and be (computer-)platform independent.
I haven't the slightest idea of where to start, except to start reading the Arduino website. Is this my best/only option? Is there something better suited for communicating with Java?
Note: I know that Arduino has something to do with Java (not sure what), but it seems like code must be written in a subset of C.
How would I get moving on this topic?
1 - No laughter, please.
The Arduino development environment is written in Java.
But the standard language you write a program for the Arduino platform is effectively C++.
The Arduino platform is based on an Atmel AVR chip. There is at least one Java VM for AVR chips. There are other languages available for the AVR such as Forth and BASIC (although I could only find commercial versions, so I'll if you want to find them, search for "AVR BASIC").
The Arduino uses a virtual COM port to communicate between the host computer and it. A virtual COM port emulates an old style serial line but is done with USB. You can use the Java communication API to then have a Java program running on the host computer communicate with your physical device.
For some encoders and buttons, you probably want to implement a USB HID device. If you're going to produce more than a couple of them, you'll want to do a custom board. Check out V-USB, an open-source library for making USB HID devices using Atmel microcontrollers. They have a bunch of examples of projects that use this library.
You could probably make this look like a HID joystick, using the encoders to produce X/Y axis information and having the buttons act like buttons. They you could use standard Java gaming APIs to read the joystick values.
Can you expand on your need for a custom device? It seems to me that designing hardware has a pretty high barrier to entry and that most applications I can think of would be better resolved by repurposing an existing piece of game controller hardware. If you really need new hardware, then i suggest you start by googling 'USB development kit' or
'USB development board' which will get you links like this, this and this.
As for working with USB hardware from Java, I've played around with the JUSB library a bit and it looks promising, but appears to be limited to Linux only because the Windows version of the native library half of the library hasn't been written. Alternatives can by found by googling 'HID java'.
Ok, computer-platform independant? What platforms are you targetting? That would depend on the driver and support for that said platform, what does the usb device do? Is it a mass storage device...You may have to look around and see if you can find a device driver that can talk to the device...
Hope this helps,
Best regards,
Tom.
I know for the serial port there were libraries that existed for interacting with it (rs232 library). Googling for java and USB returned several answers (the first was called jUSB). That would be the first type of thing I would be looking for.
sample for java usb connection to freescale microcontroller:
http://javausbapi.blogspot.com/
how can I let an SWF file to retrieve values immediately from Java application that does live calculations (Speed is a necessity).
question in other form : how can I
give my website browser immediate data
- that are bean calculated now - as fast as i
can ?
I'm going to assume the calculations are being done in a Java applet in the same browser where the flash is running.
You can call Javascript from within the applet using the following code. This code could then update the values in the flash animation.
import netscape.javascript.JSObject;
JSObject win = JSObject.getWindow(applet);
win.eval("window.alert('Hello from Java')");
If my assumption is incorrect, then where is the Java application running? On the client or server?
If it's on the server then you need Flash remoting. I believe there are a few different Flash remoting techniques. Try searching for java flash remoting. You can make it call the server every 2 seconds or so to get the latest data.
If it's running on the client I doubt you can connect to it from Flash because of security. A signed Java applet could connect anywhere it wants to. You could retrieve the data using it, then push it into Flash using the method described above. Would be a crazy hack though. Can you do the same thing with Flex? (I've never used Flex before).
If the speed is crucial, you would probably want to do it via some kind of socket connection. Usually signed applet or a WebStart Java application is able to open a listening socket. Flash application then would be able to connect to this socket and as a result you will have very fast bidirectional communication.
There are some caveats however.
You should bear in mind that user might get suspicious about weird socket activity on his machine, or it would be just blocked by a firewall - so you'll need to warn user.
In order to be able to connect from Flash to Java, you must dispatch crossdomain policy file from the listening socket (or any other below 1024 - see documentation for details; keywords: crossdomain, policy-file-request, loadPolicyFile). Also your Flash application might need to request such file manually from the Java application.
Couple of useful links on how to get certificate for your Java application: how to get free code signing certificate (Russian), similar but less detailed description in English.
However, if you are able (read: the speed is sufficient) to use Java Applet <-> JavaScript <-> Flash combination I'd advice to take advantage of it.