java

Looking for Great Example Java Application in MVC or MVP

I'm going to be delivering a presentation to my company regarding MVC, MVP and MVVM patterns, test-driven development, and ORM solutions. I'm a .Net programmer and have found the NerdDinner application to be a nice example app to illustrate MVC, TDD and ORM. Is there a good example app in the Java world to demonstrate MVC or MVP with J...

Timestamps in Ant log?

Is there an easy way to have the Ant logger (default or other) add a timestamp to each message? The only way I can think of is to use the Log4jListener and have its settings include the timestamp. Or write a custom logger that subclasses DefaultLogger and writes the timestamp. If there's a better or easier way (preferably without req...

Any good rsync library for Java?

I've been researching a little and I found some rsync algorithm implementations written in Java but it seems all the projects died some time ago. What is a good Java library implementing rsync? If there's not one: Is the best way for use rsync to invoke the program from my Java app? ...

Java: what are some steps to learn a project where you have a little or no experience

Hello, As a starting programmer with little industry-experience, I find it frustrating to learn a new project which is based on many technologies that I am not familiar with. The project I am working on has about 150 classes with 15000 lines of code, and with its extensive focus on socket and security programming which I have zero exper...

Getting the primary key value after a merge command?

Is there some way to get a value from the last inserted or updated row? I am using the merge command to do an insert or an update if the row exists. I know how to get the autogenerated key after an insert but can I get the primary key if I use the merge command? I'm using Java with JDBC and Oracle DB. ...

hibernate collection mapping with list and super entity class

hello good fellas! here i am again in my self learning hibernate and personal experiment project to gain more understanding. Here is the description of my environment: i have a super model entity that all my model inherit from.it has only id property i use the genericDAO pattern found on hibernate web site. Now my problem is that i use ...

Swing JTable Layout: how to make table occupy complete viewport - like in eclipse IDE

In the application I am building, I will be making a few tables display different data. And I want my table to look like the tables in Eclipse IDE, like in the Problems View or the Tasks View (ignore the tree structure of the Problems View) What I am mainly interested in is the last column in the above views indicated in the picture bel...

Real advantages of .Net delegates over Java's anon classes?

I know a lot of the uses of .Net delegates can be emulated in Java by using a combination of interfaces and anonymous classes, but are there any situations where delegates have a real advantage and there is no Java equivalent? ...

Looking for a design pattern

I haven't studied design patterns, but I'm willing to bet that there is one for what I need to do. I'm running a set of different algorithms over a couple of trees. They all implement an interface: public interface DistanceMetric { public double distance(AbstractTree<String> t1, AbstractTree<String> t2); } public class concreteDis...

Obtaining the "Receivers Companion" for Apache Log4j

Does anyone know where I can get a compiled distribution of the Receivers Companion for Log4j? The Apache project information for it is cryptically short. I've found the SVN repository, but I've had some trouble getting it to build. ...

What's the most AGILE APPROACH to validate Spring-MVC command (speeds up validation implementation on server side) ? (Spring-MVC)

Hi, I am starting a new Spring-MVC project. Validation is a important feature in any project. This way, i have seen many approachs as follows: Spring Validator interface It sounds like a Struts 1.x validation. In my opinion, it is not agile. Commons Validator I think it is better than Validator interface Annotation based bean ...

ip address in java

Hey, I've been asked to activate a certain piece of code if i was in my college. So I need to find the iP of where i am to match to my colleges iP. Was wonderng how to do this in java? I have already tried a loop back interface. ...

What is the state of Open Source Java?

What is the current state of Java's transition to an open source license (which Wikipedia lists as the GNU General Public License / Java Community Process)? Java being inclusive of many things, including: The JVM The JRE The JDK The Core Java Libraries JavaME JavaEE I've heard/read various things, but never seen it laid out in a s...

How do i get link that contains string of detected printer?

Hi, I have developed an applet which detects the printers and outputs the list. here's the code for that. import javax.print.*; import java.awt.*; @SuppressWarnings("serial") public class Test extends java.applet.Applet { public void paint(Graphics g) { PrintService[] printServices = PrintServiceLookup.lookupPrintServices...

JTextfield array help

I have been trying to create a JFormattedTextField array which populates in a pane. Once a click event occurs, the actions get processed and the textfields are populated using setText(). The code for the array and initializing is in the constructor method here: JFormattedTextField[] balance=new JFormattedTextField[360]; JFormattedText...

How many Microsoft JVMs still in the wild?

I know this question isn't exactly a programming question, but it will affect how we program one of our products, so i guess it might be close enough. Do you guys still see the Microsoft JVM (Java 1.1) on client computers anymore? I havent found much info on this particular JVM online... Anyone know of a good resource to find this typ...

Using a FileDialog to choose a file of a certain extension

I am trying to use a FileDialog file chooser because I really need java app to have the native apple file chooser (I know we all hate hate the lack of portability but this is what I need). I am trying to make my file chooser allow the user to pick files that end with .ws. Here is what I tried: FileDialog fd = new ...

When and how are NIO direct buffers freed?

I have a C library that wants a temporary buffer for scratch space. I'm considering passing the address of a direct byte buffer to it. Is the VM ever allowed to relocate the buffer before it is ultimately freed? The native library will be holding on to the pointer after the JNI frame goes away. My understanding is that JNI local objec...

client server socket based communication

I recently tested a socket based communication between a J2ME app and a local computer, the J2ME app was running on a emulator in NetBeans 6.7 and the server socket was also running on the same computer in Netbeans. Now I would like to move the serversocket onto the internet and test the app first on the emulator and then on on actual mo...

Debugging a MySQL charset error

I have a project where I scrape some data from a HTML file, put it into a MySQL database and then read it out again and display it to the user. Whenever the servlet is inserting something into the DB the "£" sign is being inserted as a � and when read out again presented as that. The application is written in Java (with Spring) and JPA ...