Tuesday, October 30, 2007

Visit to Galle fort


I got a chance to go to Galle fort few weeks back for the first time in my life. Also Osandi was there with me. She was dying to go the Galle fort for ages. Not to tell that she would give anything for the travelling :). Finally she was able to go there with me.
Galle fort was built by Dutch few centuries back. Today it is a world heritage site and an attraction to local and foreign tourists. Galle fort now over looks the Galle International Cricket stadium. Also not to forget that view towards the sea is just Amazing...........

Now @ Dehiwala


We left our beloved hostel last week and came to a place at Dehiwala. It's very close to Dehiwala junction. I together with Dimuthu, Hiran, Omega and Sameera are at the new place. Since we rented a home this time there was no furniture at the beginning. Slowly but surely we have purchased some of the furnitures. Here are some of the scenes from the new boarding place (and also my new mug)......

Here are photos from ERU Symposium


It took me a while to download the photos from my Phone to the laptop. Anyway here are the photos taken at the 13th ERU of University of Moratuwa at Taj Samudra, Colombo. There I presented the paper for our final year project "A Web Development Framework for Sport Event Management System". Here are some of the photos taken while we were there...

"Thala" at Matara


Last Sunday Famous Dance group Channa-Upuli came to Matara. Osandi and Me was there to witness great display of traditional and modern ballets. Also one of the leading Drum Artists in Sri Lanka, Jananath Warakagoda was present. Many of the dancers seems like quite yound people, not the ones we see on TV most of the time. Yet they performed exceptionaly well. Event was great!, but organizing could have been better(It was organized by OG of Sujatha BV).

Wednesday, October 24, 2007

Have any problem with volume control settings in Debian?

I have been having this problem of volume control setting is not being saved in my Debian lenny. Finally I was able to get some help from #debian IRC people @ freenode and fix that errors. As I understood settings and things like that related to audio comes with alsa-util. So I installed it and problem was solved.

Friday, October 19, 2007

Couple of things about VI

I'm now completely working on Debian and my true friends are vi and grep. Since Debian installations doesn't provide much of the things out of the box, we will have to configure most of them. Last week I was able to get syntax highlighting and tabs as spaces in my vi. If you want to save these settings permenantly put thse commands in .vimrc in your home(just $cd to get to ur home dir).
$cd
$vi .vimrc
(press i to get to insert mode for vi)
syntax on
:set expandtab
(pres ESC for command mode and type :wq to write and quit)

Now you are good to go.
Also in the vi command mode u can issue :set all to view all the possible options and :set to view your current configuration.

Getting missing man pages in Debian new installations

As some of you may know when u install Debian(most likely Ubuntu too) you will not get many thing in the first place if you did a net install. So as a developer one of the most important thins is that u need man pages which are unfortunately not avialable. To install man pages... try

#apt-get install manpages-dev

Also if you want to see where man pages are located issue

$manpath

Hope this will help others out as I found it very difficult to get that fixed.

Wednesday, October 3, 2007

PERL Regular expressions

“Hello world” =~/world/ -> evaluates to true

“Helllo world”!~/world/ -> evaluates to false

$word= “world”
$_=”Hello world”
print “It matches “ if $world

“Hello world”=~m!world!
“Hello world”=~m{world}

Meta characters

{} [] () ^ $ . * + ? \

Escape sequences

\t \n \033 \x1B

Anchor meta characters

$ = end

^ = beginning

Character classes

/[b,c,r]at/ - matches bat, cat and rat

/yes/i - here i denote case insensivity

Special charactors for character classes are -]\^$

‘-‘ rage operator
/item[0-9]/

If – is first/last in the class it is treated normally

Perl abbreviation for common char classes

\d – digit [0-9]

\s – whitespaces [\ \t\n\t\f]

\w – wordchar [0-9a-zA-Z_]

\D – negate \d

\S – negate \s

\W – negate \w

. – matches any character but “\n”

Word anchor - \b

$x = “Housecat catenates house & cat”

$x = ~/\bcat/
$x = ~/cat\b/
$x = ~/\bcat\b/

Alternation meta character |

“cats and dogs”=~/cats|dogs/

Grouping hierarchical matching…

Grouping meta characters ‘()’

/house(cat(s|))/

Extracting matches

$time =~/(\d\d):(\d\d):(\d\d)

$hour=$1
$min = $2
$sec = $3

/(ab(cd|ef))((gi)|j)/

$1 $2 $3$4

Bock referencing (\1,\2…)

/(\w\w\w)\s\1/ - matches words like “the the”

Matching repetition

a? – 0 or 1 a’s

a* - 0 or more a’s

a+ - 1 or more a’s

a{n,m} – least n not more than m

a{n,} – at least n

a{n} – exactly n

xx/xx/o – row substitution

xx/xx/g – global

Search & replace

s/regex/replacement/modifiers

$y = “’quoted modifiers’”
$y=~ s/^’(.*)’$/$1/
$x=”I batted 4 for 4”
$x =~ s/4/four/g

#resulted in I batted four for four

s///, s!!!, s{}{}

s{}//, s’’’

The splitter operator

$x = “Calving and Hobbes”
@word = split/\s+/,$x
#$word[0]=’calving’
#$word[1]=’and’
#$word[2]=’Hobbes’