application -> database <-> web app communication - embedded-linux

I'm working on a personal project that consists of a linux dev board and temperature sensor. I'd like to see a nice web 2.0 real time plot of the tempature from anywhere in the house. Coming from hardware/driver background so i'm not very familar with databases or webservers. I'm stuck trying to figure out how i can send new temperature values from an application to a local web server (also running on the dev board) which can be simulataneously viewed from a client web browser. I've attached a picture which shows what i'm trying to do:
http://img193.imageshack.us/img193/4742/92898822.jpg
I've written the driver, application and played around making an app using GWT. I'm stuck trying to figure out how to make the server-side application and database i.e. Do i need to make a seperate executable that embeds SQL to talk to both application and client via http or is there an easier, existing way to do this?
Thanks in advance.
Kevin

GWT is usually used with a Java application server. You can use JSON or XML to communicate with any kind of server, but I don't know how easy this is.
In a not embedded server you would install Java and an application server. You would also install a database server, but for simple projects you could avoid this by using an embedded DB like HSQL or Derby. For your situation I don't believe this is necessary.
The question is what kind of application server can you use in your platform? All application servers support some kind of CGI communication. This way you could connect your server with the application that samples the temperature values. I don't think there is a need for SQL or an embedded database.

Related

How to use MongoDB in a vanillaJS project

I want to implement a CRUD mongoDB functionality into my web app witch only has HTML,CSS and vanilla JS.
You can't , but more important is that you shouldn't.
MongoDB is a server database and you should connect to it with some kind of backend. So, you need to use something like Java, PHP, Node, etc. to connect to MongoDB. The right way to do this is to build some API that you can consume using JS (like a REST endpoint).
Even if you could find a way to connect to MongoDB using JS, you would be exposing YOUR WHOLE DATABASE to anyone who has a web browser and access to the URL. Also, if you want it to be accesible from anywhere, you would need to allow ANY IP address to connect to the server. DON'T EVER DO THAT. DON'T YOU EVER EXPOSE YOUR WHOLE DATABASE TO THE INTERNET

How to move Parse.com database to my own server and still use Parse.com SDK?

I'm using Parse.com SDK services for my Android app.
I've seen that Parse had released their Android SDK as an open source project on Github on this address.
My app is almost finished, and when I'm uploading it to the Play Store, I don't want to be controlled by Parse.com (I mean that I don't want to be blocked someday, or I don't know that), so I want to move my whole database to my own server that hosted on a secure company.
I've checked the open source project on Github and realized that all I need to use it on my own server is to generate an Application ID and a client key.
So I want to ask if someone knows how to generate an Application ID and a client key of Parse to use it on my own server, or that you maybe knows another way of moving it to my server? And one more question: Today I'm using also Facebook SDK with my app. If I will move my database to my own server, will I still be able to use Facebook SDK on my app?
Thanks!
I have write an article about how to migrate parse to a custom server.
https://medium.com/#jcminarro/run-parse-server-on-your-own-server-using-digitalocean-b2a7d66e1205
There's a massive difference between Parse open-sourcing their SDKs compared to revealing their entire backend architecture and its configuration.
The open-sourced SDKs are essentially wrappers for Parse's REST API along with some convenience functions and logic for natively interpreting the JSON data Parse is transmitting.
At a high level, Parse uses MongoDB for its core database and is entirely hosted using AWS (Amazon Web Services). The entire architecture is highly complex and is not something you could just drag and drop onto your own software stack or hardware backend.
To help give you a better idea of how Parse achieves all of their services, here's an interesting presentation their Dev Ops team gave at an AWS convention. Suffice it to say, hosting the backend services for over 180,000 apps requires a complex infrastructure and that is the "secret sauce" so to speak for Parse and is why Facebook purchased them for over $85 million two years ago.

Chat implementation in windows form using SignalR

I am trying to implement chat application in windows form using SignalR. Actually I had created the web chat application using signalR now i want to synchronize it with windows application.
I am facing following problems
1) How to initialize the hub class as in web application we initialize it in javascript on page load. So how can we innitialize the hub and in web application there is global file to maphub for dynamically generating the signalr javascript so where in windows application can i map the hub to dynamically generate the same.
2) As i want to synchronize the windows application with the web application so do i need to keep both the projects under one solution or can i synchronize the two different solutions??
Please provide the startup code for the first problem as i have searched alot but not getting any way to implement the chat in windows form. the code i found on net just raising errors but helping me in any sense.
This is a full working sample for using SignalR in WinForms and WPF
You can download it and play with it.
There is a WinForms Server and Client which can be your starting point.
It is a good idea to keep the projects under one solution, but its up to you. The WinForms projects will need a server URL where they can communicate with each other (you can see this in the sample code from the above link)

Data Syncrhonization between daemon and Django protocol

I'm currently working on a web application which shows data about remote microcontollers which collect weather data. Data is sent to an application through a proprietary protocol, and ends up being stored in a ODBC accessible database in a Windows machine.
I've written a Django application, taking a snapshot of that data, showing those remote units as Google Map Markers that show a nice Google Visualization plot. Up to this point, everything went just fine.
The problem I'm facing here is that the ODBC accesible database is running in a Windows machine and the Django app in a remote server under Linux.
I need to synchronize data from the Windows box to the remote django app. I'm planning to write a transaction-oriented sync protocol. But I don't want it to be too complex, though I must prevent stalled sync states.
Any thoughts about the problem?
I've come up with a RESTful API with TastyPie on the server, and a PyQt4 GUI in the client using httplib2 as client library.
Since I'm using Python 2.7, I use native json module (which tastes much like simplejson).
Final notes, I'm building an executable with cxfreeze.

How can a web application synch a folder of text files on the client's PC?

I want to be able to synchronize several text files on a user's PC in real time from my web application. Basically I want a few data files on the local PC to mirror the state of a user's data in my web application so if the web application or the user's internet connection is lost he can use those data files to get some critical info (possibly using html/javascript code stored in with those files that would run in offline mode on those data files.)
I know that google gears has a lot of interesting tools for working with offline state, but I'd prefer an even simpler application in html/javascript that wouldn't be as reliant on google gears. I'd rather use google gears to just create those files and slowly keep them in synch with the web application's version of data throughout the day.
Update on answers:
PersistJS is a good suggestion I will look into, but I was hoping people would direct me towards really good Google Gears tutorials resources.
You can save data on the browser using PersistJS, which uses the best client-side persistent storage mechanism it can find, supporting:
Flash
Google Gears
HTML 5 storage specs
browser-specific extensions
cookies
When your app reconnects, you can resync. Creating and reading text files is something the browser will generally block your web site from doing.
Risking of stating the obvious; if you want to store user state locally, isn't cookies the standard way?
maybe more then one cookie will be needed, but that sounds like the simplest of ways.
You're going to need to make an ActiveX control and a FireFox plugin to get these permissions. Short of that I agree with orip try using PersistJS
You can ask the user to download a subversion client that is predefined to interface with your subversion server only. Then write your web application to interface with the subversion service from your side only.
There is a good deal of security harm associated with granting access to a user's file system so you will want to lock down all possible points of exploitation. You will want to ensure that the user cannot access the subversion server except through the client that you ask them to install. You will want to ensure the connection between the application server and the subversion server is extremely secure so that the transmission path cannot be compromised and that malicious logic that may be loaded onto the application server cannot access the subversion server. I would say to encrypt the transmission path between those two servers and put the subversion server behind the firewall separating your network DMZ. I would also suggest use a challenge/response mechanism between the application server and the subversion server to prevent malicious code from appearing to be legitimate decisions made on the application server. Also, ensure that data only flows form the application server to the subversion server in a unidirectional fashion only, because if there is malicious logic planted on your application server then any data that comes from the subversion server is compromised without even accessing that server.
you could use the File System Object FSO through javascript, however it is dependant on Microsoft as it is an ActiveX control, it would also require permissions in the browser, or perhaps a HTA (HTML Application).
http://www.webreference.com/js/column71/
Its a real security issue so most avenues are closed down inhrentley.
Inherently the web model was designed not to authorize upstream from server to client. Now things are changing slowly maybe could you do this with Websocket ?

Resources