Archive for March 2006

Mount Diablo Calling

leave a comment »

When I looked north from the top of Mission Peak last spring Mt Diablo in the distance looked wicked and
massive. Last Sunday was one of the first clear weekends since spring season started. Since Saurabh, (an experienced and certified mountaineer – read his blog!) is here, we headed to the summit of Mt Diablo.

Volcanic Rock

There is a scenic drivable road that takes you directly to the summit and is only about an hour’s drive from home.
There are trails that run up and down the mountain. A small scenic walk around the summit is a good way to explore the scenery. It is perhaps a geologist’s paradise. At the summit it has strange rocks from Jurassic era with vein like texture, while at the Rock City towards the mountain foot has soft sandstones that have created a boulder wonderland!

Jurassic Rock
Camel Hump

There is an old saying in Kannada: “distant hills look smoother and friendly” (but in reality could be harsh and inhospitable). Mount Diablo is a contradiction!

More pictures …


Written by chandanlog

31 Mar 2006 at 4:46 pm

Posted in General

Discovering hidden utilities in Solaris: makedbm and makemap

leave a comment »

While blogging on the dbm theme, I had always used a PERL one-liner to dump the contents of my dbm databases.

dbmopen(%D,$ARGV[0],0444);for(keys %D){print "$_ $D{$_}\n"}

Scripting languages like PERL make it really easy to write “your own”, rather than try to find “some other tool” that does the work. It is perhaps faster to write your own.

However, let us see if there is anything readily available in Solaris that dumps the contents of a dbm file. If there is such a command, it might use dbm_open(3C). So we search for it in the source browser. The makedbm.c looks promising and see that it has a function unmake()
which is clearly reading keys and values from a given dbm database. Even though the command name sounds like it is a tool to create dbm files, its manpage
says it can also dump the contents of a dbm file with option -u. (while not very intuitive, think of -u as adding a negative i.e “not makedbm”)

So makedbm -u filename (without the .pag or .dir prefix) is your friend if you want to see whats in a dbm file.
makedbm is part of Solaris yp/NIS naming toolchest. It has a cousin in sendmail space too (makemap -u dbm filename)

Written by chandanlog

30 Mar 2006 at 11:33 am

Posted in Solaris

Parsing Sun Alerts

with 3 comments

If you wanted to parse a Sun Alert to get meta data like its synopsis, product, state etc., here is something more than plain old regular expressions. It is a XSLT transform, that reads a Sun Alert html file and just prints the metadata in plain text format.

Use xsltproc(1) to process the Sun Alert this way:

$ /opt/csw/bin/xsltproc --html saplain.xsl '' 2>/dev/null
Sun Alert ID: 102262
Synopsis: Security Vulnerability in sendmail(1M) Versions Prior to 8.13.6
Category: Security
Product: Solaris 9 Operating System, Solaris 10 Operating System, Solaris 8 Operating System
BugIDs: 6397275
Avoidance: Workaround
State: Workaround
Date Released: 22-Mar-2006
Date Closed:
Date Modified: 24-Mar-2006

The intent is to channel this metadata to an RSS feed, so those who prefer a RSS feed for Sun Alerts can get them that way. Watch this space for more to come.

Written by chandanlog

25 Mar 2006 at 11:51 am

Posted in Security

Great Inventions: Drawing the Numbers

leave a comment »

The problem is to represent X number of things using symbols.
You can represent numbers by dots (unary system) and put down as many dots as X. That quickly becomes laborious and boring if you were to write down a large number.
Ancient Romans invented way to map numbers to symbols. If that system was still in wide use, solaris mpstat command would have produced an output like this:

CPU minf mjf xcal  intr ithr  csw icsw migr smtx  srw syscl  usr sys  wt idl
-   XVI   I    -   CDLXXXIV  CCCLXXXIV  DXXII   XXXV    -    -    -   DCCXVI   X   IV   -  LXXXV
-  CDLXXXIV   -    -   DXXX  CDXXIX  DLXXXIX   XIII    -    -    -  MDLXXV    IX   IV   -  LXXXVII
-    -   -    -   DCCXCVI  DCXCVII MCXXVIII   XXVI    -    -    -  MMCCLXII    V   IV   -  XCI
-    -   -    -   DCCCXXX  DCCXXIX MCCCXXXIII  CCXIII    -    I    -  MMMCCCXLIII   XXI   V   -  LXXIV
-    -   -    -   DXXIX  CDXXX  DXXII    IV    -    -    -   DCCCLXXII    IV   III   -  XCIII
-  CXXVI   -    -   CDLXXI  CCCLXX  CDLIII   XXVII    -    -    -   DLXXXV    VIII   III   -  LXXXIX
-    -   -    -   DLXXIV  CDLXXIV  DCLXX    V    -    -    -  MCCXXVI    IV   III   -  XCIII
-    -   -    -   DCCLXXXII  DCLXXXII MCLXX   XLV    -    -    -  MMCDXCI    V   IV   -  XCI
-    -   -    -   DCCCXXIII  DCCXXIII MCCCLIII  CLXXI    -    -    -  MMMCDLXV   XVIII   V   -  LXXVII

Luckily we had the “base” system where numbers are divided in the form of Symbol X basen + Symbol X basen-1 + … + Symbol X base0.
You just drop the * basen repeaters and draw the symbols next to each other to get the graphical representation of a number.

CPU minf mjf xcal  intr ithr  csw icsw migr smtx  srw syscl  usr sys  wt idl
0   16   1    0   484  384  522   35    0    0    0   716   10   4   0  85
0  484   0    0   530  429  589   13    0    0    0  1575    9   4   0  87
0    0   0    0   796  697 1128   26    0    0    0  2262    5   4   0  91
0    0   0    0   830  729 1333  213    0    1    0  3343   21   5   0  74
0    0   0    0   529  430  522    4    0    0    0   872    4   3   0  93
0  126   0    0   471  370  453   27    0    0    0   585    8   3   0  89
0    0   0    0   574  474  670    5    0    0    0  1226    4   3   0  93
0    0   0    0   782  682 1170   45    0    0    0  2491    5   4   0  91
0    0   0    0   823  723 1353  171    0    0    0  3465   18   5   0  77

The base system made the common cases easy: common cases are compare two numbers, remember and write numbers, add or subtract numbers.
Life would have been so difficult without the base representation; an early application of human interaction principle, made so much difference!

Written by chandanlog

7 Mar 2006 at 3:12 pm

Posted in General

Great inventions: the space character!

with one comment


Imagine a world with out space characters or spacing between words.
Every program would look like it won something in

The International Obfuscated C Code Contest
! Google and Yahoo would have have to rewrite thier search algorithms because they are all based on “words”. The above text can be read more easily if read aloud. Imagine an office where everyone is reading out their emails!

As a child I marveled at the ‘Epigraphia Carnatica’ that was in our library. A favorite pass-time was to “decipher” the ancient stone inscriptions that were challenging to read. I would look up the symbols in a handbook that mapped the ancient scripts to new text, and try to match the letters.
The task was challenging because there was hardly any punctuation present. There might have been a pipe character | separating sentences, but none to separate words!

There is a
book on
this topic, which says that space was invented in middle ages to facilitate silent reading.
Europe invented “space” to match the “zero” from India!

Written by chandanlog

1 Mar 2006 at 4:13 pm

Posted in General