Can I use OpenCV with a web app? - opencv

I want to control my app using hand gestures. For various reasons I have chosen to make a web based app.
Is it possible to control/interact with a web app with OpenCV (or any other program) running as an agent on the client, communicating directly with the page on the client rather than with the server?
The web app doesn't have to be in a common browser, it can be something like Qt WebKit. I am ok requiring the user to have an agent on their computer.
The server is not running locally!

Related

I want to block electron app from communicating with outside world

I've developed an electron application and packaged it for windows x32. It's a standalone desktop app, and I want to make sure it doesn't communicate with the outside world. When I launch the compiled application for the first time, I get a prompt message asking me if I'd like to "Allow incoming network connections"
If i say no, I believe the app doesn't run properly as it will be added to my firewall's blacklist. Any advice on what the proper practices for achieving this are?
I want to block any incoming/outgoing traffic to/from my electron app, while ensuring tit runs smoothly.
by allowing incoming connection ,you may get trouble .as you have the Proper firewall to prevent it and you proceed

Access Native Resources in Electron App

I'm currently evaluating Electron for an upcoming project. Perhaps my question is trivial for someone who has used Electron. However, I can't find the answer in the documentation or maybe don't fully grasp the concept.
I want to have a web app that users can access with a browser if they choose or from a native app, if they want to use a USB device (in this case, a credit card reader) attached to their pc. So, the main.js file would open the remote web app like so
win = new BrowserWindow({width: 800, height: 600})
// and load the index.html of the app.
win.loadURL('http://www.example.com/login.html')
Is there any difference in being able to access local resources (files, ports, etc, if the page is remote vs local? In other words, can you still access the USB ports from a remotely hosted web app wrapped by Electron the same as if the files were local, as in the case of an installed native Electron app? I would think it would load a remote page the same as a local but not sure if ipc would still work.
To access native resources on devices you'll need to be running an electron BrowserWindow with nodeIntegration enabled. This is the default but there are big security implications when loading content from the web into a node enabled BrowserWindow. If you're site is compromised through XSS, all your clients PC's will be open to remote code execution.
For that reason you should build a backend service with your API and then host a front end on a website and a distributed version in your app. You can still build the two from the same code.

Building iOS app, website, and backend

I've only recently started to delve into how building apps work. I'd like to know what the general setup is for a mobile app and a website, in which users can update information on the app through the website.
I'm trying to learn how to make an iOS app with Swift, and use Amazon Web Services as the backend for it. If I wanted to then make a website that would change data on the mobile app, would I have to create a website from scratch with Ruby or Python, and then somehow connect that to the same AWS backend that my iOS app uses?
Thanks.
Usually, most data is stored on a website. Your website can have ways of viewing the data, such as web apps, like jcaron said. An app is usually used for viewing data from the website. When I develop apps (with Swift) I setup a database on a website and connect it to the app using PHP scripts. Then I make the app, with it's own UI, which does HTTP requests to the website and uses the data.
That's a very broad question, with lots of possible answers, but here are some of the options:
you have a native (Objective-C or Swift) iOS app, with its own UI, etc. It exchanges data with your back-end server, which stores stuff in a database and/or forwards messages between clients. Then, you have a website, using any language/framework you want, accessing the same database.
you have a web-based application: you use exactly the same code (with responsive design of course), serve it from your servers using any language/framework you want, and just embed that in a web view in your app
you have an hybrid application: this is close to the previous option, but you do most of the coding client-side (i.e. using Javascript, possibly with frameworks such as Angular) within a Cordova/Phonegap app. The same app would then be deployable as a native app as well as served as a website. You would just have back-end code on the server.

Applications that require a web server for full functionality

Is it possible to deploy an iOS application that requires a Node.js socket to do something on a computer?
For example:
Application -> Node.js socket -> Doing something on a computer
Computer does his job -> Response from Node.js socket -> Processing data with application
I don't think that Apple allows this, but one of my friends is sure about it. My point is that this solution does not reflect to an easy usage instead of making it a little bit complicated for average users.
The answer is yes. I don't know how to integrate Node.js into app, but there are many other server that can be easily added to app, such as CocoaHTTPServer. I have created a project to manage files inside app sandbox. Open web page hosted by app to manage files. I know some other apps, which provide web page hosted by app to transfer media files.

iOS 9 - open resource in web browser on another computer, triggered by tablet

If you had to open a resource from a database in a web browser on another computer, using an Apple tablet app as a remote control, how would you implement such a feature? This is basically what WhatsApp Web does, so it should be technically possible. But how would you go about it?
I'm assuming that you mean a situation where the app modifies something on the server, and the browser then updates automatically to reflect this. If you mean something like the iOS Remote app, then you may have to use another method (and you may not be able to do it from the browser).
To do this you'll have to have a server that both the iOS app and the browser are connected to. When the app does something, it updates the server, e.g. by submitting an HTTP request to a REST API. The server then updates the database.
Now you have to get the browser to update, and there are two ways of going about this. One is by polling the server periodically, using AJAX to update parts of the page dynamically without refreshing the whole page. This works, but there's a lot of overhead and it can be a drain on a laptop battery.
The better, but slightly more difficult to setup, alternative is to use WebSockets. WebSockets allow for two-way communication between server and client, and the connection stays open until one party closes it (or it times out after a long time). The client can submit information to or pull information from the server as before, but the server can also push information to the client without the client having to request it. This would typically be how games, chat clients, etc. can operate nearly in real time.
Setting this up isn't necessarily that difficult, but it's a very broad, open-ended topic that's beyond the scope of just iOS development. Beyond the iOS app and the web client, you'll also need a backend that's capable of using sockets. Node.js is a popular JavaScript-based backend for this sort of application; there are numerous others out there as well. You'll have to do your own research to determine what's right for you.

Resources