java

How to write from java to the windows event log?

Can you recommend what I should be using to do that? ...

Letters within integers. What are they?

This is an excerpt of code from a class I am working with in Java (below). Obviously the code is defining a static variable named EPSILON with the data type double. What I don't understand is the "1E-14" part. What kind of number is that? What does it mean? final double EPSILON = 1E-14; ...

Confusing return statement

I'm failing to understand exactly what the IF statement is doing, from what I can see it is checking if the variable x is equal to the int 0. If this is true the ABSOLUTE value of the variable y is returned... this is when I lose the plot, why would the return statement then go on to include <= ESPILON? Surely this means less than or equ...

Is the offical Sun Java EE tutorial the best way to learn how to make Java web apps?

I've been a web developer for almost a decade. I've mostly used classic ASP/JavaScript and I'd like to move into Java based apps. I have a decent understanding of Java itself (enough to know how to lookup what I don't know) and I spent some time doing minor work on a JSF/Spring/Hibernate app, but from what a trusted coworker told me, t...

Varying Colors in Processing

I've been working on porting some of my Processing code over to regular Java in NetBeans. So far so well, most everything works great, except for when I go to use non-grayscale colors. I have a script that draws a spiral pattern, and should vary the colors in the spiral based on a modulus check. The script seems to hang, however, and I...

Does Common Lisp have a something like java's Set Interface/implementing classes?

I need something like this, a collection of elements which contains no duplicates of any element. Does Common Lisp, specifically SBCL, have any thing like this? ...

Best enterprise repository tool for Maven 2?

Some of the other questions and answers here on SO extol the virtues of using an enterprise repository tool like Archiva, Artifactory, or Nexus. What are the pros and cons of each? How do I choose between them? In case it helps: We use both Maven 1 and Maven 2 (at least for a while) We want to store both internally-generated artifacts...

What is the best approach for IPC between Java and C++?

I would like to implement a robust IPC solution between a single JVM app (one process, potentially multiple threads) and a native C++ application that is linked to a C++ dll. The dll may or may not be on the same physical machine. What is the best approach for doing so? Any suggestions will be greatly appreciated! Thanks! ...

Need assistance with accelerating a GOval object (making a Breakout game)

Hey peoples, I've been studying Java for a couple of weeks, and have decided to produce my own version of Breakout. The game is working fine, apart from the method which is supposed to modify the ball (GOval) speed based on the speed of the paddle (GRect). Anyway, this is the method: private double paddleVelocity(){ double paddle...

value semantics and pointer semantics?

what does it mean by value semantics and what is mean by implicit pointer semantics? ...

How should I name packages if I don't have a domain associated with me?

So most Java resources when speaking of packages mention a com.yourcompany.project setup. However, I do not work for a company, and don't have a website. Are there any naming conventions that are common? An email address, perhaps? ...

Better preverifiers than Sun WTK

I'm currently using the sun preverifier to preverify my MIDlet. I'm finding that it can be a bit slow, doesnt give any decent error messages and is only available as a windows exe. Are there any better preverifiers around that will work cross platform (linux specifically) ...

Differences between JDK and Java SDK

Is there any substantial difference between those two terms?. I understand that JDK stands for Java Development Kit that is a subset of SDK (Software Development Kit). But specifying Java SDK, it should mean the same as JDK. ...

obtain current svn revision in webapp

what is the best way of displaying/using the revision number in a java webapp? we just use ant to build our .war archive, no buildserver or such. i'd hope there was some kind if $ref that i could write in a resource file, but this is only updated when the file in question is committed. i need it globally. what would you recommend? post...

Write a password protected Zip file in Java

I need to zip and password-protect a file. Is there a good (free) library for this? This needs to be opened by a third party, so the password protection needs to work with standard tools. ...

Calculate Throuput

Hi, I have a the following scenarios. I am trying to calculate throughput of the java's XSLT transformer. I have 10 threrads, each iterates 1000 times. The task of the thread is to read the XML and XSLT file and trasnform it and write to a new file. I want to calculate the TPS. Can you please suggest the way to calculate TPS? Thanks ...

Retrieve list of defined roles in java ee 5

I was wondering if it would be possible to retrieve the complete list of security roles defined in a web.xml file in the java code? And if so how to do it? I am aware of the 'isUserInRole' method but I also want to handle cases where a role is requested but not defined (or spelled differently) in the web.xml file. ...

java date format incompatible with xquery xs:date format, how to fix?

In java, when using SimpleDateFormat with the pattern: yyyy-MM-dd'T'HH:mm:ss.SSSZ the date is outputted as: "2002-02-01T18:18:42.703-0700" In xquery, when using the xs:dateTime function, it gives the error: "Invalid lexical value [err:FORG0001]" with the above date. In order for xquery to parse properly, the date needs to look like...

Java: Newbie-ish inheritance question...

Suppose I have a base class B, and a derived class D. I wish to have a method foo() within my base class that returns a new object of whatever type the instance is. So, for example, if I call B.foo() it returns an object of type B, while if I call D.foo() it returns an object of type D; meanwhile, the implementation resides solely in t...

Different dependencies for different build profiles in maven

Is it possible to have a different set of dependencies in a maven pom.xml file for different profiles? e.g. mvn -P debug mvn -P release I'd like to pick up a different dependency jar file in one profile that has the same class names and different implementations of the same interfaces. ...