Paul Labis: This is a personal blog where everyone can read my experiences, ideas and thoughts about programming, latest gadgets and other information technology related topics, lifestyle and many other stuff I would like to share to the public.

Why You Should Back up Your Data?


Odds are you have hundreds of gigabytes of personal data stored on your home computer including movies, music, games, documents, and photos and unless you are taking the right precautions these files could all be at risk. Data is stored on hard drives and unfortunately these spinning disks are far from perfect, it doesn't take very much to cause a complete failure and often times older hard drives will fail without any warning or trigger. When this happens all of your important personal data will be lost for good, unless you were smart and made a backup.

Backup up data is simple and usually can be automated but in the long run it will save you some serious headaches. Even if you think that the data on your computer isn't necessarily that important you will be surprised just how much it hurts to lose everything. Whether you lose everything due to a software corruption issue, a hardware failure, or some other issue; a backup will definitely be able to get you back on track without having to recreate every bit of your hard drive.

Encrypt and decrypt files in Ubuntu with ccrypt

ccrypt is a utility for encrypting and decrypting files and streams. It was based on Rijndael cipher, which was chosen candidate by U.S. government's for Advance Encryption Standard. This cipher is believed to provide a very strong security.


1. Install CCrypt from repo


sudo apt-get install ccrypt


2. To encrypt a file, use one of the following command,


ccrypt -e file_name or ccencrypt file_name


3. It will prompt you for Encryption Phrase aka Password, enter it. for example,


ccrypt -e sample.text 
Enter encryption key: your_key 
Enter encryption key: (repeat) your_key 


Note: Don't forget the encryption phrase, there is no way to get back the original file without it.

How to Backup and Restore PostgreSQL Database

There is an easy way to create backup file and restore your current PostgreSQL database using the Linux terminal. I am not sure though if this is the easiest way.

As of the moment I am writing this article, I used the following command to backup and restore my database. 

Using pg_dump and psql will make your life easier. Below are the terminal command I use to backup and restore my database.
  • Backup : pg_dump -U {user_name} {database_name} -f {backup_file_name}
  • Restore : psql -U {user_name} -d {database_name} -f {backup_file_name}
If you are getting an error:

Recover Ubuntu Grub2 After Windows Installation

A month ago I decided to dual-boot my laptop with windows 7 and Ubuntu 10.04 version as my main operating system. So I first installed Ubuntu 10.04 then Windows 7 afterwards. After installing Windows 7, ubuntu distribution isn't accessible. I am not sure but I think Windows installation might have wiped out Ubuntu grub.

To be able to recover Grub2 menu along with the option to select either which operating system you want to use, I did the following recovery steps below.
  1. Boot from Ubuntu Live CD - any Ubuntu distribution is okay to use for as long as you get access to linux terminal or bash shell.

Install NVIDIA driver manually for Asus K43 SV with Ubuntu Lucid 10.04

I just bought a new laptop Asus K43 SV and installed Ubuntu Lucid 10.04 LTS stable release. It has an i5 2nd generation processor with 4Gb of memory and 1 Gb of VRam. So far, I think this is the most affordable laptop I can look for in Philippine market offered free delivery through LBC by www.pccorner.com or www.laptopking.com from your online purchase.
Some of you might have difficulties in installing NVIDIA driver on your new bought Asus K43 SV laptop. I started researching online and found that there is a default yet not installed NVIDIA driver on synaptics. However, I had been screwing my desktop and as a result, I had to reformat my laptop again and again. I always backed-up my xorg.conf file but had difficulties on restoring it. Anyway, thats the end of story and in this article, I'm gonna share how to easily install NVIDIA driver manually on your k43SV. 

Commons Email - Examples

I found another good apache tool for sending emails.
Its easy to use and has good documentation.
Below is an example of an easy way to sending an email.
It is explained properly on apache user guide page which is embedded on the bottom part of this article.


import org.apache.commons.mail.*;
...

// Create the attachment
EmailAttachment attachment = new EmailAttachment();
attachment.setPath("mypictures/john.jpg");
attachment.setDisposition(EmailAttachment.ATTACHMENT);
attachment.setDescription("Picture of John");
attachment.setName("John");

// Create the email message
MultiPartEmail email = new MultiPartEmail();
email.setHostName("mail.myserver.com");
email.addTo("jdoe@somewhere.org", "John Doe");
email.setFrom("me@apache.org", "Me");
email.setSubject("The picture");
email.setMsg("Here is the picture you wanted");

// add the attachment
email.attach(attachment);

// send the email
email.send();


Sending Mail with SMTP

I was was having problem on sending emails through Java.
I researched and found this apache API SMTP for sending email.
I just want to share this simple tutorial article on Discursive blog to everyone who needs it.

10.16. Sending Mail with SMTP | Discursive

Check Ubuntu laptop temperature

I noticed my laptop temperature is getting hotter. I was a bit worried so I made a little research on how to check the temperature via the internal chip sensors and Ubuntu terminal/command line. The quickest way so far is through below:

1. Make sure you lm-sensors are already installed. (In latest version as of 2010 - this was already configured) To know more about it goto http://packages.ubuntu.com/lucid/lm-sensors

2. Open you terminal/command line and enter the command "sudo sensors-detect". You will be asked which hardware sensors to scan. Answer it yes or no.

3. Get the temperature by running command "sensors" on your terminal.

There we have it! Thats how I check my laptop temperature. There other ways to check and are probably better and accurate. Have fun and enjoy.

April Blogging Comeback

Oh yeah! Techieboy is back in sharing his experiences!

Its been a while since I created an article on my experiences with technology. It was around October last year since I stopped due to busy schedules and work. I was also sent to Chicago, Illinois to assist our company client.

It had a wonderful experience though. I was able to see and experience what politics was in software industry. I was exposed to high-end technologies such as Spring Roo and JQuery. Learn a lot on how to deal with management stuff particularly on strategies of motivating employees to make them productive. I had been quite on most of the time, but, I am very observant of thing happening around me.

Anyway, I will cut this article for now. There will be a lot of articles coming up in few days. Have fun and keep in-touch.

DDSteps Testing with Ant Tutorial

It has been almost a year that I've been using DDSteps for testing a back-end project module and I haven't been able to share or create an article about it. So to those people reading this article, I hope this helps you get started on DDSteps testing.
DDSteps is an integrated tool stack, combining the best open source testing tools for Java and adding the ability to resuse test cases and test data.


DataDriven so that when you want to test "sign up" on your site, you can test the same flow with both "George Bush" and "Владимир Путин". Just add another row to spreadsheet, that's all! - by ddsteps.org 
In this tutorial, I will discuss a little about this simple java application I made focus on testing and generating html test results using ant. We will not deal much on the theories since those kind of information are already provided on www.ddsteps.org. I usually use eclipse as my preferred IDE in developing the application. The application makes use of ant to generate the HTML JUnit reports.

Fix upside-down or inverted webcam on Ubuntu linux

I am running Lucid Lynx 64 bit OS version on my Asus i3 K52J Series laptop. Like everyone else, I like using Skype video/chat as well as Cheese camera for taking pictures and videos. Not until then when I had a problem using it.


NOTE: Not advisable to do "export LIBV4LCONTROL_FLAGS=3", LIBV4LCONTROL_FLAGS is for debugging purposes only. - by Hans De Goede(libv4l author and maintainer)

I was so disappointed that my camera display was inverted! I tried reading several blogs and posting comments on Ubuntu forum threads online for days and but none of their solutions helped solved my problem. It could have been easily solved if only there was an option to invert my camera on Video4Linux Device Preference. Sadly, there was not! So, I decided to find a way to flip the camera by looking into export options on gtk-v4l(Video4Linux). 

Fix Asus K52J Sound or Speaker Problem

I just got a new replacement company laptop for my 2 year acer dual core laptop. I now have Asus i3 K52J Series Laptop. Like everyone else using Lucid Lynx on their Asus. I had a problem with my sound and audio device and drivers.

Some of my problems were:
  • Speakers do not mute when headphones are plugged in.
  • HDMI sound out not working.
  • External microphone not working.
Thanks to this Ubuntu Forums Thread where a fix is posted though incomplete in my case. So, I decided to create one of my own and hope to help someone else looking for a solution online. The steps below are the things I did fixing this problem.

Use Arguments on Property File

The goal on this tutorial is to be able to format a value on a properties file given its parameter or arguments. It is best describe as passing value as a parameter and inserting those values on the string retrieved from the properties file.

To better understand what I'm doing, read and understand my example code below.

Property File Sample
message.welcome= Welcome {0} to {1}!
message.thank= Thank you for you visit {0}.

Embedded Jetty in Spring MVC, IoC/DI


I was trying to configure embedded jetty in a spring application that implements MVC(Model View Controller). I want to utilize single spring applicationContext xml file for IoC(Inversion of Control) and DI(Dependency Injection) on dispatcher servlets.

The goal is to be able to use or reference beans configured/located on already been loaded spring application context. Read and understand my resolution below.

SVN error on Eclipse: org.tigris.subversion.javahl.ClientException: Attempted to lock an already-locked dir

I met an svn eclipse error while attempting to committing to svn repository. I was thinking I might aswell share how I resolve this problem to everyone.
SVN error on Eclipse: org.tigris.subversion.javahl.ClientException: Attempted to lock an already-locked dir
org.tigris.subversion.javahl.ClientException: Attempted to lock an already-locked dir
svn: Working copy ‘D:\htdocs_svn\sites\all\modules’ locked
org.tigris.subversion.javahl.ClientException: Attempted to lock an already-locked dir
svn: Working copy ‘D:\htdocs_svn\sites\all\modules’ locked

I'm still breathing

It's been a while since my last post! I had been very busy lately with my work... I miss writing articles. After weeks of hardcore work, I've learn a lot about spring and jetty and I would say, its worth working hard.

I have this task of setting up a project for development. Its a web application for testing. I've learned embedding jetty in a spring application implementing MVC(Model View Controller) design pattern. Other than that, it builds character. Patience really was important.

Asus PL30JT Technology Business Notebook

Asus showed a notebook of new businesses, PL30JT at CeBIT 2010, which comes with a stylish design. The new Asus notebook includes Turbo33 technology company claims to improve performance by 33%.

Asus PL30JT Business Notebook

The PL30JT is fueled by Intel Core i5 processor and up to 4 GB of RAM. It is equipped with two graphics cards, the 1GB NVIDIA GeForce 310M dedicated graphics and integrated Intel GMA HD technology with Optimus. The professional notebook comes with a 13.3-inch 1366 × 768 LCD display and support for WiFi. It weighs only 1.7 kilograms, with an 8-cell battery. [via itechnews]

Lenovo IdeaPad Y460 and Y560 Notebooks

Lenovo has not forgotten the home users usually at CES 2010, the company unveiled two new models, the Lenovo IdeaPad Y460 and Y560 notebooks, with options on the latest processors Core i3, i5 and i7 Intel. The IdeaPad Y460 has a 14-inch 1366 x 768, Core i3 or i5 processor, ATI Radeon HD5740/HD5650 and up to 320 GB hard drive, while the IdeaPad Y560 has a 15.6 screen inch Core i3, i5 and i7 CPU, ATI Radeon HD5730 graphics and up to 500 GB hard drive.

Lenovo IdeaPad Y460 and Y560 Notebooks

Both machines have up to 8 GB of RAM, Combo drive blu-ray/dvd and standard WiFi b / g / n. There are also optional Bluetooth, 3G and WiMAX. Include three USB 2.0 ports, a / eSATA combo USB, ExpressCard slot and HDMI, with Ethernet, audio in / out and a memory card reader multiformat. [via slashgear]

Lenovo IdeaPad G460 and G560 Switchable Graphics Notebooks

The IdeaPad G460 has a 14-inch LED screen with backlight, while the G560 gets a screen of 15.6 inches. They have up to 500 GB of hard disk storage. They start at $ 699.99.

Lenovo IdeaPad G460 and G560 Notebooks


Lenovo also announced the V360 IdeaPad 13.3-inch IdeaPad V460 14-inch laptops SOHO market. They have Switchable Graphics and are powered by 2010 Intel Core processors. Both models starting at $ 749.99.

ASUS Eee PC 1005P Minimalist Netbook


Recently, detailed specifications and pictures of 1005P ASUS Eee PC showed on SlashGear, the netbook has a minimalist design with a pretty decent hardware spec.

ASUS Eee PC 1005P Notebook

This netbook features a 10.1-inch screen supports a resolution of 1024 × 600, it also features an Intel Atom N450 (1.66GHz) processor, 1 GB of RAM and Intel GMA 3150 graphics. You can choose between a 160 GB hard drive 250GB and the netbook has WiFi b / g standard, the more impressive as it offers up to 12 hours of battery life.