Monday, May 4, 2009

Difference of JAVA 1.6 and JAVA 1.5

Here's d mathematical Difference of JAVA 1.6 and JAVA 1.5

==>JAVA 1.6 - JAVA 1.5
==>JAVA(1.6-1.5)
==>JAVA(0.1)
==> JAVA(0)
==> 0

Sunday, May 3, 2009

JDesktop Integration Components

If you have been a Java developer for a while you may have had the experience of being told that Java can't do everything that native C can. You may have struggled with the HMTLEditor pane while Windows developers down the hall embed Internet Explorer into their programs with just a few lines of code. I'll admit it: as great as Java is, there are times I long for the features and system access of native programming. Well, we don't have to wait any longer.

JDesktop Integration Components, or JDIC, is a catchall project for a set of modules that gives Java developers access to native features through cross-platform APIs. It was started by the Desktop group at Sun to let Java applications better integrate with the desktop on which they are running. They made JDIC open source to as a way to get rapid feedback from developers on desired features, as well as bug reports. While there are no current plans to do so, the JDIC team is looking into pulling some of the JDIC features into a future version of the core Java libraries.

JDIC is broken up into five components and one incubator project:

Desktop: Launches desktop programs to open, edit, print, and mail files.
Filetypes: Sets desktop file type associations.
Browser: Embeds a native web browser (Internet Explorer or Mozilla) into an AWT canvas.
Packager: Command-line tools for converting Java Web Start programs into native installers.
Tray API: Support for system tray icons and pop-up menus.
SaverBeans: System screensavers in Java

The API is available at :

https://jdic.dev.java.net/

Friday, May 1, 2009

Java file copying

using java.nio for super-speedy copies. More readable and less prone to errors than using Input/Output stream pairs and a byte buffer

try {
// Create channel on the source
FileChannel srcChannel = new FileInputStream("srcFilename").getChannel();
// Create channel on the destination
FileChannel dstChannel = newFileOutputStream("dstFilename").getChannel();
// Copy file contents from source to destination
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
// Close the channels
srcChannel.close();
dstChannel.close();
} catch (IOException e) {
}

Hibernate Statistics

This is pretty cool. When you're experimenting with different mapping strategies, you can get Hibernate to provide you with stats for the number of queries, fetches, cache hits, and all manner of other operations.
So, just write a unit test that excercises the code you want to optimise, set stats on beforehand and dump them out afterwards. Then try a few different strategies and see which one gives you the right combination of numbers. It's not a substitute for a proper performance test harness and a profiler, but it looks like an invaluable tool for diagnosing problems.

Hibernate 3 also ships with a complete statistics and metrics API that allows you to figure out *everything* that is happening under the covers. All you have to do is a.) enable staticstics for the session factory and b.) retrieve the statistics and use them. Getting them an enabling them is easy:
SessionFactory sessionFactory = getSessionFactoryForApplication();
Statistics stats = sessionFactory.getStatistics();
stats.setStatisticsEnabled(true);

The tricky part (or at least the part that requires the most attention) is figuring out what statistics are available, and what they really mean. There are a billion methods available on the top level, but here is a glimpse (note, all of these values are based off of when statistics were enabled):
For more info read post on below link : http://www.javalobby.org/java/forums/t19807.html

Cheers!!!

Ujjwal B Soni

Myeclipse IDE 7.1 update

Hi Friends,

I switchbacked to Myeclipse 7.1 from Myeclipse 6.5 since the day 7.1 got released. But, yesterday when i updated the copy of 7.1, the update went all successful but, unfortunately all got stucked up after a restart, the ide went all mad. It restricted all my javascript and jsp codes. So, i removed it from my system, downloaded a fresh copy from web (without updates). Again, it restricted my jsp and javascipt files. I spent almost half of my day in installing 6.5 again and switching back all my projects. well, the conclusion is old is gold......

So friends, never ever try to update 7.1, it will take you to the hell.

Cheers!!!

Ujjwal B Soni