Using JAR- the Java Archive Tool

The jar tool is used in combining multiple files into one JAR file. JAR is a general-purpose archiving and compression tool, based from ZIP and Zlib compression format, but is designed mainly to facilitate the packaging of java applets or applications into a single archive.

Typical usage of jar is:

Within the directory of your classes, run:

% jar cf myArchive.jar *.class

This creates a new JAR file named myArchive.jar containing all your classes

If you have an existing Manifest file whose name: value pairs you want the jar tool to include for the new jar archive, you can specify it using the m option:

% jar cmf myManifestFile myArchive.jar *.class

To extract JAR Files, you command x:

% jar xf myArchive.jar

However, if you need to extract specific files, supply their filenames as argument/s:

% jar xf myArchive.jar foo1 foo2 bar1 bar2

 

Congratulations Manny Pacquiao!

 Manny PacquiaoCongratulations to our very own Manny “Pacman” Pacquiao for winning the fight against Antonio “Tijuana Tornado” Margarito of Mexico. Even if winning in a unanimous decision, this is our hero’s 8th winning world title, added is the WBC Junior Middleweight Champion title. Again, congratulations Manny,you make our country proud.

Changing MySQL root password

There are several ways of changing the root password of MySQL. Initially, when mysql in first accessed, there are no passwords for the root access, which we all know is not always a good practice. The user root is MySQL’s admin user account, same as in linux/unix.

Using mysqladmin

$ mysqladmin -u root password NEWPASSWORD

If you already have an existing password to root, you may change it by:

$ mysqladmin -u root -p OLDPASSWORD password NEWPASSWORD

This can also be used in changing passwords for normal users:

$ mysqladmin -u username -p OLDPASSWORD password NEWPASSWORD

Using mysql command

Another way is by changing the stored password of users within mysql command.

Login to mysql command:

$ mysql -u root -p

Change to mysql database, since this is where we need to do some changes.

mysql> use mysql;

Use mysql commands to update the password of a user, eg. lhan:

mysql> update user set password=PASSWORD("NEWPASSWORD") where User='lhan';

Reload privileges:

mysql> flush privileges;

A special day….

I just want to greet my wife a Happy 5th year anniversary. Thanks for all the care and understanding through all the years. Also, I want to greet the other woman in my life, my Mom. Even though we are far apart from you and papa (they’re in US), you’re teachings are always with us. We love you and miss you so much. We are looking forward to see you again ma, hopefully next year. :)

Software Freedom Day 2010

It’s the time of year again for us Open Source enthusiasts and users. Software Freedom Day will be held on September 18, 2010 in the Philippines. Visit http://www.sfdphilippines.org/ and http://wiki.softwarefreedomday.org/2010/Asia/Philippines/MetroManila/SFDPhilippines2010 for the details and the Programme Highlights.

Software Freedom Day

Software Freedom Day

Enabling VirtualBox in 2.6.31+ kernels

For sure reasons, after installing the latest kernel(2.6.32-23) in my Ubuntu machine, I had problems in running my virtual machines.

I have checked several sites which suggest that I re-run /etc/init.d/vboxdrv setup but still it fails to load:

$ sudo /etc/init.d/vboxdrv setup
* Stopping VirtualBox kernel module * done.
* Removing old VirtualBox netadp kernel module * done.
* Removing old VirtualBox netflt kernel module * done.
* Removing old VirtualBox kernel module * done.
* Recompiling VirtualBox kernel module * done.
* Starting VirtualBox kernel module
* modprobe vboxnetflt failed. Please use ‘dmesg’ to find out why

If you are to manually load the network module:

$ sudo modprobe vboxnetflt

FATAL: Error inserting vboxnetflt (/lib/modules/2.6.32-23-generic/updates/dkms/vboxnetflt.ko): Invalid module format

One way to load this is

$ sudo insmod /lib/modules/2.6.32-23-generic/updates/dkms/vboxnetflt.ko

Run lsmod and you will see this module loaded:

$ lsmod | grep vbox
vboxnetflt 14288 0
vboxdrv 1778380 1 vboxnetflt

The problem might occur during the next boot, so I suggest add the insmod (sudo insmod /lib/modules/2.6.32-23-generic/updates/dkms/vboxnetflt.ko) lines on /etc/rc.local.


Searching for multiple words/string patterns using Grep

?: How do I search multiple string using the grep command? For example, I’d like to search wordA, wordB, wordC and so on within /path/to/file. How do I force grep to search multiple words?

A: Answer by citing an example, we would like to find error and warning messages in /var/log/messages:

cat /var/log/messages |grep “\(warning\|error\|critical\)”

or

grep “\(warning\|error\|critical\)” /var/log/messages