java

Overlapping Views in Android

Is it possible to have overlapping views in Android? I would like to have an ImageView with a transparent png in the front and another view in the background. edit: This is what I have at the moment, the problem is that the image in the imageView is not transparent, the parts that should be transparent are just black. <RelativeLayout ...

Distinguishing between beans loaded from different spring configuration files

Hi, our project is based on Spring IoC which provides easy extensibility, meaning the functionality of our project is extended by what we call extensions (or plug-ins) that provide a few additional Spring xml configuration files + new code. The problem is I have to somehow distinguish between beans that have been loaded from different ...

What Java designs are explicitly done to support backwards compatability?

Since this question is back to four votes to close, I'm trying again to ask a more narrow question that hopefully the community will view more favorably. Which specific design decisions in Java are documented to be done the way that they are not because that was the preferred design decision, but rather because it was necessary to suppo...

Java string - get everything between (but not including) two regular expressions?

In Java, is there a simple way to extract a substring by specifying the regular expression delimiters on either side, without including the delimiters in the final substring? For example, if I have a string like this: <row><column>Header text</column></row> what is the easiest way to extract the substring: Header text Please note ...

Converting from Hibernate hbm.xml to annotations

I have a rather large program that uses Hibernate for its ORM needs. Due to the age of the project it is using hbm.xml to configure it. I would like to convert it to annotations but I'm vary of investing days (weeks?) in manually adding the annotations and then testing everything. Is there any tool out there that can help facilitate thi...

Java reports alias (symlink) as size 0 on Mac OSX. How do I get the true file size?

File file = new File("path to file alias foo"); where "path to file alias foo" is an alias reports file size to be 0 instead of the actual file size. I found a workaround to test for aliases: public boolean isLink() { try { if (file.getAbsolutePath().equals(file.getCanonicalPath())) { return false; ...

Final initialization in java can be postponed, how does this prevent against returning null inadvertently?

In the "hidden features of java" question, someone mentions that final initialization can be postponed and provides an example: public Object getElementAt(int index) { final Object element; if (index == 0) { element = "Result 1"; } else if (index == 1) { element = "Result 22"; } else { element ...

Processing Audio Data using Fourier Transforms in Java

Hi, I'm trying to process audio data. I'm working with Java. I've extracted the audio data to an array. Now I should pass N data samples to a function that calculates the Discrete Fourier Transform (or Fast Fourier Transform, which is more efficient). I've read documentation but I'm getting more and more confused. What I'm trying to cal...

Java - how to match regex Pattern containing single quotes?

[EDITED - really sorry, the code I quoted was wrong - have changed the message below to reflect this. Apologies! Thank you for your patience.] I'm new to regular expressions and want to match a pattern in Java (following on from this solution - http://stackoverflow.com/questions/962122/java-string-get-everything-between-but-not-includi...

GWT - clear.cache.gif never goes away

I have a web site that is built with GWT 1.6. One of the nagging problems is that the image clear.cache.gif is displayed by one of the widgets, but it never goes away, and even bleeds through panels that are supposed to be on top. Has anyone else had this problem? How did you fix it? ...

How to keep Apache CXF from converting primatives to object types?

I'm evaluating Apache CXF for a project so I wrote a small demo application to try a few things out. Following the CXF user's guide, I was able to get my application up and running pretty quickly. One thing I wanted to test was how well CXF is able to handle a method that returns a large array of primitives. So I defined a method 'flo...

sorting an arraylist of a self-made class by one of its variables and clone() will not work.

ok; i am making a project for school and its a game similar to falling sand. but in order for the gravity to work i have to have the sand sorted by its position from down to up (the y variable of sand) this method should sort it; although i cannot get .clone() to work and i can't hard copy any other way i know. so i don't know how to rep...

Is it possible to disable jsessionid in tomcat servlet?

Hi Gurus, Is it possible to turnoff jsessionid in the url in tomcat? the jsessionid seems not too search engine friendly. Please Advise Thanks ...

Hibernate: Used mappedBy on class that extends another class annotated as JoinedSubclass?

The following doesn't work: @Entity class Owner { @OneToMany(mappedBy="owner", cascade = {CascadeType.ALL}) protected Set<B> getBSet() { .. } } @Entity @Inheritance(strategy=InheritanceType.JOINED) class A { @ManyToOne public Owner getOwner() { ... } } @Entity class B extends A { } It causes an exception a...

Converting inserted string to a compilable expression

Hi, I'm somehow new to Java so my question can seem trivial, however i cannot find an answer to it anywhere in my books. I want to initiatie a dialog with a user in which he would enter an arithmetic expression (ex. (2*x+y)) And then print out the result for such expression (for given values of x and y) String EXPRESION = null; E...

email log file, generated by Java WebLogic Application Server

does this requirement conform to the J2EE Standards? is there a easy way to implement this, log file gets generated by Log4J and in the end I will access the file system and email the whole file(s). can I access the file system? ...

Determine if a String is a valid date before parsing

I have this situation where I am reading about 130K records containing dates stored as String fields. Some records contain blanks (nulls), some contain strings like this: 'dd-MMM-yy' and some contain this 'dd/MM/yyyy'. I have written a method like this: public Date parsedate(String date){ if(date !== null){ try{ 1. cr...

Remove a generated panel in GWT after a button is clicked

I am attempting to create a Google Web Toolkit (GWT) application that also uses Google Gears, but every time I try to remove the panel, I get an exception and the panel stays there. Here is an excerpt from the exception I get (I've only included the relevant bits of the call stack, the rest just descends into the included function below...

Javac cannot find jar for apache commons config

I'm trying to compile a very simple program in Java 1.6 on Ubuntu Jaunty, using Apache Commons Config jar. I keep getting the "package org.apache.commons.configuration does not exist" error, even though the jar is in the same directory. Any ideas? Directory Listing ~/source/UpdateStockHistory$ ll total 304 -rw-r--r-- 1 crosse cros...

Sources for learning Java as a programmer.

I'm already a developer it is my day job, and I've made a decent business out of it. I'd like to learn Java, but all the tutorials seem to start out as if the only language I know is English. Are there any good resources for a programmer to learn Java? ...