java

Does C# Monitor.Wait() suffer from spurious wakeups?

Java's Object.wait() warns against "spurious wakeups" but C#'s Monitor.wait() doesn't seem to mention it at all. Seeing how Mono is implemented on top of Linux and Linux has spurious wakeups, shouldn't this be documented anywhere? ...

Java: Cache results of computation?

I'm writing a program to calculate a value that is a measure of the similarity between two objects. The comparison is commutative, so compare(a, b) == compare(b, a). The program's output to the console is a matrix of all results. However, since the matrix has each comparison twice ((a, b) and (b, a)), I'd like to save time by only calcu...

Axis2 versus Sun Metro

Could anyone please compare Axis2 and Sun metro web service based on following parameters? Speed Hot Deployment Flexibility Stability Composition and Extensibility Security Document availability and easy to use. ...

Using AlertManager in Sametime 7.5.1

Based on the code here I was able to create an alert window for a specific message to be displayed on my screen. The next step for me is to show the same alert windows to specified userid (person objects) that i select based on a certain constraint. Can anybody give any pointers as to which class is to be used for this purpose. I would a...

Passing environment variables to a JVM, in a platform-independent manner

I'm developing a J2EE application that runs in JBoss on a Windows Vista machine, but the application will end up on a Linux machine. Is there a way to pass in the value of an environment variable in a platform independent way? I think (but I'm not sure) the platform-sensitive way would be: -Denv_var=%MY_ENV_VAR% (Windows) -Denv_var=$MY...

How much data could be stored into a Google App Engine, application?

Answering this question and searching for references I have this doubt my self: *How much data could be stored into a Google App Engine, application? If I'm reading well this table: Resources | Free daily | Free Max Rate | Daily Billing enable | Max Rate Billing --------------------------------------------------------...

How to set up a global prefix and suffix used in each error field in Spring ?

Hi, In Struts, you can confire a global prefix and suffix in a resource bundle file. Something like: errors.prefix=<div class="error"> errors.suffix=</div> So <div class="error"> will be added before each <html:errors and </div> will be added after each one. So how can i get the same effect by using Spring form tags <form:errors ? ...

10 gig ethernet in Java?

Does Java 6 support 10 gig ethernet out of the box? It seems like it shouldn't require Java changes, but I thought I remembered that Java 7 was adding 10 gig support. ...

can jax-ws web methods return objects that have static methods?

public class Pojo { private String value; public static void printValue() { System.out.println("value=" + value); } } I would want to return this from a web service as follows: @WebService public class MyService { @WebMethod public Pojo getPojo() { return new Pojo(); } } Can't seem to find the definiti...

Automated Deployment solution for multiple Java web-apps

I'm looking for solutions, preferably open source, that can manage deployments of multiple interdependent java web-applications. The solution requires an ability to create and store a release specification containing multiple items for release - specific versions of each application and relevant other artifacts (database config, apache ...

How do you use Seam page parameters?

I have a bunch of Seam form pages; each has a command button that calls a sendEmail() method in a custom utility class. The method looks like this: public String sendEmail(String mailFile) throws SMTPSendFailedException { status = "Processing email now..."; renderer.render(mailFile); status = "Email sent successfully."; ...

Can anyone provide a clear explanation of why Google Guice is useful?

I've read about Google Guice, and understand the general issues with other approaches to dependency injection, however I haven't yet seen an example of someone using Guice "in practice" where its value becomes clear. I'm wondering if anyone is aware of any such examples? ...

HttpSession problem in Google App Engine/J

I am writting a Twitter web app by using Twitter4J on GAE/J. I am saving Twitter and Request Token objects in session so that to be used after call back. I have two servlets. IndexServlet sets session and HomeServlet get from session (hits on call back by twitter oAuth). If I comment out session handling lines in both servlets then c...

Java unit test coverage numbers do not match.

Below is a class I have written in a web application I am building using Java Google App Engine. I have written Unit Tests using TestNG and all the tests pass. I then run EclEmma in Eclipse to see the test coverage on my code. All the functions show 100% coverage but the file as a whole is showing about 27% coverage. Where is the 73% unc...

How to convert an alphanumeric phone number to digits

UPDATE: The final version of my utility looks like this: StringBuilder b = new StringBuilder(); for(char c : inLetters.toLowerCase().toCharArray()) { switch(c) { case '0': b.append("0"); break; case '1': b.append("1"); break; case '2': case 'a': cas...

Eclipse "Open Type" dialog restricted to a particular interface

I'm trying to create a JavaUI.createTypeDialog() which restricts the user to selecting only types belonging to a particular interface. How could I do this? ...

Reading content of a JAR file (at runtime)?

I have read the posts: http://stackoverflow.com/questions/320510/viewing-contents-of-a-jar-file and http://stackoverflow.com/questions/1429172/list-files-inside-a-jar But I, sadly, couldn't find a good solution to actually read a JAR's content (file by file). Furthermore, could someone give me a hint, or point to a resource, where my ...

How do you configure jax-ws to work with Spring using jax-ws commons?

In web.xml I have the following: <servlet> <description>JAX-WS endpoint - EARM</description> <display-name>jaxws-servlet</display-name> <servlet-name>jaxws-servlet</servlet-name> <servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet</servlet-class> </servlet> <servlet-mapping> ...

Code for displaying the smallest power of 2 greater than or equal than the integer

I need a code in Java that can find the smallest power of 2 greater than or equal to any non-negative integer entered by the user. Can anyone help? ...

Evaluate if list is empty JSTL

I've been trying to evaluate if this array list is empty or not but none of these have even compiled: <c:if test="${myObject.featuresList.size == 0 }"> <c:if test="${myObject.featuresList.length == 0 }"> <c:if test="${myObject.featuresList.size() == 0 }"> <c:if test="${myObject.featuresList.length() == 0 }"> <c:i...