I have an ArrayList<String> that I'd like to return a copy of. The ArrayList clone method has the following signature:
public Object clone()
After I call this method, how do I cast the returned Object back to a ArrayList<String>?
...
Is it possible, in Java, to make a JPanel skip drawing its background thus being transparent except for the components on it?
...
We try to use Java and UTF-8 on Windows. The application writes logs on the console, and we would like to use UTF-8 for the logs as our application has internationalized logs.
It is possible to configure the JVM so it generates UTF-8, using -Dfile.encoding=UTF-8 as arguments to the JVM. It works fine, but the output on a Windows console...
Is there any clear documentation on the binary formats used to serialize the various MFC data structures? I've been able to view some of my own classes in a hex editor and use Java's ByteBuffer class to read them in (with automatic endianness conversions, etc).
However, I am currently running into issues while trying to bring over the ...
I know this rather goes against the idea of enums, but is it possible to extend enums in C#/Java? I mean "extend" in both the sense of adding new values to an enum, but also in the OO sense of inheriting from an existing enum.
I assume it's not possible in Java, as it only got them fairly recently (Java 5?). C# seems more forgiving ...
I have a class which is a wrapper class(serves as a common interface) around another class implementing the functionality required. So my code looks like this.
template<typename ImplemenationClass> class WrapperClass {
// the code goes here
}
Now, how do I make sure that ImplementationClass can be derived from a set of classes only, s...
I've got a J2SE application that I am maintaining uses JNDI.
(It uses JNDI to find it's J2EE application server.)
It has pretty poor error reporting of failure to find the JNDI server.
I've been looking around fora way to display which server the InitialContext is trying to talk to.
Has anyone got a neat way to do this ?
...
I am building a java server that needs to scale. One of the servlets will be serving images stored in Amazon S3.
Recently under load, I ran out of memory in my VM and it was after I added the code to serve the images so I'm pretty sure that streaming larger servlet responses is causing my troubles.
My question is : is there any best pr...
I'm having some internationalisation woes:
My UTF-8 string fields are being rendered in the browser as ???? after being returned from the database.
After retrieval from the database using Hibernate, the String fields are presented correctly on inspection using the eclipse debugger.
However Struts2/Tiles is rendering these strings as ?...
I'm returning to c++ after being away for a bit and trying to dust off the old melon.
In Java Iterator is an interface to a container having methods: hasNext(), next() and remove(). The presence of hasNext() means it has the concept of a limit for the container being traversed.
//with an Iterator
Iterator<String> iter = trees.iterator...
In our application, we are using RMI for client-server communication in very different ways:
Pushing data from the server to the client to be displayed.
Sending control information from the client to the server.
Callbacks from those control messages code paths that reach back from the server to the client (sidebar note - this is a side...
Is there a way to globally make right click also select the element that you right click on? From what I understand this has been a bug in Swing for a long time likely to never be fixed because at this point applications depend on it. Any advice on doing this on a global scale? Perhaps on the L&F?
...
Just got a request from my boss for an application I'm working on. Basically we're getting an email address setup for an external client to submit excel files to.
What I need is a way to automatically pick up any email sent to this address, so I can take the attachment, process it and save it to a folder.
Any information of even where...
Is the standard Java 1.6 javax.xml.parsers.DocumentBuilder class thread safe? Is it safe to call the parse() method from several threads in parallel?
The JavaDoc doesn't mention the issue, but the JavaDoc for the same class in Java 1.4 specifically says that it isn't meant to be concurrent; so can I assume that in 1.6 it is?
The reason...
I'm looking for a builder for HQL in Java. I want to get rid of things like:
StringBuilder builder = new StringBuilder()
.append("select stock from ")
.append( Stock.class.getName() )
.append( " as stock where stock.id = ")
.append( id );
I'd rather have something like:
HqlBuilder builder = new HqlBuilder()
.selec...
A simple question, but could someone provide sample code as to how would someone call a web service from within the JBoss Seam framework, and process the results?
I need to be able to integrate with a search platform being provided by a private vendor who is exposing his functionality as a web service. So, I'm just looking for some guid...
I'm looking for a simple solution for a yes/no dialog to use in a Java ME midlet. I'd like to use it like this but other ways are okey.
if (YesNoDialog.ask("Are you sure?") == true) {
// yes was chosen
} else {
// no was chosen
}
...
The code
private SomeClass<Integer> someClass;
someClass = EasyMock.createMock(SomeClass.class);
gives me a warning "Type safety: The expression of type SomeClass needs unchecked conversion to conform to SomeClass<Integer>".
...
In the following snippet
public class a{
public void otherMethod(){}
public void doStuff(String str, InnerClass b){}
pubic void method(a){
doStuff("asd",
new InnerClass(){
public void innerMethod(){
otherMethod();
}
}
);
}
}
Ss there a keyword to refer to the outer class from the inne...
I'm working on a project where we're using a Java applet for part of the UI (a map, specifically), but building the rest of the UI around the applet in HTML/JavaScript, communicating with the applet through LiveConnect/NPAPI. A little bizarre, I know, but let's presume that setup is not under discussion. I started out planning on using j...