java

How Do I Create a New Excel File Using JXL?

I'm trying to create a new Excel file using jxl, but am having a hard time finding examples in their API documentation and online. ...

Java obfuscation - ProGuard/yGuard/other?

This is along similar lines as these recent questions: http://stackoverflow.com/questions/93290/best-java-obfuscation-application-for-size-reduction http://stackoverflow.com/questions/149937/creating-non-reverse-engineerable-java-programs However, one ends up recommending yGuard and the other ProGuard but neither mention both. I wonder...

Stratagies for Data Loading and DB Initialization for Integration Tests

I'm developing an integration testing framework for a data intensive J2EE enterprise application and I'm trying to decide upon a strategy for initializing and populating the database. We have a fairly complex model. The system will have to: Initialize the system itself Load users Load application test data The test data won't be a...

How to get JRE/JDK with matching source?

I'd like to get at least one JRE/JDK level on my Windows machine where I have the JRE/JDK source that matches the exact level of the JRE/JDK. My purpose is to be able to go into the system classes while debugging. Any suggestions about how to do this? Thanks in advance. ...

Dependency Injection book recommendation(s)

It seems like there are very few books (yes, I read books) on Dependency Injection. The Amazon tag for "dependency injection" lists only a few titles, and all of them are specifically about Spring for Java. Are there any books out there that cover DI/IoC in general? Or any that include a survey of multiple DI frameworks? Or any that cov...

How to configure Caucho Resin's Java classpath to the system's library directory

I have a folder, '/var/unity/conf' with some properties files in it, and I'd like the Caucho's Resin JVM to have that directory on the classpath. What is the best way to modifiy resin.conf so that Resin knows to add this directory to the classpath? ...

Explain the JVM Directory Layout on Mac OSX Leopard

Here is the directory layout that was installed with Leopard. What is the "A" directory and why the "Current" directory in addition to the "CurrentJDK"? It seems like you can easily switch the current JDK by move the CurrentJDK link, but then the contents under Current and A will be out of sync. lrwxr-xr-x 1 root wheel 5 Jun 14 ...

Expressing Excel formula in Java (decimal to time interpretation)

Hi, I am converting an excel sheet formula to java but I can't understand how excel manages to take the following: 0.22 Applies a formula: =TEXT(R5/14, "h:mm") and somehow arrives at: 0.22 Again if I provide: 2.8 it arrives at 4.48 Can someone please explain to me how it does this. I have read a little regarding decimal and I understand...

Java: How do detect a remote side socket close?

How do you detect if Socket#close() has been called on a socket on the remote side? ...

Alternatives to static methods in Java

I'm making a mini ORM for a Java program I'm writing... there is a class for each table in my db, all inheriting from ModelBase. ModelBase is abstract & provides a bunch of static methods for finding & binding objects from the db, for example: public static ArrayList findAll(Class cast_to_class) { //build the sql query & execute it ...

Not able to retrieve dates

Hi all, I am working with web Dynpro java.. I have created a stateless session bean wherin i have created business methods for inserting and retrieving records from my dictionary table. My table has two fields of java.sql.Date type The web service that i have created is working fine for insertRecords(). Bt for showRecords() i am not a...

AutoLock in Java - how to ?

What is the best way to free resources (in this case unlock the ReadWriteLock) when leaving the scope ? How to cover all possible ways (return, break, exceptions etc)? ...

Programming against interfaces: Do you write interfaces for all your domain classes?

Hi, I agree, that programming against interfaces is a good practice. In most cases in Java "interface" in this sense means the language construct interface, so that you write an interface and an implementation class and that you use the interface instead of the implementation class most of the time. I wonder if this is a good practice ...

Using Lucene to count results in categories

I am trying to use Lucene Java 2.3.2 to implement search on a catalog of products. Apart from the regular fields for a product, there is field called 'Category'. A product can fall in multiple categories. Currently, I use FilteredQuery to search for the same search term with every Category to get the number of results per category. This...

Java 1.4 synchronization

I have a class proposing translations utilities. The translations themselves should be reloaded every 30 minutes. I use Spring Timer support for that. Basically, my class looks like : public interface Translator { public void loadTranslations(); public String getTranslation(String key); } loadTranslations() can be pretty long ...

Using noweb on a large Java project

Has anyone used the noweb literate programming tool on a large Java project, where several source code files must be generated in different subdirectories? How did you manage this with noweb? Are there any resources and/or best practices out there? ...

Java: StringBuffer & Concatenation

Hi guys, I'm using StringBuffer in Java to concat strings together, like so: StringBuffer str = new StringBuffer(); str.append("string value"); I would like to know if there's a method (although I didn't find anything from a quick glance at the documentation) or some other way to add "padding". Let me explain; every time I append s...

How to handle functions deprecation in library?

I'm working on a Java library and would like to remove some functions from it. My reasons for this is public API and design cleanup. Some objects have setters, but should be immutable, some functionality has been implemented better/cleaner in different methods, etc. I have marked these methods 'deprecated', and would like to remove them...

Using database resources in Axiom Safe Request

Hi, I would like to know how to make use of an Axiom database resource inside a Safe function. Right now I'm just handling the connection manually but I know it would be better to use the already defined resources. ...

In Java, do I need to declare my collection synchronized if it's read-only ?

I fill a collection one single time when my J2EE webapp starts. Then, several thread may access it at same time but only to read it. I know using a synchronized collection is mandatory for parallels write but do I still need it for parallels read ? ...