java

mssql handles line returns rather awkwardly

Here is the problem: for your reference: http://www.freeimagehosting.net/uploads/b443e7a1fe.jpg database entries 1,2 and 3 are made using jython 2.2.1 using jdbc1.2. database entry 4 is made using vb the old to be replace program using odbc. We have found that if I copy and paste both jython and vb MailBody entries to wordpad directl...

How are Anonymous (inner) classes used in Java?

What is the use of anonymous classes in java? Can we say that usage of anonymous class is one of the advantages of java? ...

Why can't my Java program read Perl's STDERR?

Hi, We have a Perl program to validate XML which is invoked from a Java program. It is not able to write to standard error and hanging in the print location. Perl is writing to STDERR and a java program is reading the STDERR using getErrorStream() function. But the Perl program is hanging to write to STDERR. I suspect Java function is...

What does 'spurious failure' on a CAS mean?

The Java AtomicInteger class has a method - boolean weakCompareAndSet(int expect,int update) Its documnentation says - May fail spuriously. What does 'failing spuriously' here mean? ...

DataTable containing inputText: is it possible with JSF Custom Component

Hi all, i'm new to JSF and for the application i'm woriking on i've to do a multiple field input form. In few words the user should have an inputText when he inputs his data and an "add" button which add a new input text in order to input another data. When the user is done, he pushes another submit button. I looked for something alread...

Multiple rows per record in JSF?

having a myfaces datatable, is is possible to have 2 rows for each record? my simple one-row table looks like the following: <h:dataTable id="somelist" value="#{MyBean.somelist}" var="item"> <h:column> <f:facet name="header"> <h:outputText value="ID"/> </f:facet> <h:outputText value="#{item.id}"/>...

Using subclassing to replace a Java class that doesn't implement an interface

For example, java.io.File is just a concrete class. My replacement for it supports resolving Windows shortcuts. I need to preprocess constructor parameters to resolve possible .lnk files because the FileSystem object that does normalizing/canonicalision/resolving on the abstract paths is not accessible. The need for preprocessing rules o...

Creating singleton factory

String fullName = PATH + "." + name; Class cl= Class.forName(fullName); if(name.equalsIgnoreCase("MobileSearch")){ if(msearchType==null){ msearchType=(SearchInterface)cl.newInstance(); } return msearchType; } if(name.equalsIgnoreCase("BookSearch")){ if(bsearchType==null){ bsearchType=(SearchInterface)cl.new...

Parsing very large XML documents (and a bit more) in java

(All of the following is to be written in Java) I have to build an application that will take as input XML documents that are, potentially, very large. The document is encrypted -- not with XMLsec, but with my client's preexisting encryption algorithm -- will be processed in three phases: First, the stream will be decrypted according ...

JSF Memory Usage Issue when using using session beans

I am working on an application that has a navigation tree which is a session bean. Every time I invoke the page that contain this bean, my memory usage will increase. However, after few hours of inactivity, the memory still isn't freed. Are there any ideas why this happens, or workarounds? ...

Singleton Factory method

Is it possible to have a singleton in a factory method? I have many domains using the factory method. How do I work around with this. Please help me with an example. ...

How to learn Java from scratch?

Java is really vast and I want to start learning it. What is the best approach to start from scratch? Should i start with core java? And does any one knows any site/free e-book that explains each and every concept of Java with the help of examples? I have stressed on site/free e-book as i want to learn along with working. ...

Designing Address validation for app

I am planning to design an address validation for users registering in my app. Possibly validating by zipcode and state. Any idea how to handle addresses from around the globe? Do i need to insert all the zipcodes in the database and then validate the address. Any possible suggestion for the implementation? Thanks and Welcome :) Krisp...

Best way to return status flag and message from a method in Java

I have a deceptively simple scenario, and I want a simple solution, but it's not obvious which is "most correct" or "most Java". Let's say I have a small authenticate(Client client) method in some class. The authentication could fail for a number of reasons, and I want to return a simple boolean for control flow, but also return a Strin...

BlackBerry threading model

I've read a lot of comments mention in passing that the BlackBerry threading model deviates from the Java standard and can cause issues, but no amount of googling has enlightened me on what this means exactly. I've been developing a fairly large business application for the BlackBerry and, although I don't really have any previous exper...

Find all unused variable

Hi, Normally it's easy to see unused variables in Netbeans, just a grey squiggly line. But how would I find all of these unused variables in my project? or of a single class? Reason: I'm debugging a code base which had lots of copy and paste, but it wasn't done carefully s.t. there's many bug of not replacing with the right variable ...

How do I access init parameters from a JSP2 tag file?

I'm trying to create a jsp tag file but it fails to compile when I try to use pageContext.getServletConfig().getInitParameter("myInitParam") I'm using tomcat and when I try to view a page including the file I get a jasper compile error pageContext cannot be resolved. I've also tried just using getInitParameter but it fails also. I can u...

A good library for converting PDF to TIFF?

I need a Java library to convert PDFs to TIFF images. The PDFs are faxes, and I will be converting to TIFF so that I can then do barcode recognition on the image. Can anyone recommend a good library (free or $$) for conversion from PDF to TIFF? ...

can I reflectively instantiate a generic type in java?

Is it possible to reflectively instantiate a generic type in Java? Using the technique described here I get an error because class tokens cannot be generic. Take the example below. I want to instantiate some subclass of Creator that implements Creator. The actual class name is passed in as a command line argument. The idea is to be able ...

Image transcoding (JPEG to PNG) with Java

Hi In my Java application I would like to download a JPEG, transfer it to a PNG and do something with the resulting bytes. I am almost certain I remember a library to do this exists, I cannot remember its name. Can anyone help me? Thanks! ...