java

Database record reverting after manual change

Problem solved: Thanks guys, see my answer below. I have a website running in Tomcat 5.5 hooked up to a MySQL5 database using Hibernate3. One record simply refuses to keep any changes performed on it. If I change the record programmatically, the values revert back to what they were previously. If I manually modify the record in the d...

What's the best way to learn .NET?

I've been developing Java EE for quite a while now. I've used WebLogic, Tomcat, Spring, and Hibernate extensively, so I have a mental model of what features are available and how things are developed and deployed. The problem that I have with .NET is that I don't have a clear mapping of its features onto Java EE. Here's what I know so...

Multi-IDE Support in Java for one Team

What is the best way to allow a team of programmers to use Netbeans, Eclipse and IntelliJ on the same project, thus eliminating the "which IDE is better" question. Which files should or should not be checked into source code control? ...

Does C++ still matter?

I am a CS student currently learning C. I'd like to get into low level programming, whether as a hobby or career and may contribute to some open source projects down the line. So far I really enjoy C and think I will continue down the abstraction level and take ASM next semester. The question I have is this, is knowing C enough to be a...

Install [java library] in Eclipse

I just downloaded Eclipse several hours ago, and needed to add Java3D to the classpath. Installing it went without a hitch, but Eclipse can't seem to find the documentation folders so that it can give super-IDE functionality, such as autocomplete and method signatures. While I know how I would add them individually, this lead me to the ...

Is there a way to tell maven where to place the artifacts ?

I am running both maven inside the m2eclipse plugin, windows command line and my cygwin command line. cygwin's bash shell dumps artifacts into the cygwin /home/me/.m2 directory but m2eclipse & windows shell (on vista) uses /Users/me/Documents/.m2 Is it possible to tell the mvn command to use one central .m2 directory ? Thanks ...

What's the best way to add a self-update feature to a Java Swing application?

I'm trying to figure out a way to add a self-update feature to a Java/Swing application I'm working on. Basically I've got a bunch of jar files with extra functionality to be re-deployed to the installed users when they change. Nothing complicated, just check if a new version has been released, download them over HTTP, and then optional...

wrapped exception from a component

There is this style of exception system where a component throws component-specific exception. For example, all data access classes throw DataAccessException. In this style, I often find myself having to catch and rethrow the component specific exception, because called methods are delcared as throws Exception: try { int foo = foo(...

How do I unit test a Java method which uses ProcessBuilder and Process?

I have a Java method which starts up a Process with ProcessBuilder, and pipes its output into a byte array, and then returns its byte array when the process is finished. Pseudo-code: ProcessBuilder b = new ProcessBuilder("my.exe") Process p = b.start(); ... // get output from process, close process What would be the best way to go ab...

How do commercial Java static analysis tools compare with the free ones?

I'm familiar with a handful of the free static analysis tools available for Java, such as FindBugs and PMD. What I'd like to know is how the commercial products such as Klocwork and Coverity stack up against these. What are their strengths and weaknesses? ...

How do you debug a series of Aspect in eclipse?

I've got a chain of aspects that are being executed in some cases but not in others. The stack typically looks something like this w/o giving an context information. There doesn't appear to be any logging that I can enable either. Thanks for any help on this. GeneratedMethodAccessor163.invoke(Object, Object[]) line: not available De...

Best approach to use in Java 6 for a List being accessed concurrently

I have a List object being accessed by multiple threads. There is mostly one thread, and in some conditions two threads, that updates the list. There are one to five threads that can read from this list, depending on the number of user requests being processed. The list is not a queue of tasks to perform, it is a list of domain objects t...

What is the best way of parsing many complex command-line arguments in Java?

I have used getopt in Python and was hoping there would be something similar in Java. Please give a reason why your answer is better than the others. ...

Java library to read a Microsoft Media Server (MMS) stream

Hi, I would like to know if there is available any Java library to read a Microsoft Media Server (MMS) stream. Thanks, Douglas ...

recursion instead of multi-loops

I want this method to work for any given number of arguments, i can do that with code generation(with a lot of ugly code), can it be done with recursion? if so how? I understand recursion, but i dont know how to write this. private static void allCombinations(List<String>... lists) { if (lists.length == 3) { for (String s3 : lists[0]...

Best API for simple 2d graphics with Java

I'm not sure what the best api for simple 2d graphics with Java is. I know java.awt.Graphics2D was the standard but has it been replaced? Swing is the new api for java GUI apps but it seems a bit heavy for what I want. What I really want is something like the C SDL(http://libsdl.org/) library. ...

Why does AbstractQueuedSynchronizer interrupt on acquring lock

I was looking at the source code of java.uti.concurrent.locks.AbstractQueuedSynchronizer and the acquire() method looks something like this - public final void acquire(int arg) { if (!tryAcquire(arg) && acquireQueued(addWaiter(Node.EXCLUSIVE), arg)) Thread.currentThread().interrupt(); } Why does it interrupt the t...

Java: How do I get a platform independent new line character?

How do I get a platform independent newline in java? I can't use "\n" everywhere. ...

How to use Vista's SuperFetch with Eclipse ?

Vista's SuperFetch works well with applications installed, but it does not seem to do so with Eclipse, which is just copied in a directory. Does anyone know how to correct this ? Or is it simply not possible ? [I hope this one will not be closed as "not programming related", since I need Eclipse on my machine for programming ;-) ] ...

Configure multiple keystores in JBoss depending on requested hostname

Hello, I have my J2EE application deployed into a JBossAS. My Application has to respond to two different hostnames (https://foo.com/myApp and https://bar.com/myApp). It is the same instance of the app serving those two hostnames. But I don't know how to configure the keystores. I need different keystores for each hostname. Is there a ...