java

Switching from Java to C#

Hi, I am a C/C++/Java programmer and I was wandering if there is any good book or some website that helps you make the switch, I mean, not a beginner's C# book, but a book that compares the platforms, CLI vs. Java Virtual Machine, that explains the .Net arquitecture, etc. To sum up, I already know OOP and design, but I need to learn C#,...

cross platform unicode support

I find that getting Unicode support in my cross-platform apps a real pain in the butt. I need strings that can go from C code, to a database, to a Java application and into a Perl module. Each of these use a different Unicode encodings (UTF8, UTF16) or some other code page. The biggest thing that I need is a cross-platform way of doin...

Is it possible to get the maximum supported resolution of a connected display in os x from java?

What the title says. Assume java 1.6 and leopard. Ideally, it would also be nice to get a list of all supported resolutions and the current resolution. If this isn't possible in java, is there some way to do it that could be called from java? ...

drawing animations at the show of JDialog

What would be the best way to draw a simple animation just before showing a modal JDialog? (i.e. expanding borders from the mouse click point to the dialog location). I thought it would be possible to draw on the glasspane of the parent frame on the setVisible method of the dialog. However since the JDialog is modal to the parent, I coul...

Do I need a Mac to make a Java application bundle?

I want to create a Java application bundle for Mac without using Mac. According to Java Deployment Options for Mac OS X, I can do this by using Xcode, Jar Bundler, or from the command line. Once the files and folders are set up, all I need for the command line method is to call /Developer/Tools/SetFile. Is there a SetFile clone on Linux...

What is your favourite Code Coverage tool(s) (Free and non-free)

What is your favourite Code Coverage tool(s) (Free/non-free) and how do you use them effectively? There are several options available, such as: CodeCover Coverlipse Emma / EclEmma Atlassian Clover (commercial) Cobertura Crap4j I have CodeCover telling me various chunks of my code are 58% covered etc. But how does this help me write ...

Does new URL(...).openConnection() necessarily imply a POST?

If I create an HTTP java.net.URL and then call openConnection() on it, does it necessarily imply that an HTTP post is going to happen? I know that openStream() implies a GET. If so, how do you perform one of the other HTTP verbs without having to work with the raw socket layer? ...

How can I set the welcome page to a struts action?

I have a struts-based webapp, and I would like the default "welcome" page to be an action. The only solutions I have found to this seem to be variations on making the welcome page a JSP that contains a redirect to the action. For example, in web.xml: <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> a...

Aspectj doesn't catch all events in spring framework?

My project is based on spring framework 2.5.4. And I try to add aspects for some controllers (I use aspectj 1.5.3). I've enabled auto-proxy in application-servlet.xml, just pasted these lines to the end of the xml file: <aop:aspectj-autoproxy /> <bean id="auditLogProcessor" class="com.example.bg.web.utils.AuditLogProcessor" /> Create...

How to find a normal vector pointing directly from virtual world to screen in Java3D?

I think it can be done by applying the transformation matrix of the scenegraph to z-normal (0, 0, 1), but it doesn't work. My code goes like this: Vector3f toScreenVector = new Vector3f(0, 0, 1); Transform3D t3d = new Transform3D(); tg.getTransform(t3d); //tg is Transform Group of all objects in a scene t3d.transform(toScreenVector); ...

How do I read and write raw ip packets from java on a mac?

What would be the easiest way to be able to send and receive raw network packets. Do I have to write my own JNI wrapping of some c API, and in that case what API am I looking for? EDIT: I want to be able to do what wireshark does, i.e. record all incomming packets on an interface, and in addition be able to send back my own created pack...

How to find a Java Memory Leak

How do you find a memory leak in Java (using for example JHat)? I have tried to load the heap dump up in JHat to take a basic look. However I do not understand how I am supposed to be able to find the root reference (ref) or whatever it is called. Basically I can tell that there are several hundred meg of hash table entries ([java.util.H...

What is the best way to migrate an existing messy webapp to elegant MVC?

I joined a new company about a month ago. The company is rather small in size and has pretty strong "start-up" feel to it. I'm working as a Java developer on a team of 3 others. The company primarily sells a service to for businesses/business-type people to use in communicating with each other. One of the main things I have been, and wi...

Handle signals in the Java Virtual Machine

Is it possible to handle POSIX signals within the Java Virtual Machine? At least SIGINT and SIGKILL should be quite platform independent. ...

Java hashmap vs hashtable

What is the difference between a hashmap and a hashtable in Java, and which is more efficient for non-threaded applications? ...

Is Java pass by reference?

I always thought Java was pass by reference, however I've seen a couple of blog posts (e.g. this blog) that claim it's not. I don't think I understand the distinction they're making. Could someone explain it please? ...

square brackets in URLs

Are square brackets in URLs allowed? I noticed that Apache commons HttpClient (3.0.1) throws an IOException, wget and Firefox however accept square brackets. URL example: http://example.com/path/to/file[3].html My HTTP client encounters such URLs but I'm not sure whether to patch the code or to throw an exception (as it actually shoul...

Validating a HUGE XML file

I'm trying to find a way to validate a large XML file against an XSD. I saw the question ...best way to validate an XML... but the answers all pointed to using the Xerces library for validation. The only problem is, when I use that library to validate a 180 MB file then I get an OutOfMemoryException. Are there any other tools,libraries,...

SCJP 1.6 Exam (Changes from 1.5)

I'm doing my SCJP 1.6 exam in a couple of days. Unfortunately, I only had the Java 1.5 study guide to work with. What are the changes between the 1.5 and 1.6 exam? ...

Best java tools for emacs

I'm a long-time emacs user, and I'm now working about 1/2 time in Java. What are the best emacs libraries for Debugging Java Code Completion/Intellisense Javadoc browsing ? ...