Where does ExtJS's store keeps all the data - html

I want to know where does ExtJS store keeps all the data? I know the data is stored in the memory but I want to know does it used HTML 5 local storage internally or if any other technique is employed?
Thanks,
Deepesh

It depends.
In every case, the data of the store is stored in a Javascript object. The store persists its data via a proxy. It is a matter of configuration how this data is stored. You can configure different types of proxies:
Client side storage
LocalStorageProxy - saves its data to localStorage if the browser supports it
SessionStorageProxy - saves its data to sessionStorage if the browsers supports it
MemoryProxy - holds data in memory only, any data is lost when the page is refreshed
Server side storage
Ajax - sends requests to a server on the same domain
JsonP - uses JSON-P to send requests to a server on a different domain
Rest - uses RESTful HTTP methods (GET/PUT/POST/DELETE) to communicate with server
Direct - uses Ext.direct.Manager to send requests
More details are in the docs.

The data is stored in an in memory collection called a MixedCollection. It's an ordered collection, but it also allows you to look up data by key, so it's like having an ordered hashmap.

Related

Writing multiple type of data into a list for it to be accessed by multiple threads

I send JSON's to my app via Postman in a list with a type of mapping(CRUD) to send it to my database.
I want my controller to put all this data, from multiple senders, in a list that will send the information to my DB. The problem is that i don't know how to store in the same list the Json and the Mapping, so when my threads do their work to know if that json must be inserted, updated, deleted and so on.
Do you guys have any ideea ?
PS: It is a spring-boot app that need to be able to send 12000 objects ( made from that jsons ) to the db.
I don't see a reason for putting all data in one list and sharing it later, each HTTP request receives own thread.
On decent server you can handle couple thousands of requests/sec which perform simple CRUD operations.

define a link (GET) on trigger

How can I send my mysql table parameters to a link through GET?
e.x. : http:/example.com/Send.ashx?id=[member.id]&name=[class.name]
You cannot access MySQL via http directly. You will need to set up a rest API server that handles http requests, makes the corresponding SQL queries, formats the result (typically as json or XML) and sends it back to the client.
In case you already have an API / web server, we need more detailed information on your setup

How to store info on client machine without using cookies in JavaScript

I am building a little HTML program (well, not little), but I have got options that I would like to permanently write to the client's machine without using cookies. reason being is cookies will expire, and have a storage limit of 4 KB. how would I do that without jquery.
Client side cookies can be deleted any time. Server side cookies cannot be deleted and the expiration date can be set. You can't write to a machine from an HTML page though, it's not allowable by any means. It would have to be a hack and a virus if such a violation would occur.
You should use HTML5 Local Storage.
To set a item to the storage
localStorage.setItem("person", "jones");
To get the item
var val = localStorage.getItem("person");
To remove the item
localStorage.removeItem("person");
Depending of what browser you use, most have 10mb of storage. read here
The storage can be stored as long as the user or the application allows it. read here
The localStorage can only store values as strings. If you want to store objects like json
var data= { person: "jones" };
localStorage.setItem("jsonPerson", JSON.stringify(data));
To read the json
var data = JSON.parse(localStorage.getItem("jsonPerson"));

Is it safe to store json object in HTML5 sessionStorage or localstorage?

hi to transfer json object from login page to index page i am storing json object in local storage/Session storage is it safe? if yes how i store >50 mb json object data in local/session storage if not what is the alternative?
Depends on how you define safe (e.g. from external or internal attacks? ) and what you want to save in the Storage.
You have to remember that every User can easily read out and manipulate the local/session storage via browser console.
Ask yourself those questions:
Why do I want to store this data in local storage?
What kind of data do I have? (password, username or whatever)?
Do you really have to store this data in local storage? Most of the time: nope
If the data consist of password, username, email-address, etc. : NEVER STORE IT IN LOCAL STORAGE!
If the data consist of meaningless stuff: Store it if you want to, but is it necessary? See Question 1.
Have in mind that local storage is NOT safe.

Read and write JSON file for mobile app

I am working on a mobile app. Since I wanted a solution that would work on multiple platforms, I started with Cordova. As I have much data to handle and many views, I decided to use Ember.
I need to use three different JSON datasets that are updated rather frequently in the database. To enable the mobile app to work offline, I will have to store the JSON data, as well as update them when the database is changed.
Questions
How can I retrieve JSON from another server(CORS blocked)?
How can the retrieved JSON be saved on device? [HTML5 LocalStorage(preferred) or FileAPI]
How to read JSON file and send data as model to templates? (I guess Ember.$.getJSON can do this)
Any help is welcome. Thanks!
Update 1
Since I ran into many issues using Ember-data, I am not using it in my app.
Found this link for cross-domain with ajax
Update 2
CORS can be solved only by JSONP or by setting ACCESS-CONTROL-ALLOW-ORIGIN in the reponse of the server(I tried many other solutions, and failed)
Since the api is in my server, I did the latter.
For 2 and 3, I think I could use this SO question
This is what I found out :
JSON data from a server in different domain
You cannot read JSON data from a server in another domain. This is due to the Same-origin policy implemented in browsers. A browser will retrieve your JSON but will not allow you access to the same. There are two solutions(AFAIK) to this problem :
Using JSONP - I'm not going into the details, but there are many links available for this.
Allow CORS from server - When the server sends JSONified data, you can add additional headers for ACCESS-CONTROL-ALLOW-ORIGIN. After retrieving the JSON from server, the browser checks for this header to either block or allow CORS. I used some decorators for adding crossdomain headers and then my data was successfully read in the browser.
Saving the json data
HTML5 makes everything easier. In your javascript, you just have to use :
localStorage["application.state.data"] = JSON.stringify(json);
or
localStorage.setItem("application.state.data", JSON.stringify(json));
Retrieve works just the same
var data = JSON.parse(localStorage["application.state.data"]);
or
var data = JSON.parse(localStorage.getItem("application.state.data"));