java

OCaml: Permutation of every value in two sets? (how to translate this from Java)

I have two sets, returned by Set.Make(t). I would like to generate every possible combination of the values in the two. How can I do this? This works to generate some pairs, but not all: List.combine (IntSet.elements odp) (IntSet.elements ftw) This would do it in Java: for (int i : ktr) { for (int m : mnx) { System.out.p...

database-based content management system design

i'm looking for best practise on designing database schema for content management system. any reference on this? p/s: i do not plan to use open source lib. as i need to get it work on google app engine + JAVA ...

Suspend on uncaught runtime exceptions in Eclipse Junit test runner

Eclipse is not suspending on an uncaught runtime exception during debugging of a Junit test. I've tried: JRE 1.6 update 15 and 16 Eclipse 3.5.0 and Eclipse 3.4.2 Checked "Suspend on uncaught exception" for the exception and all runtime exceptions Checked "Keep JUnit running after a test run when debugging" Debugging when running only t...

rmi class can not found exception

I wrote an simple project using java rmi and exported to an executable jar file. When I tries to run it, sometimes i got exceptions and sometimes it works. When I specify -Djava.rmi.server.codebase=file:serverClasses/, it seems it didn't create the jar file correctly. Here is the stacktrace: java.rmi.ServerException: RemoteException oc...

How to map dynamically created table in Hibernate?

I am working on a web application. We are using Hibernate as ORM in our project. Actually, our application creates some tables dynamically based on user selection. The user can select table name, column name and then s/he can import data from a csv file. So my question is: how to map this dynamically created table with Hibernate and Java...

Searching for a sequence of Bytes in a Binary File with Java

I have a sequence of bytes that I have to search for in a set of Binary files using Java. Example: I'm searching for the byte sequence DEADBEEF (in hex) in a Binary file. How would I go about doing this in Java? Is there a built-in method, like String.contains() for Binary files? ...

How to split a wav file into smaller chunks using Java?

I have a very huge WAV file, about 100MB in size. I would like to use Java to read this wav file and split it into smaller chunks for every 2 seconds of audio. Is it possible to do this in Java? Could you please suggest me an API with which I can achieve it? Thanks in advance, Snehal ...

Why doesn't the JPA spec (including 2.0) or Hibernate extension allow u to specify a generator e.g. Oracle sequence for the @Version annotation

I think the preamble of my use case cluttered my actual point, so I am restating more succinctly: Why can't @Version take a generator and allow me to assign a sequence to it like I can do for @Id; something like this @Entity @javax.persistence.SequenceGenerator( name="SEQ_STORE", sequenceName="my_sequence" ) public class Store i...

pagination on jsp with DB2 as backend

I am retrieving thousands of rows from the database, but I want to display only about 200 on one jsp. I am using pagination by creating links to the next rows. Currently using DB2, the only thing I can do is a FETCH FIRST 200 rows. So by the time I get to the 5th page, I am doing a FETCH FIRST 1000 rows and then I am displaying 800 to 1...

Oracle on Mac OS X Snow Leopard

Hi, I am trying to install oracle on snow leopard using these guidelines. http://blog.rayapps.com/2009/09/14/how-to-install-oracle-database-10g-on-mac-os-x-snow-leopard/ There is a step in the installation, where I have to change netca and dbca such that it runs in 32 bit mode. Can someone please tell me how to do it. I have pasted the...

How to avoid flickering effect while jumping from one jdialog to another jdialog

Hi I have created two jdialog box. from first jdialog box i call to second jdialog box. I have arranged my component at the center. But when i click on next button my program calls the second jdialog but within that period (for a fraction of second i found some flickering effect means some jdialog is displayed at the left top of my scree...

jar policy file

I'm packaging my java application into a jar file but it only packages the class files. When I run the java program from the command line, usually this is what I have to do: java -Djava.security.policy="..\java.policy" Server My question is: is there a way to package a jar file and include this policy file? For instance, When the user ...

identifying code that compiles in both Java and C# but runs differently

I am having to port code from Java to C# (and soon the other way round) by copying and pasting and then editing compiler errors. (Please accept that this is necessary; I can explain if required). Are there cases where the same code fragment runs differently in the two languages? I would include cases where order or operation or operator ...

Eclipse RCP with JFreeChart

I'm trying yo use JFreeChart in RCP application with a simple view. I added JfreeChart jar file as a referenced library to project. The view could not be created because of the error : Could not create the view: Plug-in "ViewJFreeChart" was unable to instantiate class "viewJFreeChart.View". java.lang.NoClassDefFoundError: org/jfree/da...

Determine whether .class file was compiled with debug info?

How can I determine for any Java .class file if that was compiled with debug info or not? How can I tell exactly what -g{source|lines|vars} option was used? ...

How to make another thread sleep in Java

I have a class that extends Thread. This thread when running spends most of it's time sleeping, it will perform a check, if true perform a simple action, then sleep for 1/2 second and repeat. The class also has a public method that is called by other threads. If this is called I want the thread to sleep for longer if it is already sleep...

How to start a java program?

I have written a java program and I am running it through command line like "java MyProgram" Now I want to have a GUI that have a start, pause and stop button. How to start that java program by clicking on start button. How to pause it and how to stop it? ...

Can someone steal a password from a Java application?

Hi, Suppose there is a String variable that holds a plain text password. Is there any possibility of reading this password using a memory dump. (Suppose using cheat engine.) I am puzzled with this JVM thing. Does JVM provide some sort of protection against this. If no what are the practices that I need to use to avoid such "stealing". ...

Get vargs' class type if varg is set to null in Java

How can you get the data type of a variable argument in Java if the varg is set to null? I use the getClass to retrieve the type. Is there any other way? public void method(String name, Object ... vargs) { for(Object arg : vargs) { mapType.put(arg.getClass()); mapVal.put(arg); } } The only thing i could thi...

Consuming SAAJ based webservices in .NET

I am working on a C# .NET project that needs to call webservices on a Java Servlet based application to retrieve data. Unfortunately the Java application does not provide w3 compliant webservices, but seems to be using something called SAAJ. For simple method calls I can make it work in .NET by fixing the WSDLs from the Java service manu...