5 Ways To Figure Out Ubuntu Version

Like they say, there are many ways to skin a cat. In Ubuntu, there are at least five ways to figure out what version you are running on your system. From the Gnome Menu, you can navigate to System>About Ubuntu. This is by far the easiest. There are alternative ways of course. From the Terminal, you can type one of the following:

$ uname -a
$ lsb_release -a
$ cat /etc/apt/sources.list
$ cat /etc/issue

If you know of other ways, please leave a comment.

Batch Watermark Images Using ImageMagick

In my previous post, I talked about using ImageMagick to resize images in a batch process. In this post, I’ll talk about leaving watermarks on images in a batch process. First of all, what is a watermark? A watermark is an image or text that appears on paper or photographs to prevent counterfeiting or for giving a photographer credit or ownership. It’s one way of getting recognition when distributing one’s artwork.

Let’s say you have a bunch of images about 30 or so needing a watermark. They all have an extension of JPG located in one directory or folder. First, if you haven’t already done so, install ImageMagick by typing in the Terminal:

sudo apt-get intall imagemagick

Once you have ImageMagick installed, change directory to the folder where your images are located.

We will use the convert command to leave a text watermark at the bottom of each image. I will go over each of the options one by one. We will put all the options together in the end.

Convert all images with a JPG extension

convert *.JPG

Use the Arial font

convert *.JPG -font Arial

Use a fontsize of 16

convert *.JPG -font Arial -pointsize 16

Place the watermark at the bottom center of each image

convert *.JPG -font Arial -pointsize 16 -draw gravity south

You can place your watermark text anywhere you want it, for example at the top of the image, the side or at the corner. I placed it in the bottom center. It’s just a personal preference.

Write a black text at position 0,12 supplied inside a single quote.

convert *.JPG -font Arial -pointsize 16 -draw "gravity south
fill black text 0,12 'Photos by: Ulysses'"

By the way, the command is all on one line. I placed it on several lines for readability.

Write a white text at position 1,11 supplied inside a single quote.

convert *.JPG -font Arial -pointsize 16 -draw "gravity south
fill black text 0,12 'Photos by: Ulysses'
fill white text 1,11 'Photos by: Ulysses'"

The reason we are writing black and white text that are slightly offset is for our watermark text to display regardless of background color. It’s a technique similar to creating a drop shadow. This ensures your watermark text is readable regardless of the color of the background image.

Finally, name the watermarked images in this format.

convert *.JPG -font Arial -pointsize 16 -draw "gravity south
fill black text 0,12 'Photos by: Ulysses'
fill white text 1,11 'Photos by: Ulysses'"
watermark.JPG

The watermarked images will be written as watermark-0.JPG, watermark-1.JPG, watermark-2.JPG and so forth. So, there you have it. You just watermarked 30 or so images in a batch process using ImageMagick.

Batch Resize Images Using ImageMagick

If you are using Linux and you need to resize a hundred images or so, you can certainly use Gimp, but that would be too much work. Consider ImageMagick set of graphic tools. You can install ImageMagick on Ubuntu by going to the Terminal and typing: “sudo apt-get install imagemagick.” Once the application is installed, all you need to do is go to your image directory and execute the following command:

mogrify -resize 900x600 *.jpg

This command will resize any image with a .jpg extension to a size of 900×600 pixels.

One more thing. Make a backup of your originals.

Gnome 2.28 Reviewed

TuxRadar reviews the latest Gnome 2.28 which comes standard with Ubuntu’s latest release Ubuntu 9.10 codename Karmic Koala. Gnome 2.28 comes integrated with Bluetooth support. You can now pair up your mobile device or bluetooth headset with your desktop or laptop. Gnome 2.28 also comes with Empathy which replaced Pidgin. Empathy is capable of VoIP as well as chat. The video program called Cheese has an new interface. There are a few other features which you read the rest of the review here.

Is Paper Greener than Digital?

Is paper more greener than digital? We have been programmed to think that reducing paper consumption is good for the planet. You’ll be surprised with a ZDNet article arguing that going digital usually means more harm to the environment than what is usually perceived. In the article, the author writes how digital devices require more raw materials to build, require more power to operate, and unfortunately create more trash.

Upgrade to Ubuntu 9.10 Karmic Koala

It’s just a few days away from the official release of Ubuntu 9.10 Karmic Koala. Are you wondering how to upgrade your desktop or laptop to Ubuntu 9.10? There are two ways in getting Karmic Koala installed on your system. You can:

  1. Upgrade using the Update Manager
  2. Perform a Clean Install

Update Manager

Press Alt-F2. Type in “update-manager -d.” Update Manager will open and tell you a new distribution release ‘9.10′ is available. Click Upgrade.

Clean Install

Download the appropriate ISO from Ubuntu. Ubuntu 9.10 will be available from this download page after the official release on Oct. 29th. Prior to that, you can find it here. Burn the ISO to a CD. Boot from the CD to perform the install.

If you can’t wait, you can upgrade now.

TuxRadar Loves Windows 7

Windows 7 seems to be generating a lot of interest towards Linux according to TuxRadar, an online website that provides news, reviews and tutorials of open-source software. Here are excerpts from TuxRadar’s blog:

We love Windows 7 because it seems to be providing Linux with a massive PR boost and indeed may well backfire on Microsoft – people are more curious than ever about how Linux stacks up against Windows 7.

Google is suddenly driving vast amounts of traffic to two particular pages of ours: Linux vs Windows 7 and Benchmarked: Ubuntu vs Vista vs Windows 7. You see, it seems that people who see the big marketing push for Windows 7 aren’t all immediately going out and parting with their hard-earned cash.

If you haven’t read the articles mentioned above, be sure to check them out. It gives detail comparison between Windows 7 and several Linux distributions.

Universal Phone Charger Approved

A universal phone charger for cell phones was recently approved by the Universal Telecommunication Union (ICU). Starting in the first half of 2010, you will see the universal phone charger with a micro USB type connector to be available for sale to the general public. The new standard charger will help save the environment because consumers will be holding on to their chargers longer. The universal phone charger should work on all future phones.

Firefox 3.6

The latest reiteration of the Firefox browser in the upcoming version 3.6 will have an auto-orientation feature allowing devices with accelerometers such as mobile phones and laptops to show the Firefox browser either in portrait or landscape mode. The browser auto-rotates according to the orientation of the devices. This will not have much of an impact to desktop users, but certainly a release geared towards mobile devices.

Understanding PHP Exception Handling

PHP 5 has an exception handling model similar to that of other programming languages. Exception handling is used primarily to modify the control of a program by using the “try” and “catch” method. Throwing and catching exceptions allow programmers to handle errors gracefully. Let’s say you have a function called inverse() which simply returns an inverse of the supplied integer. Here are the details of the function.

function inverse($x) {
   return 1/$x;
}

Simple. The problem with this function is when we pass an integer with a value of zero. As you recall in math class, you can’t divide a number by zero. So, we will modify the function by adding an exception handler to it. I will introduce a command called “throw” accompanied by an error message. Continue reading “Understanding PHP Exception Handling”