java

Java Regexs: unexpected char: '('

I am using processing 1.0.6, which runs on java 1.6. I have the following code: Pattern pattern = Pattern.compile("func\((.*),(\-?[0-9\.]*),(\-?[0-9\.]*),(\-?[0-9\.]*)\)"); but it gives the error: unexpected char: '(' and highlights the line I pasted above. If I change the offending \( to another character like #, it complains of t...

Inner Interfaces?

I'm pretty new to Java and I don't understand what is this structure. I know what is an interface and how is defined, but in this case, I really don't know. Could you tell what is about? public interface WebConstants { public interface Framework { String ACTION = "action"; } public interface Look { String LI...

Java ( Counting Distinct Integers )

how do you return number of distinct/unique values in an array for example int[] a = {1,2,2,4,5,5}; ...

Java vs Python on Hadoop

I am working on a project using Hadoop and it seems to natively incorporate Java and provide streaming support for Python. Is there is a significant performance impact to choosing one over the other? I am early enough in the process where I can go either way if there is a significant performance difference one way or the other. ...

How to be multi-language to JavaDoc

There is JavaDoc of normal API of the JAVA with English version, a Chinese edition, but seems to become the separate source codes each. ...

What happens if both catch and finally blocks throw exception?

What happens if both catch and finally blocks throw exception? ...

java: creating directories

in windows batch and and bash scripts there is %USERPROFILE% and ~, is there a command that works the same in java that will allow me to switch to the users home directory? ...

Broken Java Mac 10.6

Some background: On Mac OS X 10.6 using Macports and I have DYLD_LIBRARY_PATH set in my .bash_profile. The problem: When I run java -version I get this error: Error occurred during initialization of VM Unable to load native library: libjava.jnilib By way of one helpful forum thread, I've discovered the problem is some files in...

How do I make sure only one instance of my program can be executed?

I want my program, a Java executable .jar, to be run just once. I made a program but now I want users not to be able to open more than one instance ....thanks for your time... I've checked the server/client solution and the lock file, but I don't understand them much, I also tried to make them run in NetBeans, with no luck... ...

updating "nested" objects with JDO on Google App Engine

I'm having trouble figuring out the proper way to update "nested" data using Google App Engine and JDO. I have a RecipeJDO and an IngredientJDO. I want to be able to completely replace the ingredients in a given recipe instance with a new list of ingredients. Then, when that recipe is (re)persisted, any previously attached ingredients...

How to achieve highest performance possible with any kind of OutputStream in java?

I need to write blocks of data (characters) and I don't care about the sequence of those blocks. I wonder what kind of OutputStream I should use to achieve high performance? ...

build oracle sql query dynamically from java application

How do I build oracle pl/sql query dynamically from a java application? The user will be presented with a bunch of columns that are present in different tables in the database. The user can select any set of column and the application should build the complete select query using only the tables that contain the selected columns. For exam...

apache james, jsp servlet

I am trying to make a mail application through apache james, but I could not really get all the things, please give suggestions how to use it. MOreover, I could not figure it how to use jsp and servlet for james. Please help. ...

Hibernate: Foreign key has the wrong number of columns

Hi guys, I have defined a many-to-many relationship between my two entity classes User and Permission. User has a primary key composite of username and countyId, and my Permission table has a regular integer Id. The table UserPermission has the three foreign keys as its primary key: username, countyId and permissionId. Since this is a ...

How do you simulate low memory in the Android emulator ?

Is there an easy way to simulate low memory inside the emulator ? I'm interested to perform resource cleanups similar to this post ...

find out instantiating object in the constructor of a class

How can i get hold of the instantiating object from a constructor in java? I want to store reference to the parent object for some GUI classes to simulate event bubbling - calling parents handlers - but i dont wanna change all the existing code. ...

Java Program Error

Please can anyone tell me what is the error in the following piece of code? Question is Create a class person which has A variable ‘name’ which stores the name of the person. A constructor that takes a single argument that is used to initialize the name variable A method getName() which displays the name. A protected method setName()...

Finding out your website visitor IP address in Java

Hi, Is there simple and reliable way to detect your website visitor IP address using Java. I am trying to make use of Akismet to detect spam on my blog post/comment. The API require me to specify the IP address of the commenter. Thanks =) ...

How to add a Processing PApplet in SWT

I have a problem when trying to add a PApplet into SWT, it turns up an empty window when it should just render the PApplet. I.e. the PApplet works by itself, but not in a SWT window. I thought that just adding the PApplet into the frame should initially do the trick, using the SWT tutorial code in Eclipse. Apparently it wasn't so easy....

My slider in java does not give same look and feel in all platform

Hi I have created a slider in java in linux platform. But the slider gave different look and feel in different operating systems. Means in linux it looks little bit good but in mac operating system the slider looks different. so how to give same look and feel to my slider irrespective of operating system The code is given below. import...