I'm trying to display certain data in my app using a graph.
The data is saved in Firebase database under multiple nodes, like the highlighted data in this database.
Is there any library that can be used to make real-time graphs from Firebase?
You might need to restructure your data, instead of storing the workout data in the user object, try breaking it out into it's own object.
/workouts {
/{refPush} {
date: '19-2-2018'
name: 'Test Graph 2',
set: '20',
uid: 'someUid',
}
}
Then you could access this information like;
firebase.database().ref('/workouts')
.orderByChild('set')
.equalTo('20');
Related
1.DatabaseReference db=FirebaseDatabase.getInstance().getReference("users");
1.Query query = db.orderByKey().equalTo(uid);
2.FirebaseDatabase.getInstance().getReference("users").orderByChild("token").equalTo(toKen)
Does any one of the above two codes written in Java Android Studio send the entire "users" node of Realtime Database to the client Android App or Only the the Fetched Records will be send to the client Android App. It Seems like that it sends the complete "users" node to the client Android App, because my realtime database bill is quite high and customers are low.
It seems you are looking for orderByChild(). To get the child node where the value of uid is equal to passed UID, try this:
DatabaseReference db=FirebaseDatabase.getInstance().getReference("users");
Query query = db.orderByChild("uid").equalTo(uid);
The documentation says,
Method
Usage
orderByChild
Order results by the value of a specified child key or nested child path.
orderByKey
Order results by child keys.
The second query looks fine and should fetch the node where the value of token is equal to the supplied token.
If the download size is higher than you'd expect based on the number of query results, check if you've defined an index on the token property. If no such index exists, Firebase will download all data under users to the client, and perform the sort/filter there. If an index is declared, the ordering/filtering is done on the server.
i don't get way to view images according my category my database will be like this
-id
-category : A
-image : URL
I WANT TO SHOW A category in A category activity
You'll need to run a query for that. Firebase has two databases these days and the code you need depends on which one you use.
If you're using the Firebase Realtime Database, the query is:
Query query = FirebaseDatabase.getInstance().getReference("images")
.orderByChild("category").equalTo("A")
After that you need to read the results of this query, as shown in this documentation.
If you're using Cloud Firestore, the query is:
Query query = FirebaseFirestore.getInstance().getCollection("images)
.whereEqualTo("state", "CA");
And then you need to read the results of this query as shown in this documentation.
I have data structure like this for my android app. That can login and only see their profile. I dont make add content or do saving data to the database. So i created the data manually and the users only read and display the data.
How to make login,refer with username = "71140011" and password = "123456" which is inside real time database and the 71140011 only can see their profile only. thanks
I know it is a non-relational database but this does not mean that relational data does not exist.
For example, I have a table that holds urls like this ( simplified ):
url | domain
and I have a table that holds domains like this ( simplified ):
domain | favicon_path
Because many different urls may have the same domain, I did not want to repeat the favicon_path for each domain when pulling the data for sending to the view.
Hence I used a simple ( simplified for example ) join command when I need the data.
"SELECT bookmarks.*, domains.favicon FROM bookmarks JOIN
domains ON bookmarks.domain=domains.domain"
How would I handle this scenario using no-sql?
I plan on implementing no-sql using indexedDB on the client ( javascript ) and MongoDB on the server ( java ).
If you want to use document-oriented DB, you can use this structure of documents:
URL_ID : {
"domain":"id_of_domain",
"another_staff": "..."
}
DOMAIN_ID : {
"favicon_path" : "path or id of another document",
"another_staff": "..."
}
So you can get document with URL_ID by id from database and then get document of type Domain.
ADDITION:
You can use the following approach for generating id. Create special document (like sequence) which will have only one field - current_value_of_sequence. Every insert to DB you have to get this sequence and increment it. Some DB like Couchbase have low-level support of this mechanism, which very efficient and thread-safety.
From years of work expierence in IT area, I would say most of the business models could be normalized as simple as these two types of data structure:
Entity info.
Entity list.
For example, in a book store business, we will have the Book entity, and many list that containing all of the books or a subset of the whole books.
With a NoSQL database, such as Redis or SSDB, the Book entity is stored with Key-Value, where key is the book sn, and value is the stringified book info(title, publish date, description, etc). While book list(list by publish date, list by price, etc) are stored in zset data type.
In Google app engine, how can i delete multiple data selected in check box. For a sample i had attached the image below. here i had selected the multiple check boxes and the data shown are stored in the Google app engine.
i have my jsp code for check box like this,
<input name="delete" type="checkbox"/>
can anyone suggest me how to select the data and delete it from Google app engine.
Edited:
For storing the data i used,
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Entity employee = new Entity("Employee");
employee.setProperty("First Name", fname);
datastore.put(employee);
For retrieving the data i used,
Query query = new Query("Employee");
List<Entity> emp = datastore.prepare(query).asList(FetchOptions.Builder.withLimit(20));
for (Entity user : emp){
// inside the table
user.getProperty("File Name")}
By this i can retrieve the data.
First of all, I recommend that you use two frameworks to make your life easier:
Stripes
Objectify
OK, here you go: I'm not sure to which degree your question is a basic JSP/Servlet question or a specific Appengine question. However, you have to do the follwoing:
Have a list of checkboxes on your JSP page, like this: <stripes:checkbox name="employees[${loop.index}].id" value="${employee.id}"/> (see: http://www.stripesframework.org/display/stripes/Indexed+Properties)
Pass a list of IDs (of the entities that should be deleted) to the Servlet.
Delete the entities based on these IDs.
Here's the catch: Appengine can terminate the request before all entities are deleted. That can happen if the request takes too long. Therefore you should delete the entities asynchronously, using chunks of data. See this answer for further information.