Thursday, April 29, 2010

Migrate from JSF 1.1 to JSF 1.2

Sometimes there is a problem faced by upgrading the version of your JSF in a Dynamic Web Project. After you create a JSF 1.1 project, later it maybe impossible to change it to JSF 1.2 without recreating the project. In fact, a message comes in Eclipse or RSA.
"Cannot change version of project facet Java Server Faces to 1.2"
So, we need to manually modify the project properties. Firstly, below i will give the faces-config.xml for JSF 1.2:


After that we need to go to the .settings folder inside our Eclipse project. Inside this folder we need to open the file: org.eclipse.wst.common.project.facet.core.xml.
" ./settings/org.eclipse.wst.common.project.facet.core.xml "
Find the line: < installed facet="jst.jsf" version="1.1" />
and change it to: < installed facet="jst.jsf" version="1.2" />

That's all. Now you can run your project as a JSF1.2 project.

Friday, April 16, 2010

Windows Mobile 7 Application using ASP.Net WebService

This is a video tutorial which shows a simple example on how to use an web service using a Windows Mobile 7 application.
HD Quality:Windows Mobile 7 - Web Service

Thursday, April 8, 2010

Proportional image resizing in Java

In order to resize images in Java a simple code is used. In fact, depending on the quality of the photos you want to resize there can be different resize codes and libraries. But a common used is the one I'll show in this post. Together with the resize code I'll also give the code which makes the proportional resize. Proportional resizing is a "must" in order not to loose the shape of the image. Lest's start with the resize code which is shown below:

private static BufferedImage resizeImage(BufferedImage image, int width, int height)
BufferedImage resizedImage = new BufferedImage(width, height,
Graphics2D g = resizedImage.createGraphics();
g.drawImage(image, 0, 0, width, height, null);
return resizedImage;

This is enough in order to resize the image, but before calling this function we need to set the proper width and height according to the proportional resize we will make.

//imageFile is any file taken from the buffer or a disk path. It should be of type

//thumbnailWidth & thumbnailHeight should be defined as values in order to have the new image's sizes.

BufferedImage originalImage =;

int originalWidth = originalImage.getWidth();
int originalHeight = originalImage.getHeight();

float widthRatio = originalWidth/thumbnailWidth;
float heightRatio = originalHeight/thumbnailHeight;

BufferedImage resizeImageJpg = null;

if (widthRatio > heightRatio)

float newThumbnailHeight = (float)originalHeight/(float)originalWidth * thumbnailWidth;

resizeImageJpg = resizeImage(originalImage, thumbnailWidth, (int) newThumbnailHeight);

float newThumbnailWidth = (float)originalWidth/(float)originalHeight * thumbnailHeight;

resizeImageJpg = resizeImage(originalImage, (int) newThumbnailWidth, thumbnailHeight);

ImageIO.write(resizeImageJpg, "jpg", new File("filename..."));

Wednesday, April 7, 2010

Welcome to my blog!

Welcome to my blog site. Thank you for viewing it, and I hope I will see you again around here:). Have a nice time!