java

Real differences between "java -server" and "java -client"?

Is there any real practical difference between "java -server" and "java -client"? All I can find on Sun's site is a vague "-server starts slower but should run faster". What are the real differences? (Using JDK 1.6.0_07 currently.) ...

Looking for evolutionary music example code

I would like to implement an interactive evolutionary algorithm for generating music (probably just simple melodies to start with). I'd like to use JFugue for this. Its website claims that it is well-suited to evolutionary music, but I can't find any evolutionary examples. I already have a framework to provide the evolutonary machiner...

Convert audio stream to WAV byte array in Java without temp file

Given an InputStream called in which contains audio data in a compressed format (such as MP3 or OGG), I wish to create a byte array containing a WAV conversion of the input data. Unfortunately, if you try to do this, JavaSound hands you the following error: java.io.IOException: stream length not specified I managed to get it to work b...

Why isn't querying a JDBC-compliant database from Oracle as easy as pie?

Ok, so it's almost as easy as pie already. But it really should be as easier than it is. I think I should be able to connect to another database just by putting a JDBC connection string into TNSNAMES. Every database vendor has a type-4 JDBC driver and there's usually a good, free alternative. With Oracle being such keen Java fans, and ...

How to do Gesture Recognition using Accelerometers

My goal is to recognize simple gestures from accelerometers mounted on a sun spot. A gesture could be as simple as rotating the device or moving the device in several different motions. The device currently only has accelerometers but we are considering adding gyroscopes if it would make it easier/more accurate. Does anyone have recomm...

What is a good toolkit for developing Blackberry applications?

Looking for a toolkit/SDK for general Blackberry development or application toolkits. Anything like an MVC framework? ...

How do you programatically authenticate to a web server using NTLM Authentication with apache's commons httpclient?

I'm using this code, and I get the stack trace that is listed below. I've got this working with just https and with basic authentication, but not ntlm. HttpClient client = null; HttpMethod get = null; try { Protocol myhttps = new Protocol("https", ((ProtocolSocketFactory) new EasySSLProtocolSocketFactory()), 443); Protocol.registerP...

Force a full Java applet refresh (AWT)

I have a Java Applet that uses AWT. In some (rare) circumstances, the platform does not refresh the screen properly. I can move or minimize/maximize the window and see that my applet refreshed properly. I am looking for code that will give me the fullest possible applet screen repaint, simulating the behaviour of a minimize/maximize. I...

java in-memory compilation

Hi How can i generate bytecode (Byte[]) from a String at runtime, without using a "javac" process or something of this sort? is there a simple way of calling the compiler like that? later addition: I chose to accept the solution that actually best fits my situation. my application is a hobby-project still in design sketch phase, and i...

Open command prompt using Eclipse

I am new to Java and am trying to run a program using Eclipse. But I have no idea how to get the command prompt running in with Eclipse... I did some online research and couldn't get anything consolidated! Update: I'm not using an applet. It's a normal Java program trying to read a line from command prompt. I'm trying to do system pr...

Hibernate Delete Cascade

I Have one entity [Project] that contains a collection of other entities [Questions]. I have mapped the relation with a cascade attribute of "all-delete-orphan". In my DB the relation is mapped with a project_id (FK) field on the questions table. this field cannot be null since I don't want a Question without a Project. When I do sess...

What descriptive variable name can I use here?

I'm creating a custom Java Struts tag that is for building and formatting an html select box in a standardised way (part of our usability guidelines). Each select box has an additional/initial value which describes the requirement of the value returned by the select element, i.e.: Mandatory - with the label "Please Select" Optional - ...

How can I port a legacy Java/J2EE website to a modern scripting language (PHP,Python/Django, etc)?

I want to move a legacy java web application (J2EE) to a scripting language -- any scripting language -- in order to improve programming efficiency. What is the easiest way to do this? Are there any automated tools that can convert the bulk of the business logic? ...

Programming timing shellscript measuring program execution time at 0 seconds.

My professor wrote this shell script to time my program, and display the results. For some reason it just outputs 0s with my program. He provided the following files: timeit.csh sequence ecoli2500.txt ecoli3000.txt ecoli5000.txt ecoli7000.txt ecoli8000.txt ecoli9000.txt ecoli10000.txt Here are the contents of ...

How to make a Java Canvas look raised from its container

I have a simple GUI component written in Java. The class draws an analog clock in a java.awt.canvas. This canvas is then contained in a JFrame - What I want to do is give the canvas a 3d "raised" effect - almost like adding a drop shadow to a photo. Is there a simple way to do this? ...

which is the best book/tutorial for a Web Services newbie?

[sorry for my english] Hi, I'm a Newbie in Web Services. I've a java desktop app and some JSP/Servlets working fine, and I need to comm. both with the logic, (must be) using java. Which book/tutorial/how-to you recomend? Thanks ...

scp via java

What is the best method of performing an scp transfer via the Java programming language? It seems I may be able to perform this via JSSE, JSch or the bouncy castle java libraries. None of these solutions seem to have an easy answer. ...

.NET's equivalent of Java's MemoryImageSource

I found a wonderful open source Java program that I'm translating into C#. The built-in translator in Visual Studio got me started and I've now spent about a month translating the rest manually line by line. I've completed over 15,000 lines of translation and the only thing that remains is trying to figure out how to convert their Memory...

Postgres JDBC connection in Eclipse Help

Hi Everyone, I'm trying to get a postgres jdbc connection working in eclipse. It would be nice to use the Data Source Explorer, but for now I'm just trying to get a basic connection. What I have done so far is download the postgres JDBC connector. I then tried two different things. First, Preferences-> Data Management, I tried to add th...

random access file in java

Inventory control (16 byte record) Product ID code (int – 4 bytes) Quantity in stock (int – 4 bytes) Price (double – 8 bytes) How to create fixed length random access file using the above lengths? I tried some examples online, i either get EOF exception or random address values when I try to access them... Again I did try some examp...