java

Java: Simple regex question, complete words

Hi, i need a Regex to do this ( catch only real words ): Inputstring: hello,[email protected] Process: String theMagicRegEx = "?????"; String[] arrayvar = asdf.split(theMagicRegEx); Output (arrayvar) should be this: hello sdfsdf yahoo email com Question: What is the value of theMagicRegEx? Thanks a lot ...

Improving performance of merging lots of sorted maps into one sorted map - java

I have a method that gets a SortedMap as input, this map holds many SortedMap objects, the output of this method should be one SortedMap containing all elements of the maps held in the input map. the method looks like this: private SortedMap mergeSamples(SortedMap map){ SortedMap mergedMap = new TreeMap(); Iterator sampleIt = map.va...

'Master Gain not supported' in OpenJDK

We have problems playing audio files using JavaZoom's libraries on OpenJDK in Linux, although it works perfectly on Sun JDK. Is there any workaround for this 'Master Gain not supported' exception? Mohsen ...

Add html content to a page in Liferay

Hello, Im new to Liferay . I have downloaded the Liferay Tomcat bundle v5.2.3 Community Edition from the Liferay website. I am able to run it successfully. I am now trying to create an intranet portal for our company using Liferay . I created an Organization in Liferay and added some pages and child pages to it. How to add content to a ...

Best way to configure a Threadpool for a Java RIA client app

Hi all, I've a Java client which accesses our server side over HTTP making several small requests to load each new page of data. We maintain a thread pool to handle all non UI processing, so any background client side tasks and any tasks which want to make a connection to the server. I've been looking into some performance issues and I'...

java generic wildcards

Currently I'm working on a service interface which retrieves domain objects based on a primary key. However I get the feeling I'm not efficiently using generics. Base domain objects look as follows: public interface DomainObject<PK extends Serializable> extends Serializable { PK getID(); } My service interface looks as follows: ...

Communication between two Web Services

I have a problem with web services. They are programed in Java and are running on a WASCE server ( both are on the same server). My problem that i want to solve: We have two Web services: App1 and App2 In App1 i want to call a function that is in App2. How can i do this? Is this even possible? I tried creating a soapClient inside the Ap...

Is it possible to extract SCRIPT tags using SiteMesh?

I have custom JSP tags that generate some HTML content, along with some javascript functions that get called by this HTML code. In the current implementation, the SCRIPT tags are created just above the HTML code. To avoid modifying the existing code base, I want to pull up these scripts inside the HEAD section of the page using SiteMes...

Qt Jambi vs JOGL for java OpenGL development?

I'm planning on writing a simple application in Java which has a basic UI with a section of OpenGL graphics. In addition to this some kind of network access is required. Which one of these libraries should I use? What are the drawbacks and benefits of each option? I'd like the OpenGL coding be as genuine as possible, so that I could fee...

How do I rename (not move) a file in JDK7?

Hello! I'm a bit confused with all these new File I/O classes in JDK7. Let's say, I have a Path and want to rename the file, it represents. How do I specify the new name, when again a Path is expected? Path p = /* path to /home/me/file123 */; Path name = p.getName(); /* gives me file123 */ name.moveTo(/* what now? */); /* how to renam...

Add Jar File to Buildpath in Windows Command Line

Hi Im quite annoyed at having to ask this but I cant get it to work. Currently I have a project with: 5 Classes in the src/ folder 2 JARS named profiles.jar and classifier.jar in the root folder I want to create a "makefile?" or "batch file?" to compile and run these classes FROM THE WINDOWS COMMAND LINE, but first add the ...

Is it possible to define initial parameter arguments for Java webapp listeners?

In a web application's web.xml file, one can define initial parameters for servlets and filters by using the init-param element. Parameters defined here can then be retrieved by calling getServletConfig(). It does not seem possible to do the same with listeners, as the DTD only defines the listener-class element there. I would really ...

Query on iteration

Hi All, I want to written a object holding data read from xml String data = null; while ((data = stdInput.readLine()) != null) { logger.info("Data:"+data); } i want to return a obj holding the complete data read in while loop,how would i do that? its java ...

Extended Combobox in SWT

I looking for Commbobox in which I can change Font property for some items. Example: First item: bold, font colour: red Second item: italic, font colour: dark Or: How to use org.eclipse.swt.custom.CCombo widget to do this? ...

Is there a portable way for Java to check the maximum amount of RAM?

I'm writing a Java application that needs to check the maximum amount of RAM available in the system (not the one available for the VM). Is there a portable way to do so? Thanks a lot :-) ...

Who is responsible for setting the object properties?

I have an object with fields. In a project I need this object filled with information. whose responsibility is to fill this object? I would like a method like getFilledObject() that returns a full filled object to my program. I can put this logic into the main flow, and fill it "in place", also I can add this method into the class its...

Distributed Job scheduling, management, and reporting

I recently had a play around with Hadoop and was impressed with it's scheduling, management, and reporting of MapReduce jobs. It appears to make the distribution and execution of new jobs quite seamless, allowing the developer to concentrate on the implementation of their jobs. I am wondering if anything exists in the Java domain for th...

Java long running task Thread interrupt vs cancel flag

I have a long running task, something like: public void myCancellableTask() { while ( someCondition ) { checkIfCancelRequested(); doSomeWork(); } } The task can be cancelled (a cancel is requested and checkIfCancelRequested() checks the cancel flag). Generally when I write cancellable loops like this, I use a fl...

Is Jetty guarenteed to be up after start() returns?

I am seeing a phenomenon where sometimes, connections to the port Jetty is configured on fail with connection refused, shortly after the server starts (after Server.start() returns). Is there some asynch behaviour involved? Is start() synchronous or not? ...

ActionListener as key binding

I am in a situation where i have a class, ActionFactory that produces ActionListener s to be used in menu items and buttons. Now i want to bind some of these actions to keys. KeyStroke controlS = KeyStroke.getKeyStroke (KeyEvent.VK_S,modifierKey,false); panel.getInputMap (JComponent.WHEN_IN_FOCUSED_WINDOW).put(c...