java

Hibernate multi level of transaction

hi every one, I have some hibernate code and I want my code run in 1 transaction let me explain in code public void changeBranch(Branch branch) throws DatabaseException { //some code humanDao.update(he); superBranchUsername = branch.getFatherUsername(); int superBranchId = branchDao.getBranchIdByUserN...

best platform for blackberry for screen tinter?

i need to build an app for blackberry that will change the background color for all apps something like this: http://www.thomson-software-solutions.com/html/screen_tinter.html is this something i should do in java? i have no experience with programming for PDAs. which compiler would i use? ...

add build path to eclipse plugin

Hi, I need to add a variable to a jar in my eclipse plugin project. I get No class definition found exception. My thoughts is that i need to add it somehow in the manifest file? Thank you, Ido ...

Wicket session Expiration

Hi, i am using a class for session which extends org.apache.wicket.protocol.http.WebSession; i need a method to be called when this session expires as a consequence of logging out or time out. but i have found nothing. How can i do it? Thanks in andvance. ...

regex read string matcher.matches first string not match properly

Someone help me i have a file containing following a // true тодорхойгүй гишүүн\n // false ямар нэг // false нэгэн // false a good deal // true нэлээн // false a long face // true уруу царай // false ... My java code while...

Unable to Install Maven

I followed this tutorial to the letter but I still can't get maven installed!!! http://maven.apache.org/download.html#Installation When I run the following in command prompt: E:\Documents and Settings\zach>mvn --version I get: 'mvn' is not recognized as an internal or external command, operable program or batch file. I navigated to t...

reference non plugin project to eclipse plugin project

Hi, Can I add a reference from an eclipse plugin project to a non plugin jar? This is a jar that I can not change, so i have to use it as is. Thank you Ido ...

How can I safely encode a string in Java to use as a filename ?

I'm receiving a string from an external process. I want to use that String to make a filename, and then write to that file. Here's my code snippet to do this: String s = ... // comes from external source File currentFile = new File(System.getProperty("user.home"), s); PrintWriter currentWriter = new PrintWriter(currentFile);...

Make a recursive method pause in every recurse and continue with click

Hi! I have a recursive method that changes the value of a variable in every recursion, then it shows that value on the JPanel, and then I would like to pause (here is my problem) until I click (it pauses in every new recurse). Then when I click this method continues to do the next recursion. The following code is just the structure of...

Java covariance question

I'm having a hard time trying to figure this out. Say I have the following code: class Animal { } class Mammal extends Animal { } class Giraffe extends Mammal { } ... public static List<? extends Mammal> getMammals() { return ...; } ... public static void main(String[] args) { List<Mammal> mammals = getMammals(); // compilation err...

Why can Haskell handle very large numbers easily?

Hugs> 94535^445 13763208823213770506960538876615156211048901640052821530697264247739998018468419032448277029434879827074549660094560167350418780006041435009085328874649203806051649321126870390595266721098189242349208444482316125325707186571602341772853777338301048340410490766099124882372196084459950728677984306149354032194958838350428628...

Sending input to the computer programatically

This is just for fun. I'm playing a game where you type A-z as fast as you can, I can't do it faster than in 5 seconds and I think it may be humanly impossible to do it in 1-2 seconds. However, it may be possible to create a small program in Java or Php which, when started, sends the inputs of letter keys A-z to the computer as fast as ...

Is HtmlCleaner thread safe?

I can't find an answer on their website. Do you have any idea if HtmlCleaner is thread safe or not? I have a multiple threads that need to use it but I don't know if I can safetly reuse an instance of the HtmlCleaner object. Have you ever used it? any idea? ...

Hex to Ascii? Java

Hi. I'm looking for a way to convert hex to ascii in Java. An example: byte temps[] = new byte[4]; temps[0] = 0x74; temps[1] = 0x65; temps[2] = 0x73; temps[3] = 0x74; String foo = ..(temps); System.out.print(foo); That should ou...

Java's equivalents of Func and Action

What are Java's equivalents of Func and Action? I mean, instead of writing this on my own: public interface Func<TInput, TResult> { TResult call(TInput target) throws Exception; } public interface Action<T> { void call(T target) throws Exception; } ...

Servlet context scope vs global variable

What (if any) is the difference between storing a variable in the ServletContext and just having it as a public static member of one of the classes? Instead of writing: // simplified (!) int counter = (Integer)getServletContext().getAttribute("counter"); counter++; this.getServletContext().setAttribute("counter", counter); Why not ju...

Shrinking an ArrayList to a new size

Do I really need to implement it myself? private void shrinkListTo(ArrayList<Result> list, int newSize) { for (int i = list.size() - 1; i >= newSize; --i) list.remove(i); } ...

Hungarian Notation

Possible Duplicates: Why shouldnt I use Hungarian Notation? Are variable prefixes ( Hungarian ) really necessary anymore? Do people use the Hungarian Naming Conventions in the real world? I'm sure this subject has been discussed and argued countless times before, but I would like to see what the people here an StackOverflow...

Optimizing N Queens code to avoid stack overflow

Hello there, i've been trying to write a java class to solve the n queens problem using some sort of stacking and recursion, the answers are stored in grids(two dimensionnal arrays), but i've hit a dead wall which is stack overflow for recursion at n=8 (max recursion depth reached 2298) So i've been wondering if there is some way to bypa...

Restrict Certain Java Code in a Plug-in

Hi, I am creating an application which uses the Java Plugin Framework to load plug-ins and intergrate them into the program. My question is: Is there anyway restrict certain operations (such as starting a new process) in the plug-ins? What I have in mind is something like Java WebStart, i.e when the application wants to access the File...