We develop Java Web-aps (Websphere, DB2) which display graphical and databased information. We would also like to offer the same application offline (distribution via CD/DVD) with online data-update. We have tried a number of alternatives in the past, but nothing has been really stable. What are the new best practices to take a Web ap pl...
I am using the following code to set a tray icon in Windows and Linux. It works wonderful in Windows and works okay in Linux. In Linux (Ubuntu) I have my panel set to be (somewhat) transparent and when I add a GIF (with a transparent background) the background of the icon shows up all grey and ugly (see image, green diamond "!")....Any i...
Is there an elegantish way in Swing to find out if there are any tooltips currently being displayed in my frame?
I'm using custom tooltips, so it would be very easy to set a flag in my createToolTip() method, but I can't see a way to find out when the tooltip is gone.
ToolTipManager has a nice flag for this, tipShowing, but of course i...
My code is like the following:
URLConnection cnx = address.openConnection();
cnx.setAllowUserInteraction(false);
cnx.setDoOutput(true);
cnx.addRequestProperty("User-Agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
InputStream is = cnx.getInputStream();
Is it ok if I set the headers before I get the InputStr...
The other day I decided to write an implementation of radix sort in Java. Radix sort is supposed to be O(k*N) but mine ended up being O(k^2*N) because of the process of breaking down each digit to one number. I broke down each digit by modding (%) the preceding digits out and dividing by ten to eliminate the succeeding digits. I asked my...
I am currently starting my Java VM with the com.sun.management.jmxremote.* properties so that I can connect to it via JConsole for management and monitoring. Unfortunately, it listens on all interfaces (IP addresses) on the machine.
In our environment, there are often cases where there is more than one Java VM running on a machine at t...
A design question.
I have developed an online test engine web app earlier this year. I have used Java servlets and Freemarker templates and done it entirely following the MVC paradigm.
One big missing feature in the application is that it provides no reporting. The initial design of the application did not consider reporting as part o...
Is it possible for a JPA entity class to contain two embedded (@Embedded) fields? An example would be:
@Entity
public class Person {
@Embedded
public Address home;
@Embedded
public Address work;
}
public class Address {
public String street;
...
}
In this case a Person can contain two Address instances - home...
I work on a large project and want to disable the Eclipse compiler warning stating:
Access to enclosing constructor ... is emulated by a synthetic accessor method. Increasing its visibility will improve your performance
Eclipse version 3.3.2
...
What are my options for running Java 6 on OS X?
I have an MacBook Pro Intel Core Duo running Mac OS X 10.4. Do I have any options for running Java 6 on this hardware and OS?
Related questions: Which Macs (either current or forthcoming) support 64-bit computing? Are there any Apple laptops (either current or forthcoming) that will have...
I recently came across this in some code - basically someone trying to create a large object, coping when there's not enough heap to create it:
try {
// try to perform an operation using a huge in-memory array
byte[] massiveArray = new byte[BIG_NUMBER];
}
catch (OutOfMemoryError oome) {
// perform the operation in some slowe...
Im trying to create an app to control a pc remotely using java , i want to use red5 to let the admin control desktops using a flash movie
so i need to find java classes to :
capture desktop as live video
-control mouse and keyboard
...
My application's context root is /foobar and I am running an exploded deployment with maven-jetty-plugin.
I need to dynamically remap requets for /images/* to /foobar/images/*, and I cannot remap my application's context root to /.
For weblogic I have a halfwit solution where I deploy an additional war containing a proxy to context roo...
I'm working with some example java code for making md5 hashes. One part converts the results from bytes to a string of hex digits:
byte messageDigest[] = algorithm.digest();
StringBuffer hexString = new StringBuffer();
for (int i=0;i<messageDigest.length;i++) {
hexString.append(Integer.toHexString(0xFF & messageDigest[i]));
...
What is the single best pretty-printing library for Java? I mean a library for printing formatted output with indentation, break hints, etc., not a library for beautifying/re-formatting Java code itself. Ideally, the library would "play nice" with System.out.println and friends.
For an idea of what I'm looking for, see OCaml's Format mo...
I'm curious how many people out there (well, on StackOverflow at least) have played with Sun's SunSPOT technology. SunSPOTs are wireless sensor devices that can also control robotic platforms, like the Systronix TrackBot. Fortunately, there's an easy-to-use Java API for programming them.
I'm interested in whether:
You're playing wit...
I am using GWT for my client side application. I am not using GWT/Java for the server. However, I am not sure how I can handle session management. The GWT application resides on one page, all server calls are done via AJAX. If a session expires on the server... let's assume the user didn't close the browser, but left the application ...
Hi all -
I've been trying to run a jar file - let's call it test.jar - that uses the Sybase jconn3.jar on a Unix system.
I have created a MANIFEST.MF file that has the following:
Class-Path: $SYBASE/jConnect-6_0/classes/jconn3.jar commons-net-1.3.0.jar
This gives a ClassNotFoundError. $SYBASE is the system variable that points to /o...
I was curious if anyone had any hard numbers around the performance difference between annotating Entities using private fields instead of public getter methods. I've heard people say that fields are slower because they're called "through reflection" but then again so are the getter methods, no? Hibernate needs to set the accessibility...
Hi!
I have a desktop application having heavyweight components (JxBrowser) in a JFrame. How can I make a snapshot from the GUI and save it to for example a png file?
Note: The method using Graphics2d and Component.paint()/paintAll()/print/printAll works only for lightweight components.
Any answers appreciated!
EDIT
I have already...