java

BIRT Formating Legend of a bar chart

I have a small problem, a BIRT report I designed uses a bar chart. Now I want to increase the space between colored box and the text in the legend. Is that possible? (I'm using BIRT 2.1.3) EDIT: I forgot to mention I am using BIRT 2.1.3 with the RCP Designer. ...

JPA reserverd keywords to postgres

I'm using JPA with a postgres DBMS and I'm trying to create a new entity that maps to the table "User". This is a very common problem as User is a reserved word in Postgres. My question is, how can i "escape" the reserved keyword or set JPA to escape it? I tried @Table(name = "\"user\"") with no luck: 2009-02-25 15:43:14,218 ERROR...

Getting Outlook to read text/calendar headers correctly

I'm currently writing a mail programme using JavaMail 1.4 to send out scheduling invitations to a variety of platforms including Outlook, which is where I run into an issue. I can send out one or two invitations and the Accept/Decline buttons show up but if I send out more (which I need to) then the buttons do not appear - so I assume th...

Why are my Log4j log file timestamps out of order, and how do I fix it?

My log4j.xml contains: <appender class="org.jboss.logging.appender.RollingFileAppender" name="rm"> ... </layout> My log file shows timestamps that are out of order. Can we display based on timestamp? 2009-02-19 14:47:01,288 DEBUG [com.catalystwms.core.persistence.TransactionContext] 2009-02-19 14:54:27,429 INFO [com.catalystw...

Java keeps lock on files for no apparent reason

Despite closing streams in finally clauses I seem to constantly run into cleaning up problems when using Java. File.delete() fails to delete files, Windows Explorer fails too. Running System.gc() helps sometimes but nothing short of terminating the VM helps consistently and that is not an option. Does anyone have any other ideas I could...

How do I write a HQL Query for this?

I want a single HQL query that returns all groups containing a given user that where created before a given date. Somehow I can't get it right. public class Group { @ManyToMany Set<User> users; Date created; } public class User { ... } ...

Java Certifications recommendations?

I am studying for the Sun Certified Java Programmer examination, and I wondered: what have you used to study for this exam? How much experience in the real world do you need before you're ready for this exam? And will this certification actually help in terms of marketability? Thank you. ...

Stop bash script if unchecked Java Exception is thrown

I am running a java program from within a Bash script. If the java program throws an unchecked exception, I want to stop the bash script rather than the script continuing execution of the next command. How to do this? My script looks something like the following: #!/bin/bash javac *.java java -ea HelloWorld > HelloWorld.txt mv Hell...

Returning values...(Edited with new code and more questions) - illegal start of expression

These are my questions: I'm getting a couple of errors on the line "public static boolean validNumCheck(String num){" - "illegal start of expression", "';' expected", and "')' expected". How can I give the user 3 tries in total for each number? I believe right now the programme asks the user for 3 numbers and gives them 3 tries in tota...

Where can you find the native code in the JDK?

I was looking at the Java code for FileInputStream and am interested in what the open and close methods do. These functions, or parts of them, are implemented natively. Do you know where I can find this code? Is this code part of the open source license for the JDK? ...

Rijndael support in Java

We have a requirement to do some Rijndael development in Java. Any recommendations for articles, libraries etc. that would help us? Any pointers to keystore maintenance and how store the keys securely? Edit: It would need to be open source. Essentially, it's just standard encrypt / decrypt of data using Rijndael. ...

Question about Java enums.

I have 2 files which are interacting with each other. I wanted to define an enum to make the code more readable, but if I define it in file 1, file 2 complains about having no knowledge of said enum. If I define ii in file 2, file 1 does the same. I am defining it as public too. The solution was to define the enum in both files, but th...

Java: Finding objects in collections.

This problem occurs over and over. I have some complicated object, such as a Cat, which has many properties, such as age, favorite cat food, and so forth. A bunch of Cats are stored in a Java Collection, and I need to find all the Cats that are aged 3, or those whose favorite cat food is Whiskas. Surely, I can write a custom method ...

Implement Mixin In Java?

Using Java 6, how can I implement a mixin? It is very easy and possible in Ruby. How can I get similar in Java? ...

Do you know of pmd or checkstyle definition files that will enforce hibernate best practices?

For example, not to build queries by string manipulation, and the like. ...

What is the preferred way to declare a Java array?

Possible Duplicate: Difference between int[] array and int array[] What is the difference between these two declarations of an array of native types in Java? double items[] = new double[10]; double[] items = new double[10]; If they are the same is there any reason to prefer one over the other? ...

Catching exceptions as an expression while debugging Java in Eclipse IDE

An everyday debugging situation for Java developers is that in which an Exception is thrown and then you need to dig into the debugger to find out what threw it. Usually you would try to set up some breakpoints before the exception is thrown and hope that you are able to determine the situation that leads up to that exception. In Eclips...

Object/Relational mapping

In our java project, We decided to use ORM object/relational mapping technique in objects' persisting. But we hesitate to use a specific framework to do this.So, what is the best framework for java can do this task? ...

Java port of Hash by Jenkins

I am looking for a java port of this file, Jenkins Hash in C ...

JMS Messaging Performance: Lots of Topics/Queues vs. Extensive Filtering (Message Selectors)

I'm working on a project that is going to make heavy use of JBoss Messaging (JMS). I'm tasked with building an easy to use wrapper around Messaging for other developers and am thinking about using JMS's Message Selectors to provide a filtering technique to keep unnecessary sending of messages to a minimum. I'm curious if anyone has any e...