hmmmmm

Screen Shot Using Java

June 29th, 2009

Hello all,

I’m back ! Hope you all enjoyed Christmas. Today, I will tell you how to take screen shot and save it as .jpg, .png, .gif ( and so on ) file using java program.

Rectangle rectangle = new Rectangle(x, y, width, height);
// x = pixel from left
// y = pixel from top
// width = image width
// height = image height

Robot robot = new Robot();
BufferedImage image = robot.createScreenCapture(rectangle);
// Creates an image containing pixels read from the screen. This image does not include the mouse cursor and return BufferedImage object.

File file = new File(”screenshot.png”);
ImageIO.write(image, “png”, file);
// A class containing static convenience methods for locating ImageReaders and ImageWriters, and performing simple encoding and decoding.

//The code above will take screenshot according to rectangle object and it will save screenshot.png file in same folder where your java file is located.

//You can use Toolkit.getDefaultToolkit().getScreenSize() to take complete screenshot.

Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
Rectangle rectangle = new Rectangle(0, 0, size.width, size.height);

Its done! :D

Update me when site is updated

Sun Microsystems releases VirtualBox 2.1

June 29th, 2009

Overview :

Turn your PC into an easy-to-use virtualization platform with Sun xVM VirtualBox, the free and open source software that runs on all major operating systems and eliminates the need for tradeoffs or multiple hardware systems.

Some significant milestones by Andy Hall, Sun’s Sr. Product Manager of VirtualBox :

First, over 8 million copies of the software have been downloaded. Andy pointed out that the software is being downloaded a a rate that’s nearly 25,000 a day. As I’ve pointed out in other posts, the number of downloads doesn’t directly equal the number of copies of software in actual use. Andy must have read that post. Although he was polite enough not to say anything about that post, he do go on to say that over 2 million people gone to the effort of registering their copies. That figure is a better measure of software that either is involved with a pilot project or is in use in a production system.

Here’s what Sun has to say about this release:

xVM VirtualBox 2.1 software features a number of new enhancements, including:

  • New Accelerated 3D Graphics: Uses the industry standard application programming interface (API) for high-performance graphics, Open Graphics Library (OpenGL), allowing users to flawlessly run applications like Google Earth and CAM-based software that are popular among heavy users of imagery like industrial designers, automotive and robotics engineers, architects, etc.
  • Improved Network Performance: Makes network intensive applications like rich media (video, audio, interactive media, etc.) even faster. In addition, with new bridged networking configurations on Windows and Linux platforms, xVM VirtualBox software makes it easier to deploy server applications in virtual machines, allowing customers to easily deploy Web stacks like LAMP or SAMP.
  • Storage Support: Comes with built-in iSCSI support to connect to storage systems, such as Sun’s newly announced Open Storage appliances, the Sun Storage 7000 family, also known as “Amber Road.” This feature enables easier management and sharing of virtual disk images.

In addition, xVM VirtualBox 2.1 software offers improved support for:

  • Mac OS X on Intel Virtualization Technology (VT-x): Provides better support for Mac OS X as a host OS utilizing hardware-assisted Intel VT-x for better performance.
  • VMware’s and Microsoft’s Virtualization Formats: Offers improved support for VMware’s virtual machine disk format (VMDK) and Microsoft’s virtual hard disk (VHD) file format, allowing for easy transfer of critical business information.
  • Intel Core i7 processor: Enables extremely fast performance on leading-edge hardware with support for the new Intel Core microarchitecture in the Intel Core i7 processor (codenamed Nehalem).
  • 64-bit guest OS on 32-bit host platforms: Allows users to run powerful 64-bit guest OS on 32-bit host platforms without the need to upgrade the host OS while taking advantage of multi-thread applications on powerful hardware.

For more information on VirtualBox, Click here.

Update me when site is updated

Left To Right Principle

June 29th, 2008

Hey all,

This is my first post on my blog and i have something interesting stuff for newbies.

Code:

//Case 1

System.out.println(2 + 2 + ” Output “);

//Case 2

System.out.println(” Output ” + 2 + 2);

//Case 1

Console.WriteLine(2 + 2 + ” Output “);

//Case 2

Console.WriteLine(” Output ” + 2 + 2);

Any guess for the output ? Here it is:

Case 1 : 4 Output

Case 2 : Output 22

Why ? Its “Left To Right” Principle. Java and C# both uses it. I don’t know about other languages.

In the first case, It sums two integers : 2+2=4 and then converts it to a string: 4 Output

In the second case Java takes string ” Output ” then converts 2 to a string, concatenates them together. Then this process repeats with next number… Finally we get: Output 22

Stay tuned!

Update me when site is updated