Subscribe: Shehan's blog
Preview: Shehan's blog

Shehan's blog

Technology tips and tricks I never knew before

Last Build Date: Tue, 03 Apr 2018 09:51:36 +0000


Set up a Remote Desktop Connection to Windows Server 2012

Sun, 13 Apr 2014 14:54:00 +0000

Configuring remote desktop connection to windows servers is tricky.In this tutorial I will describe how to do it with minimum steps1)Allow RDP ConnectionGoto "Control Panel\All Control Panel Items\System"then click "Remote Settings" and select "Allow remote connection to this computer" and apply it by clicking "ok" button.2) Turn On network discoverygo to "Control Panel\All Control Panel Items\Network and Sharing Center" and select "Change advanced sharing settings" and then select "Turn on network discovery"Sometimes this change will not affect if following services are not running.To make sure whether changes apply, again follow the above steps and check "Turn on network discovery" is selected or not. If it is not you have to start Network Discovery Supporting ServicesNetwork Discovery Supporting Services DNS ClientFunction Discovery Resource PublicationSSDP DiscoveryUPnP Device Hostto Enable those services goto "Control Panel\All Control Panel Items\Administrative Tools"and open "Services" and start above 4 services .3) Configure Firewall If you can't ping server from remote hostopen Firewall and select "Inbound Rules" and find "File and Printer sharing (Echo Request - ICMPv4-In)" and Enable that RuleEnable RDP port on Windows ServerSometimes remote machine can ping to server but unable to establish "Remote Desktop connection", in that case RDP port should be enabled/opened on Windows Server. Right click "Inbound Rules" and select "New Rule" and Wizard window will be need to select or fill attributes in wizard windows as below.Rule Type --> PortProtocol and Ports --> TCP , Specific local ports:3389Action --> Allow the connectionProfile --> Tick all profiles or select as you wish (By default every ting is ticked)Name --> Give meaningful name like "enable-port-3389-RDP" Finally enable that rule as well4 ) Start Remote Desktop connectionNow go to remote computer and start "Remote Desktop connection" as below screen capture.[...]

Change ScureCRT default terminal emulation type

Fri, 21 Feb 2014 16:09:00 +0000

The  SecureCRT  default terminal "Delete" button does not function properly instead it works like backspace key. This is painful when need delete characters after current prompt.In this tutorial shows you how to overcome this problem by changing default terminal. The SecureCRT provides different types of terminals such as Xterm, Linux etc...  

1) open SecureCRT 

then choose Options -> Global Options.

2)Then following sub windows is appeared.

select "Default Session" and click "Edit Default Settings ..."



















3) After that second sub window will be appeared as below.

click on "Emulation" and choose "Xterm" from drop down.
then click ok to apply the changes.

4)Now it is done. restart the SecureCRT and try ..!!



Install Packages via yum using CentOS Media repo

Mon, 16 Dec 2013 09:04:00 +0000

when need to install new packages using yum, you can use either online repo or dvd repo. If there is no internet connection, possible solution is DVD repo. Here is simple way to configure DVD repo on Centos.

1) View Centos media repo file.

Since I use Centos 6.3 it is similar to can use either less or cat command to view the file content. Some  lines are removed due to brevity

less /etc/yum.repos.d/CentOS-Media.repo
name=CentOS-$releasever - Media

give more attention to following parameters
repo name -> c6-media
baseurl -> there is 3 file paths, those are the mount point of Centos DVD. you can customize it.

2) Create mount point if not exist

since this is demo, I create DVD mount location as first base URL. possible use any location which is defined in baseurl.
[root@localhost ~]# mkdir /media/CentOS

3) mount centos cdrom

mount /dev/cdrom /media/CentOS/

4)Install your package using yum

yum --disablerepo=\* --enablerepo=[repo name] install [pakage name]

yum --disablerepo=\* --enablerepo=c6-media install cpan

if this is not working, you may need to clean repo using following command
[root@localhost ~]# yum clean all

Prevent SSH connection from freezing

Wed, 11 Dec 2013 16:54:00 +0000

Recently I have experinced my ssh connection to remote server is hung after idle time. this is very annoying because ssh connection was established over vpn and take time to reconnect the session again. If your ssh connection hung/freeze time to time following solution may be helpful.

1) Open the ssh_config file.

location may differ,in centos
vim /etc/ssh/ssh_config

2) Add following lines

Host *
    ServerAliveInterval 300
    ServerAliveCountMax 2

Remember, this configuration is done at client side. client send keep alive message to server every 180 seconds and server send ack (acknowledgement) message.If 2 consecutive ack messages are lost from server side. connection will be dropped as server is not available.

Installing vpnc - Linux VPN Client for Cisco VPN

Sun, 17 Nov 2013 10:56:00 +0000

This tutorial, I will show you how to configure vpnc on Linux and  connect  Cisco devices through vpn using pcf file. The vpnc is an alternative Linux software for Cisco vpn client.
all the things are done on centos 6.3 but steps should be same for any Linux system.

1) Installing EPEL repo

Since centos repo doesn't contain the vpnc, we need to configure additional repo call EPEL.
It is straightforward installation and  document can be found form here.

Please find "How can I install the packages from the EPEL software repository? " from content and install it. you may need to enable EPEL repo sometime.

2) Installing vpnc

once you enabled the rpmforge repo, type following command to install vpnc  
[root@localhost ~]#yum install vpnc

3)Chang folder permission

I installed the vpnc as root.if you wish to run vpnc as normal user other than root .change file permission of vpnc installaion directory

4)Download pcf2vpnc

[root@localhost ~]#wget

5)Convert pcf file

[root@localhost ~]#perl pcf2vpnc demopcf.pcf demovpnc.conf
change ownership of *.conf file if you need

6)copy *.conf to /etc/vpnc/ 

[root@localhost ~]#cp demovpnc.conf /etc/vpnc/

7)Start vpnc

[root@localhost ~]#vpnc demovpnc
Enter password for user@A.B.C.D:
(A.B.C.D is public ip address where you need to connect, user is username , you need to enter password )

8)disconnect vpnc

[root@localhost ~]#vpnc-disconnect

nagios snmptt configuration

Sun, 27 Oct 2013 16:36:00 +0000

Hi folks after long time !. Today I'm going to demonstrate how to configure SNMP trap inside Nagios using SNMPTT. This simulation is done at Virtualbox 4.1.26 using two guest OS ( one guest act as server and running Nagios and snmptt, other is to generate SNMP trap and it is the client) both guest are running Centos 6.3 32bit.Server info :- ip info :- 1p hope you have installed and configured the Nagios, If not you can follow installation guide let's install snmptt. :)download and extract latest version of SNMPTT. you can find official installation document from here both server and client require net-snmp-lib , net-snmp-util so install them using using yum yum install net-snmp-libyum install net-snmp-utilAT Server 1)Install prerequirement such as net-snmp, perl ,perl modules [root@nagios ~]# yum install net-snmp[root@nagios ~]# yum install perlinstall perl cpan[root@nagios ~]# yum install perl-CPANlaunch the CPAN using following command[root@nagios ~]# perl -MCPAN -e shellinstall following perlmodules  (Getopt::Long,  Text::ParseWords ,SNMP, Config::IniFiles, Time::HiRes , Sys::Hostname , File::Basename, Text::Balanced )for an instancecpan[1]> install Text::ParseWordsThis demonstration is done with Standard handler – with standlone mode which is straightforward (remember there is daemon mode)2) Copy snmptt to /usr/sbin/ and ensure it is executable (chmod +x snmptt)[root@nagios snmptt_1.3]# cp s[root@nagios snmptt_1.3]# chmod +x /usr/sbin/snmptt nmptt /usr/sbin/3) Copy snmptthandler to /usr/sbin/ and ensure it is executable (chmod +x snmptthandler)[root@nagios snmptt_1.3]# cp snmptthandler /usr/sbin/[root@nagios snmptt_1.3]# chmod +x /usr/sbin/snmptthandler4) Copy snmptt.ini to /etc/snmp/ or /etc/ and edit the options inside the file.[root@nagios snmptt_1.3]# cp snmptt.ini /etc/snmp/5) Create the log folder /var/log/snmptt/.[root@nagios snmptt_1.3]# mkdir -p /var/log/snmptt/6) For standlone mode:  Modify the Net-SNMP snmptrapd.conf file by adding the following line:[root@nagios ~]# vim /etc/snmp/snmptrapd.conftraphandle default /usr/sbin/snmpttdisableAuthorization yes7) Edit the /etc/logrotate.d/snmptt and update the paths and rotate frequency as needed.[root@nagios snmptt_1.3]# cp snmptt.logrotate /etc/logrotate.d/snmptt8) Start snmptrapd using the command line:  snmptrapd -On.[root@nagios snmptt_1.3]# snmptrapd –On--9) Convert MIB file Copy eventhandler [root@nagios ~]# cp /home/shehan/Downloads/nagios-4.0.1/contrib/eventhandlers/* /usr/local/nagios/libexec/eventhandlerscopy snmpttconvertmib into /usr/sbin/ folder [root@nagios ~]# cp /home/shehan/Downloads/snmptt_1.3/snmpttconvertmib /usr/sbin/then issue below command [root@nagios ~]#snmpttconvertmib --in=/usr/share/snmp/mibs/SNMPv2-MIB.txt --out=/etc/snmp/snmptt.conf.SNMPv2-MIB \--exec='/usr/local/nagios/libexec/eventhandlers/submit_check_result $r TRAP 1'10) Edit /etc/snmp/snmptt.ini, and change below settings[General]mode = standalonenet_snmp_perl_enable = 1unknown_trap_log_enable = 1At end of file you can find line similar to this Add /etc/snmp/snmptt.conf.NET-SNMP-EXAMPLES-MIB like below snmptt_conf_files = <

sync log timestamp with system clock on cisco devices

Wed, 22 May 2013 03:09:00 +0000

By default most of Cisco devices, log time stamp is not sync with system clock.
I have experienced similar situation. refer to the below output, show clock  and log time stamp is totally different

To solve this problem, need to set log timestamps to local time (system time).
issue the below command

SW-2(config)#conf t
SW-2(config)#service timestamps log datetime localtime


after that, the problem should be solved, below output prove that

Virtualbox file sharing between guest and host OS

Thu, 18 Apr 2013 01:20:00 +0000

Have you ever try to transfer files between VirtualBox guest OS and host OS ?unfortunately drag and drop file transferring/sharing is not yet implemented on we have to look for alternative method.This is what I have both host and guest OS are windows , remember this is possible on Linux environment with different commands.[1] Run the guest OSopen Virtualbox then select and run guest OS that you need to transfer file.Here I used Windows XP as my guest OS [2] Install Guest AdditionsOn the VirtualBox menu click " Devices " --> " Install Guest Additions... " and follow the instruction, If you get warning similar to below Click " continue anyway" to continue the installation and finally reboot guest OS.[3] Create shared foldergo Machine --> Settings... you will have Virtual machine setting windowsthen select  " shared Folders " ,as belowthen click folder with "+" sign (right-hand corner ) to create shared folder on host OS as above screenshot.Then you will have window called "Add share" like below, Choose the Folder Path and give a Folder Name. [4]Transfer file to guest OSStart the guest OS (I used windows XP as my guest OS) open " Run " and type the below command please note I used "sharedfiles" as folder Name. look at above screen shoot\\vboxsvr\sharedfilesonce you type click "OK" , then you can open shared folder of the host machine. If you reboot the guest OS this shared folder may not available therefore change shared folder setting as requiredHappy file sharing ![...]

emulate CISCO ASA 8.4 on GNS3

Sun, 31 Mar 2013 06:58:00 +0000

This tutorial is outdated. New tutorial can be found at  . It is our new blog :-)

Today, I would like to share how to setup ASA 8.4 Firewall on GNS3.

[1] Download asa image for GNS3

here is the link :-
This file contain with initrd, vmlinuz and asdm 6.4

In any case above link is not working use below alternative link to download the file :-
link 1 :-
link 2 :-

[2] Download & Install GNS3

You can download latest version from

[3] Configure GNS3 for ASA

go to "Edit" --> "Preferences..."
On "Preferences" window, select "Qemu" and then choose "ASA" from the tabs

Fill the ASA setting & ASA Specific Settings as below . Screen capture is attached for your reference.

Qemu Options  & Kernel cmd line is important

Identifier name :     ( you can give any name )
RAM :     1024MB  ( at least 1024MB)
Qemu Options :     -vnc none -vga none -m 1024 -icount auto -hdachs 980,16,32
Kernel cmd line :     -append ide_generic.probe_mask=0x01 ide_core.chs=0.0:980,16,32 auto nousb console=ttyS0,9600 bigphysarea=65536

Click " save " and then "OK" and exit form that window.
drag and drop ASA firewall into work enviroment and run, It may take some time to boot please be patient !

[4] Configure activation keys

you can use one of below activation key
0x4a3ec071 0x0d86fbf6 0x7cb1bc48 0x8b48b8b0 0xf317c0b5
0xb23bcf4a 0x1c713b4f 0x7d53bcbc 0xc4f8d09c 0x0e24c6b6

for example :-

ciscoasa#conf t
ciscoasa(config)#activation-key 0x4a3ec071 0x0d86fbf6 0x7cb1bc48 0x8b48b8b0 0xf317c0b5

now it is done.

sharing folders using nfs on rhel

Fri, 08 Mar 2013 04:47:00 +0000

This tutorial guide you how to configure nfs share on rhel system.Below is the details of nfs Server and client, both running Redhat enterprise Linux 6.2 64-bitNFS Server :- host-name is server and ip address is Client :-  host-name is client and ip address is Server Configuration[1]  Edit /etc/sysconfig/nfs To allow nfs traffic , should need to uncomment following variable LOCKD_TCPPORT ,LOCKD_UDPPORT, MOUNTD_PORT,  STATD_PORT on /etc/sysconfig/nfs as following# TCP port rpc.lockd should listen on.LOCKD_TCPPORT=32803# UDP port rpc.lockd should listen on.LOCKD_UDPPORT=32769# Port rpc.mountd should listen on.MOUNTD_PORT=892# Port rpc.statd should listen on.STATD_PORT=662[2] Configure Firewall to allow nfs traffic . TCP port 2049 for NFS.TCP and UDP port 111 (rpcbind/sunrpc).So let's edit the iptables file [root@server ~]# vim /etc/sysconfig/iptablesBy default this file contain few rules . Find following rule  -A INPUT -j REJECT --reject-with icmp-host-prohibitedand insert bellow rules before that line -A INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 111 -j ACCEPT-A INPUT -m state --state NEW -m udp -p udp --dport 111 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 32803 -j ACCEPT-A INPUT -m state --state NEW -m udp -p udp --dport 32769 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 892 -j ACCEPT-A INPUT -m state --state NEW -m udp -p udp --dport 892 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 662 -j ACCEPT-A INPUT -m state --state NEW -m udp -p udp --dport 662 -j ACCEPTsave and quit the iptabales file, then issue follwing command apply the new rules to system[root@server ~]# service iptables restartyou can verify it by using following command[root@server ~]#iptables -L[3] Create a direcory to share with client my share folder is /svrfile and i have assigned  rwx (read write execute) permission for ugo (user group others).[root@server ~]# mkdir /svrfile[root@server ~]# chmod 777 /svrfile[4] Edit exports file [root@server ~]# vim  /etc/exports and insert following line /svrfile,sync,no_root_squash) is nfs client where i'm going share /svrfile . you can specify client host as however /24 is default for class C network. If you wish to share with any host you can use '*' (without qutoes) instead of ipaddress. Several parameters are available.I used rw,sync and no_root_squash . here is brief :- enable read write sync :-  Syncs write operations on request. Active by defaultno_root_squash :- Treat remote root user as local root; remote root users get root privileges on the shared directory[5] restart rpcbind and nfs By default RHEL system is installed this services , If it is not you should have to install .[root@server ~]# service rpcbind restartStopping rpcbind:                                          [  OK  ]Starting rpcbind:                                          [  OK  ][root@server ~]# [root@server ~]# service nfs restartShutting down NFS mountd:                                  [  OK  ]Shutting down NFS daemon:   [...]

How to fix Google webmaster duplicate meta descriptions in blogspot

Sun, 03 Mar 2013 09:21:00 +0000

Google web master tool provides collection of tools for analyze the web/blog. Among those tools, HTML Improvements reports HTML errors on web/blog and provides suggestions to overcome those errors.
If you are new to Google webmaster, please look at Optimization --> HTML Improvements.
Most common error web masters are facing is duplicate meta description.

Most probably reason for that is, you have inserted same description meta tag on each and every page of the web/blog.Solution for blogspot blogs are really simple, you can find solution from here including blogger meta description best practices .  

If you are non-blogspot web master, please check your individual web page meta description ,
and make sure to remove duplicate  meta description tag  if it is there and create page specific
description that reflect your page content as description meta tag.


After 1 and 1/2 month time

blogger meta description best practices

Thu, 21 Feb 2013 12:24:00 +0000

When creating a brand new blog, it's really important to insert meta tags on the bloggspot site such as title, keywords, description, robots ... etc.The major search engine such as google is intelligent enough to create relevant keywords for the blog/site by crawling the page. so what is the point of adding keyword meta tag to site ?? It is not really important perspective to Google. however other search engine may be use keyword meta tag, so do not forget to add keyword meta tag.  

The description meta tag plays major role on Google page ranking. don't forget Google own more than 60% percent of search engine traffic.Traditionally we are used to adding meta tag to blogger site similar to below by editing the html code of the blog.


But what happen if you do the same for description tag ?? If you do that, every page of your blog has same description and search engine refuse to index those page by considering they have same I'm going to discuss best practices of creating meta description to your blog.

* Adding Global meta description

1) Write a blog/web description

Take your time and create best description that is suitable to your site. it should be clear and concise with characters of 80 - 100.

2) Login to blogger site

so let's take advantage of blogger inbuilt tool of putting meta description.
 go to Setting --> Search preference --> edit Description and save. Use blow screen capture for your reference

* Adding meta description for each post

3) So now you have successfully added global  description to your blog. next thing is, put a description to each blog post.It's so simple. go to Post --> click "edit" which post you want to add description
find "Search Description" field from left hand side panel, insert you page description, now you are done.


Tip:- your page description should be the summary of the post. Remeber to add as much as keyword when you writing that summary ( to find relevant keywords use Google Adwords tool)
you can verify each meta tags including description meta tag using below tool.

4) happy blogging :)

Fixed Missing eth0 after creating a clone vm on linux kvm

Wed, 06 Feb 2013 15:50:00 +0000

Recently I have created a cloned virtual machine using redhat linux kvm, once the system is booted up
virtual machine  was unable to connect to system eth0 instead it's connected to Auto eth0 interface as below,
after doing some google search and reading some forums I have found a reason for this error.
this is due to cloned VM is using original VM mac address. in this tutorial I'm going to
show you how i solved that problem

1) Edit ifcfg-eth0

go to /etc/sysconfig/network-scropts/ifcfg-eth0
and remove or comment the HWADDR line as following


if you want check newly cloned vm NIC mac address pls follow this steps
select guest os click edit  -->  virtual machine details --> show virtual hardware detils -->
select NIC --> view the mac adds.

2) Remove 70-persistent-net.rules

 command is  #rm /etc/udev/rules.d/70-persistent-net.rules
you may have different name for persistent-net file

3)Reboot the system

 now system eth0 should be available also there should be new persistent-net.rules file with actual NIC mac address of cloned vm.

How to fix audio video out of sync after conversion

Sat, 02 Feb 2013 04:51:00 +0000

Sometimes when you are converting video from one format to another, you may be experienced audio video out of syn after conversion.In this tutorial I'm going to show you how to fix it.

1) Download the Any video convertor.  
.It is totally free. There is ultimate version of that software, but free version is enough for this.

2)After installing Any video convertor and select the video file you need to be converted.
please not that, I was tested with flv into mp4 conversion and output mp4 video has similar audio/video syn quality like the original one. I didn't have oppurtunity to test with other video formats but I'm pretty sure,
this method should work for any video format if it is supported by this converting software.

3)Now go to edit --> options.. --> select video tab --> increase Audio/Video Sync factor ( Default sync factor: ) to about 40 as the following image

4) by increasing Audio/Video Sync factor to higher value you can have better quality output but remember that takes time to complete the conversion.

5) hmm.. that's all , don't forget to put your comment/feedback here :)  .

virtualbox seamless mouse pointer integration and install guest additions

Fri, 25 Jan 2013 17:11:00 +0000

While running the Redhat linux on Virtual box, every time when I want to leave from
guest OS to host system I need to press "Ctrl" key (my Host key is Ctrl) .This is because seamless mouse pointer integration is not enable. This is painful and takes time to jump between guest OS and host system. After reading some forums post and web articles I have come across with a solution.In this method there will be one mouse pointer and pressing the Host key is no longer required to "free" the mouse from being captured by the guest OS and vice-versa. Following steps guide how to enable seamless mouse support on linux based guest system.

[1] install gcc and kernel-devel

install the GNU C compiler and the kernel development packages using

#yum install gcc

followed by

#yum install kernel-devel

[2] Reboot guest system

Reboot your guest system in order to activate the updates.

[3]Install Guest Additions

Click "Devices" --> "Install Guest Additions"


[4] Follow the installation wizard
you will get window similar to below and click "OK" , you may need provide authentication

[5] It will be prompted with terminal window similar to following, Press Return and close that window... that's all , Now seamless mouse integration should be enabled . have a nice day!

Adding categories and sub categories to blogspot

Tue, 22 Jan 2013 01:45:00 +0000

 At the moment of writing this tutorial,  there is no way to add sub categories to blogspot, may be in future blogger will add this feature . To implement this feature needs to edit  HTML code of your template[1] Take backup of your blog. Click " Settings  --->  Other --> Export blog " , and download the backup of your blog post , you can even can take template backup also.[2] Edit HTML code of  your blogClick " Template" --> "Edit HTML" , and you will get HTML code of template .find a line similar to the following, it should be within first 10 -15 lines of code.  final output should be similar to following
//end Now, it is done !d.add(0,-1,'Blog Categories'); d.add(1,0,' '); d.add(100,1,' ','','');  please make sure to edit(fill the parameters) above highlighted lines of code according to your blog, otherwise this will not work. Please refer following code explanation. JavaScript Code explanation bellow is example code I'm using on my blog. now I'm going to explain the code. all my explanation are bold italicall the categories are staring from 1 and topics are staring from 100 /*category index 0-990 - Blog categories1 - OpenCV2 - Linux3 - Networking stufftopics start 100..*/explanation for d.add() functions and it's parametersd.add( index , parent index , topic , topic URL  , brief description of the topic ) .this is very simple explanation. you can learn more about from this link,-1,'Blog Categories');d.add(1,0,'OpenCV'); //OpenCV categoryd.add(100,1,'OpenCV installation','','opencv 2.2 installation on visual studio 2008');d.add(101,1,'Negative Images','','negative background images');d.add(102,1,'Positive Images','','haartraining positive samples');d.add(103,1,'opencv haartraining','','opencv haartraining steps');If you have followed above steps correctly, you will get an output similar to the following :) .You can find live demonstration top right hand under name as " categories "  [...]

set post title before blog title in blogger for better SEO

Mon, 21 Jan 2013 14:59:00 +0000

Default blogspot template title structure is  " Blog Title | Post Title ". Appearing blog title before the post title will cause to get low clicks to your content through search engine, because post title provide summary of post/article content not the blog title. So let's change this default behavior .

click on the " Template "  --> " Edit HTML "  --> " Proceed " .
find following line of code


and replace the above line with following code

<data:blog.pageName/> |</b><br /><b><data:blog.title/>


save the template, Now blogspot template title structure should be changed into " Post Title | Blog Title "  . please note this takes some times to change on search engine, later you can verify it, from  following Google query.
below is example output of ,

[SOLVED] the action can't be completed because the file is open in windows explorer mkv file

Sun, 06 Jan 2013 01:19:00 +0000

There was  movie on my hard disk which has mkv format and When I'm going to delete that mkv file, it is prompted with following error message.
" the action can't be completed because the file is open in windows explorer "



 and it doesn't allow me to delete it at all. I restarted my computer and try to delete it but same error no luck. Finally I have found a solution , it was very simple than I thought . This is what I have done

[1] open command promt

for windows 7 , click start and type cmd

[2] Change the directory where delete file is located

in my case, file is at Desktop and I used following command to change the directory
cd c:\Users\Admin\Desktop

Now try to delete file using command line , issue following command
del "file name"

but you will get an error message similar to following for sure :) don't worry !!
" The process cannot access the file because it is being used by another process. "

[3] Disable "explorer.exe"

open the task manager , select "Process" tab and select "explorer.exe" from the process list and click "End Process" button
Now every thing should be vanished except command promt and Task manager , don't be confused we will get back them all later :D

[4] Delete the mkv file

Now again issue del command , this time it should be executed and you will get no error messages.
ok , big step is done , now time to get back desktop and task bar

[5] bring back desktop and task bar

type explorer.exe on command prompt . how simple it is :))

How to set a crontab job for a perl script

Fri, 14 Dec 2012 15:06:00 +0000

In this tutorial I’m going describe how to set a crontab job for perl script on a linux system. The following example I'm going to demonstrate, how to  execute perl script every five minutes. below is the steps

[1] list the existing crontab using following command. If you have not set any crontab jobs it will display noting.
[shehan@localhost ~]$ crontab -l

[2] issue following command to create a new crontab or edit previously created crontab 
[shehan@localhost ~]$ crontab -e

[3] add following line of code to crontab and don't forget to edit your perl script path.
*/5 means script will be executed every 5 minutes time , for ex :- 10.00 , 10.05 , 10.10 etc

*/5 * * * * perl /path/to/your/perlscript/

some tricky example
3-58/5 * * * * perl /path/to/your/perlscript/

This would still execute perl script every five minutes, but it would run on the 3's and 8's - e.g. 12:03, 12:08, 12:13, 12:18, etc.

[4]that's it !


How To Install Perl Modules Manually on linux

Fri, 14 Dec 2012 14:52:00 +0000

I  recently try out  perl script which is used to test download speed. when I run that script it gives me the following error saying that can’t locate Perl module called Time::Format .

Can't locate Time/ in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 ... )....

Solution for this error is install the perl module, in this case by installing the Time::Format perl module. below is most required steps to install any perl module.

[1] switch to root and launch the CPAN using following command
 [root@localhost ~]# perl -MCPAN -e shell

[2] type the module name according to below format, in this example I’m going to install Time::Format perl module.
cpan[1]> install Time::Format

[3] that’s all !! . now run your perl script again :)

How to install Redhat enterprise linux from usb drive

Fri, 30 Nov 2012 07:38:00 +0000

Installing Redhat Linux from DVD is not a huge task unless not going to customize for advance installation. However if you do same using USB drive ,you have some extra work to do. First time when I installed the Redhat Linux through USB drive I faced so many difficulties, so in this tutorial I'm going describe how I avoid those obstacle to made successful installation.1) download and install "linux live usb creator" from this link 2) format the USB drive with FAT32. open that application and follow the steps mention on that application to create bootable usb drive. it's better un-tick the "Hide created file on key" from options. it will helpful to view all created files on the USB can test the USB using "mobalivecd" application. link is http://mobalivecd.mobatek.net3) I have faced the following error message in the middle of the installation   Missing ISO 9660 Image  The installer has tried to mount image #1, but cannot find it   on the hard drive.  Please copy this image to the drive and click Retry. Click  Exit to abort the installation.4) Solution for that error message is putting a redhat iso image into the USB drive.this is crazy but it's only solution i have found so far and it's worked :) .    5) Restart your pc and change boot method to USB6) Follow Redhat installation steps. after you select the "install or upgrade an existing system" from the may get a blinking cursor screen for 10 to 15 mins.pls be patient :-) .7) Select "Language " , "key borad" according to your preference. once you got the "Redhat installation method" screen make sure to select "Hard drive" 8) Click "ok" and then you get an screen similar to the following it will display all devices connected to your pc. for an example/dev/sda1   <-- hard disk partition 1/dev/sda2   <-- hard disk partition 2/dev/sdb1   <-- USB driveselect your usb's depend on your system , according to above example it is /dev/sdb1 . and click "Ok" to continue.9) Follow rest of the steps, and install the Redhat Linux !.[...]

how to change default secureCRT appearance into Traditional color schemes

Wed, 31 Oct 2012 06:04:00 +0000

Default color scheme of SecureCRT is not eye friendly and if you work for long time with default color scheme your eye may be get tired . It is better to change color scheme into someting eye friendly. My suggestion is Traditional color schemes (Foreground is green and Background is black)

[1] Open the SecureCRT , click on " options " --> " Global options.. " . then you will get a window similar to the following

[2 ] select " General " --> " Default Session " --> " Edit Default Settings.. ", then you will have a window similar to the following

[3] Select " Appearance " --> and choose " Traditional "  form Current color schme drop down list . then click " OK " to apply the setting .

[4] Then SecureCRT prompt with a waring message like below, click " YES " and restart the SecureCRT

[5] SecureCRT color scheme is changed  , hooray !!!

how to add dvd based repository in rhel 6

Tue, 30 Oct 2012 22:46:00 +0000

Problem :- yum install [package..]    gives an error message similar to the following

[root@localhost ~]# yum install gcc
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
...(output ommited)
No package gcc available   <-- here i'm try to install pacakage called 'gcc'
Error: Nothing to do
[root@localhost ~]#

reason is we do not have access to RHN

Solution :- use DVD as base repository

[1]switch to the root

[shehan@localhost ~]$ su -
[root@localhost ~]#

[2]Create DVD based repo

[root@localhost ~]# vim /etc/yum.repos.d/iso.repo

Following text should be added to above file (iso.repo)


[3]mount installation DVD
make a directory called /mnt/cd and it should be similar to baseurl

[root@localhost ~]# mkdir /mnt/cd
[root@localhost ~]# mount /dev/cdrom /mnt/cd

[4]now try previous command again. it should work !
[root@localhost ~]# yum install gcc

tips :- How to  mount iso image ??
baseurl of  " iso.repo " file  should be changed as
file://mnt/iso/Server     ( I created /mnt/iso directory)

mount command is
mount -o loop /home/shehan/redhatiso/h-rel62x6.iso /mnt/iso

Opencv and Image processing reference books

Sun, 03 Jul 2011 16:08:00 +0000

I'm recommended following books for learning opencv and image processing . even they tech how to create GUI ( Graphical User Interface ) application.    Title :   OpenCV 2 Computer Vision Application Programming Cookbook  Author : Robert LaganièreYou can read sample book from HERE---Title : Learning OpenCV: Computer Vision in C++ with the OpenCV LibraryAuthor :  Gary Bradski[...]

Background/Negative Images for Opencv haartaining

Mon, 27 Jun 2011 15:36:00 +0000

Selecting suitable  negative aka background image for haartraining is very important. Collect set of images  (about 3000) that does not contain objects of interest, for an example if you are going to train a haarcascade classifier for Face, you should have negatives with no face images.

you can download collection of negative images (about 3000 negatives) from here. [Use Internet Download Maneger] 

According to your haartraining requirement this may not be not enough . best proposition for No. Positive images : No. Negative images is 1:2, means if you have 2000 positive images you should have at least 4000 negative images. So if this is not enough, you can get more from public databases such as google images.
You can use these softwares to make download easy otherwise it would be boring . below softwares would be helpful
[1]bulk image downloader (commercial software)
[2]google image dowloader (FREE software)

After you get enough images you should  do index and rename all images properly for further use.This tool would be useful
Ant Renamer ( )

Related Post

[ Opencv installation ]

[ Positive images for haartraining ]

[ Opencv haartraining and haar cascade xml ]