java

Should freshers learn Java or C++?

Many of my friends who are graduating from college ask me, "should I learn Java or C++? Which will help me in the long run?" Both languages have their merits and demerits, but what would you guys suggest these college graduates learn? I am sure there is no correct answer for this question, but I would like to get the community opinion...

Which are the good open source libraries for Collective Intelligence in .net/java?

Or any open source project which utilize collective intelligence extensively?. ...

Why Java programs?

I've had little exp. with java and since now i've worked with c++. what makes this one more special and preferred? Moreover I would like to know about the use of System.in classes and parseInt classes. ...

How to write a java web service to do remote login?

I have two application. I need to do a single signon from application a to application b. I thinking of using web service. I wonder how do i go about that approach. Can anyone advise? ...

On using Terracotta as a persistence solution.

Would it be a good idea to use Terracotta as a persistence solution (replacing a database)? I'm specifically wondering about data integrity issues and support for transactional systems. ...

LINQ for Java tool

Would a LINQ for java be a useful tool? I have been working on a tool that will allow a Java object to map to a row in a database. Would this be useful for Java programmers? What features would be useful? ...

Garbage Collecting objects which keep track of their own instances in an internal Map

In the constructor of my class, I map the current object (this), along with its key (a string entered as a parameter in the constructor) into a static LinkedHashMap so I can reference the object by the string anywhere I might need it later. Here's the code (if it helps): public class DataEntry { /** Internal global list of DataEntr...

Listing the files in a directory of the current JAR file

I am making a game in JAVA where I want to come up with a list of files in a certain directory in my jar so I can make sure to have a list of those classes to be used in the game. For example say in my jar I have a directory mtd/entity/creep/ I want to get a list of all the .class files in that directory using java code from another...

Running Apache Geronimo in production

If you're running Apache Geronimo in production why did you choose it over other application servers and what are your experiences with running Geronimo in production? Can you also please share what servlet engine you decided to use (Tomcat/Jetty) and why you made this decision? UPDATE: So far this question got two up-votes and one sta...

How to check if a remote image meets certain specifications

Hi, I'm doing some coding in JSP/Java (without any framework, or other strange things) and I get stuck trying to find a way to check if a remote image (by URL) meets some specifications, like some defined height and width. Is there a way to do this in JSP/Java? It's quite easy in PHP, but I can't find the way here ... Thanks for your ...

Base64 encoded string search

I have string which is base64 encoded. How can I search this string to check if this string contains specific sub string which is not encoded? I don't want to decode that string and then search it. Can I just encode that specific sub string, and search the encoded string by using the encoded sub string? Thanks, ...

How can I get a list of all the implementations of an interface programmatically in Java?

Can I do it with reflection or something like that? ...

How can I list the missing dates from an array of non-continuous dates in Java?

I have a table of data sorted by date, from which a user can select a set of data by supplying a start and end date. The data itself is non-continuous, in that I don't have data for weekends and public holidays. I would like to be able to list all the days that I don't have data for in the extracted dataset. Is there an easy way, in Ja...

How do I automatically export a WAR after Java build in Eclipse?

I have a J2EE project in Eclipse 3.2 and at the end of every build I want to automatically create and deploy a WAR file. At the moment I have to do this by hand which is 5 or 6 mouse-cliks and it would be nice to automate it. I know I can do this with a custom build script using ANT but I am hoping for an Eclipse native solution. I ha...

Serialise to YAML using XStream in Java

Is there a YAML driver for the Java XStream package? I'm already using XStream to serialise/deserialise both XML and JSON. I'd like to be able to do the same with YAML. ...

Ensuring Users are Authenticated in Java Web App

My web app has a secure area which users log in to via a JSP. The JSP posts the user name and password to a servlet, which then checks to see if the users credentials are valid. If they are valid then the user is directed to the secure resource. How can I ensure that users can't just navigate to the secure resource without validating ...

Reusing a connection while polling a database in JDBC?

Have a use case wherein need to maintain a connection open to a database open to execute queries periodically. Is it advisable to close connection after executing the query and then reopen it after the period interval (10 minutes). I would guess no since opening a connection to database is expensive. Is connection pooling the alterna...

Whare are general knowledge you should learn before (Java Developer) inteview?

You are applying for a role "Java Developer" and you are called for an interview. What are the general knowledge you should/must learn before you sit in front of the panel? ...

java bounded generic type definition

Hi, What's the difference between the following type definitions <E extends Number> and <? extends Number> Cheers, Don ...

Using JNI to retrieve outlook contacts

Hi all, I need to retrieve the list of contacts (and only them) from any Outlook application except Outlook Express. I've seen many different libraries that can solve my problem but any of them is opensource. I was wondering if it is worth to solve this problem from scratch using JNI. I have never developed using this framework; have yo...