java

Why does a "&&=" Operator not exist?

(a && b) has the same value as (a & b), but with && the expression b is not executed if a is false. In Java there is also an operator &=. a &= b is the same as a = a & b. Question: Why isn't there an operator &&=, at least in Java. Is there some reason why I would not make sense to have it, or is it simply that no one cares or needs it...

Java Web Services - Is Axis Necessary?

Is AXIS or CFX necessary for Java web services? Can it be all done via the JSDK (1.6)? ...

Global angle of 3d vectors

I have 3 Vectors, Up Right and Front that represent a direction. I need to convert these into an XYZ angle (3 floats) so i can use with glRotatef() Please help [EDIT] Its not rendering properly. can you see if its anything blatant here: pastebin.com/f6683492d ...

JBoss Binding IP addresses

Hi, I need some help from someone who understands JBoss Hostname Binding. I think the solution is easy, although it's complicated to explain. I am deploying an application using JBoss (v4.2) and am having troubles configuring the application. This application has two parts, a web site on port 8080 and web services on port 8080 using S...

multithreading with java swing for a simple 2d animation

hello , my final goal for this application is to animate several items in the same JPanel at a different speed using a thread for each item.the first part is done however the items move at the same speed and i have no idea on how to fix this problem. package javagamestutos; import java.awt.Color; import java.awt.Graphics; import java...

Common performance pitfalls on Android?

What are the most easy mistakes to make that can be performance sinks on Android? The documentation mentions "some floating point operations" can be "on the order of milliseconds" - has someone tested this? For the sake of discussion, let's assume its running on a G1/similar device. ...

Should I use Calendar.compareTo() to compare dates?

Is it a valid way of comparing dates: Calendar someCalendar1 = Calendar.getInstance(); // current date/time someCalendar1.add(Calendar.DATE, -14); Calendar someCalendar2 = Calendar.getInstance(); someCalendar2.setTime(someDate); // someDate is in the format of MM/dd/yyyy if(someCalendar2.compareTo(someCalendar1) < 0){ ...Code... ...

Setting Mnemonics and Hot Keys for a JOptionPane Dialog

Is it possible to assign hotkeys and mnemonics to the buttons in a JOptionPane Dialog? I'd like to be able, in a JOptionPane generated message dialog with the options Yes, No and Cancel, press Y to hit the Yes button, N to hit the No button and escape to activate the escape button. Similarly in a dialog with Okay and Cancel buttons I'd...

Small java project growing (maven and junit)

I'm working on a growing java project and I'm probably going to cooperate with somebody else to improve some features. I'd like to use some tools to improve the quality of my work keeping in mind that: I don't have too much time to spend on this project it's a small project but it's really important for me I don't want to buy software...

Techniques to avoid DeadlineExceededException in GAE/J?

I am developing an Twitter4J web application in Google App Engine/Java. I need to show two lists. One is Twitter friends and other is followers. With photo and screen name. It is working fine for people who have 20-30 followers and friends. But it gave me DeadlineExceededException when I try a user who has 150+ followers and friends....

Game AI programming competition framework

Does anyone know of an open source AI programming competition framework( shell)? The target should be 'game aware'. I'd like it to: Be written in Java Have a reliable way to measure/terminate time slices. (e.g. bytecodes executed) Run compiled AIs against each other. (class files) If there is anything like this available, let me kno...

Could not create servlet in web application project (google app engine) by using eclipse

I am following Google App Engine Guestbook sample to create a new servlet in src folder. When the create servlet dialog open, I found I can't choose or type "Web Project" and can't browse to select "source folder" either. The eclipse is version 3.5, jdk I installed is 1.6.0_14-b08 I am working on Windows XP Pro with SP3. Before I tri...

Hibernate: best collection type to use - bag, idbag, set, list, map

I am looking for what most people use as their collection type when making one-to-many associations in Hibernate. The legacy application I am maintaining uses bags exclusively, but keeps them as lists in code. The tables associated have an id field, so an idbag seems more appropriate, but documentation recommends a Set. EDIT: I mistake...

Java: accessing bean-type methods of an Object through reflection

Is this the appropriate way to access bean properties of an Object without knowing/caring about its exact type? (Or is there a built-in method that does this already?) Is there an appropriate exception to throw when a property does not exist or is not available? static private Object getBeanPropertyValue(Object bean, String propertyName...

Hibernate/Ehcache: evicting collections from 2nd level cache not synchronized with other DB reads

I have an application using JPA, Hibernate and ehcache, as well as Spring's declarative transactions. The load on DB is rather high so everything is cached to speed things up, including collections. Now it is not a secret that collections are cached separately from the entities that own them so if I delete an entity that is an element of...

Loading Jar files in a particular order on Tomcat 6

I'm working on a web application where I have dependencies on two different jars containing two different versions of the same class. The jar files are supplied by an external vendor and cannot be changed. I've created a custom class loader, which first first tries to load classes from a specific set of jars, and if that fails it just ...

children element with namespace prefix were considered invalid by xerces

I use xerces to valid a xml instance against schema: parser.setFeature("http://xml.org/sax/features/namespaces", true); parser.setFeature("http://xml.org/sax/features/namespace-prefixes", true); parser.setFeature("http://xml.org/sax/features/validation", true); parser.setProperty("http://apache.org/xml/properties/schema/external-schemaL...

Using Scanner in Java how can I hasNext(aString) where the string is not regex pattern?

Hi, I am trying to do as my question states, sooo I have the following code which would find the match. String test = scan.next(); if (test.equals("$let")) return 1; However, I would prefer to use hasNext as to not consume a token; however, when i do the following it fails. if (scan.hasNext("$let")) return 1; I realize the whe...

On dialog boxes

I'm trying to make a dialogue box which displays an answer and will print to the screen but am having no success. The code looks like this: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package dialogbox; import javax.swing.JOptionPane; /** * * @author Tyranax87 */ public class M...

HowTo: Find all references to a Field in Java

Let's say I have the following classes: class A { static public String a; } class B { public function referToFieldInClassA() { System.out.println(A.a); } } Is there anything in the Java reflection APIs to allow me to find all places where a particular field is referenced? What I'm looking for is a way to find out that (give...