For my new job I'll need to do Java development, which I have never done before. Nevertheless I have a fairly decent software development background, so it would be great to read a couple of books that won't be too simplistic (not "Java in 24 hours for the mentally deranged"-style ;-). Topics especially interesting for me are:
Language...
I have a simple key-value property file where I need to parse a value which is then to be assigned to an enum type. What is the best way to do this?
The only thing that comes up to my mind is something like iterating through all the possible values of the enums.toString and see if it equals any of them.
...
Hello,
I have created one Java desktop application.I have to run it from command line How should I do that ?
...
I would like to get access to the Tomcat internal data from a servlet (or filter). In particular, I would like to read information about busy threads, from thread pool manager. So, my question is if it is possible at all (I can imagine that it could be blocked for safety reason)? If it's possible, maybe someone could give me any advice w...
Why a developer should pay attention to Model-view-controller for designing a GUI? and is there other elements that a developer should pay attention for designing a GUI?
...
I'm not sure about the difference. I'm using Hibernate and, in some books, they use JavaBean and POJO as an interchangeable term. I want to know if there is a difference, not just in the Hibernate context, but as general concepts.
...
I have a Java and Tomcat-based server application which initiates many outbound HTTP requests to other web sites. We use Jakarta's HTTP Core/Client libraries, very latest versions.
The server locks up at some point since all its worker threads are stuck trying to close completed HTTP connections. Using 'lsof' reveals a bunch of sockets ...
I have an SWT app that has been developed on win32 and is now being ported to OSX. Everything works smoothly except for some visual quirks and one annoying problem.
The shell for this app is an image with rounded corners, so I'm using some code taken from one of the SWT snippets to create a shell with rounded corners. For some reason, w...
i got a problem.
suppose on the other side, the WSDL will be always changed,
for example, the web service on the otherside which descriped in the WSDL file has only method,
but the name of the method might always change, today call methodABC(), tomorrow will be change to methodDEFO()..
suppose in JAVA,
is there anyway, i can dynamica...
There are already some discussions here on stackoverflow about Java generics, but I am too stupid to solve this specific question. I have defined an interface in a project, and its implementation in another one. They are in different packages. Instead of implementing the method, the compiler complains in some workspaces:
Name clash: The...
Our application has ~10 threads doing separate tasks (no thread pools). We are not experiencing deadlock, but are always trying to lower latency to respond to a request so we are interested in determining which locks are the most contended. jconsole shows how often threads are blocked, and it isn't very often, but we still want to know...
I'm trying to write TIFF IFDs, and I'm looking for a simple way to do the following (this code obviously is wrong but it gets the idea across of what I want):
out.writeChar(12) (bytes 0-1)
out.writeChar(259) (bytes 2-3)
out.writeChar(3) (bytes 4-5)
out.writeInt(1) (bytes 6-9)
out.writeInt(1) (bytes 10-13)
Would write:
0c00 0301 0300 ...
In an OO component, when you have only one implementation available for an class and that class is not 'published' to other components, is it still advisable to have an interface and work with the interface instead?
I am fully aware of 'programming to an interface' design principle and also use it extensively.
Lately, I have been obs...
So, I'm creating a small web app using Wicket that will run on the google app engine. I'm using JDO, and so far have no problems persisting data (inserts) or querying data those same data objects. Maybe I'm missing some basic thing, I'm trying to take one of those persisted objects, change two values and then I want that modified objec...
Hi,
I'm stepping into the world of Servlets and 3.0 in particular and I saw certain methods and annotations used in examples and tutorials which talked about this being available when JAVA 6.0 is released (which it has) and now when I try to use the above annotation for example in Eclipse it does not recognize it although I have java 1.6...
I'd like to be able to conditionally replace a value in a ConcurrentHashMap. That is, given:
public class PriceTick {
final String instrumentId;
...
final long timestamp;
...
And a class (let's call it TickHolder) which owns a ConcurrentHashMap (let's just call it map).
I wish to be able to implement a conditional put m...
Is it possible to do a nested select in JPA QL?
How would I write the following SQL statement in JPA QL?
select * from preferences p left outer join (select * from preferencesdisplay where user_id='XXXX') display on ap.pref_id=display.pref_id;
The JPA entity PREFERENCES has a OneToMany relationship to PREFERENCESDISPLAY. I want to...
I want to take an XML file as input and output the same XML except for some search/replace actions for attributes and text, based on matching certain node characteristics.
What's the best general approach for this, and are there tutorials somewhere?
DOM is out since I can't guarantee being able to keep the whole thing in memory.
I do...
I have the following line that works for Firefox
assertTrue(!selenium.isElementPresent("//input[@name=\""+chosen.getField().getName()+"\" and contains(@style, \"color: rgb(255, 0, 0);\")]"));
But Fails in IE.
When i inspect the field in IE, i see the color style represented in hexadecimal. How would you represent the line above to w...
Is there a way in Java/J2ME to convert a string, such as:
{name:"MyNode", width:200, height:100}
to an internal Object representation of the same, in one line of code?
Because the current method is too tedious:
Object n = create("new");
setString(p, "name", "MyNode");
setInteger(p, "width", 200);
setInteger(p, "height", 100);
May...