java

"paint" like control within a web page

I am looking for a Java UI control which allows users to draw drawings which can internally stored as an image. I am looking for a very light weight control which does not slow down the page rendering. Any pointer? ~Sri ...

How to optimize activemq

I'm using ActiveMQ on a simulation of overloading servers in Java. And mainly it goes ok, but when I get over 600 requests the thing just go WTF! I think the bottleneck is my Master Server which is this guy below. I'm already reusing the connection and creating various sessions to consume messages from clients. Like I said, I'm using a...

What's an easy, quick way to reload a webapp in tomcat in dev environment?

I'm running Tomcat 6 on Windows. I've got the "Monitor Tomcat" system tray icon which allows me to start and shutdown Tomcat, but is there another little tool that allows me to easily reload my web app when I've changed the class files? I know the "manager" app that comes with Tomcat does this but just wondering if there's a native app t...

JXTA Applications on the iPhone

I'm creating a P2P Java application in JXTA, for simple messaging between peers. I want to create a similar program on the iPhone, that will be able to talk with this java JXTA program. Is this possible to do? I know theres JXTA-C which would work on the iPhone, but I'm not sure if the JXTA-C will communicate properly with JXTA-Java. I...

java api for simple gis computations

Hi, I am trying to develop some simple location logic in the server-side portion of a java servlet-based webapp. There are really just two operations that I'm interested in: Given a start point (lat/long) s1, distance d, and search point (also lat/long) s2, determine if the s2 is within d distance from s1. Given two points (lat/long),...

accessing an object array item, java

Hi, I have created a number objects using an array statement, and I can println the values passed within the class as it is created, but when I try and retrieve element values from outside of the class (monopolygame class) it doesn't recognise the refrence - how can I refrence this correctly? public class monopolygame { public stat...

c++ server htons to java ntohs client conversion

Hi I am creating a small TFTP client server app where server is developed using c++ and client using java. Here i am sending "block count" value using htons conversion. But i am not able to convert it back to its original value at client. for example if am sending block count ntohs(01) (2 bytes) from se...

Java BigInteger prime numbers

I a m trying to generate a random prime number of type BigInteger, that is between an min and max value which I supply. I am aware of the BigInteger.probablePrime(int bitlength, random), but I am not sure how or even if the bitlength translates into a max/min value of the outputted prime. Thanks, Steven1350 ...

Array of Dates in Java

I know how to create an array of strings or integers, but how does one create an array of dates :/ ...

Cannot stop java service in Linux using start-stop-daemon

I have a process that is running as a java daemon on Ubuntu Linux. I cannot stop it using start-stop-daemon command in d_stop() below. The process id should be written to file $PIDFILE during the start process, but that is not working. Here is my script: #! /bin/sh # # # # Version: @(#)daemon 1.0 # set -e PATH=/usr/local/sbin...

ByteBuffer, what is a clean way to detect if it needs to be flipped.

Is there a clean sure fire way to detect if a ByteBuffer needs flipping? I have a ByteBuffer that is used for packing and unpacking a data stucture and also for storage of bytes to be packed / unpacked. However, if a write operation has just been performed or a read operation has been performed or if a ByteBuffer was passed to my code...

Any good website teaches datagram sockets use in Java?

I want to program in Java some application that would use sockets, specially UDP sockets, do you have by chance any good website where I can find some resources ? ...

Java readFile from byte x to byte y

Im trying to read a text file, x bytes at a time into a variable, process each "chunk" and write it to another file. So far all I can do sucessfully is: // read each line at a time: while ( ( str = in.readLine() ) != null){ .... Is it possible to specify something like... str = in.readBytes( 320 up to 400 ) ... ??? Any thoughts or ...

Why is this JText panl giving me amemory address?

This is an undo feature button on a calculator that I am writing. undo is the button Status is a class that holds my status. listOfStates is an ArrayList of Status. displayBox is a object of JTextFeild. What I do not under stand is that when I display previousState in the text box I get something like: Status@11dc088. I know I am missin...

Cancelling a Timer

I have implemented a token system which assigns a fixed number of tokens. Each token on assignment starts up a Timer which expires after a few number of minutes and clears that token slot for reuse. If the user validates the token before the timer expires the Timer is supposed to be cancelled and reset with another token validity period....

I've written a java getting-started tutorial, where would be a good site to post it for checking?

Hi all, For our company's internal training, I'm writing a java getting-started tutorial. This will go all the way from installing eclipse through to writing a working demo application with Struts, Hibernate, Sitemesh, and Sql server. Now, admittedly i'm new to Java (although have good c# experience) - where would be a good site to pos...

Event driven with Java and Javascript?

I am trying to perform some computations on a server. For this, the client initially inputs some data which I am capturing through Javascript. Now, I would perhaps make a XMLHttpRequest to a server to send this data. Let's say the computation takes an hour and the client leaves the system or switches off the system. In practice, I woul...

Algorithm - How to delete duplicate elements in a list efficiently?

There is a list L. It contains elements of arbitrary type each. How to delete all duplicate elements in such list efficiently? ORDER must be preserved Just an algorithm is required, so no import any external library is allowed. Related questions In Python, what is the fastest algorithm for removing duplicates from a list so that all ...

Using database resources in Axiom Safe Request

Hi, I would like to know how to make use of an Axiom database resource inside a Safe function. Right now I'm just handling the connection manually but I know it would be better to use the already defined resources. ...

Outer Java class is able to access inner class private members?

I observed that Outer classes can access inner classes private instance variables. How is this possible? A sample code demonstrating the same is explained below:: class ABC{ class XYZ{ private int x=10; } public static void main(String... args){ ABC.XYZ xx = new ABC().new XYZ(); System.out.println("H...