java

Annotation-based and xml-based transaction definitions precedence

I couldn't find a definitive answer to this in the docs, and although there seems to be a logical answer, one can't be sure. The scenario is this - you have a xml-based transaction definition, like: <tx:advice id="txAdvice" transaction-manager="jpaTransactionManager"> <tx:attributes> <tx:method name="*" propagation="REQUIRED...

Netbeans creating "JPA Controller classes from entity classes"

Hello, I want to achieve basic CRUD operations available of the db schema I already have for a JAVA program. To put it in another way, I have a DB schema I use with PHP and I just need them to be entities available in a JAVA application. I discovered I can use Netbeans and sucessfully created Entities from DB! (Entities look like this...

Accessing Java Packages in different Drives

Consider if I have got a Package in my C:\x\y\z and another package in D:\m\n\o. How can I access them in my java program? Do I need to set any path? ...

Where is the JavaBean property naming convention defined?

The Spring Framework API doc says: The convention used is to return the uncapitalized short name of the Class, according to JavaBeans property naming rules: So, com.myapp.Product becomes product; com.myapp.MyProduct becomes myProduct; com.myapp.UKProduct becomes UKProduct. I looked at Suns website to find a definition, but didn't ...

Find all combinations of a given set of numbers

Hi, say I have a set of numbers '0', '1', '2', ..., '9'. I want to find all numbers that contain exactly one of each of the numbers in my set. The problem is: Before I start my program, I do not know how many numbers and which numbers my set will include. (For example, the set could include the numbers '1', '3' and '14'.) I searched t...

What does the ^ operator do in Java?

What function does the "^" operator serve in Java? When I try this: int a = 5^n; ...it gives me: for n = 5, returns 0 for n = 4, returns 1 for n = 6, returns 3 ...so I guess it doesn't indicate exponentiation. But what is it then? ...

Expose members in a data structure like class?

For the use in a Servlet based application I've written a class to store a view name and objects to be rendered. Actually it is more a data structure than a class in the sense of OOP. I wonder if I should expose the members or if should use getters. public class Result { private final int status; private final String view; ...

What exactly is java server faces?

In comparison with asp.net webforms and asp.net mvc frameworks. ...

Castor compilation problem

I got "cannot access org.exolab.castor.core.exceptions.CastorException" from the compiler when I try to use Marshal and unmarshal. I used Castor 1.3 try { Writer writer = new FileWriter("out.xml"); Marshaller.marshal(person, writer); Reader reader = new FileReader("out.xml"); metaType = (Person) Unma...

Encoding problem

Hi, I have to parse the content I get from the web and it can contain special characters. In this case the content string appears like the following: <?xml version="1.0" encoding="UTF-8"?> <products> <product> <id>1</id> <price>2.14</price> <title>test &#382; test</title> When the contet above is passed to the method ch...

How can I mount a Wicket application at /* in GAE development server?

My Wicket application runs fine on the live Google App Engine at /* <filter-mapping> <filter-name>WicketApplication</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> However this URL pattern does not work on the development server (GAE 1.2.8): a request to http://localhost:8080/ gives this message: HTTP ERROR: 500...

accessing Browser's javascript from Java applet with MS Internet Explorer

I'm using JSObject plugin to write a cookie through the java applet and it worked with SUN's Java. but, With MS JVM the javascript command returning undefined I'm issuing the following from my Applet: String s1 = "document.cookie='logged=1'"; aobj = new Object[] { s1 }; JSObject.getWindow(MyAppletWindow).call("eval", aobj); any clue...

Network Order short (Java)

I need to send a Network Order short for a game server I'm writing using Java. I read about network order, but I couldn't find any details about a short that is sent before the data. Could someone explain to me what it is, and how to send one to a client with Java? ...

unable to send mail with zip attachment over google app engine

Hi, I tried sending an e-mail with a pdf attachment over google app engine and it worked. I then used the same code with a zip file. The recipient didnt receive the mail. When I checked the logs in Google App Engine, no errors were reported either. What could be going wrong? Can someone please tell me if it is possible to send zip files ...

Can we have a "not override a concrete method ..." compile time error when implementing interfaces ?

Can we have a "not override a concrete method ..." compile time error when implementing interfaces ? An example to be more clear : I build up a framework containing interfaces. To use the framework developers need to implements some interfaces. But if they don't override equals(Object object) and hashCode() Object methods the internal ...

Constructor dependency injection with Servlet 3.0?

Since Servlet 3.0 it is possible to register Servlet instances programmatically with javax.servlet.ServletContext#addServlet. This class has also a createServlet method which analyses some annotations and performs dependency injection. I wonder if I need this method if I don't need the annotation processing. I'd like to have a servlet wi...

Audio fingerprinting system in Java

Are there any audio fingerprinting systems (PUID, etc) that are implemented in pure Java (for running on Android)? ...

Maven parent pom vs modules pom

There seem to be several ways to structure parent poms in a multiproject build and I wondering if anyone had any thoughts on what the advantages / drawbacks are in each way. The simplest method of having a parent pom would be putting it in the root of a project i.e. myproject/ myproject-core/ myproject-api/ myproject-app/ pom.x...

Logging from SpringMVC controller

I have just started exploring SpringMVC and logback. This is my controller, (the only one i have so far) import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @Contro...

fire both blur and focus tightly coupled?

Any idea how I can fire the blur even just after the focus event, such that it doesn't occur "loosly coupled" (the actions are send one-by-one to the selenium server). Let me explain: In Selenium RC you fire the blur and focus through fireEvent(locator, "blur") and fireEvent(locator, "focus"). However, after the blur event is send to t...