Jsfiddle, codepen,Jsbin like front end - Javascript - javascript

I've created HTML/CSS/JS playground some well known playground like Jsfiddle, codepen,Jsbin etc.
i would like to know about, "how to save and load the workaround when the user logging in again?" i want user to save their workaround and let them resume from where they stopped.
what approach/idea/possible ways available for this?
do i need to know session/local storage very well?, if not, kindly share your experience. if possible pls share tutorial/example snippets or any other work around.
Note: before asking questions here, i have searched solution as much as i can. but not able to uderstand.
many thanks for any help.

Here are the options that you have:
If you want the data to be persistent for users then you need to implement user login and store their data in your database on the backend. That way they will still have it if they log in on a different browser or device.
If you use local storage then it will be saved only for that browser and and every time the user changes the browser the data will be lost.
If you don't want to implement your own backend then you can use something like Firebase or other solutions: see noBackend for more options and more info.
Another option is to use a solution described on StaticApps or unhosted which are very interesting ways to avoid using any backend logic in your apps but still keep some persistent state.

Related

Share data without database

I have this web application that gets and displays data from SAP, but i need a way (maybe a JSON file?) to share some data between different users, with the possibility to modify these same data for each user (even at the same time), without a database. There will be really small data and few users, and what i would write is simple data that tells me who is online in that moment. How can i do? I'd like to know if exist an easy solution to share these really small and simple data. I'm using React with no back, because i'm taking all the data i need from SAP. Clearly, i'm a beginner. All advice is welcome.
If you talking about some prototype like MVPs, I think JSON files would be best.
However, consider to work also that you can work with Local Storage.
You could use LocalStorage, SessionStorage or IndexedDB, but the last option is an in-browser database. Maybe LocalStorage is your solution.

Load data to service when it turns to online

I am able to add data to indexeddb when it is offline using service-worker in PWA but want to add the same data to service when it comes online(means i want to store the data into database by calling service). How to achieve this?
Your question is not very clear. There are two interpretations of it and I'll try to answer for both.
Question - You want to use service worker in both offline and online cases.
Answer - There shouldn't be any problem in doing it the same way.
Question - How can you send the data to server, which was saved in IndexedDB when the app was offline.
Answer - You want to use Background Sync.
If there's any different requirement which you may have, please feel free to ask but try to ask it a bit clearly. Hope this helps!

Creating a note taking app using JQuery mobile and phone gap

I have an app i'm developing with JQ Mobile and PhoneGap. Within this app, i want to include a 'Notes Taking' page and it has to do the following.
Make new notes and save them locally.
Recall them whenever i need to,
Edit them and delete them
i could not find a good example to follow, i tried this:
http://tutorialzine.com/2012/09/simple-note-taking-app-ajax/
but he lost me at the index php and how to implement that, i also tried this example:
http://miamicoder.com/2011/building-a-jquery-mobile-application-part-1/
but its so complex i got lost in all the code.
I'm a beginner at programming and my JavaScript is very very poor and i have no idea where to start and what kind of code is involved in making this part of the app.
Please help. Thank you.
Your first site (http://tutorialzine.com/2012/09/simple-note-taking-app-ajax/) will not work for you as the examples are embedding PHP into the html and that is not acceptable with phonegap apps.
Your second site is making it way more complicated than it needs to be for your limited scope.
Not going to do this for you but I will give you some advice and places to look.
Draw out what you want the user interface to look like and create that html
Create a load and save function in javascript to... well... load and save your notes. Take a look at the below references:
This will show you how to interact with the local database and store and retrieve info. Always a good thing to read the documentation.
This is a great resource for help all sorts of stuff. In this case, with SQL queries.
Test, test, test. With the above, you will be able to figure it out if you put your mind to it. Come back here and post specific questions with code samples of what you have tried if you get stuck.

Google Drive API Application Data folder, is it realy that difficult?

I want to store some application data on the google drive, for example to remember settings the user have made. Normally I will use cookies for this or the localStorage of the browser but this is browser depended and limited (storage size).
I google for some information about this functionality but didn't found something useful except the example of google itself. In this example (found here: https://developers.google.com/drive/appdata) they explain how to store some information. To me it looks more like sending an e-mail and they didn't explain how to replace some data. Quite complicated if you ask me.
I wonder why it must be that difficult to store a simple boolean, integer or string like you can do with cookies or the localStorage object. I doesn't have to know where it is located, just simple, you alter an identifier and a value, that must be it.
Does have somebody an example that makes this function easier to use? I mean is this the only way to do it? Does somebody has some experience with saving appdata?
Or does anybody knows a class that can simplify those things (like the PHP version)?
If you wish to store data in the users Google Drive, yes, it is that complicated. You are going to have to go through the OAuth2 process or one of the other handshake methods Google allows. However, if you wish to store that data into your own Google drive, which doesn't sound smart but I cannot tell from your question, you could make the process a lot easier because you could hard code your username and password into the header of the api calls you make. Again, that is not smart or recommended but because OAuth2 requires HTTPS its not suicide.
I'm sorry but it is not clear what you are asking. Please more specifically state your problem, otherwise this is the best answer anyone could give.

Storing user data for free

I will make a website where users log in to see the site's info organized in a way which is specific to each user, depending on the settings which they can set/save while logged in. But they won't be adding content or uploading anything. So I guess, it won't be a lot of data - just a couple lines of text for each user.
So, to start out, I'd like to use something free to store that user data. Dropbox or Google docs, my own compter.... I dont know.
And then later, when I get enough users to make the investment worthwhile, pay for a more legitimate solution.
My question is, in the meantime, what is the best way to store that user data? Should I use javascript and Google docs API to read/write to a spreadsheet?
What is going to be most convenient when my user base has grown enough and it comes time to move all that over to a larger system?
And are there any other concerns I should be thinking about?
Look into using a lightweight DBMS like MySQL. If you want, you can serve it locally using your computer, but don't expect it to handle a lot of traffic. It'd be better to find an old computer and use that as a server.
What is your hosting solution? Many include free mySQL databases which should be enough.
I would suggest using sqlite3 or something for a database setup. They can be very small files and easily manageable. In the long-run sqlite3 isn't a great choice. You would want to move to a heftier database assuming you rake in a lot of users.

Categories

Resources