Archive for December, 2008

Atoms in Regular Expressions

Posted in Perl with tags , , on December 14, 2008 by vinaychilakamarri

I read about something interesting today. There is a term called ‘Atom’  when you are dealing with regular expressions. Knowing the importance of  how you formulate a regular expression becomes important because some
expressions might turn out as something you usually don’t anticipate. Talking about quantifiers in the context of  atoms, the importance of atoms becomes more vivid when you consider this example: ha{6}, (ha){6}. Although
they seem to be very similar, the additional parentheses treat ‘ha’ as a single atom and match only those words whose pattern contains ‘ha’ for 6 consecutive times. The former expression tries to match only those patterns in which ‘h’ is followed by 6 a’s. Let’s say I wanted to match a word that starts with ‘pre’ and ends with ‘tion’

These are some of the possibilities that I should be expecting:

So, a possible expression can be:


Any word that beings with the atom “pre”, in which the atom “pre” Must occur at least one time and can occur more than one time after the beginning, and there can be 0 or many characters in the middle, starting from a-z OR A-Z OR space characters with a quantifier *, which indicates that the characters can occur 0 or more times, with an external quantifier that ensures that the letter case is ignored during the match, and it only matches the patterns that end with the atom, “ion”, which is specified by the concluding $

Example 2:


Says that the atom ‘ord’ has to be preceded at least once by a number. The + quantifier after [0-9] signifies that the numbers can be repeated any number of times. Also the ^? signifies that the numbers need not start from the beginning of the pattern in question. Also what the “\$?” means is that the pattern need not essentially end with the atom “ord”

Advanced Packaging Tool forces the usage of CD-ROM sources and quits…. help!

Posted in Linux with tags , , , on December 13, 2008 by vinaychilakamarri

When I started using a headless Debian, my only weapon to install the needed packages was ‘apt’. But I was hit on the head, when it was forcing me to install sources from CD-ROM, instead of looking for sources from the internet. Picture this scenario:

vinay@darkbox:~$ sudo apt-get install blah-app


After printing some packages that need to be updated



[b]Media change: please insert the disc labeled
‘xxxxxxxxxxxx_xxxxxxxxxx_ -xxxxxxxxx(xxxxxxxx)’
in the drive ‘/cdrom/’ and press enter
Media change: please insert the disc labeled
‘xxxxxxxxxxxx_xxxxxxxxxx_ -xxxxxxxxx(xxxxxxxx)’
in the drive ‘/cdrom/’ and press enter

** The xxxxxxxxxxxx_xxxxxxxxxx_ -xxxxxxxxx(xxxxxxxx) can be anything depending on your distro.

A solution for this is to comment out the source list that points to the CD-ROM on the apt sources. So I did this:

vi /etc/apt/sources.list and comment the line that reads something similar to this:

deb cdrom:[ xxxxxxxxxxxx_xxxxxxxxxx_ -xxxxxxxxx(xxxxxxxx) ]/ hoary main restricted

This will restrict the apt tool from looking back to CD-ROM for the sources and quit. There may be some other approaches for this problem. It would be helpful if anyone who reads this thread discuss those approaches here.

Good Luck!