Efiiciency for Pagination in Java [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am writing Pagination for a set of records in Java. Here i am talking to a service which fetches a result set of 500 per time. I interact with that service to display at most 50 records at a time with page markers.
Is it a really efficient model or if there is any other way to improve the suggested pagination model ?

Depends on your data.
If your data is rapidly changing, this definitely isn't a suitable method. I would suggest tweaking the service to return only as much requested records that are needed by the page.
If data is static and need not be time dependent, this should work fine. Just fetch the 500 records, put it in a local array and display from there. Once this is exhausted, replenish the same.

Related

What is the benefit of writing an object to a file? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I understand we can do this with file input and output, but why would we want to do this?
It is simply called persistence.
You nailed it: you want to be able to store information (for example after intensive computations) in a way that survives the lifetime of the current JVM process.
In that sense serialization is a (poor) version of database storage.
But of course, that comment is correct: this does not prevent the creation of objects. It is a mechanism to resurrect previous state into "new" objects.

What is the most efficient way to use database? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm new to using a database, specifically MySQL. I'm creating a web application for class in which you can look up the name of a book and it'll display the summary of the book. My question is should I send a query to the database that collects all of the books' data on initialization and put them into a HashMap inside a manager class for lookup or should I use a query each time to lookup a specific book information?
It depends on the data transport time I would say. If your average query time times the number of request goes faster than a script to put everything into a HashMap, use queries. Otherwise, use a script that collects everything and puts it into a HashMap.
But if you have thousands of rows, you should use queries, because otherwise you will use too much RAM.

How to set a restriction for each phone/user on my app? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm starting to build an app where people vote certain stuff just by clicking on happy/sad faces (kind of like grading it). The thing is that I dont want to make a log-in nor registration for my app (the reason is a long story). So is there any way that I can limit people's vote to 2 per day? Every phone/user could only vote twice a day, and that count will reset after 24h from the first vote.
You have tow options:
Limit the number of votes on the device, by saving the number of votes into persistant storage on the device with a timestamp and act accordingly.
Or (more secure, but also more difficult)
Track the installations as described here identifying app installation
And send the id with every request and validate on the server side.

What is the best way to create a data table in android? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I would like to create a table which is filled by data from DB. I know that it is possible to create a dynamic table using TableLayout but I'm not sure that it's the best solution im my case.
Here is an example of what I want to create(the first table on the page).
I'll give you my inputs on this.
If your data is limited and you are sure to display all of it in a single screen in a presentable manner, then yes, a TableLayout will suffice.
However, in a real world, flexibility counts so you should always consider the possibility that your data may expand in the future. Keeping that in mind, you should use a ListView or a RecyclerView in this case. Define a base layout for each row of your list or recycler view and then connect the data from your database to this view using a suitable adapter.
For starters:
https://developer.android.com/training/material/lists-cards.html

How to combine many(1000) png file together in one big file system where we can iterate and get all if needed [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am putting many images on HDFS. However each one is taking 64MB Block there.As the count of images are very high So wanted to put all image information in one big file. Now this will be feed to mapper to process it faster . What inputformat i can use? Or do i need to use sequencefile concepts ?i am not much sure as how to proceed further could someone please suggest some better way to deal this.
Just throw them all in a Zip.
Really you would be better off using a Database (for example MongoDB) and store them all in there though.

Categories