java

How to get the next hub

I want to write a Java program in which, if I give destination IP address, I will get the information on next hub to reach that IP. So how can I achieve this? Thanks Bapi ...

Java UrlConnection HTTP 1.0

I am trying to download a file from my Java application. But because UrlConnection uses HTTP 1.1 protocol i get a Tranfer Encoding: chunked response in which case i can not find out file size(content-length is not set). From what i could find HTTP version is hard coded in the class and there is no way to change it. Is it somehow possible...

Simple regular expression help

I need 2 simple reg exps that will: Match if a string is contained within square brackets ([] e.g [word]) Match if string is contained within double quotes ("" e.g "word") Thanks in advance. ...

Knowing C++, how long does it take to learn Java?

I am a competent C++ developer. I understand and use polymorphism, templates, the STL, and I have a solid grasp of how streams work. For all practical purposes, I've done no Java development. I'm sure some of you were in a similar situation at one point when you had to learn Java. How long did it take you to become a competent Java p...

I've got a road on map. How to convert it into a function?

I have an image file of a map and a curvy road marked with bold red line (wider than 1 px, there is no other red objects on image). Can someone please suggest steps how to recognize this road as a line and then turn it into a function y=f(x) so I can measure precise distances. I have no idea where to start... Thanks. ...

latest news about Eclipse 4.0

What are the "latest" news about the next big release of the Eclipse IDE? (3.5 Galileo could also be of interest) ...

C# client connecting to a Java server over SSL

As a team project I need to connect from a C# client to a Java 6.5 SSL server, however when I get to the stream.AuthenticateAsClient line it hangs. C# connect code public static void connect(string server, Int32 port) { try { client = new TcpClient(server, port); stream = new SslStream(client.GetStream(), false); stream...

Sticky situation where accessing parent functions is necessary in Java

I've been working on an economy simulator in Java and ran into a roadblock. I have an Economy class that owns a vector of Traders. Every iteration, the Economy class calls each Trader to update() and decide what trades it would like to place. The update() function returns the desired transactions to be added to the queue in the parent Ec...

Hierarchy & data structure in Java (or XML to Object conversion: best practices)

The problem: Let's say there is an XML file that contains both the data and the hierarchy of certain elements of interest to the application: <root> <node title="lvl1Node"> <node title="lvl2Node"> <node title="lvl3Node"></node> </node> </node> <node title="lvl1Node2"></node> <node title="lvl1Node3"> ...

Java Web Application: Using a custom realm

Hello, I'm writing a java web application which need to perform login through a webservice. Of course, none of the realms supplied with the application server I'm using (glassfish v2) can do the trick. I therefore had to write my own. It seems however, that the realm implementation that I wrote is completely tied to glassfish and cannot...

How can I check if I have that java 6 plugin 2 for applets installed?

Also, is creating an applet that uses the java 6 plugin 2 thing any different than creating a normal applet? ...

Customizing login procedure in a java web application

Hello, I'm writing a java application which needs to perform an unusual login procedure. One of my problems is that the user needs to supply more than a simple username/password combination. Specifically, a username/password/domain combination is required. Another problem is that my application enforces some password lifetime rules (eg...

Is there any square root function more accurate than java.lang.Math.sqrt(double)

I am looking for square root functions (to use in java) that can give square roots upto atleast to 5-6 decimal places accurately. If there is a way to control accuracy of java.lang.Math.sqrt(double) or any external math library, please mention it. ...

Issue with Jama's Eigen value decomposition fuction

I am getting a wrong eigen-vector (also checked by running multiple times to be sure) when i am using matrix.eig(). The matrix is: 1.2290 1.2168 2.8760 2.6370 2.2949 2.6402 1.2168 0.9476 2.5179 2.1737 1.9795 2.2828 2.8760 2.5179 8.8114 8.6530 7.3910 8.1058 2.6370 2.1737 8.6530 7.6366 6.9503 7.6743 2.2949 1.9795 7.3910 6.9503 6.2722 7.3...

Terracotta + Compass = Hibernate + HSQLDB + JMS?

I am currently in need of a high performance java storage mechanism. This means: 1) I have 10,000+ objects with 1 - Many Relationship. 2) The objects are updated every 5 seconds, with the most recent updates persistent in the case of system failure. 3) The objects need to be queryable in a reasonable time (1-5 seconds). (IE: Give me...

Why doesn't this for-each loop work?

In this code, why isn't my array initialised as I want it to? Is the for-each loop not designed to do that, or am I just not using it correctly? int[] array = new int[5]; //initialise array -> Doesn't work! Array still full of 0's for(int i : array) i = 24; ...

In Swing, how can I find out what object currently has focus?

I have few TextFields on my frame. I want to know the TextField name which is currently focused. Can someone please help me? How can I find out the current focused object name? Thanks ...

Multi-threading and Java Swing Problem

Hi I have a GUI application that is working fine. I created a socket server. When I create a new object of the Server class in program the GUI application stops responding. This is my server class. If I do Server s = new Server(); in my main application it stops working. How should I add it? Making a new thread? I tried Thread t...

missing resource exception

my application uses eclipse and run on Tomcat server.technology used is 'JSF'. while running my application i m getting exception like: java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key Content Management Exception Please suggest what to do? ...

Hibernate criteria: Joining table without a mapped association

I'd like to use Hibernate's criteria api to formulate a particular query that joins two entities. Let's say I have two entities, Pet and Owner with a owner having many pets, but crucially that association is not mapped in the Java annotations or xml. With hql, I could select owners that have a pet called 'fido' by specifying the join in...