java

Have I implemented a n-tier application with MVC correctly?

Being pretty unfamiliar with design patterns and architecture, I'm having trouble explaining to others exactly how my latest application is designed. I've switched between thinking it's a pure n-tier, pure MVC and n-tier with MVC in the presentation layer. Currently I think the latter is correct, but I want thoughts from more experienced...

Returning CSV file from Servlet using ServletOutputStream over HTTPS in Internet Explorer

I have a Servlet which is returning a csv file that is 'working' over HTTP in both internet explorer and firefox. When I execute the same Servlet over HTTPS only firefox continues to download the csv file over HTTPS. I don't think this is necessarily an Internet 6 or 7 issue described on MSDN : The message is: Internet Explorer ca...

Point ivy dependency at a local file?

I've got a main project where module A depends on a a .jar file created by the build for module B. While I'm in development, I'm modifying B regularly, then building B to create the library, then building A to use these changes. Is there a way to point module A's ivy file to the jar file my module B build creates? Given I'm iterating mu...

Java: Does Collections.unmodifiableXYZ(...) in special cases make a collection object a flyweight?

The possible answers are either "never" or "it depends". Personally, I would say, it depends. Following usage would make a collection appear (to me) to be a flyweight: public final static List<Integer> SOME_LIST = Collections.unmodifiableList( new LinkedList<Integer>(){ // scope begins { add(1); add(2); ...

Execute with Ant works with absolute path but not relative path

I have the following snippet in my Ant script. It executes just fine: <exec executable="C:\test\foo\programName.exe" /> But then when I try to execute it by setting the directory, like so: <exec executable="programName.exe" dir="C:\test\foo\" /> I get: Execute failed: java.io.IOException: Cannot run program "programName.ex...

Is XML Serialization really different from XML databinding, and if so, how?

There's a related question What is the preferred Java XML binding framework? In the answer currently ranked 2nd there, the poster drew a distinction between XML Serialization, and Java/XML data binding. As best I can tell, XML data binding means "creating an in-memory object graph from an XML document". And XML Serialization means "cr...

Set the text color in a Java textbox

How does one set the color of text in a Java Swing textbox at run-time? At startup, the color is grayish and when the user enters the textbox, I wish to change the color to the normal text color. I am currently using the following code: private void txtScheduleInfoFocusGained(java.awt.event.FocusEvent evt) ...

Recursively finding only directories with FileUtils.listFiles

I want to collect a list of all files under a directory, in particular including subdirectories. I like not doing things myself, so I'm using FileUtils.listFiles from Apache Commons IO. So I have something like: import java.io.File; import java.util.Collection; import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefi...

Preparing for a Java professional work environment before interviews

I recently graduated in Computer Engineering. I don't have a permanent job yet. The recession is making a good difference in my aim and reality. I don't want to just sit down. I want to sharpen my capabilities. I want to learn and practice in a professional work environment. Now my question is: What are the tools and practices followed ...

Java compareto for String and Integer arguments

I am building a bubble sort and I want it to be able to accept both Integer and String parameters. I cast all input as Strings and use the compareto method to compare the integers casted as strings and the strings. I am getting some incorrect answer when using compareto to compare the casted integers. What am I doing wrong? ...

Looking for pros/cons of using GWT or JSF

I'm a long time Java developer who has been building UI with Adobe Flex for the past few years. I'm looking to broaden my repertoire with a RIA technology that runs in a plain-old browser, no plug-ins required. I've read a lot about GWT but don't know much about JSF, especially given the varying implementations. Below are some criteri...

How do I restore a transient field in Hibernate like readResolve() for hibernate serialization?

Is there a way to hook up a callback method to be called when an object is deserialized from Hibernate. Similiar to Java's readResolve() method for Java object serialization? ...

Is the maven-native-plugin widely used to build C++ projects using maven?

It's been a little while since I did C++ development professionally and I'd like to get caught up on what the current state of C++ development is in a number of areas. Most of my recent work has been Java, making heavy use of Maven. When I last did C++ development for work, some variant of make was widely accepted as the way to go for ...

How to send data to COM PORT using JAVA?

Friends, I want to connect and transfer data to COM PORT (either virtual or original) in JAVA? ...

decompress .gz file in batch

I have 100 of .gz files which I need to de-compress. I have couple of questions a) I am using the code given at http://www.roseindia.net/java/beginners/JavaUncompress.shtml to decompress the .gz file. Its working fine. Quest:- is there a way to get the file name of the zipped file. I know that Zip class of Java gives of enumeration of...

The Need To Restore Graphics Original State When Overwritten paint or paintComponent

Hello all, I realize most of the Java code to overwritten paint or paintComponent, most of them doesn't restore the old state of graphics object, after they had change the state of graphics object. For example, setStroke, setRenderingHint... I was wondering whether it is a good practice that we restore back the old state of graphics ob...

help needed in threading implementation in NIO

I want to have create NIOServer which reads data from client using 1 thread and writes data to the client using another thread. also accepting client connection will be in some other thread. Is there any online help Thanks Deepak ...

Listening for input without focus in Java

I'm making a small program in Java using the Robot class. The program takes over the mouse. while in the course of debugging if it starts acting in a way that I don't want it's hard to quit the program, since I can't move the mouse over to the terminate button in eclipse, and I can't use hotkeys to hit it because the mouse is constant cl...

decrypting data with AES/CBC/PKCS5Padding using blackberry

I am using AES/CBC/PKCS5Padding cipher instance for AES encryption and decryption in java How can I decrypt the data using blackberry encrypted by above in java. decrypting data with AES/CBC/PKCS5Padding using blackberry Thanks Bapi ...

What is the Java equivalent to webmin?

webmin is a administration/UI framework for configuring software. I am curious if anyone know what the Java equivalent might be? ...