java

Lemmatization java

Hi, I am looking for a lemmatisation implementation for English in Java. I found a few already, but I need something that does not need to much memory to run (1 GB top). Thanks. I DO NOT NEED A STEMMER. ...

Criteria queries in EJB 3

Can I use Criteria queries with EJB3 entities? If so, how can I combine them with EntityManager? ...

Is it possible to instantiate an object of generic type in Java or C# ?

For example, in Java, if I have a parameterized class, is it possible to do the following? public class MyClass<T>{ public void aMethod { .. T object = new T(); .. } .. } In Java, I think it is not possible, because the compiler doesn't know what constructor to call. But in C#? I don'...

Weird System.out.print Behavior in Netbeans

I'm getting weird results from the System.out.print immediately below the Scanner declaration in the code snippet below. It seems like it's executing twice. I've debugged it and immediately after executing the print statement I get this in standard out: run: Input a freaking binary number: Input a freaking binary number: I added t...

Avoid creating 'new' String objects when converting a byte[] to String using a specific charset

I'm reading from a binary file and want to convert the bytes to US ASCII strings. Is there any way to do this without calling new on String to avoid multiple semantically equal String objects being created in the normal object pool? I'm thinking that it is probably not possible since introducing String objects using double quotes is not ...

java.rmi.MarshalException

whenever I try to call my ejb from a client, I get this error : java.rmi.MarshalException: Failed to communicate. Problem during marshalling/unmarshalling; nested exception is: java.io.InvalidClassException: com.afrikbrain.util.message.MessageInfo; local class incompatible: stream classdesc serialVersionUI...

Quartz Scheduled Job in Error State

Hi, I have two jobs scheduled with Quartz. One runs once per week. The second runs one per day, for three consecutive dates in the week. I've noticed the following behaviour, but can't figure out what is going wrong. The first job sometimes just doesn't start at all. Before the scheduled start time, the TRIGGER STATE column is set...

Bluray Burner in Java - Where to start?

Like the subject of this post suggests, I am looking at developing a suite like nero which helps burn bluray discs. I am kind of clueless as to where to start. Is there anything in Java API that lets you do this? If I were to start from scratch, would I need to start with the bluray disc spec? Are there any open source tools which are al...

Need authoritative source for why you shouldn't throw or catch java.lang.Exception

I've got a coding standards meeting in just over an hour and I need a quick answer to this one. Common wisdom among experienced Java programmers is that you don't throw or catch java.lang.Exception (with rare exceptions - no pun intended). The reason you don't do this is that the statement catch (java.lang.Exception ex) {...} will ...

What's the deal with web service generation and JavaBeans?

I recently wrote some data access methods (plain old Java) that use immutable objects for both the request objects and the resulting data objects. I like the immutable objects because they prevent a good deal of confusion from appearing in the client code which I've seen in the past when people attempt to mutate and reuse objects. Anyw...

Java: How to replace all occurances of a character if and only if followed by some other character

In particular: I want to replace all occurances of a full stop \. with a full stop plus white space \.\s if the full stop is immediately followed by an upper case character [A-Z]. Any suggestions? thanks ...

Extract from Cache.db files on Mac OS X Leopard

I am a Windows user, and I delete temp internet files from IE by URL visited (because the Java app has an embedded web browser tied to a web server). I read from another post that the Cache.db file stores responses from webservers when it is an app bundle (/users/username/library/caches/myappbundle/cache.db). Is it possible to extract ...

Library to generate text from a regular expression in Java

Yup, you read that right. I need a library that is capable of generating random text from a regular expression. So the text should be random, but be matched by the regular expression. It seems it doesn't exist, but I could be wrong. Just a an example: that library would be capable of taking '[ab]*c' as input, and generate samples such a...

Two EntityManagerFactories...

I want to have two EntityManagerFactories (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in this case), with each of them having their own data source and own set of persistent objects. So somehow I need to be able to scope entities to a particular entity manager factory. I would prefer not to have to hard code the ...

How to get the request string including parameters

I have an odd exception in our application and I'd like to log when it occurs and include the complete request string including the parameters. When I try log.warn("Weird request " + request.getRequestURL()); I get the request string but not the parameters which were included with ? and &. example: /testRequest.do?param1=1&param2=...

Design of an Alternative (Fluent?) Interface for Regular Expressions

I've just seen a huge regex for Java that made me think a little about maintainability of regular expressions in general. I believe that most people - except some badass perl mongers - would agree that regular expressions are hardly maintainable. I was thinking about how this situation could be fixed. So far, the most promising idea I h...

Java Properties Object to String

I have a Java Properties object that I load from an in-memory String, that was previously loaded into memory from the actual .properties file like this: this.propertyFilesCache.put(file, FileUtils.fileToString(propFile)); The util (fileToString) actually reads in the text from the file and the rest of the code stores it in a HashMap (...

Transform Java-project to .NET-project

I have a project in Java. I want transform it to .NET-project. How to do it the easiest? ...

Is there a Java API for Google's AJAX Search API

Does anyone know of a Java library that provides a structured interface to Google's AJAX Search API http://code.google.com/apis/ajaxsearch/? I could only find Java API's for their old SOAP based interface. ...

Overwriting the errorPage property in JSP

I've defined <%@ page errorPage="/error.jsp" %> in the header that all JSP files include, to catch any unhandled exceptions and redirect to that error page instead of printing them. This works fine with one caveat - if error.jsp itself throws an exception, it will continuously redirect to itself in an infinite loop. I want to erase the e...