java

Java+Tomcat, Dying databse connection?

I have a tomcat instance setup but the database connection I have configured in context.xml keeps dying after periods of inactivity. When I check the logs I get the following error: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was68051 seconds ago. The last packet sent...

What's the best way to get started with OSGI?

What makes a module/service/bit of application functionality a particularly good candidate for an OSGi module? I'm interested in using OSGi in my applications. We're a Java shop and we use Spring pretty extensively, so I'm leaning toward using Spring Dynamic Modules for OSGi(tm) Service Platforms. I'm looking for a good way to incorpor...

Taking the SCJD exam

I asked the same question about SCJP. What about the Sun Certified Java Developer exam (SCJD)? I haven't taken it, but am thinking about doing so. Is it worth the effort? ...

What Java portal server do you use?

I've been tasked with learning Vignette and setting it up is a nightmare. There are many different components in the wizard. If something fails, you get a cryptic error message and then have to start again. This is the worst "Wizard" since Kwame Brown. Are there other Portal servers out there that are easy to configure, or at least see...

Calling .NET Web Service (WSE 2/3, WS-Security) from Java

I need to call a web service written in .NET from Java. The web service implements the WS-Security stack (either WSE 2 or WSE 3, it's not clear from the information I have). The information that I received from the service provider included WSDL, a policyCache.config file, some sample C# code, and a sample application that can succes...

How can I deploy artifacts from a Maven build to the SourceForge File Release System?

I am using SourceForge for some Open Source projects and I want to automate the deployment of releases to the SourceForge File Release System. I use Maven for my builds and the standard SFTP deployment mechanism doesn't seem to work unless you do some manual preparation work. I have come across some old postings on other forums suggestin...

Overiding the equals method vs creating a new method

I have always thought that the .equals() method in java should be overridden to be made specific to the class you have created. In other words to look for equivalence of two different instances rather than two references to the same instance. However I have encountered other programmers who seem to think that the default object behavior ...

Java and c# interoperability

I have two programs one in c# and another one in Java. Those programs will, most probably, always run on the same machine. What would be the best way to let them talk to each other ? ...

Ant's <javac> tasks throws StackOverflowException

I'm trying to compile over 100 java classes from different packages from a clean directory (no incremental compiles) using the following ant tasks: <target name="-main-src-depend"> <depend srcdir="${src.dir}" destdir="${bin.dir}" cache="${cache.dir}" closure="true"/> </target> <target name="compile" depends="-main-src-depe...

How do I open the default mail program with a Subject and Body in a cross-platform way?

How do I open the default mail program with a Subject and Body in a cross-platform way? Unfortunately, this is for a a client app written in Java, not a website. I would like this to work in a cross-platform way (which means Windows and Mac, sorry Linux). I am happy to execute a VBScript in Windows, or AppleScript in OS X. But I have n...

Differences between unix and windows files

Am I correct in assuming that the only difference between "windows files" and "unix files" is the linebreak? We have a system that has been moved from a windows machine to a unix machine and are having troubles with the format. I need to automate the tranlation between unix/windows before the files get delivered to the system in our "...

How to Round Up The Result Of Integer Division

I'm thinking in particular of how to display pagination controls, when using a language such as C# or Java. If I have x items which I want to display in chunks of y per page, how many pages will be needed? ...

Easy way to backport Java 6 code to Java 5?

We've been developing a windows based application using Java for a while now, but NOW we want to make a mac port and have to reverse of code from Java 6 and Java 5. Is there any easy way to do this rather than re-coding Java 6 specific code? We'd like to keep our code up to date. ...

Are there any studies comparing JEE vs. .NET?

I've been tasked with the awesome responsibility of trying to document the advantages of using JEE for a web app over .NET. Of course via Google I am mostly getting back blog posts on how an Int is an object in Java, or a list of code comparisons. No real hard evidence or numbers. Is anybody aware of any legitimate studies trying to pro...

Java: Best way of converting List<Integer> to List<String>

I have a Java list of integers, List<Integer> and I'd like to convert all the integer objects into strings, thus finishing up with a new List<String>. Naturally, I could create a new List and loop through and String.valueOf() all the integers, but I was wondering if there was a better (read: more automatic) way of doing it? [Minor edit...

shortcut for creating a Map from a List in groovy?

I'd like some sorthand for this: Map rowToMap(row) { def rowMap = [:]; row.columns.each{ rowMap[it.name] = it.val } return rowMap; } given the way the GDK stuff is, I'd expect to be able to do something like: Map rowToMap(row) { row.columns.collectMap{ [it.name,it.val] } } but I haven't seen anything in the docs... ...

Best practice for storing large amounts of data with J2ME

I am developing a J2ME application that has a large amount of data to store on the device (in the region of 1MB but variable). I can't rely on the file system so I'm stuck the Record Management System (RMS), which allows multiple record stores but each have a limited size. My initial target platform, Blackberry, limits each to 64KB. I'm...

What .NET Mime Parsing libraries are available?

I have a project that utilizes the javax.mail.internet.MimeMessage and other related classes that does mime parsing for emails that we receive. This needs to be ported to .NET. What .Net 3rd party or built in library can I use to replace the Java classes that I'm using? EDIT: Anything change in the last 9 months since I asked this ques...

Database backed i18n for java web-app

I'd like to use a database to store i18n key/value pairs so we can modify / reload the i18n data at runtime. Has anyone done this? Or does anyone have an idea of how to implement this? I've read several threads on this, but I haven't seen a workable solution. I'm specifically refering to something that would work with the jstl tags such...

What is the best way to go from Java/C# to C++?

At my university most of my classes have been in Java. I have also recently learned C# (and the Visual Studio environment) at a summer internship. Now I'm taking an Intro to Computer Graphics class and the grad student teaching the class prefers us to use C++ to access the OpenGL bindings via GLUT. Does anyone have any good resources ...