How to send data from android app to my local site? - javascript

I have a local site like no server no nothing just the html, css, javascript files and i need to send data from an app in my phone created with android studio and display it on the site.I read that you can have a webserver and send data with the android/java tcp client to it but i cant find how to do it.So how can i approach this?

This is possible using server-side programming languages.
You can receive data using Api and display it on your web pages after saving it in the database.
To start, I suggest learning Php - Mysql , it's easier to understand and easier to implement

you can send data from your android mobile to the server by using API such as REST and SOAP but you have to any of the server-side scripting languages like node PHP etc.. Please refer the tutorial point to get better ideas
https://www.tutorialspoint.com/android/android_php_mysql.htm

Related

Display UART in HTML (web site)

I receive continuously data by uart sérial port.
How can i print this data on my html web site and update it dynamically ?
I use a raspberry pi 3 with apache server.
I can use php, javascript, python... and many languages.
You could create a NodeJS server, with express for example.
Then use the serialport npm module to get data from your serial port.
Then send this data through a websocket, create a web page, and use the Websocket Javascript API to retrieve the data from your websocket.
This way, you can display real-time data from serial port on your website. I've used this 'stack' to build a connected aquaponics system in a Hackathon and it worked well !
It would even be simplier if you use socket.io, since it provides simple library and code example for both the back-end and the front-end part.
Hope it helps,
Best regards

Advice on building a server connected android app

I'm creating a personal project, an Android application, where user sign ins via a server are essentially. Also users will be able to share important "updates" in both a data stream that all users can have access to, and potentially down the line a data stream that will be specific to local users.
Unfortunately I have basically no idea of how to implement the server for this application. I'm confident that I'll be able to create a solution though, I just need to be pointed in the right direction. Are there any existing servers/api's that I could access that will allow me to handle my "connected" tasks? If I were to make a server myself for this application where should I start?
If you have absolutely no experience with server side coding, you should start with PHP and MySQL to create a simple API for your app.
For getting started download the XAMPP bundle that has everything you need.
SQL and PHP are fairly easy for beginners. On the client(Android) side use Volley as it is simple to understand.
However if you want to get started with Node.js, your server can be up in a few minutes with express.js

Is it Possible to Connect Arduino through the EthernetShield to Read a Text File?

I'm new to Arduino and am trying to connect it to the internet using an EthernetShield. Before I buy the EthernetShield, I want to make sure I will be able to execute the necessary steps with it. Is it possible to use Javascript to write to a text file stored on the server (containing binary data), connect to said server/file address with Arduino, and then use Text Finder (Arduino's) to read the file's binary data and perform the necessary commands? If so, what are the steps (if it diverges from this basic outline)?
It seems fairly straight forward, but through my own research, I am unsure if text files can be written and stored in that fashion, and if the Arduino can read this file type. I'm also aware that the conventional way entails PHP and mySQL, both of which I am fairly unfamiliar with.
Thanks!
Arduino can read text file. I suggest you use XMl or json instead of text file.
I am sharing a link of code for my final year btech project "Controlling devices using internet".
(ofcourse this can be done easily by using arduino+ethernet as server but the problem with this is you need port forward the router in order to access server from outside the local network Port forwarding is little risk as per security aspects.)
I used apache server (for testing I installed in my laptop, later I used hosting sites) and Arduino+Ethernet Shield as client. Arduino sends HTTP request to server for XML file after getting, it parses the XMl and control the devices. I used PHP for creating UI and updating XML file....
I hope this may be useful
https://drive.google.com/folderview?id=0BxWdBbr_6RYkSXVwcGxOa3pxTDA&usp=sharing

connecting access 2007 db using js in html5 page

I am developing an web page (html5) for my graduation project. In the web page the user would provide "body type" and based on the input various garments's images would be pulled from database and displayed on the page.
I am not a technical student so failing in my database connection efforts.
I have index.html page, a .mdb db (ms access 2007) and using js to connect to the .mdb. I also installed the "Microsoft Access Database Engine 2010 Redistributable". Then too failing.
Kindly mention what I am missing.
HTML pages are mostly accessed via a Server (IIS, Apache,..) and the data work is done by the server, on the server (AKA ServerSide programming)
So first consider if your project is intended to be accessed this way or only locally / standalone to your very computer.
If you only want a local page, there might be a solution here : http://accessdb.sourceforge.net/
But I bet it only works on IE through ActiveX
Read this : Read and write to an access database using Javascript
Also : why MSaccess ? If you really try to manipulate data locally using JS, try SQLite, there should be many library for JS like this one : https://github.com/lovasoa/sql.js
or why not... the HTML5 webstorage objects, that could be pushed far
http://www.w3schools.com/html/html5_webstorage.asp
I think you have got it all wrong! The short answer is you can not. And that is because your design is wrong. You can not* directly connect form html5 / javascript to a database.
Back to the basics.
You will need server side scripting to read the database content and expose them to the client (javascript) or to embed directly the result to html5 (while server is building the page).
You need to take a look to the following technologies
java / Jsp
c# / aspx
Those will help you to read the db file on the server side. Then as I said you will need to find a way to expose that information to your web page. As a side note, those are not the only server side scripting technologies, but are the one (IMHO) the can read an access file.
So look into that direction you will find a lot of resources to help you.
*The truth is that you can, but this can be considered an 'advance' issue.

Connectin to MongoDB using Javascript

I am working on a little fun project(webcalender) and I want to use mongoDB. MongoDB is running and I figured out how to deal with it. I also got the connection to PHP.
I was wondering is there any chance to connect to the MongoDB using simple javascript?
I have searched a lot and I always passed by Node.js? Do I need Node.js to connect to mongoDB over Javascript?
Does anyone have a great link? Tutorial? or arguments why I should not do that?
Thanks for help
there are client side ways of doing this but its not safe at all.
there are a few reasons for the lack of security.
1. connection info is in the source for anyone to see.
2. if you use a service like mongoHQ where its a restful API to connect to Mongo your secret is exposed on the client side.
Both of these reasons scared me enough to not use a JS library that allowed me to connect to mongo on client side.
is your application being built in node? or PHP?
if PHP I know theres a PEAR library for MongoDB, then you can use javascript on the client side to interact with php to do what you need on the DB.
if the application is being built in node.js then sure why not? I've had success using Mongoose with express in node.
hope that helps.
Yes, you need Node.js to access MongoDB via JavaScript, because simple plain JavaScript runs on the user browser, not on the server, and Node.js is meant to run on the server.
Accessing a database directly from the browser would be a huge security issue, since JS files are always available to those viewing the page.

Categories

Resources