Thursday, December 31, 2009

My 2009... (Cross-post)

Leave a Comment
I've posted the rather incomplete account of my year 2009 on my new blog:
My 2009...

And BTW, Now this is my Tech blog. is my poetry/arts blog. And my new miniblog is my generic blog. :) I also have microblogs too, you know. ;)

In case you don't choose to see it on the other side,...

Wish you all a very happy new year 2010!

Sunday, November 15, 2009

Slides from my session at LKRUG October Meetup

Leave a Comment
The October meetup of Lanka Ruby User Group was help on 28 October evening. This month also Sameera organized the meetup at Ridgecrest Asia premise with the backing of Sanath (their CEO).

As usual we went with the two technical sessions setup where Sameera took the first session. Unfortunately I could not make it to the first session. However people who were available claim that it was great. Anyone interested can see the slides from Sameeras presentation at Slideshare. The topic was "Agile Software Development with Scrum" by the way.

My session was named "Ruby beyond Rails". It talked about why most of us came for Rails and stayed for Ruby. My aim was to give an introductory background about various Ruby related projects. The session was much generic, but I believe it paved the way for more technical and/or hands on sessions in future.

So here's the slides:

If you have a Slideshare account you can log in and grab the PDF file.

Update: Thanks to the guys at SinhalenFOSS podcast for the mention about the Ruby User Group. We couldn't make it to the last recording session, but we'd love to be there in a future session.

Get to know a Fedora Ambassador or User

Leave a Comment
Name: Gaveen Prabhasara
IRC Nickname: gaveen
IRC Channels: #fedora and a lot more on
Location: Colombo, Sri Lanka

Following the tradition.

Monday, October 05, 2009

Lanka Ruby User Group - 1st Meetup

As some of you may have already heard, some people who are interested in the programming language Ruby got together and formed a Ruby User Group. Within something around a months time they had their first meetup. If you get my drift, I'm also one of those people. :)


Sri Lankan software developers have been using Ruby for a while. Some cases were isolated projects but during the time period around 2005/2006 there have been a rise in the usage of Ruby in serious projects. Still the people who loved Ruby coding lived scattered everywhere. When an Italian Ruby coder named Sebastiano visited Sri Lanka by the end of 2007, he asked the few of us he met (individually), why we weren't hanging around with the like minded crowd. True, we had a quite active Linux User Group / FOSS interest group in Sri Lanka. But apart from that there weren't much enthusiasm flying around in favour of technical groups. However Twitter was able to get some Ruby enthusiasts together.

Ruby User Group

Anyway, the history behind, they formed a Ruby User Group quite recently. I am personally very excited about it and the progress so far.

If you are interested in Ruby (and Ruby on Rails) programming or you are interested in learning more about them you are welcome to join the Google group, which is currently named Rubyologists.

1st Meetup

1st meetup was held on 30th September evening at the RidgeCrest Asia premises. Laktek (Lakshan) already has a blogpost about the event.

I was very happy to see more than 20 Ruby enthusiasts showing up and getting to know each other. I was even more happy to see that the group consists of people from a wide range of backgrounds. There were two CEO/CTOs, couple of web/visual/experience designers, web applications developers, software engineers, trainee developers, people from category combos and etc. Me and Yajith (who by the way was delighted to see the healthy participation of ladies) were mainly SysAdmin types. :) Humour apart, it was really encouraging to see that a few of our female colleagues showing up. It's a good sign that the group has a balanced eco system.

We are planning to abide by the golden principle: MINASWAN (or MINSWAN, depending in how you write). After all, I personally believe the biggest strength of Ruby is its friendly community. For people who didn't know, MINSWAN stands for "Matz Is Nice, So We Are Nice".

Anyway here are some snaps from the meetup. You can find the full set from here.





Aslam doing the session "HTML 5 and Semantic Web"

Lakshan (Laktek) doing his talk "Evolution of Rails"


A big thank should go to Sameera Gayan who stepped up and coordinated the meetup. Another thank goes to Sanath for allowing us to use Ridgecrest premises for the meetup, ans also for the snacks/refreshments.

Aslam also deserves a big thanks from us for the great session about HTML 5 and Semantic Web, and more than everything, travelling all the way from Kandy just for the meetup despite the bereavement in his family.

Even though Laktek (Lakshan) is a little worried that he scared/bored the girls away with his session about Evolution of Rails, I have to admit it was a good details session. :) Further more he gave us a teaser trailer of a cool project he's working on (which would be an upcoming Open Source project). For everyone interested, his slides of the session can be found at slideshare.

And finally a big thank to every guy and girl who showed up that eve to get to know and have a chat about Ruby. We appreciate it very much and hope to see you all in the future meetups and other events too. :)

PS: If you are interested in Ruby, consider joining the User Group. In a future meetup I'm going to do a session about "Ruby Beyond Rails" which would talk about use of Ruby for non-web projects such as system infrastructure (mainly), security, etc. If the time allows you should be able to join that session in the next meetup.

Thursday, July 23, 2009

Syntax Highlighting Pager: Vim


If you use a Linux/Unix system using a pager should be quite familiar to you. A pager in the Unix sense is a program which lets you view pages of contents. Examples for pagers are the Unix commands "less" and "more". It's likely that your man page viewer is also using one of these.

The program less is perhaps the most popular of these, with more features than "more". These pagers are nice to use use and come very handy in day to day Linux/Unix operations. When you just need to view a file (instead of opening it for editing) it's quite natural to use less. If it's a file with a few lines we'd usually use cat, but less is more convenient on longer files.

One irritating thing about less is, there is no syntax highlighting support there by default. You can try to use an external program like "highlight" for the highlighting part and then pipe it to less. (Eg: $ highlight --ansi --force my_file | less -R) But that's tedious. If the filetype isn't supported by "highlight" you need to add them manually.

Enter Vim

If you have painstakingly tuned a beautiful Vim environment like I did, you might be wondering if there's a way to use Vim as a pager. In fact you can.

The good folks at the Vim project ships a nice configuration file and a shell script just in case you love Vim so much that you want it to be your pager too. It's usually located under the macros directory in your Vim installation directory. For example in my case it's: /usr/share/vim/vim72/macros/

The file we need is named It in turn uses a file named less.vim. Which means you can edit the less.vim file in order to introduce your custom changes, if you need any. In that case it's better to copy the two files to somewhere else and do it. That way you leave the original files untouched.

However, if you simply just need to use Vim as a viewer we can do it easily.

1. Create a bash alias to /usr/share/vim/vim72/macros/
Eg: in your .bashrc specify,
alias vess='/usr/share/vim/vim72/macros/'

Next time you log in the alias you created will be ready to use. Or you can just reload the .bashrc again by running
Eg: $ source ~/.bashrc

Now you are good to use vess instead of less. You can use any name you instead of vless as long as it doesn't conflict with existing commands, aliases, etc.

You can always create a link named less so that your custom configuration is used instead of the original less. But I'd rather keep it as it is and use my new "vess" whenever I need a pager.

The final result acts like less. You can traverse with arrow keys, exit with pressing "q" and do on. If you need to edit the file you are viewing you can press "v" to start editing.

Wednesday, July 15, 2009

My Vim Configuration

My Editors

I have used many text editors. Some for specific tasks such as LaTeX editing (Eg: Texmaker), coding (Eg: gedit with plugins) and the others for more generic text editing.

As a system administrator I have been using Vi/Vim all along for editing configuration files and the likes. It was always convenient as almost every Unix system has vi/vim. For me the first Unix editor I used was Emacs. I felt more at home with Emacs key combinations than a hard to fathom Vim modes. Time passed and after a little while, I got used to basic Vi concepts. Since then all of my editing in command line was done in vi/vim.

As I've said recently, I have been transforming myself from a sysadmin to a sysadmin/developer kind of person. For coding purposes I used gedit. Some people might think of gedit as the notepad.exe of Linux, but that's so not correct. In fact gedit is a powerful text editor with a lot of plugins to extend it's capabilities. For example there there are plugins for LaTeX, Python consoles, bash terminal, snippet completing, snap open, integration with VCSs, smart tab/space, code formatter, class browser, Ruby on Rails modes, encryption, smart indentation, ToDo list, web browser, full screen editing, split screen, PO file editing, markdown preview, etc. among other things. As you can see, it's no toy editor. It's fully fledged editor for serious work.

Let's get back to the topic. I love gedit and I use it whenever I need. But from a couple months ago, my main editor is Vim. Vim is the most popular improved clone of the original Vi editor. It's been around for about 18 years. So you too might be wondering "Why, oh WHY, do those #?@! nutheads use vi?" or why Vim, an 18 year old, hard to learn terminal based text editor?!

I can take a lot of posts to answer that or assume you will try it yourself and get into your own terms with Vim. I'll go with the latter and share with you what my current (as of 15 July 2009) Vim configuration is.

My Vim configuration: Gavim

Note: I'm working on a Fedora Linux system. By default there's a very decent Vim configuration in Fedora. So I took the default global Vim configuration file in a Fedora 10/11 system and did the tweaks to get it to my liking. As you would have expected, a significant part of the vimrc is straight from Fedora.

Some of the plugins I use are taken from, while some are taken from their sources (mostly from GitHub repositories).

And oh, I only use Vim not gVim (Vim with a GUI).

In the first few lines of my Vim configuration file is an entry which says,
set nocompatible

which is to tell that it shouldn't try to be compatible with older Vi, and just use the Vim behaviour. I also liked to have the editor show the line numbers on left. There are other other small tweaks I like to have.

All these things are included in my Vim configuration files repository, and the files are well (hopefully) commented. So anyone interested can refer to my vimrc and find more about those.

One thing to notice is I'm using the key "," as my leader key.
let mapleader = ","

Vim 7 also has built in spell checking abilities. I find this very useful as I use Vim for every typing needs these days. I have configured 2 keyboard shortcuts to enable and disable spell checking.
map <F8> <Esc>:setlocal spell spelllang=en_us<CR>
map <F9> <Esc>:setlocal nospell<CR>

This means that I can press F8 key to turn spell checking on with language set as English (USA) and turn off by pressing F9.

I also like to have the ability fold/unfold code blocks when coding. For this I used another Vim built in.
setlocal foldmethod=syntax
setlocal nofoldenable

which sets the folding based on syntax (i.e. programming language), and doesn't enable it by default.

I also have set a place holder character to be displayed while typing "space" and "tab" characters. These are displayed until you type a new character after the tab/space.
set list
set listchars=trail:⋅,nbsp:⋅,tab:▷⋅

And BTW, the theme (colour scheme) I'm using for Vim is called "darkblack". It's a dark theme which provides very good readability. It is included in my repository.

To get the best view for most of the themes and the smoother fonts you need to tell Vim to use 256 colors in the terminal.
set t_Co=256

As you already know most Linux systems have excellent font rendering. The default on Ubuntu systems are not good, but other systems like Fedora was having quality font rendering by default for a while. So having a nice colour theme with smooth fonts is a very pleasant experience. See the screenshots for proof. :)

Those are the major Vim features I'm using. You can see everything in the configuration files. Now let's check the major Vim plugins I'm using.

Plugins I use

Different plugins may have different installation steps. Check the "Readme" files of the plugin for more details. Generally it involves copying the .vim file in the plugin package into the plugin directory of the vim configuration directory.
$ cp ./NERD_tree.vim ~/.vim/plugin/

1. NERDTree

The NERDTree plugin by Martin Grenfell is an excellent file system tree browser plugin for Vim.

You can set the exact key binding to activate NERDTree by specifying
nnoremap <leader>d :NERDTreeToggle<cr>

Once installed you can toggle the tree browser pane by pressing [leader]d in command mode. Eg: ,d

I have also set this:
let NERDTreeMapActivateNode='<CR>'

which aloows you to toggle the expanding of directory views by pressing "Return" (Enter) on the directory node.

2. Scratch

Scratch gives a temporary scratch buffer area which will be discarded when you exit vim. This is not saves in a file. It's quite useful to jot down something quick while you are editing.

I'm using s to toggle the scratch area.
function! ToggleScratch()
if expand('%') == g:ScratchBufferName

map <leader>s :call ToggleScratch()<CR>

3. Snipmate.vim

Snippet completion is a very useful thing to have when you are coding. This is a feature which can be found on almost all Integrated Development Environments (IDE). Snipmate is a cool plugin with brings some of snippets from the popular test editor TextMate to Vim.

Martin Grenfell have a useful collection of snippets to use with Snipmate.vim.

4. Bufexplorer

This is a simple Buffer Explorer plugin which with list the open buffers and let you go to any of them.

5. VCSCommand

This plugin takes care of working with different version controlling systems such as Git, Bazaar, Subversion, CVS, etc.

How to use this for you

That's all I have to tell about my Vim configuration for now. Some of the general configuration and some plugins I use are not mentioned in this post. But you are welcome to check it out.

Just in case if you are interested in using these for your Vim setup, be my guest. Be informed though. This works fine with Fedora 10/11 systems. I haven't checked on other systems, which might ot might not have differently compiled Vim setups. In any case you are welcome to grab the files and tweak it to your liking.

Here's the link to my Vim files repository: gavim

You can find more instructions in the "Readme" file there.

Monday, July 06, 2009

Still Blogging. Yes, I am

I know I have been away from this blog for quite a long time. It's been just over 6 months since I've blogged. There are reasons and other stories. But apart from all of those, I'm glad I am writing here again. I don't know how often I'll be writing again, certainly not once a day (like I ever did that). However I'm hoping now I'll have freedom to write whenever I feel like. But the best way to keep in touch with me is to follow me on Twitter.

Here's a brief account of how my life's been during the past few months which saw me transform significantly.


First thing which slowed down my blogging is microbloggin. Yes, I got in to Twitter early last year and since then never look back. I'm an avid Tweeter and it has become a part of my daily routine. One cool thing I like about Twitter is it's no nonsense and does just one thing, and one thing properly. It lets me keep in touch with like minded people and share information as a side benefit. It's the one social network service which I found non-obtrusive. Another thing Twitter did was killing my dilemma about write or not about every interesting thing I came across. It's a good thing. Now I can write here only the things I feel like.


My professional life has not been so good. I got to learn a few important lessons about how *not* to do things. I'm glad I got to learn those things but I'm really disappointed about a certain few people, whom I thought had the guts to walk the talk. I'm not without error in this interest. So I am not blaming anyone for taking my own enthusiasm about FOSS (and computing in general) and hanging myself with it. I did that to myself. Those people just gave me a place to do just that. :)

To be concise, I left one place and joined a new place hoping that there's much to do and gain. Unfortunately it was not so to be. If it hadn't been my parents, that patch was enough to see me to financial oblivion. I'm all grateful to my family including my love and my good friends for helping me to hold up. Being said all that, today I'm doing as well as any time else. Life's good. There's a lot of challenges to be faced, but I'm up to it.


I've been an undergraduate from the beginning of the recorded history I guess. When some of my friends have achieved their masters I was still in my bachelors. To my justification I've been working and doing my studies part time.

This year, finally, I finished my undergraduate studies by completing Business Computing program of the University of Wolverhampton. The lecturers were wonderful and they flew all the way from UK to deliver the lectures. Academic staff at IDM did a very good job coordinating the process.

Unfortunately I missed this years graduation ceremony. No worries, I can wait for the ceremony.


I assure you that I've seen a a lot of maturity in the last few months. A lot of people close to me might beg to differ. ;) But hey, I know how I think better.

I used to be this guy who went with the flow and thought everything would be more or less OK (in life). Maybe not exactly in the way it sounds like, but there were certain things I thought I took serious. But really I had no idea how serious they were. And I always felt a little shy/awkward to discuss about my girlfriend with my parents, even when they've known her for a long time and considered her to be one of their own. :)

From that I went on to being the guy who sat down and had 5.5 hour discussions with family about marriage, wedding, career, and etc, etc. It might not sound convincing, but I know who I am now.

New Computer

Just last Friday, I bought a new computer. Which reminds me that I have to get my old laptop into repair. I didn't feel like buying a new laptop because I hope I can get the old one working and because I can get a lot of power for a low cost if I bought a desktop. Core i7 is still a little pricey, so my bargain was a Core 2 Duo.

I got a machine with Intel Core 2 Duo 2.8 GHz processor, 4 GB memory, 320 GB SATA disk, DVD burner, Intel motherboard, 17" widescreen LCD display, Foxconn casing, etc. all under 60k rupees.

My Main OS

If you are reading this anyway the chances are, you already know that I use Linux 100%. Sometimes I've dual booted with FreeBSD and OpenSolaris, but I'm mainly a Linux user. I have long given up using Windows. I've been running Red Hat (until version 9), then Fedora, then completely Debian, then Ubuntu for a while and finally Mint until recently.

I still run Mint at home where my father, brother, cousins, etc. all who are not Linux folks are happily using Linux Mint. Kudos to the Mint team for making a very new / convert user friendly distribution of Linux. Whenever a new Linux user asks for a first distro I hand out Mint these days. It's very good. Their latest version (7), named Gloria gives a superb 1st impression.

However my personal favourite distro now is Fedora. I've run Fedora 9 alone with Mint and it was solid. So I switched to Fedora as my main OS when Fedora 10 was released. It didn't disappoint. To me Fedora has the perfect balance between use friendliness and power user convenience. It doesn't stay on my way and in the same time it makes a lot of things I regularly do (coding, documenting) really convenient. Fedora is a solid distribution of Linux and probably the one who's riding the innovation / cutting edge tide at the foremost. So I installed Fedora 11 on my shiny new desktop PC, and I'm loving it.


I've always been contributing to FOSS projects whenever I could via bug reports, mailing lists, forums, helping out new users, public events, etc. Now I'm comfortable enough reading code (remember, I'm a SysAdmin) so I might take more active roles in near future.

I've also started lurking more in IRC (Internet Relay Chat) channels at My nick on Freenode is "gaveen".

I also started contributing to the monthly, free, online IT magazine, diGIT. I'm writing a Linux basics article there. It's good to see a free magazine with good content. Gihan Fernando is leading and coordinating this effort. It should be much commended how much he takes with his crew to get diGIT out by the 1st day of every month.

Professional Transformation

From the regular System Administrator, I've gone into become more coding loving (thanks to Ruby) and more cloud aware, agile aware. I'm so glad that I looked into Ruby programming a few years ago. For the record Ruby has a great assortment of system administration / infrastructure related projects in its ecosystem.

As they say, I came for Rails and stayed for Ruby. The attraction which caught me was Ruby on Rails web application framework. But what kept me all interested was the language behind it.

I'm much interested in following things these days: Puppet (configuration management), Hudson (continuous integration), RabbitMQ (AMQP/message queuing) among many others as usual. As you can see, I've taken quite an interest in the next generation of system infrastructure. ;)

About version controlling systems, there's been no hiding how much I like Git. There's no need to repeat it. My stance haven't changed. Again for the record I started using Git before the Ruby crowd changed from Subversion (seemingly over one night) into Git users. :) I've used Mercurial, and also closed a repo using Bazaar ;) but Git is still my favourite.

My main text editor was gedit (with a few plugins) for a while. I always used vi/vim on a terminal, but on a desktop, gedit did well for me. Then a few months ago I had the opportunity to use Vim for things other than just basic editing. I used, I witnessed and now I am a believer. :)

In fact, I'm loving Vim so much that my next blog post will be about the Vim configuration I'm using. To be fair gedit is a very good editor and I also have good expectation from the new Redcar editor. However I don't see myself switching away from Vim in the foreseeable future.

That's all for this post. I'm not going to say I'm back (because I've done that before). But I'm saying I'm blogging again. I'll be back soon with a post about my Vim configuration. If you like to keep more in touch follow me on Twitter.