java

"No suitable driver" problem with Hibernate3, PostgreSQL 8.3 and Java 5

Hi. Does anybody know what's going on here: I run hibernate 3.2.6 against a PostgreSQL 8.3 (installed via fink) database on my Mac OS X. The setup works fine when I use Java 6 and the JDBC 4 driver (postgresql-8.3-603.jdbc4). However, I need this stuff to work with Java 5 and (hence) JDBC 3 (postgresql-8.3-603.jdbc3). When I change the...

What is the best way to allow both a servlet and client-side scripts read the same file?

We want to share user validation configuration between a Java validation class (for sanity checking) and a Javascript-enabled form web interface (for usability). What's the best way to deploy this static file in our web application so that it is both available to the server-side code, and available via a URL accessed by the client? So f...

What component should I use to draw a dendrogram in Java?

Dendrogram is not a regular diagram. Should I use any component from javax.swing.* library, or just draw it with java.awt.Graphics? ...

Why doesn't java's assert statement allow you to specify a message?

Seems likes it might be useful to have the assert display a message when an assertion fails. Currently an AssertionError gets thrown, but I don't think you have the power to specify a custom message for it. Am I wrong? If I am please correct me, and if I'm correct can you provide a mechanism for doing this (other than creating your ow...

Java image library to deskew and crop images

Does anybody have a suggestion for a java library that performs automatic cropping and deskewing of images (like those retrieved from a flatbed scanner)? ...

Is this way of detecting heartbeats threadsafe and consistent?

This question has been discussed in two blog posts (http://dow.ngra.de/2008/10/27/when-systemcurrenttimemillis-is-too-slow/, http://dow.ngra.de/2008/10/28/what-do-we-really-know-about-non-blocking-concurrency-in-java/), but I haven't heard a definitive answer yet. If we have one thread that does this: public class HeartBeatThread extend...

Reporting Services WS from Java - Getting (401)Unauthorized

We're writing a web application that is trying to replace all ReportManager functionality using calls to Reporting Services SOAP API. We started working with SSRS 2008 and had our Java code working correctly. We've since had to downgrade to SSRS 2005 and now we're having problems connecting to the Server to get the list of reports avai...

Building with ant : dynamic build options?

With multiple developers working on the same Tomcat application, I'd like to tell the application to install to a different path, based on the current user and revision control client/view. So, if Bob is building, the app should be installed in Bob's test environment, maybe /bob1 or something like that. Bob might have several revision ...

SWT Image concatenation or tiling / mosaic

I have an Eclipse RCP application that displays a lot (10k+) of small images next to each other, like a film strip. For each image, I am using a SWT Image object. This uses an excessive amount of memory and resources. I am looking for a more efficient way. I thought of taking all of these images and concatenating them by creating an ...

Should I put html and java files in the same package (folder) in Apache Wicket ?

I wonder if there is an example which html files and java files are resides in different folders. ...

Why is Java on a Vista box reporting it is on XP?

I have stumbled across something truly puzzling regarding System.getProperty("os.name"). According to a Java bug on the matter and the Java 5 release notes (search for "os.name"), there was a bug in Java with early "longhorn" versions of Vista that should have been fixed in v5 release 10. However on my Vista SP1 box - using both v5 rele...

What is the equivalent of Oracle’s REF CURSOR in MySQL when using JDBC?

In Oracle I can declare a reference cursor... TYPE t_spool IS REF CURSOR RETURN spool%ROWTYPE; ...and use it to pass a cursor as the return value... FUNCTION end_spool RETURN t_spool AS v_spool t_spool; BEGIN COMMIT; OPEN v_spool FOR SELECT * FROM ...

Question about decorator pattern

I'm a beginner when it comes to design patterns , and I have a question related to the decorator design pattern . Presuming I have a class named A , and I want to use the decorator design pattern . Correct me if I'm wrong , but for that to work , we'll need to create a decorator class ( ADecorator ) , which will hold a reference to an A ...

AJAX/jsp/HTML vs Applets

Which approach is better? Having jsp/HTML based web application which allows you to traverse web pages in the browser. An applet based web application which opens up a Swing applet screen? ...

NoSuchPortException using RXTX Java library on Windows?

I have followed the instructions to setup rxtx on windows from http://www.jcontrol.org/download/readme_rxtx_en.html. What I did exactly was copy rxtxSerial.dll to "C:\Program Files\Java\jdk1.6.0_07\jre\bin" and copied RXTXcomm.jar to "C:\Program Files\Java\jdk1.6.0_07\jre\lib\ext" (my JAVA_HOME variable is set to C:\Program Files\Java\j...

Convert frustum to a projection matrix in Java 3d

I need to prepare for my exam and this is the probable question for the test. Given a frustum method such as frustum(-1,1, -0.5, 0.5, 1, 2) how to convert this to a projection matrix? The above example from my textbook but the writers don't define it in detail. If anyone can explain this in detail, I'd appreciate very much. ...

Mixing different versions of Java libraries

My project uses Java libraries that have their own dependencies (Hadoop, Jetty for example). I end up with different versions of the same dependencies, like ant 1.4.5, 1.4.6. My project may want to use ant 1.4.7. This is a small example, can get more complicated with larger dependencies like HTTP Commons. How do I get all the librari...

How do I make for loops run side by side?

I have been working on a childish little program: there are a bunch of little circles on the screen, of different colors and sizes. When a larger circle encounters a smaller circle it eats the smaller circle, and when a circle has eaten enough other circles it reproduces. It's kind of neat! However, the way I have it implemented, the pr...

How do I use JDK6 ToolProvider and JavaCompiler with the context classloader?

My usage case is compiling generated source files from a java program using the ToolProvider and JavaCompiler classes provided in JDK 6. The source files contain references to classes in the context classloader (it runs in a J2EE container), but not in the system classloader. My understanding is that by default the ToolProvider will cre...

Looking for a good WebSphere book

My spouse is looking for good book on WebSphere. Preferebly from starter to advanced. She is an experienced developer. Can anybody reccommend a title? Thanks in advance. ...