Is pointer is just used for implementing java reference variable or how it is really implemented?
Below are the lines from Java language specification
4.3.1 Objects An object is a class instance or an array. The reference
values (often just references) are
pointers to these objects, and a
special null reference, which refers
...
I have 2 tables, devices which contains a list of devices and dev_tags, which contains a list of asset tags for these devices. The tables join on dev_serial_num, which is the primary key of neither table. The devices are unique on their ip_address field and they have a primary key identified by dev_id. The devices "age out" after 2 we...
I've coded a .... I believe my approach is right, but I'm not 100% sure. In respect to the threads, I don't understand why I can't just run a (new MatrixThread(...)).start() instead of using an ExecutorService.
Additionally, when I benchmark the ...approach versus the classical approach, the classical is much faster...
What am I doing ...
I'm writing some experimental GUI code. I'm trying to set it up so calling main generates two windows, each with a button and a label. The label displays how many times the button has been clicked. However, I want it so if you click the button in one window, the label in the other updates. How would I do this?
import javax.swing.*;
impo...
I am investigating on the best free mail library to use for java web applications. It is something with more support and easy to use. If it's complex but would be justified by its great features it might do. Have any suggestions?
...
what's the shortest path to convert a java applet to flash / flex ?
have you any experiences with something similar? please describe.
thanks guys
...
I need to specify a custom media for printing on a 32x48 sheet of plotter paper without using a page setup dialog. The MediaName class hints at creating a custom MediaName subclass, but there's no way to specify a custom media size with this MediaName.
How does one print to custom-sized media from within Java? I am using the java 1.3+ ...
Hi everyone,
I'm using Ivy to resolve dependency in my very small project. It's the first time I'm doing that and it's more to learn as my project is very small.
I had a problem 5 minutes ago, when trying to download log4j.
My configuration is very basic, I have an ant task :
<target name="resolve" description="--> retrieve dependenc...
I have two arrays: Walls and Neighbors.
public boolean[] walls = new boolean[4];
public Cell[] neighbors = new Cell[4];
and I have an Enum:
enum Dir
{
North,
South,
East,
West
}
Now, I would like to be able to access walls or neighbors by their direction, so I don't have to pass around a bunch of magic indexes.
How...
I'm new to Drools and they have these very nice debug listeners, DebugAgendaEventListener and DebugWorkingMEmoryEventListener, that spit events out to System.err. That's all well and good, but the underlying events don't implement toString() so you end up with a debug line that looks like:
org.drools.event.rule.impl.ActivationCreatedEve...
Hello there,
I'd like to do this in Java Google App Engine
if(developmentMode)
foo();
else
bar();
Does anyone know a good way to do this?
Daniel
...
I'm new to JSPs so bare with me.
I have a JSP where I'm using a javascript framework to build a chart using the Google Visualization API.
My servlet is returning a sales hashmap object with year as the key and integer (sales number) as the value.
My javascript uses the sales object to add data to the Google chart API which builds my ch...
I saw some similar, but not-quite-what-i-need threads.
I have a server, which will basically take input from a client, client A, and forward it, byte for byte, to another client, client B.
I'd like to connect my inputstream of client A with my output stream of client B. Is that possible? What are ways to do that?
Also, these clients...
I originally thought that static blocks were for static variables but the compiler allows both A and B to compile and run, what gives?
A
private static final Map<String,String> m = new HashMap<String,String>();
{
m.put("why", "does");
m.put("this","work");
}
B
private static final Map<Stri...
I have an Java application for copying large amounts of data from users' workstations to a server. The java.io.File class is supposed to work with UNC paths very well and in fact it does but only when I run the app in standard execution model.
When the application is launched via Web Start I get a FileNotFoundException when trying to op...
Perhaps I don't understand how clone() works. Shouldn't the return value equal the caller?
int[] nums = new int[] {0, 1, 2};
int[] list = nums.clone();
nums.equals(list); //returns false. Why?
for (int ket = 0; ket < list.length; ket++) {
System.out.println(list[ket] == nums[ket]); //prints out true every time
}
list == nums /...
I have to develope a simple desktop application. I have to call my Jar behind it. I am thinking that I should have Adobe Air interface that will call my Jar.
Is it possible in Air. If yes, then I am going to learn Adobe Air, otherwise I will develope it in Swing.
Thanks.
...
Our JBoss server.xml file has this line:
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="app_server_01">
Is there any way to get the jvmroute value (in this case app_server_01) at runtime using Java?
Background
We've got session affinity (sticky sessions) configured between our app servers and Apache servers. JBoss appe...
Given a double variable named sizeValue and sizeValue contains something other than 0, what is the most efficient way to determine that sizeValue contains a value that is an integer?
Currently i'm using
sizeValue % 1 == 0
any other faster ways?
...
I am attempting to write a Genetic Algorithm based on techniques I had picked up from the book "AI Techniques for Game Programmers" that uses a binary encoding and fitness proportionate selection (also known as roulette wheel selection) on the genes of the population that are randomly generated within the program in a two-dimensional arr...