java

tricky hibernate criteria

Hi, I have a sql statement which I want to move it into hibernate criteria, but I am not clue how to do this. The problem is one of the WHERE clause which looks like the following ...(skip other parts)... ? ILIKE strprefix||'%' ...(continue) strprefix is the column name, the ? is the place i need to fill in the value. With criteria...

Developing Palm WebOS Mojo applicaitons with Google Web Toolkit GWT

Has anyone successfully developed a "native" Palm WebOS app using GWT? How do you setup your development environment and how did you interface with the mojo framework? I was thinking one setup might be to create 2 projects: a GWT & a Palm OS project. Setup your build to copy the results from you GWT compile into the Palm OS project. Pro...

Android: SearchBox -> fill hint list dynamically with data received via HTTP/JSON

I've been looking into the Android SDK's example of the SearchableDictionary for a while now, but I'm still not sure if that is the right approach. The problem is, that I want to fill my hint list (see picture below) with data, which I will receive via a HTTP/JSON query. So I'm not sure if using a ContentProvider as used in the above ex...

Java Polymorphism problem

I've learned all these programming terms in Swedish so please bear with me.. I'm having problems calling a method in a subclass which should override a method in the superclass. Here is the class structure with removed code: public interface Movable { public void move(double delta); } public abstract class Unit implements Movable,...

Arguments Against Annotations

My team is moving to Spring 3.0 and there are some people who want to start moving everything into Annotations. I just get a really bad feeling in my gut (code smell?) when I see a class that has methods like this: (just an example - not all real annotations) @Transaction @Method("GET") @PathElement("time") @PathElement("date") @Autowi...

How do I iterate and perform some arbitrary operation on each item?

I have a Abstract Iterator class which has this function void iterate(){ while(this.hasnext()){ ..this.next().. } } How do I pass in any arbitrary function that will be applied to the next element. For example, is there a way to do iterate(print)? ...

Using Google AppEngine as a "cache" for personal websites (wordpress blogs, wikis)

I read an article of an indie game developer who is using Google AppEngine to cache his main site and blog, to protect provide high-availability during traffic spikes (Digg, Slashdot effect). Wolfire Blog - Google App Engine for Indie Developers There's not a lot of detail on the exactly what they developed in Python on Google AppEngin...

High-performance Math library for .NET /C# and Java

We currently have a high-performance scientific application written in C++ that makes use of Intel Math Kernel Library. We are considering writing a benchmark application written in Java and .NET/C# to compare the performance difference. To do that, we also need a good (commercial is preferred) math library for both. Does anyone know of...

To split only Chinese characters in java

I am writing a java application; but stuck on this point. Basically I have a string of Chinese characters with ALSO some possible Latin chars or numbers, lets say: 查詢促進民間參與公共建設法(210BOT法). I want to split those Chinese chars except the Latin or numbers as "BOT" above. So, at the end I will have this kind of list: [ 查, 詢, 促, 進, 民, 間, ...

Escaping an apostrophe in Java

I'm still somewhat new to Java and trying to insert data into a database. I'm getting an error when inserting a string containing 's so my end result would be to escape the apostrophe. How can I accomplish? ...

Adding to the classpath on OSX

Can anyone tell me how to add to the classpath on OSX? ...

Java: interspersing bytes and characters

I have a piece of test equipment, from which I can read data using an InputStream, which intersperses bytes and characters (organized into lines), e.g.: TEST1 TEST2 500 {500 binary bytes follows here} TEST3 TEST4 600 {600 binary bytes follows here} I'd like to use BufferedReader so I can read a line at a time, but then switch to Input...

How to close a modal JDialog when user clicks outside of JDialog?

I have a Undecorated Modal JDialog which I want to setVisible(false) when the user clicks outside of the modal dialog. Is this possible in Swing? What I am doing is popping up a custom editor for a text field like a date selector. Is there an easier way to do what I want? EDIT Remember that modal blocks on the call to setVisible(tru...

Apache HttpClient 4.0. Weird behavior.

Hello. I'm using Apache HttpClient 4.0 for my web crawler. The behavior i found strange is: i'm trying to get page via HTTP GET method and getting response about 404 HTTP error. But if i try to get that page using browser it's done successfully. Details: 1. I upload multipart form to server this way: HttpPost httpPost = new HttpPo...

Why is paint()/paintComponent() never called?

For the last two days I have tried to understand how Java handles graphics, but have failed miserably at just that. My main problem is understanding exactly how and when paint() (or the newer paintComponent() ) is/should be called. In the following code I made to see when things are created, the paintComponent() is never called, unless...

Automating Integration Tests: Use xUnit?

I'm looking into how best to automate integration tests (by which I mean complete use cases entirely within our application) The questions Correct Approach for Unit Testing Complex Interactions What are the pros and cons of automated Unit Tests vs automated Integration tests? cover the "why" and "what" aspects very well. The questi...

Passing an HTML string to jQuery function

I'm working on an application which retrieves some HTML code from a record in a database. That strings then gets taken and inserted inside of a specific div. Right now I'm accomplishing this by passing the variable from Java and printing it within the div in the JSP. Now I'm trying to use an external jQuery function to accomplish this ta...

Integrating SOAP and VXML

I am writing an interface for our VXML application that will allow access to a SOAP service. Because of the difficulties inherent in trying to use javascript to make SOAP calls and the limitations of VXML, as in making external resource calls are pretty much limited to HTTP requests, GET and POST. I designed a java servlet that would a...

How to encrypt passwords for JConsole's password file

I am using the JConsole to access my application MBeans and i use the the password.properties file. But as per the Sun's specification this file contains passwords in clear text formats only. com.sun.management.jmxremote.password.file=<someLocation>/password.properties Now i would want to encrypt the password and use it for the JMX us...

org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource

Hi I am developing a RIA application using SWING as client,Java WebStart JNLP and Spring on server side using HTTPInvoker. I am getting the below error message when I am trying to Launch & Run my application from JNLP. But if I run the same as java application it workes fine and communicate with server and fetch data using spring bean. ...