How to acquire data from users online? - javascript

I prepare to perform a simple project and I don’t know what I should use to accomplish this. I need to receive a data entered by a user (via a webpage) and store them somewhere. I need them to be able to search and returned on the user request. I’m a little old-fashioned so I assumed that should be a file on ftp managed by some python or JS script? I really don’t know where to start so please advise.
project

Have you considered storing data in a database?
You can use MySQL. It's quite simple after you understand how a database table works.
Data are stored in a table. Table is a part of a database with other tables.
Each table has columns you create. Data are added to the table in rows.
For example, let's say a user sends you their name 'Brian'.
You can have a table called 'users'. In that table, you can create a column 'id' of the user (read about it later, including auto incrementing), and 'name'.
You insert the data into that table. Brian is now in a table with his own ID, like this:
id Name
----------------
1 Brian
Check this out:
SQL tutorial

Possible solution i would recommend:
create a mysql server
create a backend (links for Java)
rest-service https://spring.io/guides/gs/rest-service/
access DB https://docs.spring.io/spring-data/jpa/docs/1.5.0.RELEASE/reference/html/repositories.html
put the parts together
get/save the data on your webpage with xhr2.

Related

Is it good to store data in JSON files

I have a Discord bot that has about 50,000 users, but the question here is, is it good if I store data by Json file or not Because I'm currently doing this, but sometimes everything in JSON automatically deleted and The file becomes empty. i I don't know why, is JSON not dedicated to the huge amount of data Some examples of data that I store Like the ID of the server members, and also servers id
The problem with JSON file, is when multiple users try to edit the same information at the same time... you have to think about which update will persist... all except for one will get overwritten by the update that was last submitted.
JSON is basically used to send and receive data from user and server, it is seldom used to store data, sometimes it does but not often.
For a dataset of 50k user consider using MySQL, it would be much easier to handle data.

Insert the selected data from the grid into SQL Server database

I am trying to create a website using Django, python and sql server which lists out the items in a tabular form. And upon selection of particular item via check box i want to update my database table with selected items.
For eg: in the image below if ID : n1234 is selected i want to update backend table with drugsdispensed
I am trying to learn Django and Python.
HTML File :
loop through the object and save it in the database :
I know there is a better of doing the same thing looking for comments

How to update large dataset with MySQL migration scripts

We are developping a Nodejs app for a client that demanded that we use migration scripts to facilitate update the production database. Since i'm new to MySQL , i can't wrap my head around something, which is, how am i supposed to update tables content with only MySQL when i need to do some API calls to get the updated information, compare it to the current one and then update what needs to be updated.
What i did so far is, saving the new data in a JSON file. Is it possible to read a JSON with MySQL and import its content. This is what i want to do :
// read json file and star a loop
UPDATE table SET column = data WHERE id = json_id
// data and json_id are information from the JSON file
Is that possible ? if so how can i achieve that ?
Create a migration script. You can create a .sql file with scripts for create, update, and whatever you need for tables, stores procedures etc. Now when you want to deploy your app in production environment you can execute this script in the production instace and this will recreate your tables, sp's and even data if you want. You don't need an api endpoint for that.

Add to bookmark browser data SELECT from database

I have an application build in php that show some data SELECT from a database build in MYSQL. These data are show as link where you can click on and the appaer as document.
Is it possible to add a function with a button star that add me these links (that extract data from a MYSQL table) to my bookmark browser?
Providing the data is accessible through some unique URL, most simply achieved with $_GET variables, then yes. You can even obfuscate the $_GET string using mod_rewrite to make more attractive URLs, so instead of http://domain.com/?document=document_name you could have http://domain.com/documents/document_name/ as the URL.
Then it's simply a question of using JS to implement the add bookmark function, which is explained (as #SevStryker pointed out) shown in this question

Javascript control page and user view page

Currently I'm working on a project where a user enters a lot of data constantly for a hour long window. I'm looking to have one user control all the data via some control panel and then have a link they can distribute to other users that will allow them to view that data without the ability to edit it.
Right now I'm doing some extremely weird methods. I have an XHR request on the control page that fires whenever a field is finished being edited. From there the data is sent to a php file that converts the data into a simple text file. Then the distributed link file will load that file one time and translate it into the necessary format.
Some potential problems I've run into are it seems odd that I'm sending starting as javascript data then going to a php file then to a text file then translating the data all the way back into javascript data again. Another problem I've come into is I'm not sure of a way to force users to reload the page when a field is edited in the control panel after the user has opened the view page.
Have I totally gone overboard here? What are some better concepts I could employ to accomplish this task?
If i understand what you want to do this is how i will do this:
First the data entry
if you have lot of fields you better use a form wizard, i don't have a particular one in mind right now but there is lot of them just search jQuery Form wizard
Here is an example:
http://i.stack.imgur.com/Luk2b.jpg
The concept of the form wizard is to guide user via multiple page and also validate the data. And click save when and the end.
Then save date in database.
Display content
All you need to do is to create a global separate page to display your content.
Let see something like: http://yourserver.com/view/{id}
where id is the identifier of the particular row in your database.
i'm not sure if i totally understand what u about to do. i'm trying to make your work description shorter here:
want to build a website that one person can edit a single page's content in 1 hour, and others can view the content change in that 1 hour.
if this is what u want to build, here's the module:
teacher: the one who can edit the page
student: the one who can only view the page
server: information center
teacher client edits page -> teacher client sends update data to server -> server saves data -> server sends update notice to student client -> student client receives update notice -> student fetches update data from server
to make this module work well, i suggest try socket instead of http reqeust, just like online games or IMs do.
well, try socket.io

Categories