java

Rails flash messages in Java

What's the best way to achieve Rails-like flash messages such as "Update successful" http://api.rubyonrails.org/classes/ActionController/Flash.html) in the Java world? I'm using Spring MVC. ...

Order of XML attributes after DOM processing

When processing XML by means of standard DOM, attribute order is not guaranteed after you serialize back. At last that is what I just realized when using standard java XML Transform API to serialize the output. However I do need to keep an order. I would like to know if there is any posibility on Java to keep the original order of attri...

What is the memory overhead of an object in Java?

Duplicate: What is the memory consumption of an object in Java? Assuming Java 1.6 JVM on 64-bit Linux on an Intel or AMD box, creating a simple object uses how much memory overhead in bytes? For example, each row in a 2-dimensional array is a separate object. If my array is large, how much RAM will I be using? ...

How to implement generic test for RMI connection, J2EE services?

I'd like to implement a little test to check connectivity to J2EE services over RMI. It needs to be generic, so that I could just give it a property file with the following properties set in it: java.naming.factory.initial=oracle.j2ee.rmi.RMIInitialContextFactory java.naming.security.principal=user java.naming.security.cred...

How to efficiently unpublish all datas from a particular user on a blogging application ?

We develop and operate a blogging application in which user data a scattered across many tables: - Blog - Article - Comment - Message - Trackback - 50 other tables. Users are able to close their account, and their account/contents must disappear from the site right away. For legal/contractual reasons, we also must be able to undelete...

How to override method to invoke superclass' superclass method?

Part of me thinks that this shouldn't be possible (even if it is), but I'll ask anyway. Given the following class hierarchy (Grandparent and Parent are from a 3rd party and thus, not under my control), how would I override myMethod() in Child such that it bypasses the overridden implementation in Parent and invokes the one in Grandpare...

Get heap dump from a remote application in Java using JVisualVM

I run JVisualVM (Windows XP, Sun Java 1.6.0.13, 32 bit client VM) to monitor a distant application (Linux, Sun Java 1.6.0.07, 64 bit server VM). Before starting the actual remote application, I launch on the remote machine jstatd using an all access policy: grant codebase "file:${java.home}/../lib/tools.jar" { permission java.securit...

Creating a "logical exclusive or" operator in Java

Observations: Java has a logical AND operator. Java has a logical OR operator. Java has a logical NOT operator. Problem: Java has no logical XOR operator, according to sun. I would like to define one. Method Definition: As a method it is simply defined as follows: public static boolean logicalXOR(boolean x, boolean y) { retu...

Refactoring classes that use global variables.

I'm working on some classes that get part of their configuration from global variables, e.g. class MyClass { public void MyClass(Hashtable<String, String> params) { this.foo = GlobalClass.GLOBALVAR.get("foo"); this.bar = GlobalClass.GLOBALVAR.get("bar"); this.params = params; } } This is bad for a coupl...

Server disconnects in Java

Related posts didn't answer my question. I have a server which does something like: EVERY TWO SECONDS DO: if the inputstream is not null { if inputStream.available() is 0 { return } print "handling input stream" handleTheInputStream(); } Even after my client disconnects, the server doesn't recog...

Reset/remove a border in Swing

Here's a very specific coding question: I've recently been asked to maintain some old-ish Java Swing GUI code at work and ran into this problem: I've attached my own subclass of InputVerifier called MyFilenameVerifier to a JTextField (but it may as well be any JComponent for these purposes). I've overridden the verify() method such th...

How to obtain a Java stack trace from a client running under web start?

I wanted to get ideas from the SO community about this issue. Here is the problem: We have a user on the other side of the world launching our app through WebStart. The user, however, is complaining that her whole application freezes up and becomes unresponsive. Usually, the client is doing a lot of database queries to a distributed da...

Find if an SQLException was thrown because of a duplicate

I have a Java program that is agnostic from the database and I need to know, while inserting, if an SQLException was thrown because of a duplicate key. If I was using a single database driver I would simply use the ErrorCode, but since I can be using very different engines the ErrorCode are not the same. Has anyone done this before? An...

F5 irule with RESTful services

I'm trying to come up with a rule on our F5 to direct traffic to our Tomcat server appropriately. We are deploying separate WAR files for each RESTful service. So, we would like to have the following URIs as an example: /services/quiz/01234/ /services/user/54321/ Where 'quiz' and 'user' are quiz.war and user.war respectively. We want t...

Java Restful Web Service Tutorial with Eclipse and Tomcat

Hi, I was wondering if anyone could post or know of instructions on creating a simple restful web service with eclipse and deployed on tomcat. ...

How do I cleanup an opened Process in Java?

I'm starting a Process from a Java program. I hold onto it and at later points in the program I may send it some signals (not as in UNIX signals -- a different mechanism) to tell it to clean itself up and shut down, which is the proper way of terminating this process. I may later restart and hold onto the process and stop it again an a...

Setting the mouse cursor for a particular JTable cell.

I have a JTable with a set of uneditable cells and I want all the cells in a particular column to have a different mouse cursor displayed whilst the mouse is hovering over them. I am already using a custom renderer and setting the cursor on the renderer component doesn't seem to work (as it does for tooltips). It does seem to work for e...

What is your experience with GWT?

Do you find the Google Web Toolkit to be a useful project? Are there licensing issues? ...

Synchronizing Jena OntModels with bnodes

This question relates to rcreswick's question on Serializing Jena OntModel Changes. I have Jena models on two (or more) machines that need to remain synchronized over sockets. The main issue that I need to address is that the models may contain anonymous nodes (bnodes), which can originate in any of the models. Question: Am I on the r...

Tools for coding conventions and analyzing HTML, CSS, Javascript client side code

I use various code checkers for Java development but I haven't used one for HTML,. CSS, Javascript. Do any exist. That flag bad practices or similar tool. ...