java

Can I put annotations for multiple processors into a Java class?

I'm not really sure how annotations actually work. I'm using JAXB and JPA (with eclipselink) on the same classes, i. e. I get class definitions like this: @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Channel") @Entity public class Channel extends NamedEntity { @XmlAttribute @XmlSchemaType(name = "anyURI") @Column(n...

Automated transcoding H.264 video on Linux

I've got a video camera that I'm using to capture video; the camera records in H.264 at 720p resolution. I'd like to transcode this stuff to a simpler, smaller format; something that will work properly on digital photo frames that support video, for example. As well, I'd like to transcode to DVD format where possible, so I can burn DVD...

Equivalent of c#'s 'as' in Java?

Is it possibly in java to attempt a cast and get a null if the cast fails? ...

Why does Maven javadoc fail with error "cannot read options"?

When I run mvn javadoc:javadoc, I get the following error: [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] An error has occurred in JavaDocs report generation:Exit code: 1 - javadoc: error - cannot read options (The system cannot find the file specified) Command line was:"C:\P...

Java performance Inconsistent

I have an interpreter written in Java. I am trying to test the performance results of various optimisations in the interpreter. To do this I parse the code and then repeatedly run the interpreter over the code, this continues until I get 5 runs which differ by a very small margin (0.1s in the times below), the mean is taken and printed. ...

Signed applet without modifying policy file manually.

Currently I had developed an applet. Applet basically uses java.awt.Robot package for capturing screen. I want to store captures images locally. I had signed my applet jar. Still when applet tries to write file into local system it gives access error. Is there any way by which I can write file in local file system without modifying polic...

Why aren't video games written in Java?

So I was just wondering, why aren't many video games (commercial 3D games, not random open source 2D ones) written in Java? In theory, it makes a lot of sense; you get a productivity boost and a cross-platform application for free (among other things, such as the vast amount of Java libraries, and built-in garbage collection -- although ...

Java Iterate Bits in Byte Array

How can i iterate bits in a byte array? ...

How do I prepend information to STDERR when a method generates stderr?

Is there some way I can catch when a method generates a write to STDERR? I'm trying to pre-pend some information with each STDERR write. let's say our method is: parser.thatGeneratesSTDERR(); it'll generate something like line 37:29 no viable alternative at character 'a' can I just wrap it with something that catches the stderr to...

character recognition in Java

I have a new project that invloves on-line character recognition (recognizing characters as they are written). My idea is that each character is defined by a number of strokes that fit a mathmatical model. For instance, 'A' could be defined by three linear strokes; 'O' could be defined as a single circular stroke. The reason for using li...

Netbeans / persistence API error

I am following this tutorial, I'm using netbeans 6.5.1 http://www.netbeans.org/kb/docs/java/gui-db-custom.html When I get to the part where I create the "new entity class from database", which is in the "Customizing the Master/Detail View" section of the tutoiral. I can't ever compile because I get this error in the task list (and I ge...

Dozer object on GAE/J

I'm trying to write application using GWT and GAE/J (Google AppEngine with Java). For my application i need to use DTO. In order to convert Pojo into JDO Entities I want to use Dozer library. So when i'm trying to convert object I'm getting following error: Jun 23, 2009 7:12:30 PM com.google.appengine.tools.development.ApiProxyLocalImpl...

Java's >> versus >>> Operator?

I'm without my Java reference book and I'm having a tough time finding an answer with Google. What is the difference between the ">>" and ">>>" operators in Java? int value = 0x0100; int result = (value >> 8); System.out.println("(value >> 8) = " + result); // Prints: "(value >> 8) = 1" result = (value >>> 8); System.out.println("(v...

How to Timing out java.sql.ResultSet

The PL/SQl cursor was getting hanged due to some reason, this makes my app to hang when try to loop through the ResultSet.Is there a way to handle this, like timing out the resultset if the database hangs? ...

Which solution to represent large results ?

Hi, I'm working on source code analysis of the linux Kernel considering all the 2.6 versions... I'm collecting results for each file compiled and for each version of the kernel... So far, i'm using an ad-hoc format and then I analyze the data with a small python script (a typical result file is about 300MB)... However, an ad-hoc is ...

Java practice questions

Hi, i posted the other day with practice questions i was getting stuck with and i am stuck again Please firstly can i ask you dont post full solutions. The question is from here http://www.javabat.com/prob/p141494 and reads Given a string and a second "word" string, we'll say that the word matches the string if it appears at the fro...

How can I left-pad the string representation of a float?

Hello. I'm trying to convert a single precision floating point number into an ascii representation of the four bytes that make it (sign/exponent/mantissa). My current code is: Integer.toString(Float.floatToRawIntBits(f),16); Float.floatToRawIntBits makes an integer using the same bytes, and then Integer.toString creates the ascii dig...

Packaging with a smaller JRE

I want to ship an open source Java project with its own JRE so that it doesn't depend on whether one is installed or not.I will have everything in one directory and my program will be the sole user of that jvm and class library. As Java is now open source, I think I can now legally strip down the class library (rt.jar) to only classes I ...

How to retrieve a list of directories QUICKLY in Java?

Suppose a very simple program that lists out all the subdirectories name of a given directory. Sound simple enough? Except the only way to list all subdirectories in Java is to use FileameFilter combined with File.list(). This works for the trivial case, but when the folder has say 150,000 files and 2 sub folders, it's silly waiting th...

How can I test client pipelining in java?

Can anyone suggest a simple setup of a servlet in java that supports pipelining? (It is for unit testing, so simplicity is better than scaleability). ...