java

How do I use Maven through a proxy?

Hi dear community, I wanna share with you my experience of using maven through proxy. You would most likely face exceptions and messages like: repository metadata for: 'org.apache.maven.plugins' could not be retrieved from repository: central due to an error: Error transferring file: Connection refused: connect See my answer below. ...

Testing an AspectJ Aspect

When writing aspects, how can I test that they do match and that they are invoked when I want them to? I'm using @Aspect declarations with Spring 2.5.6. I don't care about the functionality, that's extracted and tested otherwise. ...

Java to C# Translator

I heard that JNBridge will translate C# code to native Java code.( I haven't tested it). Is there any tool available in market to translate Java code to native C# ?(or Will JNBridge also translate Java code to C# ?) ...

java pgm 2 jpeg/png

I have an int array containing gray scale values from 0-254, i also have the x and y size of the image. It is an easy thing to create an pgm image, but i want to display it in a jsp, so i need somehow to convert it to a jpeg or png image. If you suggest jai, than please tell me at which classes to look, or how to actually do it in jai. ...

How to obtain an HttpSession Object from SessionID?

I want to invalidate sessions of users based on some Event. I store their sessionID, how to get their HttpSession from this ID? The HttpSessionContext class is deprecated with no replacement. ...

Java: Is there a class which wraps a reference and provides a getter and setter?

Hello! Sorry for the stupid question. I'm very sure, that the Java API provides a class which wraps a reference, and provides a getter and a setter to it. class SomeWrapperClass<T> { private T obj; public T get(){ return obj; } public void set(T obj){ this.obj=obj; } } Am I right? Is there something like this in the Ja...

regenerate ecore after schema changes

Hello, I have a schema in xsd file. once in a while a new version of the schema is created, and I need to update my .ecore (and .genmodel). How do I update them, without deleting them and re-generate them. I have made some manual modification to the ecore, and i want to keep this modifications. Ido. ...

format years bc/ac differently

I would like to display e.g. 31-12-1999 for years ac and 31-12-(-)2000 for years bc. I spent some time with the joda api's e.g. something like: new DateTimeFormatterBuilder().appendYear(4, 10).appendLiteral("-").appendMonthOfYear(2).appendLiteral("-").appendDayOfMonth(2).toFormatter(); but I cannot find any details about this specific...

how to init an iterator

hi folks, i just intent to initialize an iterator over a generic linked list like that (generic typ T seems to be erased in here since the site interpret it as tag) public <T> LinkedList<T> sort(LinkedList<T> list){ Iterator<T> iter = new list.iterator(); ... but i got the error: "list cannot be resolved" what's wrong? ...

InputStream read doesn't read the data

I'm having an issue reading from a java input stream. I have a buffer of size 1024, and an input stream of size 29k-31k. I read the inputStream in a loop, but I only get 29 bytes for the first read, 39 for the second read, and nothing after that. The same behavior repeats for different InputStreams. (I'm writing the data to an output str...

How do I use user defined Java classes within Matlab ?

Hi, I have read the documentation and several websites on exactly how to do this, however Matlab does not seem to pick up the classes that I have added to the dynamic java class path. Nor do I use the right syntax to correctly construct the object. I have an class HandDB and which to create an object of this type and invoke it's static ...

What is the meaning of jitter in visualize tab of weka

In weka I load an arff file. I can view the relationship between attributes using the visualize tab. However I can't understand the meaning of the jitter slider. What is its purpose? ...

Loading JList with components/values

Can anyone tell me how I can insert some components/ values into JList? I 've being trying all means of loading my JList which can later-on be drag unto a textpane. Can anyone help me please? ...

Swing Menu that can be customized by user

Is there any framework or lib out there to create a Java swing menue that can be edited by the user via drag and drop? Added: Implementing a polished solution myself can take a lot of time. What i would like to see: display the entry while dragging, opening submenus automaticially, showing a line where the item would be placed when rele...

HEAPSPACE ERROR: cannot figure out what is causing the error

Would anyone mind having a look at these bits of code and see if there is a memory leak in them, it isn't going to be overly large but my program keeps crashing after a while of running and I don't know how to use viualvm even though I have been reading up on it for several days now and haven't the slightest idea what I am looking for in...

flickrj dependencies

does anyone know the java packages that flickrj is dependent on? I'm going through the slow and painful compile - jarify - run - locate-library - repeat loop. ...

Is it possible to retrieve the form name from a Java HTTPServletRequest?

I would like to get the name of the form used to post parameters from a Java HTTPServletRequest object. Is this possible. I don't see any method that looks like it will return it to me. ...

Java: How to wait for a set of threads to complete?

What is a way to simply wait for all threaded process to finish? For example, let's say I have: public class DoSomethingInAThread implements Runnable{ public static void main(String[] args) { for (int n=0; n<1000; n++) { Thread t = new Thread(new DoSomethingInAThread()); t.start(); } // wait for all t...

Groovy/Java process management intercept/listen output.

Hello everyone. Groovy has a nice process execution engine and I'd like to use it. There is a method consumeProcessOutput that does all the necessary work. But what I want is to inject my additional functionality every time when consumeProcessOutput call append or something on the out instance. public class ProcessExecutor { static p...

Android: Passing a Service a Handler

So, I've read the android AIDL documentation and have a general idea of how RPC works between an Activity and a Service. However, for my application it seems overboard to implement such features: basically, I want to pass a Service a nice handler so its thread can pass data to my Activity. Currently I'm getting around this by using a sta...