java

How to map a set of enum type in Hibernate?

In hibernate, is it possible to define a mapping for a class to a set of enums? I've been able to find examples of how to define mappings of Sets and I've been able to find separate examples for how to map Enums, but I cannot figure out how to define a of Enums for a class. Could anyone please provide me with an example? This is ...

indexOf Case Sensitive?

Is the indexOf(String) method case sensitive? If so, is there a case insensitive version of it? ...

Using XMLBeans on Andoid

Hi Everyone. I was just wondering if anyone had any success in getting XMLBeans (or any other generator) to work on android. It would be very nice if I could use it because I have a very large schema that I would rather not write all the classes by hand. I had asked about this on the android developers mailing list, but no one responded...

Selenium RC - disabling browser cookie

Is it possible to disable a browser cookie using selenium, RC specifically? If so, what is the api call or sequence of calls to make this happen. There is a feature being tested where theres a need to verify the behavior when cookies are enabled or disabled. Thanks ...

Which templating engine is this?

At my current place of work we have to use a web-service which works with a text template we feed to it. Now we would like to use those templates at other places in code and so I wondered what template language that could possibly be and if it's some off-the-shelf or off-the-net software. It's presumably something from Java or .NET world...

Slow string concatenation over large input

I've written an n-ary tree ADT which works fine. However, I need to store its serialization in a variable a calling class. eg. DomTree<String> a = Data.createTreeInstance("very_large_file.xml"); String x = a.toString(); I've written method which serves the purpose exactly how I need it, but on very large inputs it takes forever (2...

What is the system effect of starting large quantities of timers in Java?

Hello, recently I have had to program some applications that require large amounts of timed tasks to occur. However, I'm afraid to create so many timers because I haven't been able to figure out how they are handled by Java. Is there a problem with starting large quantities of scheduled tasks? If so, what is the better alternative? ...

Make JTextPane adjust height to content

I'm trying to get a JTextPane to adjust its height according to whatever content I feed it. All I can do is to set a fixed height in pixels using Dimension. How do I make the JTextPane collapse/expand so it will fit to contents? I might add that I use this in a GridBagLayout'ed JPanel that has been added to a JScrollPane. ...

Getting the JSP URI that was sent to the GET/POST of a Servlet

Is there a way to get the URI of a JSP that sent a particular GET/POST request to a Servlet? I know of the request.getRequestURI() function within a Servlet, but that is just returning the URI of the Servlet itself. For example: Let's say that index.jsp sent the request to the Servlet SampleServlet. I want to get the URI of the ind...

Casting to a recursively bounded type

I defined a Java interface to represent the ability of an object to copy itself (no, I don't want to use Cloneable, but thanks for the suggestion ;-). It's generic: public interface Copiable<T> { T copy(); } An object will only make copies of its own type: public class Foo implements Copiable<Foo> { Foo copy() { return new Fo...

How do I access Windows credentials from Java?

How do I (or can I?) retrieve the cached credentials for the currently logged-in Windows user in Java? I want to reuse these credentials in some other GSS-API calls. Specifically, I'm answering an SPNEGO challenge from IIS. Thanks. ...

Building a GUI in Java

What mechanism do you prefer for building a GUI: from scratch or using GUI-building software? ...

How long should it take Tomcat to shut down?

My webapp runs on dedicated Tomcat instances on various platforms and hardware--mainly x86 Linux and Windows, but also Solaris and I develop on OS X. I've been generally surprised by the variance in shut down times between OSes. And tomcat generally seems slower so shutdown than other non-trivial services (httpd, mysql, squid.) So, a s...

Retrieving the SMS Messages from the SIM card on with android

Hi Everyone, I was wondering if anyone knew anything about programmatically getting the sms messages off of your phone's sim card on an android platform. I would like to write a program that allows you to save either individual messages or entire threads to the sd card, but after looking around for a bit, I have discovered that google d...

improving performance of writing query results to CSV in java

Hello all, I have the following code that executes a query and writes it directly to a string buffer which then dumps it to a CSV file. I will need to write large amount of records (maximum to a million). This works for a million records it takes about half an hour for a file that is around 200mb! which seems to me like a lot of time, n...

Determine location of a java class loaded by Matlab

When using java from Matlab, is there some way to figure out from where in matlab's java class path is a class being loaded? I'm trying to diagnose a error caused by conflicting versions of the same class being used simultaneously. Specifically, the class I'm looking for is org.apache.lucene.store.FSDirectory. It seems to be used by one...

Replicate Eclipse's "display tab" in my Java/Swing application?

So, I've got a Swing GUI that, for testing purposes (the other applications that my task will interact with aren't all developed yet), I'd like to be able to give a "debug console" to. The idea being that I could use this console to explicitly set values in my model, and verify that the appropriate GUI elements get updated. The Eclip...

How to handle/parse ill-formed html into DOM in java?

I am using NekoHtml. It failed parsing html from sites like mercurynews.com into DOM. Any solution to the problem? ...

Java interface to Windows communications? (OLE, OPC, DDE)

I need to integrate an off-the-shelf Windows application with a Java application. At a few key points, I need the Windows application to send an "event" and some data to the Java application. The Windows application anticipated this need, and can be configured to "Poke a DDE Item", "Set an OLE Auto-Property" or "Write an OPC Item". I'...

Tomcat6 won't start on Windows and Java6

I just downloaded a fresh copy of Tomcat6 to install on a development server. The server is running Win2k3 SP2 and Java6. When I go to start Tomcat6 it reports the following: D:\>d:\tomcat\bin\tomcat6.exe //TS/Tomcat6 [2009-07-14 15:26:38] [427 prunsrv.c] [error] The operation completed successfully. [2009-07-14 15:26:38] [1336 pruns...