java

Android CursorAdapters, ListViews and background threads

This application I've been working on has databases with multiple megabytes of data to sift through. A lot of the activities are just ListViews descending through various levels of data within the databases until we reach "documents", which is just HTML to be pulled from the DB(s) and displayed on the phone. The issue I am having is that...

Persisting a list of elements with composite keys

I'm using java persistence to save a list of entities that are associated to another entity. Here's a quick rundown of where I'm having some problems. @Entity public class Offer implements Serializable { @Id private Long offerId; @OneToMany @Column List<OfferCategory> offerCategories; } @Entity public class OfferCategory implem...

Java framework/tool for simple distributed computing problem

Hi We generate pdf files with data regarding monthly financial balance of tens of thousands of clients. At it's peak (100.000 files at the end of year), the process may take as long as 5 days to complete using distribute the load between 5 servers. The distribution of workload is a manual process (eg. server 1 generates pdf for clients ...

I'm studying Head First Java, but I can't understand Page 544

"When you declare a type parameter for the class, you can simply use that type any place that you'd use a real class or interface type. The type declared in the method argument is essentially replaced with the type you use when you instantiate the class. If the class itself doesn't use a type parameter, you can still specify one for a m...

JSplitPane resize behavior

I have a vertically split JSplitPane and when I move the divider down, it shifts the bottom component and the bottom gets cut off. Is there a way to specify the resize behavior of a JSplitPane so the top (of the bottom component) gets covered by the split pane and the bottom is the last thing to get covered? thanks, Jeff ...

Inconsistent GWT behavior in IE 8

All, I have a web site that's built with GWT at https://penwag.com/penwag/. If you just hit the site and see the main page, there's supposed to be a login/registration area that displays, along with a teaser for the site. I've tried the site with most of the main browsers - FF 3 & 3.5, IE 6 & 8, Safari, and Chrome, and all appears wel...

Java I/O consumes more CPU resource

I am trying to create 100 files using FileOutputStream/BufferedOutputStream. I can see the CPU utilization is 100% for 5 to 10 sec. The Directory which i am writing is empty. I am creating PDF files thru iText. Each file having round 1 MB. I am running on Linux. How can i rewrite the code so that i can minimize the CPU utilization? ...

java to python conversion: x509 / dsa / sha1withdsa crypto howto?

I've got the following Java code that I'm trying to convert to python, and I'm not really sure how to do this: import java.security.spec.X509EncodedKeySpec; import java.security.KeyFactory; import java.security.PublicKey; import java.security.Signature; byte[] key = KeyReader.read(filestream) //KeyReader.read(inputstream) just reads...

Track text cursor, to display menu above

I want to build predictive sentence advisor, like (Onion News) Apple Introduces Revolutionary New .... Sentences can probably be generated by stylized pseudo-random text generating algorithm like Markov chain. I imagine this as - while typing, menubox with predictive sentences are displayed above text cursor. How to 'text cursor track...

Flash drag and drop uploader?

I've seen this done with a signed Java Applet, but is it possible with Flash? ...

Correct syntax for using Runtime.exec with "Program Files"

I wish to use the method with the following signature: exec(String command, String[] envp, File dir) Suppose my program is called "myprog.exe" and it is located at "C:\Program Files\My Software". What is the correct syntax for using Runtime.exec? I keep getting an error message "The system cannot find the file specified". To clarif...

java cvs,svn file structure

I have recently learnt how to program in java, I was looking at some open source programs from sourceforge.net and after downloading these programs I don't understand the file structure most of the programs follow. Pretty much every program has src,bin,lib etc folders, how do I know the standard way of organizing my program. Is there any...

java socket / output stream writes : do they block?

Hi all, If I'm only WRITING to a socket on an output stream, will it ever block? Only reads can block, right? I am asking because someone told me writes can block but I only see a timeout feature for the read method of a socket - socket.setSOTimeout(). It doesn't make sense to me that a write could block but I'd like to hear for sure...

Using Runnable Interface in Applet program?

Hi, i am on developing Sound Recording applet.Here is the code import java.applet.*; import java.awt.*; import java.awt.event.*; import java.io.IOException; import java.io.File; import javax.sound.sampled.DataLine; import javax.sound.sampled.TargetDataLine; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem;...

use atmosphere api or use grizzly directly?

i cannot see the different between using atmosphere api or use grizzly directly? can explain? ...

Log4J able to recover from disk full?

We have several java application server running here, with several apps. They all log with Log4J into the same file system, which we created only for that reason. From time to time it happens that the file system runs out of space and the app gets log4j:ERROR Failed to flush writer, java.io.I...

create a new java file in eclipse plugin

I'm creating an eclipse plug-in. I have a string with java code, and I want to save this code to a project. I used the IFile to create my file. Is there another way that is better for saving java code? Ido ...

Guide to Learn J2ME

Hi all, I am starting study java2me. But I have some source study about it like ebook, source sample code, and ... Could anybody give some link website or source ebook study about it. Thanks, Sopolin ...

Google App Engine / JDO : is there a session cache?

Since there is no way to join tables using Google App Engine datastore, I loop over a list of entities and look up the related entities one-by-one using the foreign key value. for (Employee staff: staffList){ Employee manager = pm.getObjectById(Employee.class, staff.getManagerId()); } There is a good chance that I will be needing ...

Java file locking and Windows - the lock isn't "absolute"?

Hi, I'm trying to lock a file with Java in Windows environment with FileLock and I got an issue : after I lock the file it can still be accessed by other processes at least on some level. Example code follows: public class SimpleLockExample { public static void main(String[] args) throws Exception { String filename = "loremli...