Sunday, August 02, 2009

Ask Mr Make

Ask Mr Make is a tips and tricks column on build systems with an
emphasis on GNU make. The wealth of information provided by these
articles apply directly to real world problems, something that the
manual does not do. Also, there are fun articles like solving the
Tower of Hanoi problem using make that demonstrate the extent to
which make can be (ab)used. Highly recommended if you are the kind
of person who writes makefiles by hand.

Thursday, July 16, 2009


I've replaced GNU Screen with tmux as my preferred terminal
multiplexer. The main reason is that the defaults are better in tmux
and I don't have to worry about setting up a config file. For
example, with screen, I need a (rather simple) configuration file
to get the status line that I get with tmux by default. I also like
Ctrl-b better than Ctrl-a used by screen as Ctrl-a is a heavily
used key combination (emacs, terminals with emacs-like line editing

tmux seems to use less memory than screen and for me this is be a big
plus as there is very little RAM left on my VPSs when running the
various fastcgi and squeak processes.

The code for tmux is arguably better than that of screen and it is
under a BSD license. Recently it was imported into the Open BSD
base system. This is what Theo had to say about the software:
The most impressive thing about tmux, in my view, is how
frustrating the code audit was. In 2 hours, I found only one
or two nits that had very minor security consequences. It was
not accepted into the tree based on license alone. It is high
quality code.
Here's an interview with the author of tmux:

Sunday, July 12, 2009


I've been using Clang as a drop-in replacement for GCC for compiling C
code and so far it has been pretty good. While I did not see any
drastic increase in performance of the generated code, the compile
times have come down considerably. For example, compiling a fresh tree
of the latest emacs pretest took 1m55s using GCC on my quad-core
box. The same test with Clang took just over a minute. Other things
that I've built using Clang that are working well without any problems
include: GNU Smalltalk, cmus, tmux and a whole bunch of stuff.

Clang is a C/C++ and Objective-C frontend for the LLVM "compiler
infrastructure". As of now, the C and Objective-C frontends have
reached production quality on x86 and x86-64. The C++ frontend is no
way near completion and is not expected to be complete in the near

Apart from the compilation speed one other feature that is in favour
of Clang is the shockingly expressive diagnostics. Along with the
message, the exact code fragment that is causing the problem is also
shown. If the C++ frontend is able to provide this feature and I'm
sure it will as it is a fundamental goal, this feature alone is going
to propel the adoption of Clang. GCC sure does have its place thanks
to the support of other languages like Ada, Fortran, Java, Pascal
etc. However Clang improving at this rate is surely going to supplant
GCC atleast on the primary hardware platforms. The BSDs in particular
are quite keen on replacing GCC as is evident from the funding of the
development of the Portable C compiler. With Clang already compiling
the kernel source and 99% of the userland, FreeBSD is seriously
considering replacing GCC with Clang in the base system. I think it is
just a matter of time.

An excellent intro to Clang can be found here:

Clang features can be found here:

Instructions for building Clang can be found in the Clang Getting Started
page. In addition to the instructions given there, I added
--enable-optimized to the configure script when building llvm to avoid
building the debug versions as they tend to take up a lot of disk

Building programs with Clang is easy. It comes with a gcc compatible
driver called "clang" so all you need to do is to make sure
llvm/Release/bin is in PATH and run configure as

CC=clang ./configure

LinuxMint 7 "Gloria"

It's been six months and time for change. I’ve switched from OpenSuSE
11.1 to Linux Mint 7. Prior to that I was running ArchLinux for a year
and it was a solid distribution with a fantastic package manager. But
after Chip Magazine came out with the 11.1 DVD I wanted to try out
OpenSuSE 11.1. OpenSuSE, overall, has been mostly stable for me and I
loved the artwork. While things like package upgrades were efficient
through the use of binary (x)deltas, the package manager itself drove
me nuts. It was way too slow on my not-so-fast connection. Over the
course of six months, I had to install a few packages from the build
service which prompted me to add a few additional repositories. Now
everytime the package manager was launched it tried to refresh the
package list. While I understand the reasons it simply was
annoying. Sometimes the refreshing would simply hang. So everytime I
had to hit Skip Refresh after launching the package manager and the
whole exercise was irritating.

Another reason was the PulseAudio sound system. This caused the
biggest pain and I din't manage to resolve the problem. Sound input
never worked and the output volume was too low. To add to the misery,
I had a skype meeting and the webcam was not working. While the camera
was picked up the device /dev/video0 had permission issues. I'm sure
these things can be fixed after enough googling but I simply didn't
have the patience for it. I had issues running virtual machines under

Finally, my / partition had grown to 80% of its size which is a signal
that enough cruft has accumulated on my system and that usually is
when I switch to another distro :)

I had been watching the progress of Linux Mint and when 7 came out I
decided to switch. Thanks to its Ubuntu base, installation was a
breeze and post-install, I didn't have to hunt for codecs as the
installed mplayer played most of the videos I threw at it. Artwork is
as good as OpenSuSE's and even the menu was very similar. The
"mint-green on dark" theme looks very nice and overall it's a lovely
green desktop.

The package manager (mintInstall) has a list of "featured"
applications for things like Adobe Reader (stay away from it!), Skype,
VLC, Audacity etc. Handy.

Audio is still controlled by PulseAudio but on Mint7 there was a
control panel to control it and I was able to adjust the output to an
audible level. Sound input is still not working. Skype picked up the
webcam and that is a relief.

Overall, I really like the system. Boots fast, plenty of packages
thanks to Ubuntu and Debian underneath, nice green desktop, KVM
virtual machines not complaining. Happy!

Saturday, July 11, 2009


I was looking for a bigger font for my terminals as 6x13 was starting
to look too small on my display. For terminals, I prefer the crisp and
sharp appearance of bitmap fonts although Envy Code R is not bad at
all. Ctrl-Rightclicking on XTerm gives you a menu where you can select
a large font which turns out to be 9x18.

Originally part of the ucs-fonts package, the font got merged into
core X distribution. This is what the website says about the font:

9x18 is an improved version of 9x15 that has more space above and
below the base characters to increase readability and to allow
overstriking combining characters to work properly.

Indeed, the font is nice and tall (although some may say spindly) with
a good inter-line spacing making it a good choice for terminals. Also
the font has a good coverage of characters. For example, it includes
all mathematical symbols, smiley and even chess pieces (terminal based
FEN viewer anyone?)

-Misc-Fixed-Medium-R-Normal--18-120-100-100-C-90-ISO10646-1 is the
actual XLFD 9x18 is aliased to but on my machines (Ubuntu and
OpenSuSE), the fonts.alias file did not have the entries so I had to add
them manually.

Versions of -misc-fixed family are also available for Windows. My cmd.exe
windows use 6x13 giving me plenty of lines of clear text.

Monday, July 06, 2009


For the last two weeks, I've been down with chicken pox. While the first
10 days were pretty bad things are improving as I'm finally off of curd
rice and raw onions and slowly getting back to eating some tasty food.

This little period of rest is a god-send for me as I was getting worked
up at work and an ever piling reading list adding to the irritation. The
last few days, apart from reading, the tool seeker in me has found some
really cool tools and when you start dreaming of use cases for these
cool toys and tools, the pain and the irritation just vanish. Hopefully,
I shall blog about them here this week as I'll be quarantined for atleast
another week.

Tuesday, March 17, 2009

LyX, LaTeX and books...

I'm typesetting a book for a friend. Initially I had to decide between LaTeX and ConTeXt. Although LaTeX had a WYSIWYM editor in LyX I've always liked ConTeXt for its perceived completeness (their documentation always looked better than the rest) but I haven't touched it since 2002 when I last used it for preparing reports for college. However after checking out LyX 1.61 the choice was easy. LyX has come a long way since the early versions that used the XForms toolkit.

As for the document class to use for the book the popular choices seemed to be KOMA-Script and Memoir. I almost selected KOMA-Script when at the last moment decided to take a look the Memoir documentation and I was pleasantly shocked! The documentation for the memoir class is simply brilliant! (and beautifully typeset too!). It is not only a class documentation but also a complete introduction to typesetting. I'd say it is mandatory reading for any novice getting into typsetting. Google for memman.pdf and give it a good reading.

I ended up using LyX with minimal ERT needed to customize the memoir document class.

Here's an article that presents a good overview on designing a book with LyX:

Also a good set of tips was picked up from

For preparing bibliographies, JabRef is a nice utiility for managing your BibTeX databases.

I haven't really looked at indexing options but the book is mainly an internal monograph so the index can be omitted.

Monday, March 16, 2009

Hello again!

Back to blogger after roaming elsewhere for three years. As was mentioned in my last post here, I moved my blog to WordPress but was never happy which ofcourse had to with the then prevailing confusion in my life rather than wordpress itself. I eventually deleted that blog in early 2008 and then moved my blog to my own VPS on linode. After grappling with toolset issues (dokuwiki, blorg, ikiwiki) finally settled on pier which is what the fork of this blog is currently running on at .

In the meanwhile this "dead" blog was getting more hits than all the other blogs put together. Also blogger is now a google service which meant that it was auto-associated with my gmail account which happens to be my primary email account. There were also additional conveniences like mail2blogger which suits my workflow than logging in and editing posts inside a HTML editor (which I really hate btw). All these factors made me want to switch back to blogger and continue my original blog. However there was a nasty problem: I forgot the password and the email that was associated with my blogger account was no longer there. So this blog was more or less orphaned but the hits kept coming. Wrote a few times to Google but I guess my requests went to /dev/null.

Finally, today I sat down to methodically try and eliminate all the passwords I've used so far in my life. After an hour of trial (and getting kicked out) I managed to login!!!

So here I am, back to where I first started.