java

A line of java code and what it does?

So I have purchased the book "Java for Dummies" 4th Edition, and I must say it is probably the best 30 dollars I have ever spent on a book. I'm not new to coding, am actually fairly decent at at it if I say so myself. However, I've come across a line of code that has me a touch confused: public void setName(String n) { if(!n.equa...

Java: Vector Definition

l_ABC_BEANVector = utilRemote.fnGetVector("ABC_COVBEANVector"); What is the coding means? Any help, i am truly appreciated it. Thanks ...

Invalid access of stack red zone from Java VM

I'm trying to figure out what can cause this error in Java: Invalid access of stack red zone 0x115ee0ed0 rip=0x114973900 Has anyone ever encountered this error message? It's literally killing the JVM and everything stops there. I'm currently using this version of Java:(on OS X 10.6) java version "1.6.0_15" Java(TM) SE Runtime Envir...

Can Java Constructor construct an object of a subclass?

Is there a way to modify the class being constructed in a constructor? public class A { A() { //if (condition) return object of type B //else return A itself } } public class B extends A { } Basically I want to use the base class constructor as a factory method. Is it possible in java? ...

java.lang.NoSuchMethodException: javax.ejb.EJBHome.getHomeHandle()

I'm trying to figure out why I'm getting the following exception when a client app is connecting to JBoss. I happens on startup, when the client attempts to connect to the server. java.lang.ExceptionInInitializerError at org.jboss.proxy.ejb.HomeInterceptor.<clinit>(HomeInterceptor.java:77) at sun.misc.Unsafe.ensureClassInitialized(Nati...

Access to private Collection fields in Java

One of my classes has a field which contains a Set. This field is only ever filled in the constructor, and then read by other classes. Originally I had something like this: public class Foo { public final Set<String> myItems; public Foo(Collection<String> theirItems) { this.myItems = new LinkedHashSet<String>(theirItems)...

Drools Flow - define deadline of human work item in declarative fashion

We are evaluating the drools flow with process and sub process flows. One of the features we are looking set up the deadlines for Human task during the assignment through declarative similar to JBPM <Timer duedate ="50 minutes" /> Please provide expert input on how to acheive the dead lines ...

How could I programmatically trigger google analytics events without a browser?

Background: We receive non web based events (like SMS) to our server, it would be nice to be able to track them via analytics. I have thought of several solutions, but am not entirely happy with any of them. Hack together the analytics url and post it using from the server. Unsure if this would work as there are a lot of unexplain...

ZipFile inside a ZipFile

Hello All, I have a zip file which can contain any number of zipfiles inside it (recursively also). I need to iterate over all of them. Right now, i have a function which takes zipInputStream and zipFile as parameters. The problem is; if i get a zip inside another zip, i am calling this function recursively again. So i dont know how to...

Different JUnit-result starting from Eclipse vs. mvn test

Hi all, I've got a JUnit-test which is successfull when starting with mvn test but fails when starting from Eclipse (see stack trace below). What I'm trying to do is inserting new elements into the database with entityManager.persist() and entityManager.flush() (when calling flush, I get the error). My config.properties looks the follo...

Why is there a difference between the same value stored as a float and a double in Java?

I expected the following code to produce: "Both are equal", but I got "Both are NOT equal": float a=1.3f; double b=1.3; if(a==b) { System.out.println("Both are equal"); } else{ System.out.println("Both are NOT equal"); } What is the reason for this? ...

Java : getParameter

lStrABC = UTIL_COMMON.fnGetValue(req.getParameter("ABC")); hi, please help to define the above code? the "ABC" is wat? variables? come from the ma? thanks ...

How to track the internet usage thru java?

How to track the internet usage thru java? I want to track the site visited, how much bytes (uploaded/downloaded). ...

one method classes with enum in java

I have an enum that looks like public enum MyEnum { myValue { @Override public String myMethod(String dostuff) { return dostuff + "One"; } }, myOtherValue { @Override public String myMethod(String dostuff) { return dostuff + "Two"; } }, aThirdValue { @Override public St...

Switching between bytecode versions for a Java class file

Given a Java class file (ClassName.class) with bytecode version X is there a general way to convert this class file from being represented in bytecode version X to being represented in bytecode version Y? Assumptions: The source code is not available. The class file is the only available representation of the class. The class file is ...

Implementing Authentication for a WebDAV Servlet

I am currently using this WebDAV Java Servlet Implementation, it's as far as I know the smallest and the easiest to use WebDAV java solution that doesn't depend on Tomcat ( Using WebLogic ). So I would like to extend this to use my underlying security layer which somewhat uses a database connection to authenticate users. My question is...

What is the purpose of the temporary Vector instance in this code?

Please explain this code to me; I don't understand why the additional vector TempC is needed: Vector A = new Vector(); Vector B = R.funcVector("TemporaryVector"); if(B!=null) { for(int i=0;i<B.size();i++) { Vector TempC = new Vector(); Vector D = new Vector(); TempC = (Vector)B.elementAt(i); if(...) { ...

Send an E-Mail with attachment using JAVA Mail API.without storing in local machine..

Hai to every one. i have report in my jsp page.And i am writting thet report in PDF Format. And i want to send the PDF as E-Mail with attachment,But i dont want store the file in local machine or server,But i want to send an email with attachment.. ...

Problems with GData Request Token

We have successfully used GData libraries to access a user's Google Docs. But we encountered problems when many users log in to our site and authorize our web app at the same time or successively. Here's what happens: First user successful logs in, authorizes our web app via OAuth and is able to add rubric (or google spreadsheet). Se...

Favourite Open Source Google App Engine apps (Java or Python)

To learn from good examples, what are the best open source Google App Engine applications out there? I don't care if it is Java or Python based. Please one app per answer. Feel free to add a link to the live app (if there is) and to the project page. ...