Do I want an embedded web-server, or what? - web-services

So, someone want me to hack some code for him. He has a 42" TFT display on which he will display some application/business related data.
However, 75% of the screen real estate is unused, so he wants to fill it with "TV/adverts/flash/you know, that kind of thing... web based....".
Any advice? Do I want an embedded web-server? If so, which? (he wants free & open source, or as cheap as possible) Do I display it in a browser? (duh! probably, dude) But I don't want/need a menu, address bar, toolbar, etc - it should be full screen (does that mean "kiosk mode"?).
Sorry, folks, the requirements are not clear, but I hope that you can guess what he probably means (he is not very techie). How should I proceed with this? Thanks.

I am working on such a display system, although ours already quite evolved, with support for multi-screen, multi-user and a lot more.
A few hints :
We use firefox with the "full fullscreen" extensiton (https://addons.mozilla.org/fr/firefox/addon/1568) that allows to not display any menu bar, status bar etc. and to automatically start Firefox in that mode. Then you just need a startup script to launch firefox specifying the right URL when the machine is started.
Our system is web based, but as a multiscreen system it has one server and several client PCs connected to the server via HTTP, and each one to a TFT screen via VGA cables. If you have only one screen you could install the browser and the web server on the same machine. Only restriction : we use wake-on-lan from the server to the clients to automatically start the display every morning. This will not be possible with a single machine system !
To give you some ideas, the display mechanism basically works like that : first, the browser loads a html page with lots of javascript (that javascript constitutes what we will call the "client application".) This client application is written using the Prototype.js library (just an indication, there are many other possibilities). Then the client application asks the server for the content to be displayed. That content is passed as a JSON stream representing a playlist of objects (images, videos, text news, etc.). The client app displays each object in the playlist sequentially. The objects stay displayed for a specific duration (lots of setTimeout in the code). The transitions use effects from the Scriptaculous library (fade-in, fade-out...). When all objects have been shown, the client asks the server again for the playlist (in case changes have been made), and the process starts again. There is actually never a full reload of the page.
Then we also have a multi-content mode, where the screen is separated in various zones that are updated separately.
For one machine and a realtively static system (i.e. no GUI to add content), maybe you could implement that mechanism in a local site accessed via file://... The whole "intelligence" of the system would be in the javascript. That would save you the server part. I see one possible restriction : I think flash can't play video files from the client's machine (security restriction) so check this if you plan to use flash videos.
Well, I hope these few ideas can help you. Good luck !

Get one these
They offer a VESA mount for it I think if the screen your using supports that.
Full screen firefox would be one option.
A more flexible option would be a full screen QT app written in the language of your choice using the webkit widget for display, this would likely make flash content more difficult.
As for the content, i would put a LAMP setup on the fit pc. Build the web page using whatever feeds you want and just display the web page aka http://localhost
Alternatively you could host the "web parts" of the display on a standard web hosting server and display the data coming in on RS-422 in a separate QT widget.

Related

How to properly notify client of changed status?

I am writing a (Django-based) website which is working just fine. It displays a list of sensors and their status. If a new sensor is attached, the user needs to wait for a certain amount of time until it is warmed up and ready to use. Also, when the sensors are updated (which the user can trigger, but can also be done automatically by the system) - the user needs to wait.
On the server side I have all signals/Status updates/whatsoever available. Now I want to create an overlay for the current webpage where the statuschange is displayed for x seconds and userinput is disabled.
I have no clue what technology to use. I could frequently ask for updates client -> server but that doesn't feel like the correct way. Any suggestions on what to search for?
No code here because the answer is probably independed of my website code
Standard solution is to use Ajax (JavaScript) or similar to get state from your backend on specific intervals, that is the approach you're mentioning.
You can also "push" changes from your backend to frontend using WebSockets but that is a bit more complex. A popular framework is socket.io, I recommend you take a look at it.

How to broadcast audio *from* my website to clients

I want to have a button on a (private) webpage on my site that, when clicked, starts an audio stream from the computer of the user who pressed the button.
Then, I want that stream to be accessible on another webpage on my site.
I'm aware of YouTube, Periscope, Spreaker, and others, but it is my understanding that the broadcast, using these services, is initiated through their website or apps. I'm ok with the broadcaster having to download a plugin on-the-fly (that is, after he has pressed the button), but I want to avoid the broadcaster having to install software, or having to use an alternative website.
So, what I'm looking for is a service/API that somehow takes a live audio recording within a browser, and repackages that as a live feed, to be used in an (embedded) player, elsewhere.
I'm aware of software like Kurento, but I do not want to maintain the infrastructure myself. I just want the service/API to take care of that.
I'm also aware of join.me's API, but it's my understanding that the broadcaster still needs to install software to broadcast.
This service does not have to be free. And this service should (of course) not use Flash.
Does this exist?

Can Web Applications detect local printers?

I was wondering if it is possible for a Web Application (hosted on a remote server) able to detect printers connected to a host(the one accessing the Web Application)?
Also, is it also possible to be able to send print-jobs (mainly images) to the host's printer?
For instance, assume you have a local WPF application (Windows Presentation Foundation, C#) running on the desktop.
To print an image:
Select an Image on the WPF application (loaded from a directory on the local harddisk)
Click the "Print Button"
This will run this line of C# code:
e.Graphics.DrawImage(image, x-coordinate, y-coordinate, imageWidth, imageHeight);
And it will send a print job of the image to the default printer of the local computer.
So now, instead of a WPF application, you have a Web Application. The user will:
Type in the URL of the Web Application
The Web-App will load a page similar to the WPF application
The Web-App will display images that are loaded from say, a database.
User select image he wants to print
User clicks "Print Image"
However, in order to Print the image, I would imagine the Web-App would need to recognise the printers the user has on his local computer, and be able to communicate with the printer.
Of course, the Web-App does not need to be in .NET. I was just using WPF/C# as an example.
Bluntly, the answer is no. Server-side code can't talk with client-side resources in that manner.
A possible solution might be to embed some client-side component into your web app which does what you
want, such as a Java applet or Silverlight item. I don't know off the top of my head whether they're capable of printing, but it might be an option worth investigating.
However, I would suggest the best way to handle it (if your use-case allows), is to serve up something capable of printing via native browser methods. You are able to serve a stylesheet which applies to printing specifically using the media="print" attribute on your link element. If that remains too imprecise (you'd have no control over the browser's paper size, margins, headers/footers etc), perhaps another option might be to serve a print-specific file such as a PDF. Ultimately though, what you are asking is not possible and it is a case of finding another way to fulfil your requirements.
I have a similar issue, which I haven't programmed, but, I have found that HP printers can receive print jobs, through the HP network. If you are WiFi enabled, there should be a way to email the print job to the printer. I'm still researching this. But, I have a friend who did something similar using AWS.
Been a while, but I have learned that HP printers can be WiFi enabled. Which means, they get an email address and can be printed to, at that address, through the internet, if they are connected to a WiFi net connected to the internet. The email goes through the internet directly to the printer, where it is then printed. So, you can email a print doc.

Wait for certain website to be accessed

My objective is to have an event that is triggered when a website is accessed.
Now, maybe through the window title, or the text in the window. Or maybe even reading a URL.
As of now I am aware of FindWindow (class,title);
However all attempts to put this line of code into a loop and it's exit condition being when the window appears have been fruitless.
Any assistance would be very helpful.
That's not possible. At least if I understood you correctly.
You want to register a callback when ANY software on your machine accesses a specific website?
Just imagine a browser uses SSL, there is no way to detect this by listening to the traffic or something similar.
However, if you want to be notified about all connections to a specific IP, then you could use sniffing mechanisms of your kernel or even redirect all traffic to this IP to a proxy you have set up with iptables or similar.
Windows has a sniffing library called WinPCap, on linux you could use tcpdump.
Though, more information about your problem would be nice.
Looking for window titles can be a bit problematic. I don't know how much control you have over the desktop, but you might consider building an addon for Firefox (or the equivalent in IE) to look for this particular site.
https://developer.mozilla.org/En/Extensions/Firefox
You might also consider building a simple local proxy server (depending on what you are doing) that looks for this site and performs some action. You would have to make sure all the browsers on the machine point to this local proxy to get it working correctly. See the link below for some discussion on a custom proxy server:
How to create a simple proxy in C#?

How to keep a C++ realtime server application with a modern web client interface?

I develop industrial client/server application (C++) with strong real time requirements.
I feel it is time to change the look of the client interface - which is developed in MFC - but I am wondering which would be the right choice.
If I go for a web client is there any way to exchange data between C++ and javascript other than AJAX <-> Web service <-> COM ?
Requirements for the web client are: Quick statuses refresh, user commands, tables
My team had to make that same decision a few months ago...
The cool thing about making it a web application would be that it would be very easy to modify later on. Even the user of the interface (with a little know-how) could modify it to suit his/her needs. Custom software becomes just that much easier.
We went with a web interface and ajax seems the way to go, it was quite responsive.
On the other hand, depending on how strong your real time requirements are, it might prove difficult. We had the challenge of plotting real time data through a browser, we ended up going with a firefox plugin to draw the plot. If you're simply trying to display real time text data, it shouldn't be as big an issue.
Run some tests for your specific application and see what it looks like.
Something else to consider, if you are having a web page be an interface to your server, keep in mind you will need to figure a way to update one client when another changes the state of the server if you plan on allowing multiple interfaces to your server.
I usually build my applications 2-folded :
Have the real heavy-duty application CLI-only. The protocol used is usually text-only based, composed of requests and answers.
Wrap a GUI around as another process that talks to the CLI back-end.
The web interface is then just another GUI to wrap around. It is also much easier to wrap a REST/JSON based API on the CLI interface (just automatically translate the messages).
The debugging is also quite easy to do, since you can just dump the requests between the 2 elements and reproduce the bugs much more easily.
Write an HTTP server in your server to handle the AJAX feedback. If you don't want to serve files, create your server on a non-standard port (eg. 8081) and use a regular web server for the actual web page delivery. Now have your AJAX engine communicate with the server on the Bizarro port instead of port 80.
But it's not that hard to write the file server part, also. If you do that, you also get to generate web pages on-the-fly with your data pre-filled, if you want.
Google Desktop Search does this now. When I search my desktop for 'foobar', the URL that opens is this:
http://127.0.0.1:4664/search?q=foobar&flags=68&num=10
In this case, the 4664 is the Bizarro port. (GoogleDesktop serves all the data here; it only uses the Bizarro port to avoid conflicts with any web server I might be running.)
You may want to consider where your data lives. If your application feeds a back-end database, you could write a web app leaving your c++ code in tact -- the web application would be independent and offer up pages to web users and talk directly to the database -- In this case you have as many options, and more, as you have indicated.