java

What to do when Java Best Practices conflict with Mockito

My development team has started to use Mockito and have classes that have been defined as 'final'. I've read in Effective Java by Joshua Bloch and in the SO thread When to use final that all classes should use the final modifier. There have been some disagreement in the thread, but I do agree with the idea of forcing class composition ...

binary search tree impelementation and java

Hello I am trying to implement BST algorithm using Cormen's pseudo code yet having issue. Here is my Code for Node: public class Node { Node left; Node right; int value; Node(int value){ this.value = value; this.left = null; this.right = null; } } and for the Bstree: public class Btree...

How to programmatically create a Java ResultSet from custom data with no database

I have some existing code that accepts a java.sql.ResultSet that contains info retrieved from an Oracle database. I would now like to reuse this code, but I'd like to pass it a ResultSet object that I create myself from some in-memory data that is not affiliated with any database. Is there an existing Java framework class that I can us...

Spring Ajax controller - Accept submissions without refreshing page

I am using Starbox in my Spring page. I want to submit the user rating so I can store it in the database and not have to refresh the page for the user. How can I have a Spring controller that accepts this value and doesn't have to return a new view. I don't necessarily need to return any updated html - if the user clicks the Starbox, ...

Perl Client to Java Server

I'm trying to write a perl client program to connect to a Java server application (JDuplicate). I see that the java server uses The DataInput.readUTF and DataInput.writeUTF methods, which the JDuplicate website lists as "Java's modified UTF-8 protocol". My test program is pretty simple, i'm trying to send client type data, which should...

hibernate annotation bi-directional mapping

I'm building a web application using Spring framework and Hibernate with annotation and get stuck with a simple mapping between two entities. I'm trying to create a many-to-many relationship between User and Course. I followed one of the Hibernate tutorials and my implementation is as follows: User class: @Entity @Table(name="USER") ...

Is Java 1.6 the same as JDK 6 ?

I'm taking a computer science course and the syllabus says download java 1.6. I don't find a java 1.6, everything says JDK 6. When I googled java 1.6 I found this link: http://java.sun.com/javase/downloads/index.jsp Is this what he's refering to as java 1.6? I downloaded JDK 6 update 17 and netbeans 6.8. I'll email the instructor a...

Reason for using Class instead of actual type in this java example?

I have seen this "design pattern" (don't know what else to call it.. template?) show up more than once in Java code. Application is expected to be extended and include a main method. I can't figure out what the benefit is of using Class instead of the AppFrame in the start method since it is just type casted to AppFrame anyways. It ju...

Is a colon safe for friendly-URL use?

We are designing a URL system that will specify application sections as words separated by slashes. Specifically, this is in GWT, so the relevant parts of the URL will be in the hash (which will be interpreted by a controller layer on the client-side): http://site/gwturl#section1/section2 Some sections may need additional attributes,...

MigLayout usage

A question for those familiar with MigLayout sorry couldn't think of a more appropriate name for the question... I'm trying to create a layout that will end up looking like the following: +---------+---------+ | btn1 | btn2 | +---------+---------+ | | | btn3 | | | +---------------...

Tricky java serialization problem

I have a java server that has to communicate over a TCP socket to an external program written in C. They pass messages back and forth in a message protocol that can't be changed (due to reasons too complicated to go into here). The TCP messaging protocol looks roughly like this: Header (with message length) -> Message body -> Message C...

can spring support multi applications sharing membership?

Does the spring framework support multi applications sharing a common user base? e.g. 2 separate web applications somehow hook into a single database to get user related information (username, password, and maybe even roles) The idea is this, something similiar to asp.net membership it works like this, you can have 10 websites, all pu...

Library for strict floating point Math in .NET

I have algorithm/computation in Java and unit test for it. The unit test expects result with some precision/delta. Now I ported the algo into .NET and would like to use same unit test. I work with double data type. The problem is that Java uses strictfp (64bits) for some operations in Math class. Where as .NET uses FPU/CPU always (80 ...

Java API to extract content from Flash (swf) file

I am looking for an Java API to extract and control content from an flash (.swf) file. Are there any existing open source APIs which can help me do that? Thanks in advance.. ...

java on all platforms

if you wanna code a desktop application in java for windows, mac and linux, will the code be the same for all of them? and you just change the GUI so that the Windows application will be more Windows-like and so on? how does it work without digging into details? ...

JDBC driver for Oracle 10G XE

Hello, I have installed Oracle 10G XE. I want to connect to it using JDBC . Which driver should i use for it and from where can i download it ? Thank You. ...

How do I programatically make a Liferay Portlet go into Full Screen Mode

I'm sure it's an easy thing, but I can't find it anywhere. How do I programatically make a portlet inside of Liferay go into Full Screen Mode. eg: the equivalent of clicking on the maximise button, but in code rather than having to make the user manually click that button. ...

Java HashMap to Matrix

Hi all gurus! I am facing a problem. I used the following hashmap to store some values HashMap<String, Object> hm = new HashMap<String, Object>(); The object is another HashMap (yeah, you can say HashMap of HashMap). String is to store book name, and Object is again another hashmap that is to store author name and number of authors....

What is a good CSV Java Utility

I was using opencsv which seemed fine but from the looks of the website it's gone so it's time to look for a new library to deal with parsing CSVs it is a simple task but I would like to keep it with a utility not have to roll my own or maintain one by myself. What is the best alternative? Seems like the opencsv site was updated and is ...

screen sharing library

I'm looking into screen sharing functionality - i.e. allowing remote users to view your desktop in real time, possibly control it and write annotations (text/drawings) on the shared screen. Something similar to what webex allows in its conferencing software. Preferably a Java-based api, possibly to run from an applet. Any recommendation...