Wednesday, June 6, 2012

How to Access Image Dimensions from MultipartFile in Java

Here's how to access image dimensions from MultipartFile:
java.awt.image.BufferedImage image = javax.imageio.ImageIO.read(new BufferedInputStream(multipartFile.getInputStream()));
System.out.println("Image height: " + image.getHeight());
System.out.println("Image width: " + image.getWidth());

Tuesday, June 5, 2012

Reset Ubuntu Panel

My Ubuntu 10.04 panel are not showing all the application icons that are currently running. It happened after an error occurred while opening my computer. Good thing the panel can be reset through the following terminal commands:

Unset all gnome settings:
gconftool --recursive-unset /apps/panel

Remove configuration files:
rm -rf ~/.gconf/apps/panel

Restart the Gnome panel:
pkill gnome-panel

Git svn in Ubuntu

It's time to familiarize more with git after working for years with SubVersion.

As my current project uses SVN, thank God git svn exists so I can practice more using git.

For future reference, here is a link for starting using git on svn repo in Ubuntu through git svn.

http://blog.coralic.nl/2010/01/15/git-svn-and-ubuntu/

Wednesday, May 16, 2012

More Emails for Testing

Problem: Email is usually used as login username. There are times when you want to test a system by using several email accounts. And you usually need a lot more than the number of your existing email accounts. Now you think of opening another account from email providers.

Solution: With gmail, you can have only one account and use it with different addresses.

Here's how:
Assuming your email is myemail@gmail.com

Emails sent to the following:
myemail+001@gmail.com
myemail+002@gmail.com
myemail+003@gmail.com
myemail+010@gmail.com
... and so on

will be all sent to myemail@gmail.com.

Got the point?
Enjoy testing...

Wednesday, May 9, 2012

How to Check for null value in FreeMarker Template

Here it is:

<#if variable??>
    not null
<#else>
    it is null or is missing
</#if>

Monday, April 30, 2012

Modify SVN Ignore List in Eclipse/STS

You can edit the ignore list of SVN in Eclipse IDE or SpringSource Tool Suite but it is not obvious in the user interface.

Here's how:

Right-click on the project
Click Team > Show Properties
Right click the row containing svn:ignore and click Modify Property

Happy Editing...

Friday, February 17, 2012

Rename Set Featured Image in Wordpress

Posts in Wordpress can have their own featured image when enabled.
Now, here's a way to modify both the 'Featured Image' title and the 'Set Featured Image' link text.

Just add the follwing code to your theme's functions.php

function customizeFeaturedImageLinkTitle( $content ) {
  return $content = str_replace( __('Set featured image'), __('Set DefaultMessage image'), $content);
}

function customizeFeaturedImageTitle($translated) {
  return str_ireplace('Featured Image', 'DefaultMessage Image', $translated);
}

add_filter('gettext','catalogph_customizeFeaturedImageTitle');
add_filter('ngettext','catalogph_customizeFeaturedImageTitle');