I’m trying to make a threaded TCP server that accept multiple client. It’s only accepting one client. Any idea on how to make the server accepting multiple client? Here is what I tried so far: I changed the server code. I ran both the server and the client, but it seems that it’s only one th…
Tag: java
Comparing dates with JUnit testing
Hello I’m new to the site and have a issue with my application using JUnit testing. My issue is when I try to compare the Date method with itself it always fails. I printed the Date object in the test to see the problem and always end up with the package name and random letters. Here is the Date constru…
android getlastknownlocation always null in emulator
It seems a common issue, but i really can’t understand why is it happening even though i read ton of simialr issues. I am playing with a basic location class on a emulator device, i set everything – permissions (FINE and COARSE) , i have set the coordinates in the DDMS i also tried using the telne…
Plugin org.apache.maven.plugins:maven-compiler-plugin or one of its dependencies could not be resolved
I’m having some issues to configure properly my eclipse to work with maven. I create a new project, this one is correctly build with maven in command line (mvn install), but in Eclipse I got this error: CoreException: Could not get the value for parameter compilerId for plugin execution default-compile:…
How to put a dynamic drop-down list in Eclipse Kepler toolbar?
I’m working on an Eclipse plug-in. With Indigo, a drop-down list in the toolbar like the one below works perfectly. Drop-down list in the toolbar, the currently selected item is shown when the list isn’t open It is built like this (where the MyList instance is dynamically constructed): However, th…
Is there such a thing as a “local interface” in Java?
Java allows me to define local abstract classes, like in this example: For some reason, when I try to define a “local interface” instead of the local class, like this: Java complains that “The member interface Bar can only be defined inside a top-level class or interface”. Is there a r…
How can I make my class iterable so I can use foreach syntax?
I have Book and BookList classes. BookList is something like this: In my main class I want to print titles of books with in a for each loop: Eclipse says: Can only iterate over an array or an instance of java.lang.Iterable How can I get this working? Answer You need to implement the Iterable interface, which …
What are template classes in Spring Java? Why are they called templates? For example jdbc-template, jms-template etc
I’m new to Java. I’ve only been programming it for about a year. What does Spring mean by the use of templates? In Spring, there is jdbc-templates, jms-templates etc.. What are template classes in java? Are they a special kind of design pattern or what? Thank you in advance. Answer They are called…
Get URL(link) of a public S3 object programmatically
I am storing one public object in AWS S3 bucket using given java API in my server Now i need to return back the public URL of the S3 object to my client Till now i have’nt found any API call that can return the public URL(or link field) of a S3 object Is there any way to get the
Query creation in Spring Data – dynamic where clause
Is there a way in Spring data to dynamically form the where clause? What I want to do is have a method (which is like the findBy / get method) which runs a WHERE and AND using the mentioned properties which are NOT NULL. For example, Our method looks something like this Thanks. Answer Take a look at JPA Speci…