java

Amazon SQS invalid binary character in message body

I have a web app that sends messages to an Amazon SQS Queue. Amazon sqs lib throws a 'AmazonSQSException' since the message contained invalid binary character. The message is the referrer obtained from an incoming http request. This is what it looks like: http://ads.vrx.adbrite.com/adserver/display_iab_ads.php?sid=1220459&title_c...

How to escape "\" characters in Java

hi everyone: As we all know,we can use string aa=@"E:\dev_workspace1\AccessCore\WebRoot\DataFile" in c# in order not to double the '\'. But how to do in java? ...

Disable Hot Code Replace for the Eclipse Java debugger

When you change Java code while in a debugging session, Eclipse will upload the updated class files into the running JVM (hot code replace). This even works for remote applications. Is there a way to turn Hot Code Replace off (within Eclipse, not at the remote JVM)? We want to be able to debug our test and staging servers remotely, but...

How to populate the values of XML in JSP?

Hi, I am new to the Java development. I need to populate XML fields in a JSP page. I didn't do with JDBC actually i have written the Mysql wrapper in C it executes the query and return the table value as XML. Help me how to populate the XML fields in JSP? how to read the XML file using JDBC ResultSet? Will be much helpful thanks ...

Validation Design and Documentation

In a perfect world you have the validation (verification) of inputs in the business logic layer, not in the presentation or persistence layer. In reality you can (or want) to place it anywhere. Lets make a simple sample (web-application using a framework like JSF or ZK): A certain input field accepts 4 digits between 0001 and 0500. Yo...

Using Sun JCE provider on top of IBM SDK

Hi, I need to use Sun JCE provider in an application that is running on IBM Websphere. This can be achieved by specifying the security_provider.1=com.sun.crypto.provider.SunJCE. Some parts of my application make use of SSL facilities of IBM. I want to know whether configuring the SunJCE provider affects the JSSE provider usage in other...

List as a named parameter in JPA query using TopLink

In the following JPA query, the :fcIds named parameter needs to be a list of integer values: @NamedQuery(name = "SortTypeNWD.findByFcIds", query = "SELECT s FROM SortTypeNWD s WHERE s.sortTypeNWDPK.fcId IN (:fcIds)") Quite logically, this is what is done when the named query is called: Query findByDatesPlFcIds = em.createNamedQuery("...

How can I get the number of availableProcessors in Ant

I would like to get the number of availableProcessors from with my Ant build script (i.e. value that is returned from Runtime.getRuntime().availableProcessors(). Is there an existing property that contains this value or do I have to write a custom ant task? ...

References to MappedBySuperclass-classes

I have the following problem. I have an abstract class called Vehicle, this class is annotated with MappedBySuperclass. Then I have lots of classes extending that abstract class, such as Car, Boat, Bicycle, Motorcycle etc etc etc. I also have a class called Person. A person owns a set of vehicles. I would like the relation to look like t...

Do any Java libraries use annotations for code generation?

Is anyone aware of a library that uses the the techniques (annotations and classworking) described in this article for automatically generating the standard Object methods toString(), equals() and hashcode() for standard java classes? ...

I need a uDIG tutorials

Do you know any good tutorials - how to create plug-ins to uDIG application? ...

Are there Compound property values in Spring

I read about Compound property names in the "The Spring Framework (2.5) - Reference Documentation - chapter 3.3.2.7" Can i use the same concept to set values of properties? Can i use a compound string as a value expression? <bean id="service1" class="a.b.c.Service1Impl" scope="prototype"> <property name="service2" ref="service2"/> ...

What is org.springframework.orm.hibernate3.support.BlobByteArrayType good for?

What is org.springframework.orm.hibernate3.support.BlobByteArrayType good for?Why not map a byte[] as the Hibernate basic type "binary"? What are the differences? When to use which? Thanks! ...

Is it possible to create a mock object that implements multiple interfaces with EasyMock?

Is it possible to create a mock object that implements several interfaces with EasyMock? For example, interface Foo and interface Closeable? In Rhino Mocks you can provide multiple interfaces when creating a mock object, but EasyMock's createMock() method only takes one type. Is it possbile to achieve this with EasyMock, without resor...

JSP Struts to Velocity Struts conversion

I'm asking this on behalf of one of my students - "Does anybody have an idea how to convert JSP Struts to Velocity Struts?" ...

How do I configure apache httpcore 4 to use a proxy?

I'm trying to use the latest (4.0.1) Apache http core components library. However, my web browser goes through a proxy - suppose it is myproxy.com:9191. Could someone provide some sample code for getting a simple http get to use this as a proxy? I've tried adding the following at the beginning of my code, but had no joy: ProxySelector....

java gui - overlapping panels?

Hi all, i'm just trying to create this little simulator. in a gui, i have two main components - a map, taking up most of the window, and a control panel on the right hand side. now, i'd like to add a time slider across the bottom of the window (running only under the map, not under the control panel). i can do it in the runner class (wh...

Number of classes loaded in java

Hi I have program that the number of classes loaded there is constantly rising. How could this actually be ? Or do i misunderstand something in java about classloading? Here is a snippet from jConsole overnight : Could someone please tell me what could be the possible reason for such a constant classloading growth ? Or is this norm...

An unbounded set of hashes based on bounded sets of hashes based on paths

Suppose there is a tree, for argument's sake an XML tree. And you want a complete set of root to node paths, however you want to divide that set into groups of i, where i is user specified. So for example a html document: /html /html/head /html/head/title /html/head/title/[text] /html/body /html/body/[text] becomes for example...

Authenticate users with SpringSecurity using a WebService that requires a username and password

Currently I am writing a web application using Spring Security. We have a web service which authenticates users by username and password. Web service: String[] login(String username, String password); How do I configure Spring Security to pass the provided username and password to the web service? I have written a UserDetailsService...