Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
In a recent interview with Amazon I have been rejected because I could not tell the advantage and disadvantage of making model and Entity classes different and same.
I have always created Model and Entity class same.
Can anybody help me on that with an example? Interviewer said you are making strong binding of UI+DB if you are keeping it same.
It's true by making same class for Entity and Model you are tightly binding UI and DB, simple example of why should avoid is -> most of the time, we modify response like adding DTO, modifying format of date and so on. which could impact your database calls (DTO layer).you can read more here
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
Where I can find a reference to which all data types come under certain media types?
For example, #Consumes(MediaType.APPLICATION_FORM_URLENCODED) can consume a String or MultivaluedMap in Java.
I would like to such reference. Any help is appreciated.
I found the answer for my own question. I am just putting it out here so that in future if anyone needs to refer can refer to it :
On the following oracle webpage refer to the table mentioned in section 'Using Entity Providers to Map HTTP Response and Request Entity Bodies'
https://docs.oracle.com/cd/E19798-01/821-1841/6nmq2cp22/index.html
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm trying to solve the following problem:
I have some expensive work to do which I then cache the result of
The work is keyed by a string
Many requests may arrive simultaneously for the same key
I'd like to avoid doing the work more than once per key
I'd like to add callbacks against the key which will be invoked when the work is completed; not all of these are known when the work is first submitted.
This feels like a problem which ought to have been solved already; does anybody know of a Java framework or library which covers it?
I can imagine a wrapper around guava's LoadingCache but I'm not aware of a library which does everything out of the box.
While LoadingCache#get is synchronous, it does get you 1-4 and there may be some mileage in using refresh which can return a ListenableFuture (although to get all the features you list it might become a fairly chunky wrapper?)
For Reference:
http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/cache/LoadingCache.html#refresh(K)
http://www.theotherian.com/2013/11/non-blocking-cache-with-guava-and-listenable-futures.html
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm looking for a Java/Android implementation of promises that allow chaining and joining.
With chaining I mean chaining then calls so code looks like synchronous.
// Example:
getCity().then(getRestaurants).then(findBestMenu);
With joining I mean waiting for multiple promises to be fulfilled, or any of them fail.
// Example:
Promise p1 = getFlights();
Promise p2 = getHotels();
PromiseManager.when(p1,p2).then(planTrip).fail(stayAtHome);
I have found these solutions:
RxJava-Promises supports chaining via PromiseFunction and RepromiseFunction.
jdeferred supports joining via DeferredManager. EDIT: It also supports chaining via DonePipe.
EDIT2:
RxJava or RxAndroid are for reactive paradigm. A bit more complex but powerful.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I have a table in my database. I am using jdbc to use this database. I want to update a particular data by subtracting it to some value.
Suppose a student with name xyz is there. Currently his marks in a subject is 50. I want to delete it by 10, then what would be the syntax? I am new to SQL.
More or less:
update students
set mark = mark - 10
where name = 'xyz'
Can't give a better answer than that, as your question is very limited in useful and concrete information. I'm sure you'll figure it out.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I am a complete newbie to Java programming and I am trying to learn caching and hash tables. I have seen tutorials online but they are complex, does anyone here know of any relatively short programs that utilise caching and hash tables?
Thanks for any help given
UPDATE:
I am basically starting from scratch. I know hash tables and sort of know caching (more simple caching programs would be much appreciated), but I don't get how the two work together. For example saving to a hash table and caching the data.
As the comments mention, a cache is just a store where you keep the output so you won't have to do the calculation again.
Here's a really simple example
Map<String,Double> answers = new HashMap<String,Double>();
// checking cache if we have the answer
If (answers.get("volatility") != null) {
System.out.println("volatility found in cache:" +
answers.get("volatility"));
}
// store a value in cache
answers.put("rate",1.887);