java

How to maintain null for numeric values when using BeanUtils.copyProperties?

I have a numeric database field (numeric(3) in SQL Server 2000) that allows nulls, and null is my preferred "no value" value. That field is mapped to the non-primitive java Long class in Hibernate: <property column="my_column" name="my_column" type="java.lang.Long" not-null="false" /> The field is set as java.lang.Long in both my stru...

Getting rid of derby.log

I'm using the Apache Derby embedded database for unit testing in a Maven project. Unfortunately whenever I run the test I end up with the derby.log file in the root of the project. The database itself is created in the target directory (jdbc:derby:target/unittest-db;create=true) so that is not a problem. After consulting the reference gu...

Is there a HTML templating engine for Google App Engine (in Java)?

Looking for something simple (like Smarty for PHP or erb in Rails), but that will allow nesting templates inside each other. Does App Engine have anything built-in, or will I need to look into something separate (like Velocity?)? Thanks. ...

JAR files, don't they just bloat and slow Java down?

Okay, the question might seem dumb, but I'm asking it anyways. After struggling for hours to get a Spring + BlazeDS project up and running, I discovered that I was having problems with my project as a result of not including the right dependencies for Spring etc. There were .jars missing from my WEB-INF/lib folder, yes, silly me. After...

How do I specify conditions from 2 different beans in a jsf rendered attribute?

I want to do something along the lines of the following but when I use it like this I get a parse error telling me an entity needs to directly follow the '&' character: <ice:selectManyCheckbox rendered="#{!bean1.condition1 && bean2.condition2}" value="#{bean1.selected}"> <f:selectItems value="#{bean2.items}" /> </ice:selectManyCheckbox>...

how to get a the value of an http post as a whole? parsing restful post

Is it my ideea or in rest-web services a post comes "with no name", so say something... I mean, is the post the whole body, minus headers??? so, how can I parse such a post message with java? do I have to use HttpServletRequest.getInputStream? http://www.softlab.ntua.gr/facilities/documentation/unix/java/servlet2.2/javax/servlet/htt...

What is the VB equivalent of Java's instanceof and isInstance()?

In the spirit of the c# question.. What is the equivalent statements to compare class types in VB.NET? ...

How do I programmatically import a public key .cer file into a java keystore using JSSE?

I want to take a public key .cer file generated from java keytool command like this: "keytool -export -alias privatekey -file publickey.cer -keystore privateKeys.store" and import it into a new, empty java keystore like this: "keytool -import -alias publiccert -file publickey.cer -keystore publicCerts.store" except I want to do the...

Is it possible to extend a class with only private constructors in Java?

For unit testing purposes I'm trying to write a mock object of a class with no constructors. Is this even possible in Java, of is the class simply not extensible? ...

Java client calling WSE 2.0 with DIME attachment

I need to integrate with a legacy .NET Web Service that uses WSE 2.0 for WS-Security and DIME. The catch is I need to do this from a Java application. I'm expecting that Axis2 works fine with the WS-Security because folks around here have done it before. It's the DIME that I'm concerned about. I see a reference to DIME at http://ws.apac...

executing a dynamically created file

import java.io.*; public class Demo{ public static void main(String[] args){ File f = new File("abc.txt") ; try{ System.setOut(new PrintStream( new FileOutputStream(f) ) ) ; } catch(FileNotFoundException fnfe){ System.out.println(fnfe.getMessage()) ; } System.out.println("Hello\n") ; ...

android web scraping behind a secure login.

I've been racking my brain about this for a while, I've managed to send a post request to a https based login form using the android sdk, specifically the org.apache.http library. All seems well in that the response i get back from the server is 200 OK. However, I can't figure out how to then scrape the page behind the login. The apach...

keyboard event handling....

hi.... i m doing the project on remote screen capturing and controlling.... i have done the screen capturing.... now i watn to make controlling....in it i want.... i have done the controlling through mouse events like mouseMove & mousePressed,mouseReleased... but the controlling by Keyboard is not done...so tell me how to do KeyBoard ev...

Why do I get ClassNotPersistableException while running GWT App Engine application in hosted mode?

I am randomly getting an org.datanucleus.exceptions.ClassNotPersistableException when I try to perform a query on the local JDO data store of my GWT/App Engine application. This only happens when I run the application on Hosted mode. When I deploy it to the Google App Engine everything works perfectly. Stack Trace: org.datanucleus.exce...

should interfaces (in java) be placed in a separate package?

i'm new to a team working on a rather large project, lots of components, dependencies. for every component, there's an 'interfaces' package where the 'exposed' interfaces for that component is placed. is this a good practise? my usual practise has always been interfaces and implementations in same package. was wondering what's the sta...

Initialization of an ArrayList in one line.

I am willing to create a list of options to test something. I was doing: ArrayList<String> places = new ArrayList<String>(); places.add("Buenos Aires"); places.add("Córdoba"); places.add("La Plata"); I refactor the code doing: ArrayList<String> places = new ArrayList<String>(Arrays.asList("Buenos Aires", "Córdoba", "La Plata")); I...

Java Preferences.app doesn't change default java version

The version returned by java -version on the command line will be determined by the link /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK if JAVA_HOME is exported as /Library/Java/Home (which is a link to /System/Library/Frameworks/JavaVM.framework/Home) The version returned by java -version on the command line will be ...

I need code in jsf to convert AFP file to PDF

I have written a code to retrieve a Pdf document from remote machine in JSF technology.But i also want to retrieve AFP file by converting it to xml and then to PDF. Please help ...

Using Netbeans to design GUIs and the ability to start with Web Start.

I designed a GUI program using Netbeans 6.5 on a computer running Vista. I uploaded it to my server and tested out the web start. It worked fine. Later when using a Mac, it was not able to work. I tested it out in Ubuntu and was unsuccessful as well. I even tried to compile the source code on Ubuntu and I got this: Task required to...

Can I move maven2 "target" folder to another device ?

I would really like to make maven write the "target" folder to a different device (ramdisk), which I would normally consider to be a different path. Is there any maven2-compliant way to do this ? I am trying to solve this problem on windows, and a maven-compliant strategy would be preferred. ...