If I have a base class such that
public abstract class XMLSubscription <T extends XMLMessage>
Is it possible to write a method in XMLSubscription that returns a class object of T?
The only possible solution that I came up with is to have each descendant of XMLSubscription have a method like:
public class XMLStatusSubscription extend...
I'm using Spring, but this question applies to all JSP-controller type designs.
The JSP page references data (using tags) which is populated by the corresponding controller. My question is, where is the appropriate place to perform formatting, in JSP or the controller?
So far I've been preparing the data by formatting it in my controll...
Hi everyone, here's the deal.
For my project I have to serialize and deserialize a random tree using Java and XStream. My teacher made the Tree/RandomTree algorithms, so I don't have to worry about that. What I don't know how to do is this: I am using FileInputStream to read/write the xml file that I serialized and deserialized, but ...
Hi,
After an upgrade to XP and Java 1.6 one of our intranet apps is experiencing a problem when running a java applet in the browser. The java applet is a document editor and accepts a parameter to where the document is located. I assume it copies this file to the users machine for editing. I wish I knew more but I don't have the source...
I am having difficulty with the following method. I can't figure out if my problem is, but I have narrowed it down to not populating the array list from the file. Any help is greatly appreciated.
private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {
//create arraylists
ArrayList<String> model = new ArrayList<Stri...
Is tight looping in a program bad?
I have an application that has two threads for a game-physics simulator. An updateGame thread and a render thread. The render thread is throttled by causing the thread to sleep for some milliseconds (to achieve the frame-rate I want) and the updateGame thread (that updates my in game objects positions...
How do I properly set the default character encoding used by the JVM (1.5.x) programmatically?
I have read that -Dfile.encoding=whatever used to be the way to go for older JVMs... I don't have that luxury for reasons I wont get into.
I have tried:
System.setProperty("file.encoding", "UTF8");
And the property gets set, but it doesn't...
Is it possible to create a new process on windows with a different user account? I know there are a context menu "Run as" but I want do it from Java. I have the username and the password.
...
If there are many return records from DB. It will get stackoverflow problem.
User is a class, which has a one to many relationship (to 3 other classes). When I print out the SQL, i found that the system runs the same query many time to get the data from DB. Does anyone know what the problem is?
result.addAll(getCurrentSession().cr...
Hi,
I'm begginer in java I'm reading data from serial port and I have stored the data in string array data is 24 byte length.
Data I'm getting as output: 12120814330006050.0
data also contains hexadecimal character in the string I want to read first character of the string. I have done:
String str=dispArray[i].substring(1,2);
int i= ...
I plan to use a distributed cache in my load-balanced webapp.
So I'm going to try to abstract out the common functions between apache ehcache and memcached.
My goal is to be able to make a simple configuration switch to select the caching solution to use. Should I go the SPI route e.g. like how XML parsers are wired in ?
...
I am developing a Web Album using Grails and for image processing, I am using grails-image-tools plugin. I need a functionality to resize the images if the uploaded images size is too big (for eg: more than 600 * 840 ) . In this case I need to resize this image to 600 * 840). What is the most efficient way to do this? Thanks a lot.
...
So in C#, I can treat a string[] as an IEnumerable<string>.
Is there a Java equivalent?
...
I ask because I am sending a byte stream from a C processto Java (through a priority middle ware). On the C side the 32 bit integer has the LSB is the first byte and MSB is the 4th byte.
So my question is on the Java side when we read the byte as it was sent from the C process, what is endian on the Java side?
A follow up question if t...
Lets say I have a concrete class Class1 and I am creating an anonymous class out of it.
Object a = new Class1(){
void someNewMethod(){
}
};
Now is there any way I could overload the constructor of this anonymous class. Like shown below
Object a = new Class1(){
void someNewMethod(){
}
publ...
Are there some practical programming situations for someone to declare a class abstract when all the methods in it are concrete?
...
I've just upgraded some old Java source which has been running on a Sun Java 1.4.2 VM to Sun Java (JRE) 6 VM. More or less the only thing I had to change was to add explicit datatypes for some abstract objects (Hashmap's, Vector's and so on). The code itself it quite memory intensive, using up to 1G of heap memory (using -Xmx1024m as a p...
It's been suggested that this might be a reasonable approach, in order to minimize changes to an existing server configurations, but is it actually valid/supported? I've not been able to find anything specific either way.
In practice, with a JBoss Portal V2.4.2 server, there appears to be some class-loading issues, so things such as the...
The company I work for sells a J2EE application that runs on Tomcat, WebSphere, or WebLogic. We have a customer that is trying to decide between Tomcat and WebSphere. They're leaning towards WebSphere because they're concerned that Tomcat has more security holes.
After searching around on the web, I've been unable to find any sites or...
I am developing an interface that takes as input an encrypted byte stream -- probably a very large one -- that generates output of more or less the same format.
The input format is this:
{N byte envelope}
- encryption key IDs &c.
{X byte encrypted body}
The output format is the same.
Here's the usual use case (heavily pseudocode...