java

How do I enable open id on a Java Webapp?

Is there a simple jar that I can just drop in a web app with simple configuration to allow people to log in my app and be seen as JASS user? I am not looking just for a library that implement the protocol, but a complete solution for simple solution integration. ...

Java ConnectionPool connection not closing, stuck in 'sleep'

I have a webapp that uses JNDI lookups to get a connection to the database. The connection works fine and returns the query no problems. The issue us that the connection does not close properly and is stuck in the 'sleep' mode (according to mysql administrator). This means that they become unusable nad then I run out of connections. Ca...

Hibernate crops clob values oddly

I have a one to many relationship between two tables. The many table contains a clob column. The clob column looks like this in hibernate: @CollectionOfElements(fetch = EAGER) @JoinTable(name = NOTE_JOIN_TABLE, joinColumns = @JoinColumn(name = "note")) @Column(name = "substitution") @IndexColumn(name = "listIndex", base = 0) @Lob privat...

Getting hibernate to log clob parameters

(see here for the problem I'm trying to solve) How do you get hibernate to log clob values it's going to insert. It is logging other value types, such as Integer etc. I have the following in my log4j config: log4j.logger.net.sf.hibernate.SQL=DEBUG log4j.logger.org.hibernate.SQL=DEBUG log4j.logger.net.sf.hibernate.type=DEBUG log4j.logg...

using DBMS_APPLICATION_INFO with Jboss

Does anyone have examples of how to use DBMS_APPLICATION_INFO package with JBOSS? We have a various applications which run within JBOSS and share db pools. I would like, at the start of each session these applications to identify themselves to the database using DBMS_APPLICATION_INFO so I can more easily track which sections of the app...

Some Tomcat webapps not opening

Hi, I downloaded a couple of webapps and placed them in my /webapps folder. Some of them I could open by going to http://localhost:8080/app1 and it would open. However, some others I would do the exact same thing and go to http://localhost:8080/app2 and it will display "HTTP Status 404 - /app2/", even though I am sure it is there. I've...

Enabling Hibernate second-level cache with JPA on JBoss 4.2

What are the steps required to enable Hibernate's second-level cache, when using the Java Persistence API (annotated entities)? How do I check that it's working? I'm using JBoss 4.2.2.GA. From the Hibernate documentation, it seems that I need to enable the cache and specify a cache provider in persistence.xml, like: <property name="hib...

How to get whois information of a domain name in my program?

I want to get whois information of a domain name from my c#/java programs. Is there a simple way to do this? ...

Good 15 minute Java question to ask recent college graduate

When interviewing college coops/interns or recent graduates it helps to have a Java programming question that they can do on a white board in 15 minutes. Does anyone have examples of good questions like this? A C++ question I was once asked in an interview was to write a string to integer function which is along the lines of the level ...

Why does windows XP minimize my swing full screen window on my second screen ?

Hello dear fellows, In the application I'm developping (in Java/swing), I have to show a full screen window on the second screen of the user. I did this using a code similar to the one you'll find below... Be, as soon as I click in a window opened by windows explorer, or as soon as I open windows explorer (i'm using windows XP), the ful...

Java Compiler Options to produce .exe files.

What compiler (I'm using gcj 4.x) options should I use to generate an "exe" file for my java application to run in windows? ...

What are the best Java Podcasts?

What are the best Java coding practices Podcast you can find on the net? I'm thinking in a podcast like HeardingCode or Hanselminutes, but oriented to java development... is there any this good out there? thanks! ...

How would I allow a user to stream video to a web application for storage?

I'd like to add some functionality to a site that would allow users to record video using their webcam and easily store it online. I don't even know if this is possible right now, but I think flash has access to local webcams running through the browser. Do you have any suggestions or resources to get me started on this? I'm primarily a...

How to write java.util.Properties to XML with sorted keys?

I'd like to store a properties file as XML. Is there a way to sort the keys when doing this so that the generated XML file will be in alphabetical order? String propFile = "/path/to/file"; Properties props = new Properties(); /*set some properties here*/ try { FileOutputStream xmlStream = new FileOutputStream(propFile); /*thi...

Conditional Number Formatting In Java

How can I format Floats in Java so that the float component is displayed only if it's not zero? For example: 123.45 -> 123.45 99.0 -> 99 23.2 -> 23.2 45.0 -> 45 Edit: I forgot to mention - I'm still on Java 1.4 - sorry! ...

How do I get InputVerifier to work with an editable JComboBox

I've got an JComboBox with a custom inputVerifyer set to limit MaxLength when it's set to editable. The verify method never seems to get called. The same verifyer gets invoked on a JTextField fine. What might I be doing wrong? Thanks. ...

How to get a list of current open windows/process with Java?

Does any one know how do I get the current open windows or process of a local machine using Java? What I'm trying to do is: list the current open task, windows or process open, like in Windows Taskmanager, but using a multi-platform approach - using only Java if it's possible. Thanks! ...

Better way of opening a Document from Java?

I've been using the following code to open Office Documents, PDF, etc. on my windows machines using Java and it's working fine, except for some reason when a filename has embedded it within it multiple contiguous spaces like "File[SPACE][SPACE]Test.doc". How can I make this work? I'm not averse to canning the whole piece of code... but...

How do I in java add a stacktrace to my debugging printout

What's the easiest way to print a stacktrace from a debugging printout? Often during testing you would like to know the callstack leading up to the situation provoking a debug message. ...

Hidden features of Eclipse

Alright it can be a lame question, but everybody uses these things differently. What's some of the best time savers out there for this IDE. Tom ...