java

What is the concept of erasure in generics in java?

What is the concept of erasure in generics in java? ...

JDBC simplified connection

Is there any library that would simplify the task of connecting to a server with JDBC? Something that can take a string like "mysql://username:password@host/db", similar to what PHP MDB2 do: http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2.html#methodparseDSN I'm not interested on any ORM or complex library such as Spring as I'm n...

How to set height to the SimpleHistogramBin bin in SimpleHistogramDataset?

I used setItemsCount() method to manage height of the bin in my SimpleHistogram from JFreeChart. Yet, it does something weird: when I set for example 1, it shows 1.4 Besides this method's argument is Integer, while i need double ...

Is a good idea to enable jmx (lambda probe) on a production server?

We are experiencing some slowdowns on our web-app deployed on a Tomcat 5.5.17 running on a Sun VM 1.5.0_06-b05 and our hosting company doesn't gives enough data to find the problem. We are considering installing lambda probe on the production server but it requires to enable jmx (com.sun.management.jmxremote) in order to obtain memory a...

Java RMI tracing

Is there a tool which traces & logs all RMI activity of a Java application? ...

What are the advantages of using J2EE over ASP.NET?

We are currently planning to launch a couple of internal web projects in the future. Our company's dev teams are mostly experienced in J2EE and have worked with it for years. Today, we have the choice of launching a couple of our projects on .NET. I have checked out a couple of sources on the .NET, and it seems like the "J2EE vs ASP.NET"...

Custom Cursor in a Swing JDialog

I have a Java Swing application, developed on Mac OS X 10.5 using Java 1.5. I'm trying to make a custom cursor appear when the user moves the mouse over some text in a dialog. The cursor never changes, though. When I don't use a JFrame instead of a JDialog, the cursor does change. But then I'll have to write all the dialog code myself...

Optional Parameter in MVEL Functions

Is there a way to get MVEL 2.0 ( http://mvel.codehaus.org/ ) to work with functions with optional parameters? I would like to be able to eval this: trunc('blahblah',2) but also trunc('blahblah',2,'[...]'); Now i have tried: def trunc(param1,param2,param3) { ... impl ... } That gives an exception if i try to call it with only 3 pa...

What sort of Business Applications do you build with .NET, Java, PHP or Ruby?

Yesterday I asked a question about COBOL guy moving to modern platforms and I got some great answers. I was thinking about what kind of applications get built with java or .net? I know for sure that most corporate portals, blogs, discussion forms, surveys, tracking who registered which course, progress of your e-learning and stuff like ...

How can I make this java generic cast ?

How can I make this java generic cast ? public interface IField { } class Field implements IField { // package private class } public class Form { private List<Field> fields; public List<IField> getFields() { return this.fields; } } The return statement throws a compiler error (I know the reason - I read the generic...

Overloading methods by return type in java.

Can I collapse those two "getFields" methods into one using generics (the second method is intended to package private access) or should I rename the second one into something ugly like "getFieldPackagePrivate"? public interface IField { } class Field implements IField { // package private class } public class IForm { pu...

How do I upload a document to SharePoint with Java?

I'm creating some big files (DB exports) with Java and I need to put them somewhere on our SharePoint server. Right now, I'm doing this with IE but I'd like to automate this step, too. I searched the web and I found some hints to use SOAP but I don't really see to the ground of all this, yet. Can someone provide me with some sample code...

SQLClientInfoException / Linux

I am running a java program that sets up a database connection to an SQL database. It works fine on Mac OS X, but when I try to run the same code on Linux, I get a Exception in thread "main" java.lang.NoClassDefFoundError: java/sql/SQLClientInfoException. I am using jdk-1.6.0_02 - if I unzip src.zip, it turns out that SQLClientInfoExcep...

how to (simply) generate POST http request from java to do the file upload

I would like to upload files from java application/applet using POST http event. I would like to avoid to use any library not included in SE, unless there is no other (feasible) option. So far I come up only with very simple solution. - Create String (Buffer) and fill it with compatible header (http://www.ietf.org/rfc/rfc1867.txt) - O...

Programmatically marking an Oracle BPEL task complete

I am using Oracle BPEL Process manager and have a task assigned to a group of users. I try to mark it approved using Java class oracle.bpel.services.workflow.task.ITaskService.updateTaskOutcome(). This works if the task is assigned to an individual user, but if the task is assigned to a group of users, I get an error message about the t...

lazily compile Jasper .jrxml to .jasper

Hi, I use Jasper reports with the JasperReportsMultiFormatView class provided by the Spring framework. This class takes care of compiling the source .jrxml files to their compiled .jasper format when the Spring application context is created. However, this compilation process is really slowing down the application startup time. Is it p...

Which is a better way to force GC on ThreadLocal instance?

Which is a better way to force GC on ThreadLocal instance? ...

When are API methods marked "deprecated" actually going to go away?

I'm code reviewing a change one of my co-workers just did, and he added a bunch of calls to Date.toMonth(), Date.toYear() and other deprecated Date methods. All these methods were deprecated in JDK 1.1, but he insists that it's ok to use them because they haven't gone away yet (we're using JDK 1.5) and I'm saying they might go away any ...

Bug in eclipse compiler or in javac?

The following code public class GenericsTest2 { public static void main(String[] args) throws Exception { Integer i = readObject(args[0]); System.out.println(i); } public static <T> T readObject(String file) throws Exception { return readObject(new ObjectInputStream(new FileInputStream(file))); ...

Need an example of a primary-key @OneToOne mapping in Hibernate

Can somebody please give me an example of a unidirectional @OneToOne primary-key mapping in Hibernate ? I've tried numerous combinations, and so far the best thing I've gotten is this : @Entity @Table(name = "paper_cheque_stop_metadata") @org.hibernate.annotations.Entity(mutable = false) public class PaperChequeStopMetadata implements S...