java

Check invariants in hibernate mapped classes

One challenge using hibernate is that manged classes have to have a default constructor. The problem is that there is no explicit point where the class is initialized and invariants can be checked. If a class has invariants that depend on more than one property the class design gets complex. Let's start with the hypothetical green-fiel...

liferay portal with asp.net

Hi This is a java noob related question. Have been looking at Liferay portal technology, however I'm a dotnet (c# or vb) developer by day. Does anyone know if you can use the install of liferay to host dotnet code, not just by using the iFrame method of redirecting to a different site - that just sucks in my opinion Alternatively is t...

JavaCC: I wish to generate java classes from dymanicly generated jj files and to compile them at runtime...

Hi all, I am refactoring a project which uses javaCC to create a proprietary language parser during compile time. Due to the fact that different variations of languages can exist at the same time, it has been decided to dynamically generate the java source code from the jj files during runtime, to then compile the java files into class ...

GUI + multithreading support + regex support. Which language? JAVA / Python / Ruby ??

I'm interested in learning a programming language with support for GUI, multithreading and easy test manipulation (support for regex). Mainly on Windows but preferably cross-platform. What does the Stack Overflow community suggest? ...

Cruisecontrol hangs when checking SVN for modifications

Since migrating a Cruisecontrol build server to a new machine, it sometimes hangs during the "modificationset" stage of the build cycle (it is configured to check for modifications every 15 minutes). Cruisecontrol itself stays responsive, only the build does not progress. There is no significant load on the CPU when this happens, and I...

JMS Queue to JTable Update [Now getting exception after changes]

I am writing my own JMS Browser and I am struck at the JTable update of Messages from JMS servers. I have tried AbstractTableModel TableModelListener to make Jtable refresh when the data added into LinkedList. This below logis works , but its not updating realtime , means I would like to display each and every row added to Jtable immedia...

Web Application with Sample "guest" data

Hello, we are currently working on a new web application using Java and MySql. We would like to implement a "guest" login feature. The idea is simple: anyone can login as a guest user and get access to a small pre-defined dataset which they can then interact with as if they were fully paid up clients. This feature should have these att...

java: search & replace in a Stream

How do I do on-the-fly search & replace in a Java Stream (input or output)? I don't want to load the stream into memory or to a file. I just see the bytes passing by and I need to do some replacements. The sequences being replaced are short (up to 20 bytes). ...

Could Java be used to write a Win32 System Service?

The title sort of sums it up. I was thinking of using Jabaco seeing as it makes .EXEs (as well as .jar files), and I'm more familiar with VB syntax than with Java. ...

How to handle error java.lang.RuntimeException/NullPointerException

I follow this tutorial about "JPA in Web Service"(http://www.netbeans.org/kb/61/javaee/persistence.html). i follow this tutorial step by step, and when i compile the code , i have no problem. But when i run the program i got many error i already download the finish project, but it still same error, any way to handle this error? thx ...

Seam: login using external SSO application

I have a Seam application that have to use an external one to login. The logic is as follows: My app sends user to external SSO URL User does what it takes to authenticate there On success, the external app redirects user back to my app with a random token My code should contact the external app via HTTP with the passed token and get...

Problem in javax.swing.SwingWorker

I have made a swings application but there is one problem in that which is as follow: I have initiated a SwingWorker thread named "Thread-Main" from the Event Dispatch Thread and have passed a JLabel reference of the GUI to the "Thread-Main". Now I have started 10 threads from the "Thread-Main". Now I want that all the 10 threads shou...

What lucene analyzer can be used to handle Japanese text?

Good day, Which lucene analyzer can be used to handle Japanese text properly? It should be able to handle Kanji, Hiragana, Katakana, Romaji, and any of their combination. Thanks, Franz ...

Calling main method from another application

I'm writing a wrapper application that will be used to provide an abstraction layer around an existing application that is currently called from the command line. How would I go about calling the main method in the existing app from within my wrapper app? ...

How to implement a data-based ComboBox control with GraniteDS?

I'm trying to integrate Seam and Flex with GraniteDS, with the goal of implemenenting a code generation tool for main use cases of CRUD operations. One of my needs is to have the possibility to generate a combo box to reference a parent entity from another. For example, a state combo box in my county edition/creation screen. My first a...

Java Double Checked Locking

Hi All, I happened upon an article recently discussing the double checked locking pattern in Java and it's pitfalls and now I'm wondering if a variant of that pattern that I've been using for years now is subject to any issues. I've looked at many posts and articles on the subject and understand the potential issues with getting a re...

Image resize quality (Java)

Hi, I have an open-source app which uploads photos to Facebook. To save bandwidth, the photos are automatically resized before uploading (Facebook imposes a maximum size limit). A few people have complained about the photo quality, and in fact you can see the difference (see this issue for some demo images). So my question is, what is t...

How to append text to an existing file in Java

I need to append text repeatedly to an existing file in Java. How do I do that? ...

Parsing invalid xml

I parse xml using jaxb. I want to parse xml successfully also when xml is not valid that have additional tag. Just ignore tag that non-exist in xsd. Is it possible? ...

Get Text Content of xml element

Hola! ;) So, i have some question about xml Documents in Java. Can i get all text(only text) content of some element and all descendant's elements of this element, without to iterate through all this elements and using Element.getText()? By another words, it must be some analogous function to JavaScript textContent. Or i must to iterate ...