java

how to check if a session is invalid

Hi, how to check if a session is invalid or not. there is no method in the API. is it the same as isNew(), and what is the difference if not. Thanks, Ido ...

HttpURLConnections ignore timeouts and never return.

We are getting some unexpected results randomly from some servers when trying to open an InputStream from an HttpURLConnection. It seems like those servers would accept the connection and reply with a "stay-alive" header which will keep the Socket open but doesn't allow data to be sent back to the stream. That scenario makes an attempt ...

Microsoft Team System and Java

We're starting a project written in Java in a company which works purely on MS technologies. Microsoft Team System is used as source control tool. A question is whether we should try to integrate Eclipse with MTS (which makes sense from the top level as there would be still a single repository for the company) or we should try to setup a...

A good bank of solved recursion problems in C/C++/Java/C#

I saw this question, but the answers there are not very relevant. A friend needs a bank of solved recursion problems to help him study for a test tomorrow. He learned the issue theoretically, but is having problems grasping how to actually solve recursion problems. Do you know a good source of solved recursion problems (preferably in C,...

Any disadvantage to using arbitrary objects as Map keys in Java?

I have two kinds of objects in my application where every object of one kind has exactly one corresponding object of the other kind. The obvious choice to keep track of this relationship is a Map<type1, type2>, like a HashMap. But somehow, I'm suspicious. Can I use an object as a key in the Map, pass it around, have it sitting in anothe...

JMS Durable Subscriber last usage

I have two JMS durable subscribers that seems to no longer be in use. Does any one know of any way to determine when was the last usage of these subscribers. show durable bweston prints the following: Durable Subscriber: bweston Subscription name: bweston Client ID: Topic: aquafirmout.* Type: dynam...

Multiple deployments in maven

We have a internal artifactory repository. At the moment all snapshots will be deployed there. We also want to have a different server with a web interface, and want to copy the to it the created artifacts. For our builds we use Hudson, but the post-build action "Deploy artifacts to Maven repository" together with scp doesn't work. So t...

Best Language for String Manipulation?

I am about to begin writing an app that handles adding new users/repostories to my subversion server, so that I don't have to repeatedly open vi and edit conf files and execute shell commands. Most of my experience centers around C, C++, Objective-C and Java. Java seems decent for string manipulations with its tokenizer class, however I...

Web frameworks performance comparison

I'm looking for real life benchmarks comparing web frameworks based on dynamic languages (Python, Ruby, Groovy and Lua). Even better if they're compared up against classic solutions based on PHP, Java, ASP.NET maybe even Perl. I'm particularly interested in: Django Ruby on Rails Grails Zend Framework Struts2 EDIT: As for Sean's answe...

SWT DropTargetListener has empty event data under Mac OS X

I'm currently experiencing a weird platform inconsistency between Mac OS X and Windows/Linux. I've implemented an SWT DropTargetListener and tried to analyze the data dropped in the dragEnter method. Unfortunately, the data attribute of the TransferData contained in the DropTargetEvent parameter is always null on OS X (but becomes valid...

How can I handle custom tags in a Java HTMLDocument?

I have a swing client that renders HTML through the use of the JEditorPane and HTMLDocument classes. The problem I have is that I want to be able to define an area of the document as a container for some text that will be retrieved at a later date, and then use document.setInnerHTML(element, data); to swap out the place-holder content...

Best way to consume .NET web services in Java

I'm trying to consume some .NET web services using JAX-WS. I have generated the Java classes using the wsimport tool. However, when I try to use these (proprietary, not public) web services in Java, I notice that most of the methods and properties provided by the vendor in their C# examples are not avaiable in the generated classes (desp...

What are the URLs of all the Maven Archetype catalogs that you know about?

Maven Archetypes are the "templates" by which you can quickly generate a running example of a given framework or project type. I am trying to compile a list of all the Maven archetype catalogs currently active on the net. From the Maven documentation about catalog files: Knowledge about archetypes are stored in catalogs. The...

Generating ActionScript value objects from an xsd schema

Are there any tools available for transforming types defined in an xsd schema (may or may not include other xsd files) into ActionScript value objects? I've been googling this for a while but can't seem to find any tools and I'm pondering wether writing such a tool would save us more time right now than to simply code our value objects b...

Java generics

I'd like to implement a method that takes an Object as argument, casts it to an arbitrary type, and if that fails returns null. Here's what I have so far: public static void main(String[] args) { MyClass a, b; a = Main.<MyClass>staticCast(new String("B")); } public static class MyClass { } public static <T> T staticCast(Objec...

How to get the Join of Two One to Many associations?

I have two hibernate entities User and Blog. User can be interested in multiple Tags. Blog can belong to multiple Tags. For a User, How do i find the Blogs which belong to the Tags the User is interested in? I need something like Select * from Blog where Blog.Tags IN User.Tags except that SQL or HQL doesnt allow such comparisons in ...

Can a string literal and a character literal be concatenated?

Why does name misbehave in the following C++ code? string name = "ab"+'c'; How would the equivalent code behave in Java/C#? ...

Replacement for JAXMServlet?

I am maintaining an application that has classes (written in 2005) that extend javax.xml.messaging.JAXMServlet. While upgrading to a new app server that implements the latest J2EE standards, I discovered that JAXMServlet was removed in JWSDP 2.0 (Java Web Services Developer Pack), according to this question (and apparently JWSDP itself h...

How does vector graphics performance in Java compare to Flash?

Answers should compare the best possible methods/libraries for drawing/animating the vector graphics on both platforms (particularly java, is there more than one way in flash?). What are those methods? ...

HIbernate and CMT

Lately I decided to implement in my project CMT transactions (jBoss5, Hibernate, jta postgres datasource). Everything is working fine except Hibernate.initialize() in my entities. It works in EJB beans but when trying to invoke initialize in entity getter I get "couldn't associate with session" exception. It worked just fine before imple...