java

Java parallel work iterator?

I'm looking for a class where I can override a method to do the work, and return the results like an iterator. Something like this: ParallelWorkIterator<Result> itr = new ParallelWorkIterator<Result>(trials,threads) { public Result work() { //do work here for a single trial... return answer; } }; while (itr.hasNext()) { ...

ColdFusion 8 Performance & Load Monitoring

Question: What are tips and tools you can give us to help troubleshoot & monitor performance on ColdFusion 8 & the JRE? What we're currently doing: We currently use a combination of the following to help us, but feel like we're not really getting anywhere. I'd love to be able to have a peak into the JRE to see what's going on. Fusion...

Which phones support which J2ME (Java Micro Edition) spec?

Hello! I just can't find an up-to-date chart about which mobile devices support which Java Micro Edition version. I'm especially interested in Nokia smartphones and their support for the new JME 3.0. (I wonder that Sun doesn't seems to provide such information.) Please, provide me some links, if you know any! EDIT: I'm probably mixi...

SVN Syncing with Eclipse IDE 3.5.0

I am currently using Eclipse 3.5.0 (Build id: 20090619-0625) with Subeclipse for SVN. I am looking for the feature that will update my local machine with the latest code that resides in the repository. I have seen the Team > Synchronise With Repository option, but i'm not sure if this will do what I want it to do. I don't want to commit...

Display form-processing results on current page in JSP

Currently I'm able to send some form data from an HTML page to a Servlet, process it, and return the result by forwarding/redirecting to a displayresults.jsp page; However I'm wondering if there's a way to process a form submission in this fashion and then return the results to the initial page? So that whatever I wish to return shows up...

Best practices for integration tests with Maven?

I have a project which I am building with Maven which uses Hibernate (and Spring) to retrieve data from a database, etc. My "tests" for the DAOs in my project extend Spring's AbstractTransactionalDataSourceSpringContextTests so that a DataSource can be wired into my class under test to be able to actually run the query/Hibernate logic, ...

Manually Dispatching a DocumentEvent for testing UI element validation code

Hi. I'm testing a Swing GUI application using the UISpec4J testing framework. I'm testing validation code on a JTextField, but the framework does not support focus-change events, as it runs the application in a headless fashion. The text field has a DocumentEvent attached to it that activates the validation code. I'm trying to figure o...

Creating multithreaded Java server and clients, but messages have to be in XML format

Hi, I've got to write a multithreaded chat program, using a server and clients but each message sent has to be in XML. Is it simpler/easier just to write out all the code in java, and then try and somehow alter it so the messages are sent in XMl format, or would it be simpler just to try and go for it in XML and hope it works. I'll ad...

Sharing a Java synchronized block across a cluster, or using a global lock?

I have some code that I want to only allow access to by one thread. I know how to accomplish this using either synchronized blocks or methods, but will this work in a clustered environment? The target environment is WebSphere 6.0, with 2 nodes in the cluster. I have a feeling that synchronized won't work, since each instance of the ap...

How do I remove component from JFrame that uses BorderLayout.

The container uses a BorderLayout. I have a JPanel that I added to the CENTER. However the JPanel doesn't have a variable name for it. I could do contents.remove(nameofPanel) But since I added it like this contents.add(new CustomJPanel(), BorderLayout.CENTER); Now I'm trying to remove the current CustomJPanel and add a new one. How d...

Getting error "bash: appletviewer: command not found".

Hi, I'm trying to learn Java and I'm having problems with the appletviewer command. I am using openSUSE 11 and am able to compile and run normal java programs but when I issue the appletviewer command I'm getting the following error "bash: appletviewer: command not found". I have set the PATH variable in the .bashrc file. so the problem...

TextBox Search string manipulation

This is sort of complicated for me to explain,let me try anyway. i want to know how can i manipulate the string i've collected from this(such type of ) textbox and use it for my pupose in webapp or dektop app. i mean for example, i've two situations. 1) If i've to take the search string in text box and want to forward user to say s...

java console menu

I'm writing a java console menu. however, my jre doesn't support "Scanner". What is the walk around to this problem? java.util.Scanner scanner = new Scanner (System.in); ...

Difference between ByteBuffer.allocateDirect() and MappedByteBuffer.load()

Hi , I was trying to implement a sort of shared cache between two or more JVMs by memory mapping a particular file using MappedByteBuffer. From the specifications I see that when we use MappedByteBuffer.load() it should load the data into a direct buffer. I have a couple of questions on this. My code snippet:: RandomAccessFile file =...

Handling an expired ViewState in JSF and Richfaces

I have a series signup pages that build on each other. When the users session expires I have a Listener that cleans everything up on the server and that works great. But, if the user attempts to do anything else I just want to redirect them back to the first page of the series. However, my filter doesn't seem to work correctly. I keep ge...

Java+DOM: How do I elegantly rename an xmlns:xyz attribute?

Hello! I have something like that as input: <root xmlns="urn:my:main" xmlns:a="urn:my:a" xmlns:b="urn:my:b"> ... </root> And want to have something like that as output: <MY_main:root xmlns:MY_main="urn:my:main" xmlns:MY_a="urn:my:a" xmlns:MY_b="urn:my:b"> ... </MY_main:root> ... or the other way round. How do ...

regex for that excludes matches within quotes

I'm working on this pretty big re-factoring project and I'm using intellij's find/replace with regexp to help me out. This is the regexp I'm using: \b(?<!\.)Units(?![_\w(.])\b I find that most matches that are not useful for my purpose are the matches that occur with strings within quotes, for example: "units" I'd like to find a way...

Real world comparisons of Glassfish and JBoss 5?

Does anyone have experiences with both in the real world? How do they compare in terms of performance (memory usage, speed, etc)? Stability? Does JBoss Seam work well on Glassfish? ...

Can `apt-get install` be used for JDK?

I've been using a linux machine for less than two weeks, so I am extremely new to Linux. I'd also like to install the Java Developers Kit. How should this be done? Is there an apt-get command, or should I just click on the download button at Sun's website? I'm sure there is more than one way to do this, and it probably doesn't matte...

How to convert a string 3.0103E-7 to 0.00000030103 in Java?

How to convert a string 0E-11 to 0.00000000000 in Java? I want to display the number in non scientific notations. I've tried looking at the number formatter in Java, however I need to specific the exact number of decimals I want but I will not always know. I simply want the number of decimal places as specificed by my original number. ...