java

Java Property Change listeners

Hi , I would like to know , how the java beans property change listeners work. Do they use , EventListeners inside ? Is it good to use , property change listeners when we can do same with POJO implementation of mediator pattern . I mean performance wise ? Thanks J ...

Is there any relation between CPU and threads??

if yes,what is the relation? ...

convert inputstream to byte[] in java

hi i want to read an image and convert it to byte[] for my use. what should I do? ...

Project ideas in Java or opensource

I am a final year computer engineering student looking for project which can be completed in around 300 Hrs. I am interested in Java, Qt - even C, C++ will do. I am interested in developing for Open source. Please suggest me some topics (I don't have enough time to decide on my own). Any help would be appreciated. (I dont want to impleme...

Use Sounds in java

Hi…I searched the site and found another code that works correctly. Now I have another problem: When I create object from blow class and send the address of audio to its constructor, I have to send the complete address like: “C:\Documents and Settings\TheHero\My Documents\NetBeansProjects\project1\src\project1\s1.wav” But I want to ...

How can I stop ".\null\logs" folder being created?

My Java 6 console app is creating an empty ".\null\logs" folder when I run it. I've tracked this down to being caused by db4o. Why is this being created, and is there any way that I can prevent it from being created? This happens under both Windows XP and Vista, if that's relevant. ...

Pretty-printing output from javax.xml.transform.Transformer with only standard java api (Indentation and Doctype positioning)

Using the following simple code: package test; import java.io.*; import javax.xml.transform.*; import javax.xml.transform.stream.*; public class TestOutputKeys { public static void main(String[] args) throws TransformerException { // Instantiate transformer input Source xmlInput = new StreamSource(new StringReader( "<!-- Doc...

FATAL ERROR in JNI code - presumably in JDIC library

I am using a Java coded desktop application to track my time on projects. I used it until the IT did a new setup on my station. And now I cannot launch this application. I got a log file when I launch it saying: # # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d...

Orchestration vs Message Driven Architecture

What are the responsibilities of an Orchestration engine vs a Message Driven System. If I have to build a system which have to string together different independent components(cross-technology/platform components which need not expose a web service end point), which is the toolset to be chosen? Is there a better option? ...

Obtain search engine query-string from a servlet

Hi all, I want to improve my site usability by providing users some kind of "related search" funcionality if they are coming from a search engine. It is possible, from a servlet, to obtain if a visitor of my site is coming from search engine results page? If yes, is possible to obtain the query string? Thanks in advance EDIT: Thanks...

Refactoring domain logic that accesses repositories in a legacy system

I am working with a legacy system that has an anemic domain model. The domain has the following entity classses: Car, CarType, CarComponent, CarComponentType. For each of these, there is a separate repository. There is also a number of services that access these repositories and contain basically all logic. I need to implement a metho...

Java Programming SCJA or SCJP

I am very new to programming, but it has been suggested to me that Java is a language worth looking at. Question:- Should I start with the SCJA or just go straight for the SCJP. My previous knowledge of programming is building a VBA application or two. My exposure to Java is just reading the "Dummies" book, but no actual development y...

How to extract a substring from a string in java

Hello. What I am doing is validating URLs from my code. So I have a file with url's in it and I want to see if they exist or not. If they exist, the web page contains xml code in which there will be an email address I want to extract. I go round a while loop and in each instance, if the url exists, The xml is added to a string. This one...

Bluescreen of death during Java development on a Leopard - any ideas how to solve this?

I develop using Java 5 and 6 on Intellij IDEA 7 and 9M1. From time to time (during run/compile) my Mac (10.5.7) will die with a Bluescreen of death. Has anybody else had this issue and somehow managed to solve it? If so, how? Any suggestions other than running the IDE in a VM? ...

Putting each attribute on a new line during xml serialization

Lets say I have a DOM object (or a string containing xml). Is it in any way possible to serialize the xml in such a way that each attribute appears on a new line? This is the output I want: <parent> <anElement attrOne="1" attrTwo="2" attrThree="3" /> </parent> Preferred if the solution a part of the ...

Recommended method for escaping HTML in Java

Is there a recommended way to escape <, >, " and & characters when outputting HTML in plain Java code? (Other than manually doing the following, that is). String source = "The less than sign (<) and ampersand (&) must be escaped before using them in HTML"; String escaped = source.replace("<", "&lt;").replace("&", "&amp;"); // ... ...

Using SwingWorker publish efficiently

I am using SwingWorker to query a server process for a large number of "result" objects on a background thread. As individual results arrive I want to publish them and display them on the GUI. My question is: Given that I will be receiving potentially thousands of results is it more efficient to call publish(V... chunks) for every N re...

Why do my aspects get executed in their original setting and not when packed as a separate jar and called from elsewhere?

Hi all, I am a newbie to aspectj... I have written the following aspect which is intended to add logging to function calls of type public * doSomething*(..). If my main class is part of the same project the weaving of the aspect is performed without a glitch and the code executes. If I pack up the weaved code into a jar and call it fr...

Default escaping in Freemarker

In Freemarker templates we can use the escape directive to automatically apply an escaping to all interpolations inside the included block: <#escape x as x?html> <#-- name is escaped as html --> Hallo, ${name} </#escape> Is there a way to programmatically achieve a similar effect, defining a default escape applied to all interpola...

Centering dialog using JOptionPane.showMessageDialog

I’ve always been using code similar to the following to display dialogs: JOptionPane.showMessageDialog(JOptionPane.getFrameForComponent(this), … yada However, I’m now thinking that this is "more correct": JOptionPane.showMessageDialog(getRootPane(), … yada What do people prefer / recommend? ...