java

Java USB library

Is there a good Java USB API i can use? I tried JUSB but it doesn't seem to work. It's also very old, no updates since 2001. ...

Restore session after restart in JBoss

Can I somehow restore the session on JBoss after restart? I want to use it on my development machine. ...

Is it possible to view what shell commands Eclipse is making?

I have a rather length project I'm working on, which requires an older JDK to compile correctly, various JAR includes, and the like. I'm assembling the entire project using a batch script, and I'd like to make the whole process fully automated with the script. So I was wondering if I could view the shell commands Eclipse does to make a p...

controllable memory swapping in Java?

Is it possible to prevent Java from swapping out certain objects? This would be relevent if I cache a password inside a client Application for subsequent logins into a remote Service or for decrypting data from the local disk. Unless the user does not encrypt his swap space, the password would appear as clear text in the swap space. I...

make java custom annotation to mark bean properties for html cleansing

Can I use a Java custom annotation to add some code to a set or get method on a bean property to cleanse the property from bad html being input by my users? I've been looking for examples but I've not seen something that I feel I can extend. ...

ImageIcon + ImageIcon = ImageIcon

Hi, I have two ImageIcons and I want to create a third ImageIcon which has nr 2 drawn upon nr 1. How would I best do that? ...

Ordering By Mapping Table Value in Hibernate

I have a @ManyToMany mapping where the table self-references through a mapping table, and we want to order on an order id in the actual mapping table, but are finding it difficult to configure this. We could perform it in hibernate xml, so it is natural to assume the support is there in JPA annotations. Does anybody know how we can orde...

Get current filename in JSP

Is there a way to get which JSP is currently rendered, with JSTL or Struts (or without)? like _ _ file _ _ in Python and PHP? ...

Regular expression to retrieve domain.tld

I'm need a regular expression in Java that I can use to retrieve the domain.tld part from any url. So https://foo.com/bar, http://www.foo.com#bar, http://bar.foo.com will all return foo.com. I wrote this regex, but it's matching the whole url Pattern.compile("[.]?.*[.x][a-z]{2,3}"); I'm not sure I'm matching the "." character right....

Is it possible to deploy a SOAP server with Axis without using WSDD?

In the project I am working I have deployed a SOAP server using Deployment Descriptors (WSDD) files. To do that a webserver (e.g tomcat, jetty) is started and then the following command is executed: java -cp %AXISCLASSPATH% org.apache.axis.client.AdminClient deploy.wsdd What I need is to skip the above command to avoid a call to the Ax...

From Computer Scientist to Software Engineer

Hello Stackoverfellows, I graduated in December in Computer Science and have acquired a Software Engineering position. I have been banging my head up against the wall for 2 months trying to learn Hibernate, Spring and everything else that has been thrown at me in my first project. Prior to accepting this job I had experience only in pr...

What is the time complexity of a size() call on a LinkedList in Java?

As the title asks, I wonder if the size() method in the LinkedList class takes amortized O(1) time or O(n) time. Thanks! ...

What's the best way to set all values of a three-dimensional array to zero in Java?

I have a three-dimensional array that I want to reset to zero. It seems that there should be an easy way to do this that doesn't involve three for loops: for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { for (int k = 0; k < n; k++) { cube[i][j][k] = 0; } } } ...

Create a html-js UI GCalendar alike in java

Hello guys, I'm trying to replicate a UI like a gcalendar (only the layout not any of its functions) how to build a loop with a calendar to build a cute layout like that? with saturdays marked and holidays too. Thx ...

How do I encode a binary MIME attachment in C#?

I need to send a binary attachment to a JAVA webservice via SwA (Soap with Attachments). After discovering that .Net does not support SwA I am writing my own client. How do I encode the binary MIME attachment, so that the Java service will be able to decode it? ...

Unicode problem with JSF and HTML forms?

I have an HTML form generated by JSF which maps an input element to a bean setter and it looks to me like JSF is garbling unicode input on the way in. In particular I put the following exception for testing purposes in the setter public void setTitle(String title){ System.out.println("title set with: "+title+"\n"); if (title.st...

Problem with HTML output in JSP

Hi, I have code which generates some HTML, but when I try to output this content in a jsp all '<' are replaced with '&lt;' and all '>' with '&gt;'. Here is the piece which renders the result: <c:out value="${data}"/> Can someone please explain what causes the character replacement, and how it can be avoided? PS: I've tried escapeXml...

SOAP Java 1.4.2

What libraries are available to write a SOAP client in Java version 1.4.2? ...

Smarter setter? Good or Bad Idea?

Hi there In a GWT solution. (so this is java code that is then compiled to javascript). There are of course some classes. Is it a good idea to make the setter check for Null on a String field? something like this public void setSomeField(String someField){ if (null != someField) this.someField = someField; else this.so...

Problem with Java properties utf8 encoding in Eclipse

I've recently had to switch encoding of webapp I'm working on from ISO-xx to utf8. Everything went smooth, except properties files. I added „-Dfile.encoding=UTF-8“ in eclipse.ini and normal files work fine. Properties however show some strange behaviour. If I copy utf8 encoded properties from Notepad++ and paste them in eclipse, they sh...