Wednesday, May 25, 2011

Install Al-Quran extension in openoffice

This was done in Fedora 13 with openoffice 3.2.0. Please follow below steps to install it:

1. Download the installation files

$ wget http://qioo.googlecode.com/files/QiOO-0.4b.zip

2. Extract it to somewhere
$ unzip QiOO-0.4b.zip
$ ls QiOO-0.4b
CHANGELOG QiOO-0.4b.oxt README.txt ScheherazadeRegOT.ttf

3. Copy ScheherazadeRegOT.ttf to /usr/share/fonts
$ sudo mkdir /usr/share/fonts/ScheherazadeRegOT; sudo cp -apv QiOO-0.4b/ScheherazadeRegOT.ttf /usr/share/fonts/ScheherazadeRegOT

4. Install the extension by opening openoffice writer and go to Tools > Extension Manager > Add, and search for the QiOO-0.4b.oxt plugin.

5. Activate CTL by going to Tools > Option > Language Settings > Languages > Enable For CTL(Complex Text Layout)

6. If all went well, you can see AlQuran menu in your openoffice writer's menubar like below.


That's all.

Friday, May 20, 2011

Cloning virtual machine on vmware esx using vmware-cmd

Below are the steps:

1. List down all the virtual machines that you have

# /usr/bin/vmware-cmd -l
/vmfs/volumes/47971de9-34657d96-8ac4-001d09068c0c/server-1/server-1.vmx
/vmfs/volumes/47971de9-34657d96-8ac4-001d09068c0c/server-2/server-2.vmx
/vmfs/volumes/47971de9-34657d96-8ac4-001d09068c0c/server-3/server-3.vmx

2. Shutdown the machine that you are going to clone. Let say the machine is server-1
# /usr/bin/vmware-cmd /vmfs/volumes/47971de9-34657d96-8ac4-001d09068c0c/server-1/server-1.vmx stop

3. Use hard stop if you cannot stop it using above command
# /usr/bin/vmware-cmd /vmfs/volumes/47971de9-34657d96-8ac4-001d09068c0c/server-1/server-1.vmx stop hard

4. Make sure the vm is shutdown by viewing the state
# /usr/bin/vmware-cmd /vmfs/volumes/47971de9-34657d96-8ac4-001d09068c0c/server-1/server-1.vmx getstate

5. Copy the whole directory
# cp /vmfs/volumes/47971de9-34657d96-8ac4-001d09068c0c/server-1/ /vmfs/volumes/47971de9-34657d96-8ac4-001d09068c0c/newserver/

6. Once done, rename all the files to new name
# rename server-1 newserver /vmfs/volumes/47971de9-34657d96-8ac4-001d09068c0c/newserver/*

7. Change all occurrence of "server-1" to "newserver" in .vmx, .vmdk and .vmxf
# cd /vmfs/volumes/47971de9-34657d96-8ac4-001d09068c0c/newserver/
# sed -i 's/server-1/newserver/g' {newserver.vmdk,newserver.vmx,newserver.vmxf}

8. Edit newserver.vmx file and remove below lines
ethernet0.generatedAddress = "....."
ethernet0.generatedAddressOffset = "....."
uuid.location = "....."
uuid.bios = "....."

9. Add below line to newserver.vmx
uuid.action = "keep"

10. Register your newly cloned virtual machine. Please use the full path to register as below
# vmware-cmd -s register /vmfs/volumes/47971de9-34657d96-8ac4-001d09068c0c/newserver/newserver.vmx

11. Start your new vm after registration.
# /usr/bin/vmware-cmd /vmfs/volumes/47971de9-34657d96-8ac4-001d09068c0c/newserver/newserver.vmx start

Friday, February 4, 2011

vim comment lines

In linux, while editing configuration files, we always used # sign for comments. How do we do it to multiple lines in vi easily?

Steps:

1. Edit the files using vi
$ vi files.conf

2. set line number in vi (for us to easily determine what is the line number that we want to edit)
:se nu

3. replace start of lines with # (for example, put # sign in front of line 2 to line 5). The meaning of below command is for line 2 - 5, subtitute (s) start of line (^) with # sign, and press enter
:2,5s/^/#/
<enter>

4. It is done. Save your file (w) and quit (q)
:wq

Thursday, December 2, 2010

yum plugin to remove dependencies

You can remove dependencies using yum-plugin-remove-with-leaves plug-in.

To install:

# yum install yum-plugin-remove-with-leaves

To use:
# yum remove --remove-leaves <package-name>

That's all folks :)

Friday, November 26, 2010

Using markers in vi/vim

This feature is useful if for example we want to delete a few lines or characters but we are too lazy to count the lines or characters to use dd or dw command. We can set up to 26 marker using lowercase a-z as the marker's name. The main usage of marker is to mark any location in file.

How to use (we put 'a' as the marker's name):

ma - mark current cursor position as marker named 'a'
`a (backquote a) - move to character marked as 'a'
'a (quote a) - move to first non blank character (line) containing marker 'a'
`` (backquote backquote) - move to last operated marker or toggles with last cursor position, if no marker is set, cursor moves to beginning of file (BOF)
'' (quote quote) - move to beginning og line (BOL) operated marker or toggles with BOL of last cursor position, if no marker is set, cursor moves to BOF

Example on using marker:

If you want to indent 5 lines starting from current line: majjjjj>'a
If you want to delete five words using marker: mawwwwwmb`ad`b

That's all friends :)