java

Running Selenium Tests through JUnit in Hudson

Hi, apologies for the somewhat confusing title :-) Basically, I've configured my Selenium tests to run through JUnit when I build the project through maven. If I start my Selenium Server in a command prompt and then run the maven build goal in another cmd prompt then the tests runs as expected. I figured that this process would be easy...

Has anyone done crosshairs that follow the mouse in JFreeChart?

We are using JFreeChart to make XY plots and we have a feature request to do a crosshair that moves along with the mouse and highlights the data point that most closely maps to the x-value of the mouse. You can see a similar example at Google Finance - http://www.google.com/finance?q=INDEXDJX:.DJI,INDEXSP:.INX,INDEXNASDAQ:.IXIC. Those ...

RMI registry is empty after restart

I am using this plugin (it's pretty cool). Needless to say, I am an RMI novice. I followed the tutorials and was able to put together a sample application. I do not understand though why every time I stop and restart my local RMI registry the remote objects that were bound to it just vanish. Is this normal behavior? I was under the imp...

Can't open HPROF file with Eclipse Memory Analyzer

Eclipse Memory Analyzer prompts me only with this message: "Invalid HPROF file header". Stack dump: java.io.IOException: Invalid HPROF file header. at org.eclipse.mat.hprof.AbstractParser.readVersion(AbstractParser.java:135) at org.eclipse.mat.hprof.Pass1Parser.read(Pass1Parser.java:69) at org.eclipse.mat.hprof.HprofInd...

How to inject a Spring bean into a Seam context?

I need to inject a Spring bean into a Seam context. Unless I declare the spring bean as a EJB, I cannot get it injected into other seam-managed components. But when I do this, all the spring injected fields are usless cause Seam creates new instances at run-time. I also tried to add the <seam:component/> element to the spring bean defi...

try and catch in for statements

how can i rewrite the following code using try and catch statements,catching any exceptions that might be thrown for (j=0; j<limit; j++) { x=Integer.parseInt(keyboard.readLine()); y[j]=1/x; } ...

WSDL - to Java (IBM Rational Application Developer) from BizTalk

In Biztalk, I always make the root element and the typename the same as the filename (less the .xsd extension). We have an orchestration, published as WCF web service (Basic Http Binding). When Java (RAD) pulls the WSDL and generates classes and packages, it builds a package and a class name with the same name, thus it won't compile w...

clarification of cursors in oracle with jdbc

I have situation where a 3rd party open source product I am using is running out of cursors in Oracle and receiving the error: java.sql.SQLException: ORA-01000: maximum open cursors exceeded My maximum cursors is set to 1000 and I am trying to figure out if the code that is reaching this limit is doing something incorrectly, or if I sim...

Java Strings and StringPool

public String makinStrings() { String m = "Fred47"; String s = "Fred"; s = s + "47"; s = s.substring(0); return s.toString(); } How many objects are created by the code? I made a simple test: public static void main(String[] args) { String m = "a"; m += "bc"; String s1 = "mabc".substring(1); String s2 = "ab...

Handle Transaction on differents EARs

Hello, what is the best practice to handle multiple EARs and the same transaction, as far as we know we need to apply XA concepts in order transaction works correctly. but apparently in currents project that we've been working on, this is not strictly necessary for creates and updates; however if we try to retrieve any collection from an...

C++ client for Java RMI? Or any other way to use Java from C++?

Hi, We need to use a Java library from C++ code. An idea that I had is that if we could build a C++ client for Java RMI (ideally using some framework or wizard), than we could run the Java lib as a separate server. This seem cleaner than trying to run Java VM within a C++ application. Alternatively, if you have any other idea on how t...

Extract Integer Part in String

What is the best way to extract the integer part of a string like Hello123 How do you get the 123 part. You can sort of hack it using Java's Scanner, is there a better way? ...

In Netbeans, how do I type a non-existent method and have the method get generated automatically?

In other IDEs, I can type a method as if it existed, hit a key combination and the method is generated. For example, I type: public List<String> getIds() { int max = 4; return generateRandomArray(max); } As of now, the method generateRandomArray doesn't exist. I then hit a key combination and it generates: private List<Stri...

Performance penalty of getSerializedSize() in Protocol Buffers

Is there a performance penalty for calling getSerializedSize() on a GPB message before serializing the message with writeTo(OutputStream)? I need to be able to know the size of a message before writing it to an output stream. I'm using GPB on Java. ...

Show/Hide JMenuItems in a JPopupMenu based on a JTree's selection.

I have a JTree which displays a JPopupMenu when I right click nodes in the JTree. What is the best way to hide/show or enable/disable certain JMenuItems in my JPopupMenu based on the node selected in the JTree? The first solution that came to mind was to add a TreeSelectionListener to the JTree for the 'value changed' event. In the even...

CXF Service Assistance

I'm not a Java programmer by any sense, so I apologize if this is a stupid question. I have a service that was given to me, that basically searches the inventory of a future partner. The file they sent is a compiled .jar file, and a wsdl file. The read me file states that it can be used with XFire or CXF. The question is, how do I set th...

Pitfalls of Event Handling in Java

I'm working on a program that needs a Java object to have an event. I'm quite familiar with how this works in C#, having had enough experience to learn the pitfalls. What are the pitfalls of working with events in Java? How are they different from events in C# 2.0? Example: An object changed event to prompt a save from the owner ob...

delete trigger in quartz

Is there a way to delete a scheduled trigger with a specific job? It seems that only way to delete a trigger is to delete the whole job and then re-register the job and trigger. I've a job which can potentially have 100+ triggers and I really don't want to delete the job and re-register all the triggers when I just have to delete 1 trig...

Java: Difference in usage between Thread.interrupted() and Thread.isInterrupted()?

Java question: As far as I know, there are two ways to check inside a thread whether the thread received an interrupt signal, Thread.interrupted() and Thread.isInterrupted(), and the only difference between them is that the former resets the internal interrupted flag. So far, I've always used Thread.isInterrupted() and never had any pro...

MVC on the command line

Hello I am looking into the MVC from a Command line point of view (not web and no framework).. nice and simple. the only thing that confuses me is the View part of this? (well it may not be the only but its the main one) from the IBM site the view has the following definition The view provides the presentation of the model. It is...