java

Output from a Java agent in Lotus Notes to the client status bar?

Does anybody know a way to get the behaviour of LotusScript print in a Lotus Notes Java agent, i.e. displaying the output on the client status bar? ...

Java's default JAXB implementation is chosen over my classpath.

I've written a java application that utilizes JAXB for XSL transforms. I've included the saxon9.jar in my classpath so that I can use XSLT 2.0 rather than XSLT 1.0 on the command line. java -classpath ./lib/saxon9.jar:./ -jar myApp.jar I've included code in my XSL to report the XSLT used. <xsl:comment><xsl:text > </xsl:text>XSLT Ver...

Counting nodes in a tree in Java

Hi, First of all, I swear this is not homework, it's a question I was asked in an interview. I think I made a mess of it (though I did realise the solution requires recursion). Here is the question: Implement the count() method which returns the number of nodes in a tree. If a node doesn't have either a left or right child, the relevan...

Converting java 1.5 source into 1.1 source

I am trying to convert java 1.5 source code into equivalent 1.1 source. My strategy so far has been to try to cross-compile 1.5 source into 1.1 byte code, and then decompile the 1.1 byte into 1.1 source code. I see that there are issues with cross-compiling using the -target option to javac. Can anyone explain the hang-up here? Is th...

Hibernate implementation. Are we paying the reflection penalty?

Long time ago, I was creating a mini ORM using reflection. While reading about reflection I got a similar answer like this: Java Reflection Performance Which makes completely sense and I quit my mini orm and sharpen my CTRL+C, CTRL+V keys ( the lib was intended to avoid having to rewrite again and again the same snippets for differen...

How do I write (test) code that will not be optimized by the compiler/JIT?

I don't really know much about the internals of compiler and JIT optimizations, but I usually try to use "common sense" to guess what could be optimized and what couldn't. So there I was writing a simple unit test method today: @Test // [Test] in C# public void testDefaultConstructor() { new MyObject(); } This method is actually ...

Is there any value in creating a pool of Dom4J SaxReader objects?

I'm using Dom4J 1.4.2. Right now my code creates a new SaxReader every time I want to parse a new XML document: SAXReader reader = new SAXReader( ); Is there any value in creating a pool of SaxReader objects and just reusing them? How much overhead is involved in creating a new SaxReader on every call? My code could get one from t...

Is there anything like branch/jump table in Java?

Hi all, does Java have something similar to a branch or jump table? A branch or jump table table is, according to wikipedia, "a term used to describe an efficient method of transferring program control (branching) to another part of a program (or a different program that may have been dynamically loaded) using a table of branch instruct...

Help Need To Correct Java Code

I have this but there is an error, I don't get it :(. I'm relatively new to Java. package hw; import java.util.Scanner; public class Problem1 { public static void main (String [] args) { int cost; int number; double cost_unit; double total; Scanner entrada = new Scanner(System.in); System.o...

Java : ignore single click on double click ?

Hiya - can anyone think of a good way to ignore the single click that comes with a double-click in Java ? I'm looking to have different behaviors for each such that: single-click paints crosshairs on the click point double-click selects an object on the screen, but should not paint crosshairs on the click point ... can anyone think...

Real time thread synchronization with normal threads

How would one synchronize one real-time thread with a normal thread in Java? Take for example a real-time thread that calculates some temperatures and the GUI thread that has to collect those numbers and show them on some controls. The implementation of the real-time library shouldn't matter as it should follow the specifications. ...

Is there a good reason to use "printf" instead of "print" in java?

I haven't had the chance to take any serious low-level programming courses in school. (I know I really should get going on learning the "behind-the-scenes" to be a better programmer.) I appreciate the conveniences of Java, including the ability to stick anything into a System.out.print statement. However, is there any reason why you woul...

How to generate Winamp-Style visualization effects with openGL? (Milkdrop, etc)

I'm trying to create an animated ambient abstract background for my game. I'm picturing something very similar to what Winamp has when you turn on it's visualization plug-in. Here's a link to some screenshots. I can handle tweaking the idea once I get something up and running that is acting generally how I want it, but I just have n...

Is there a better Java application framework than Swing?

I'm planning to work on some hobby Java projects. I've done some small-scale projects, so I'm familiar with the language itself and building a GUI with Swing. I'd like to make my work a little less ad-hoc and perhaps find some tools that might be useful out in the real world. NetBeans now comes bundled with the Swing Application Framewo...

JTable problem

I have one panel which i am adding to dialog from some othere frame. But my problem is, i want to close the jdialog when user presses "Enter", For Example, from frame-1 i am calling and adding the panel which contains table to the dialog from this frame, /* Frame_1*/ JDialog jd = new JDialog(); jd.add(panel1); // This panel come...

Can the uncommon maths library be trusted?

There is a Java library by the name of Uncommon Maths that claims to provide better random number generators than Sun and (potentially) even BouncyCastle. How one can determine whether their library can be trusted? I trust Sun and BouncyCastle because a lot of important companies use their stuff. It's not clear if Uncommon Maths falls in...

Getting input and output from a jar file run from java class?

Hi, I have a jar file that runs this code: public class InputOutput { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { boolean cont = true; BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while (cont) { System.o...

Is it possible to build a Java web application without using a framework?

If not what is a good friendly java framework for newcomers? I want to build something like twitter. ...

Is there an implementation of the ActiveRecord pattern in Java like the one from Ruby?

I'd like to have a ActiveRecord implementation in Java and before crafting my own, I'd like to know if there is an open source implementation of it. I am aware of other successful java OR maping tools like Hibernate, Castor, etc... and that is not what i want, i want a ActiveRecord like in RoR: RoR ActiveRecord .NET Castle ActiveRecor...

Commonly reusable annotations or commons annotations?

Are there any commonly usable annotations available? Similar to commons-lang? If not, have you seen any effective use of annontations (not built-in annotations) as part of any open source application development. I remember Mifos was using it for Transaction. Mohan ...