java

Is the SCWCD still worthwhile, and if so, how to prepare?

If you have taken the Sun Certified Web Component Developer certification, or otherwise know a lot about it, how would you rate its usefulness? How does it compare with SCJP or SCJD, for example? (Note: SCJP specific discussion can be found e.g. here and here.) As someone considering taking the SCWCD, I'd hope it would improve my unders...

What libraries ship with support for the Java 6 ServiceLoader facility (META-INF/services) ?

I'm wondering what adoption rate is of the (now officially supported) ServiceLoader facility in Java 6. I'd like to begin using it as a preferred way to locate dependencies. Obviously this would be made much easier if the jars already ship with with the necessary configuration file in place. Just poking around I was happy to see the MyS...

Java Web Project Structure Best Practice

Hi All I am starting a new Java Web Project which is using Hibernate and a standard MVC Architecture. I have just started to layout the projects structure and while doing this I started to look around to see if there was any standards in this area, about where Controllers should go and generally the best way to lay everything out. Howe...

How to submit different form actions in BeeHive based on netui:select change events?

I'm using Apache BeeHive. My JSP contains a form (<netui:form>) with a dropdown box (<netui:select>) and a submit button (<netui:button>). When the submit button is pressed, the form's default action ("doAction1) will be submitted. I want a different action ("doAction2") to be submitted when an option is selected from the dropdown. Se...

Java : How to determine the correct charset encoding of a stream

With reference to the following thread: http://stackoverflow.com/questions/498636/java-app-unable-to-read-iso-8859-1-encoded-file-correctly What is the best way to programatically determine the correct charset encoding of an inputstream/file ? I have tried using the following: File in = new File(args[0]); InputStreamReader r = ne...

problem while running batch file that is present in the remote system

Hi, My requirement is that i need to run batch file that is present in remote system from local machine. i am having the following code. But it is giving the following error :Path not correct". I have the ip address of the machine, and i have given the batch file as public share and share name is dsc. ip address of the machine is 16.18...

Java NIO: Sending large messages quickly leads to truncated packets and data loss

I've got this nasty problem where sending multiple, large messages in quick succession from a Java (NIO) server (running Linux) to a client will lead to truncated packets. The messages have to be large and sent very rapidly for the problem to occur. Here's basically what my code is doing (not actual code, but more-or-less what's happen...

How to delete buttonGroup in netbeans 6.5

Hi, I'm new to netbeans I played around with matisse gui editor and would like to delete a buttonGroup with no reference. I tried the refactor/safe delete action but no way to do so!! That so bad. Is there a trick or do I have to re-start everything? 2.By the way I find it so crazy not to be able to edit the generated grey source cod...

Build JavaFX project without NetBeans

I'm trying to learn JavaFX and maybe create a few "learner" games. I always do my development in Eclipse, rather than NetBeans which the JavaFX team is clearly trying to push. Can anybody point me in the direction of a how-to for building a JavaFX project in Eclipse, or at least building a JavaFX project without NetBeans? Everything I'v...

In Java, when should I create a checked exception, and when should it be a runtime exception?

When should I create a checked exception, and when should I make a runtime exception? For example, suppose I created the following class: public class Account { private float balance; /* ... constructor, getter, and other fields and methods */ public void transferTo(Account other, float amount) { if (amount > bala...

Swing JLayeredPane.getLayer() - Documentation error or actual side effect?

I'm trying to figure something out about JLayeredPane in Swing. If anyone has used this class, feedback would be appreciated. The documentation for getLayer(JComponent c) states: Gets the layer property for a JComponent, it does not cause any side effects like setLayer(). (painting, add/remove, etc) Normally you should use t...

replacing regex in java string

I have this java string: String bla = "<my:string>invalid_content</my:string>"; How can I replace the "invalid_content" piece? I know I should use something like this: bla.replaceAll(regex,"new_content"); in order to have: "<my:string>new_content</my:string>"; but I can't discover how to create the correct regex help please :)...

android.provider.Telephony

Does anyone know what happend with the android.provider.Telephony ? It is not there anymore. ...

Should I learn C++ and Java simultaneously?

I'd love to start writing Android apps. That's apparently all in Java. Programming jobs on Craigslist are at least 100 Java to 1 C++. I want to learn Java. Unfortunately, the CS program I'm considering teaches C++ rather than Java, so C++ is what I'm learning. (I'm sure learning C++ will teach me to code well, but so would Java, and...

How can I draw a filled rectangle in a java applet with half opacity?

How can I draw a filled rectangle in a java applet with half opacity/transparency? ...

simulated annealing for placement and routing

i am in need of a well documented source code of simulated annealing for placement and routing (in c++ or java). can anyone help me? ...

BufferedImage's getSubimage performance

I'm working on a Java 2D rendering program (running on 1.6.0_11), which uses external images for its UI rendering. These large images contain several UI graphics parts at the same time, which I extract now with the BufferedImage.getSubimage(). Assuming an average desktop system (with our without enabling DirectX/OpenGL acceleration), my ...

Why should I use the keyword "final" on a method parameter in Java?

I can't understand where the final keyword is REALLY handy when it is used on method parameters. If we exclude the usage of anonymous classes, readability and intent declaration then it seems almost worthless to me. Enforcing that some data remains constant is not as strong as it seems. A) If the parameter is a primitive then it w...

Embedded OSGi or Application Bundle

I've just spent the last two days reading up all the OSGi stuff I can get my hands on and I finally think I've got my head around it. I'm now trying to integrate it with an existing application for many reasons such as 3rd party plugins, automatic updates, not to mention that SOA just makes me happy. I now have a decision I'm strugglin...

Understanding the need for a DI framework

This might be a naive question. I'm currently learning the Spring framework and dependency injection. While the basic principle of DI is rather easy to grasp, it's not immediately obvious why you need an elaborate framework to implement it. Consider the following: public abstract class Saw { public abstract void cut(String wood); }...