java

Hibernate DetachedCriteria in FROM clause

I have 2 tables: orders: id items: id, orderId, total, flag I would like to make following query using Hibernate Criteria (DetachedCriteria): SELECT o.id, SUM(i1.total), SUM(i2.total) FROM orders o LEFT JOIN ( SELECT i.orderId ...

Subclassing Array

If you're not interested in a story, skip the first 2 paragraphs. I was talking to a friend about arrays and why they (still) crash if you try to access an object that is out of bounds in "modern" languages like Objective C (That's my main language). So we got into a debate and I said that I could write him an Array (I named it GeniusAr...

How do I do a deep copy of a 2d array in Java?

I just got bit by using .clone() on my 2d boolean array, thinking that this was a deep copy. How can I perform a deep copy of my boolean[][] array? Should I loop through it and do a series of System.arraycopy's? ...

how to use java stringtokenizer ?

how to use java stringtokenizer for the below string |feild1|field2||field4|... i want java to take the blank as a field too, but stringtokenizer is skipping it. Any option to get it?. ...

How can I send messages from Red5 to my Flash AS3 App?

I'm a bit confused. I would like to send messages from my Red5 Server to my Flash App... but I don't find any information how to do that... Can anyone help me? ...

GWT: what are the best practices for building a web2.0 interface with GWT?

I am no artist/designer so usually my GUIs well, you know... I've tinkered a bit with GWT and I was able to get sensible results but I feel I have used contrived ways of getting those results. If the community feels this question could help: please put one recommendation per answer. ...

Validity of the Java Code

double ABC = - UTIL_COMMON.fnChkDouble(lStr); Above statement, is it valid or not? Thanks ...

How to extend / amend OSGi lifecycle management?

I have a modular application that uses OSGi for lifecycle and dependency management. However, some of the bundles require some time after startup to be ready, for example, because they have to acquire data from somewhere. Also, they might be unable to process certain calls during a configuration update, for example a bundle that keeps a ...

Is there a way to check if two Collections contain the same elements, independent of order?

I've been looking for a method that operates like Arrays.equals(a1, a2), but ignoring the element order. I haven't been able to find it in either Google Collections (something like Iterables.elementsEqual(), but that does account for ordering) and JUnit (assertEquals() obviously just calls equals() on the Collection, which depends on the...

How to determine what part of Java code needs to be synchronized?

How to determine part of what Java code needs to be synchronized? Are there any unit testing technics? Samples of code are welcome. ...

KeyListener and timing

Hello, I am writing program in Java will have to do with music input. I want to use my computer keyboard as instrument.Pretty much it will be as button accordion which I play. I will do the mapping between keys and notes through 2 octaves for beginning. I was thinking what would be good design in timing how much the key was pressed. I a...

Conversion from Perl to Java

I want to convert the code by Giuseppe Maxia for DBIx::SQLCrosstab to Java. I have done the bulk of the conversion, however I am stuck at these in the code listed below in DBIx::SQLCrosstab::Format. Some pointers on the listed code will be helpful. # find initial columns without sublevels my @header_columns =(); #@header_columns = map ...

How can i send a point (x,y) in a server in java?

Hi, i'm trying to change a Skor4 game (feor two players) into tic tac toe. The problem is that in the source code that im trying to change sends only the x dimension of the ball to the server and then the other player takes that x dimension and finds the y dimension. In my case i want to send both x and y dimension. How can i do this?? ...

MockEJB - JUnit Mockito - cannot rebind a mock EJB on second unit test

Hi I have a question related to MockEJB. I need to write unit tests to test a code that is calling a EJB. I use Mockito to write a mock for the EJB, and MockEJB to simulate the JNDI context. My tests look like this : @Test public void test1() throws Exception { // create a mock instance NetworkManager aMockManager = createMockNet...

Cancel/abort a connection from the ThreadSafeClientConnManager connection pool

I'm using ThreadSafeClientConnManager to manage a pool of client connections, because my application has several threads, which are simultaneously connecting to a webserver. Abstract sample code: HttpClient httpClient; ClientConnectionManager conMgr = new ThreadSafeClientConnManager(parameters,schReg); httpclient = new DefaultHttpClie...

How to achieve custom smooth rounded application windows with Java inside windows?

Hi, How can smooth rounded corners for the application window be achieved with Java? I have seen the following tutorial, but it states that you still get a jagged white outside due to a transparency issue inside windows. Anyone know how to do this or has a link? http://marioyohanes.wordpress.com/2008/10/31/translucent-custom-shape-wi...

PMD - check for too many public methods (but exclude constructors and getters/setters)

I wish to add a PMD check to ensure that a class does not have too many public methods, but I do not want constructors and getters/setters to be included in the check. The ExcessivePublicCount check includes constructors, getters/setters and public variables, and I can't see a way to customise it. The TooManyMethods check excludes gett...

Increase heap size in java

Hello I am working on windows-2003 server(64-bit) with 8 GB ram. How can I increase the heap memory maximum. I am using -Xmx1500m command to increase the heap size with 1500mb. Can I increase the heap memory to 75% of physical memory(6GB Heap). Thanks ...

location of com.opensymphony.workflow.loader.SpringWorkflowFactory?

may i know which jar has this class file? i already tried serach osworkflow.jar .cannot find it ...

Creating a byte[] from a List<Byte>

What is the most efficient way to do this? ...