Programming and writing about it.

echo $RANDOM

Category: BookReviews

Book Review: Guide to Learning Python Decorators

Matt Harrison’s Guide to: Learning Python decorators is a mini-book dedicated to the topic of decorators in Python.

He starts off with a brief introduction to programming paradigms and subsequently introducing the concept of Python supporting first-class functions. He talks about function attributes, scope in functions and nested functions. Next, he introduces the topic of function arguments/parameters, the * and ** operators and related concepts.

(I like the way he builds up the book, starting from the very basics of functions)

Next, he introduces the concept of closures in a very easy fashion.  Reading this chapter you will feel ‘Huh? That’s it?’.

Finally, he comes to the chapter on decorators. First he introduces a simple decorator; then he talks about decorators with parameters, multiple decorators and ends with simple uses of decorators.

Short and sweet.



Book Review: tmux: Productive Mouse Free Development

I quickly browsed through the book [1]. In 88 pages, the book is what you would need to get started with tmux.

Book Cover

If you are like me, lazy (very lazy at having custom configurations for your shell/editor/whatever), Chapter 1 should be the absolute must read. It teaches the basics – creating multiple sessions, windows, panes and navigating around with them. Basics of naming sessions/windows/attaching/reattaching is shown. This chapter itself should get you quite happy about not managing multiple tabs/windows and seeing multiple panes in one window.

Once you are through with that, Chapters 2 & 3 will be your favorites if you don’t mind spending time to customize/script things up.

Chapter 4 was my second favorite chapter in the book, since it talks about scrolling/copy/pasting text from windows/panes.

Chapter 5 talks about pair programming, something which I gleefully skipped during my current reading.

The last chapter, Chapter 6 furthers on Chapters 2 & 3 about various customizations and launching tmux automatically, etc.

Each of the chapters end with a review of the most important commands/keybindings which is really good for composting your own cheatsheet.  I created by own out of a fork here [2].

All in all, get the book if you are interested in tmux (or want to get started with a terminal multiplexer). Great job by the author, Brian P. Hogan.



Book Review: Working with Unix Processes

I am subscribed to PragPub’s mailing list and that’s where I came to know of this book: Working with Unix Processes [1], by Jesse Storimer. While working on some major projects, I was looking for a light reading and hence finally bought the book. I finished it quite fast (in a couple of days) and hence thought would write a review (also gives me an excuse to write a post on something other than my Google Summer of Code work).

Book Cover

Why you should read this book?

You should read this book, if you are an application developer (Ruby or any other language) and have absolutely no idea about what a process ID is, or what a fork() is. This book attempts to fill the gap that you may feel deep inside if you learnt programming in say, Ruby or Python. There is just so much going on in a Unix/Linux system that you owe yourself to know atleast as much as is introduced in this book. It even tells you about man pages on Linux! It talks about Inter-process communication, pre-forking, copy-on-write, and some of the really fascinating things that is just so cool to know.

But beware, it just touches the surface, this book can be used as an entry point into the fascinating world of knowing Linux internals. You may even be spurred to pick up a book on Linux system adminstration or one of the Richard Stevens books [2] to know that little more that makes Linux programming so awesome.


To cut it short, considering my experience and background in working on Linux systems and being conversant with system calls, fork, exec and C programming and some experience with Network programming, I didn’t consider the 27$ very wisely spent. However, the author didn’t make any false promises and my expectations was clear: I was just looking for smome light reading. So, it was a good read overall. I did not try out the code examples, since I am not really very conversant with Ruby, so can’t comment on them.

If you have any familiarity with working with Linux systems and have some system adminstration/programming experience, buy this book if you are interested in getting an overview of things you may already know. However, if you don’t have any idea of what we talked in the earlier part of this blog post, then go buy it.

Congratulations to the author [3] for writing a short, to the point book which should serve its niche well.



[3] Author:

Book Review: Embedded Linux Primer

My review of Embedded Linux Primer: A Practical Real-World Approach is now in the stands – April, 2009 issue for Linux For You. Thanks to Linux For You and Pearson Higher Ed. for the review copy.

Book Review: The Last Theorem

I finished reading The Last Theorem, Arthur C. Clarke and Frederik Pohl. Its a story of Ranjit Subramanium and his life after he finds a proof to Fermat’s Last Theorem

There is also a parallel storyline in the book which involves characters from other parts of the universe- Grand Galactics, One point fives and machine-stored creatures. The two storylines have common strings attached at various points and finally converges in the end with both Ranjit and Myra (his beloved wife) ending up as machine-stored long after their deaths.

My main motivation in reading this book was its fictional relationship to the theorem. Considering that, I am a tad disappointed as it doesn’t really justify my choice as it has a somewhat cursory in its treatment of the theorem.

However, taking that out of the equation, this book is a enjoyable read as it takes you on a voyage in a solar sail and more. To the math lover’s delight there are references to Sophie Germain and Lady Ada Lovelace.

For a detailed review of the book, please visit

Book Review: Programming Groovy

I have zero experience with Groovy before this. However, I am well versed with the Java language and hence this review should be read from the point of view of a Java guy but a Groovy newbie. My goal in reading this book is get acquainted with the Groovy language and keep the knowledge in my sub-conscious mind so that I am ready when I need it :-)

Programming Groovy
is a great starting point to the Groovy language and more so if you are already decently acquainted with Java . The whole book is divided into three parts, each part looking at different features of the language.

Part I: Beginning Groovy

As the name of this part suggests, in this part of the book, the author begins with instructions on how to go about setting up your system for Groovy development. Among other things, working with the Groovy shell is demonstrated.

Being well acquainted with Java, I skimmed over the chapters 2 and 3. Things are very familiar in these chapters. Chapter 4- Dynamic Typing talks about data types in Groovy and some other essential information of typing in Java world and its counterpart in the Groovy world. This chapter also introduces multi-methods. Chapter 5- Using Closures was the first major interesting roadblock for me. I intended to understand it fully and so I read this chapter and worked on it for a couple of times. Co-incidentally, I was also reading about closures in Common Lisp. You will need to understand at-least, what closures are and how they can be used- Sections 5.1-5.3 (as you will later see) that closures are widely used in Groovy. Most of the times, you will be passing a closure around to standard method calls in Groovy. So, understanding how a closure works is very useful. You may also want to read more about closures here. Chapter 6- Working with Strings, introduces the GString ( he he )- which are interpolated strings, and also talks a bit about the GString Lazy Evaluation Problem. Some other topics include: Groovy’s own String Convenience Methods, and Multiline Strings. The last chapter in this part- Working with Collections talks about working with the usually available data structures: lists, maps and arrays, alongwith the convenience methods made available by Groovy.

Part I is over and I haven’t yet learnt to take a User Input or is it assumed that I am a Java developer?

Part II: Using Groovy

Using Chapter 8: Exploring the GDK, looks at the extensions provided by the GDK to make the JDK more groovy.

In the next three chapters, the author will help you start using Groovy in your daily tasks, like Working with XML files, Databases (GSQL) and mixing and matching Groovy and Java.

Part III: MOPping Groovy

This part of the book looks at the implementation of the Meta-Object Protocol in Groovy and essentially builds upon it to present other very useful concepts such as Unit Testing and Mocking (where you are shown how to write Unit tests for your Java classes in Groovy), Groovy Builders and finally, at Creating DSLs in Groovy. This part can be classified as some serious and advanced Groovy and is a great collection of some very cool concepts in Groovy.

Overall, this book of is a great introduction to Groovy for the Java developer. I am not sure, how non-Java developer would benefit at all from this book, or for that matter Groovy.

Great work by the author and the whole team!

To learn more about the book, errata and discussions, please go to

Many thanks to O’Reilly UG program for providing with a review copy to BOJUG. This review is also published at the BOJUG blog at

Book Review: A Byte of Vim

A Byte of Vim is a freely available, immensely useful and well written book on Vim which has made me more confident of using only the keyboard with Vi(m). I am not getting into a detailed review of the book, rather I will simply refer to the best (IMO) portions of the book.

The Introduction begins in a way, a thrilling flick would, by showing you the best of the ammo that you can get to watch during the rest of the movie.

The next few chapters talk about installation of Vim, the Vim modes and basic moving around tips.

Editing basics and More Editing talk heavily about yanking and more in Vim.

Multiplicity talks about tabs and a lot more in Vim. Reading this chapter will help you in working with multiple files in a single Vim instance.

Scripting and Plugins shows you how you could increase your productivity with Vim.

How can you set up your programming environment with Vim ? Programmer”s Editor helps you in that quest. Vim as an IDE?

More points some great resources to Vim scripts and resources.

This book definitely has increased by knowledge and confidence about Vim. It’s well worth your bookshelf (in your room or your computer)

Book Review: The Theory of Everything: The Origin and Fate of the Universe

I finished reading The Theory of Everything: The Origin and Fate of the Universe by Stephen Hawking, which is one of the newest additions to my library.

It is a collection of essays by Stephen Hawking as he shares his views on the origin of the universe with the reader. Rightly composed as a collection of essays, there possibly cannot be a unified treatment of the various theories that exist or existed or will exist on the subject. The essays talk about Black Holes, Bing Bang model, the theories that about of the current state and fate of the universe.

I particularly liked the essay on the arrows of time (Wikipedia article) . Starting from the earliest theories of about the Universe, this book proved to be a good refresher of the earliest science classes I took back in my pre-university classes.

I must confess that I did not get the hang of many a thing of what he has written about, but then I am no science geek.

Book Review: Practical Common Lisp

Practical Common Lisp is a freely available book on Common Lisp which gives the impression that it can be appealing to the ignorant but enthusiastic newbie to Lisp. Lisp and other languages of this niche category are often thought to be of any use, only in academic circles. This book attempts to dispel that myth by having a ToC which mixes theory and practical applications, both.

I have a working knowledge in C/C++, Python and Java and am knowledgeable of the Functional Programming paradigm. However, I have zero experience with any dialect of lisp.

In this post I shall try to put down my own reviews. chapter wise, as I read and work them.

Chapter 1: Introduction: Why Lisp?

From the book chapter: “If you think the greatest pleasure in programming comes from getting a lot done with code that simply and clearly expresses your intention, then programming in Common Lisp is likely to be about the most fun you can have with a computer. You’ll get more done, faster, using it than you would using pretty much any other language.”

This chapter puts the whole book into perspective and answers the first question that comes to the reader’s mind. A bit of history about Lisp is discussed, along with the author’s personal experiences with Lisp about getting the job done in much fewer lines of code.

Personally, I love picking up a new language from time to time. Lisp has been beckoning me for some time now. Hence, I picked up the book at the first instance.

A good first chapter. Me, the newbie likes it.

Chapter 2: Lather, Rinse, Repeat: A Tour of the REPL

The first taste of Lisp programming is felt in this chapter.

Lisp in a Box packages a Common Lisp implementation- Allegro with the Emacs editor and
SLIME– Superior Lisp Interaction Mode for Emacs. Once you extract the
tarball downloaded, you will find that there is Allegro CL
implementation, Slime and Emacs binaries.

On executing the ‘’ script, you will finally get Lisp prompt:CL-USER>

can also modify the ‘’ script to use your existing Emacs
binaries, instead of the one bundled. Modify the last line, starting
with exec emacs to point to your own Emacs installation. For eg.

exec /usr/bin/emacs --no-init-file --no-site-file --eval='(progn (load "lispbox") (slime))'<br />

The List processing is well introduced with examples such as (+ 2 3), (format t "hello world") . The concept of the return values and side-effects of functions is well demonstrated.

The rest of the chapter takes the reader in a REPL loop, moving from a “Hello, World” value Lisp code to a “Hello, World” program to the concepts of functions in Lisp. The reader also learns to save his Lisp programs and load use them in later sessions. The Lisp debugger is also mentioned.

new to Emacs are made familiar some rudimentary Emacs commands to move
around, save files, compile and re-compile Lisp sources.

Along with being a introductory chapter on Lisp programming, the reader almost has a feeling that he is learning Emacs as well, which is double whammy :-)

UPDATE: More than being a double whammy, I think its more of a hindrance to try and learn Emacs along with Lisp, even though the two do go hand-in-hand. You are better off just using the Allegro CL Environment for the code editing and execution.

All set for the next chapter.

Chapter 3: Practical: A Simple Database

This chapter is the book’s first Practical chapter in which you write some CL code to design a useful working application for you. Here, the reader code a MP3 database for a personal music collection.

This is the first post Hello World program and language features such as the fundamental list, Lisp operators- functions, macros, Property lists– simplified, but useful stripped down hash table-like data structure, Simple interactions with the user, loading and saving files on disk.

Lambdas, or anonymous functions are introduced and used widely in the code.

I come from a background in C/C++, Python, Java where one of the things I essentially do is call a function and use its return values in variables or placeholders. What I learnt in this chapter, is to design a program around functions and lambdas (anonymous functions). Yes, Python has lambdas, but I haven’t learnt to design my program around it, till now.

Another concept that I really found new is the concept of macros in Lisp:

“Common Lisp macro shares
essentially nothing but the name with the text-based macros found in
C and C++. Where the C pre-processor operates by textual substitution
and understands almost nothing of the structure of C and C++, a Lisp
macro is essentially a code generator that gets run for you
automatically by the compiler. When
a Lisp expression contains a call to a macro, instead of evaluating
the arguments and passing them to the function, the Lisp compiler
passes the arguments, unevaluated, to the macro code, which returns a
new Lisp expression that is then evaluated in place of the original
macro call.”

Pure enlightenment.

Somwhere in my mind, now I have started thinking about a program as independent blocks of symbols and operators with the order of evaluation being determined by the parenthesis. I think I will be able to write this in a more sensible way as I learn more of this.

As a side note, I would highly recommend you to read this article: The Nature of Lisp

Chapter 4: Syntax and Symantics

This chapter helps you to sink in all that has been introduced in the previous chapter. It introduces the basic paradigms and concepts behind a Lisp program with just the right amount of detail.

The burning question: What’s with All the Parentheses? is addressed in this chapter. Why does such a syntax make sense? This is explained by talking about how the execution of a Lisp program differs from the stages of execution of a program coded in other languages in Breaking Open the Black Box.

S-expressions and symbols– functions, macros and special symbols are all explained in detail. The usage of macros in the previous chapter is explained in greater detail here.

The reader also gets to know about how all (almost) Lisp operations are evaluated as functions and all expressions are Lists in Lisp. Thus, appreciating all the parenthesis that surrounds the code.

The chapter concludes by looking at Truth, Falsehood, and Equality in Lisp.

Chapter 5: Functions

Functions, which is one of the three basic components of Lisp programs (others being, macros and variables) are given detailed treatment in this chapter. After using them in chapters 2 and 3, this chapter looks at the various components of a function in great detail.

Different kinds of parameters that a function can take is discussed here.

Returning from functions, Higher Order functions, Lambdas (Anonymous functions) are the other things discussed.

Chapter 6: Variables

This chapter takes a look at another basic building block of Common Lisp- variables.
Lexical and Dynamic variables and their features are discussed in detail. Closures are discussed for the first time in this chapter.

Basic operations on variables are demonstrated.

Chapter 7 and 8: Macros: Standard Control Constructs, Defining your own

In these two chapters, the author writes about Macros in Common Lisp. In chapter 7, the author looks at the standard control construct macros defined by Common Lisp. This chapter helps the reader to understand a lot about how macros are used, almost everywhere in the language itself in Common Lisp.

The next chapter builds upon the former to help the reader to write a trivial, but useful macro on his own, introducing concepts along the way to write code that writes code.

Chapter 9: Practical: Building a Unit Testing Framework

In the second Practical
chapter, the author helps the reader code a simple Unit Testing
Framework, mostly making use of some of the concepts introduced in the
last couple of chapters on Macros.

Chapter 10: Numbers, Characters and Strings

As the name of the chapter suggests, this will be one of those reference chapters you will coming back to, as you use more of numbers, characters and strings in the Common Lisp language.

From here onwards, you will notice that, reviews for later chapters appear earlier and vice versa.

This indicates a couple of things:

  1. That I am reading the chapters, which I find interesting first and then coming back to some earlier chapter which might have been referred to in there
  2. More importantly: Most of the basics have been covered till Chapter 10

Chapter 21: Programming in the Large:Packages and Symbols

As is apparent, this chapter is a first step in the world of writing and using medium to large scale Common Lisp codes. As you start coding you may want to help the world by creating and distributing your own packages or use a lot of third party packages which provide Common Lisp features which may not be available in a standard implementation. This chapter takes on a tour of packages and a detailed look into how the REPL resolves symbols.

A must read before moving on to the later chapters.

Chapter 14 and 15:

Files and File I/O and the next Practical chapter, as their names suggest looks at working with files- text and binary using Common Lisp.

These chapters introduce important concepts such as Pathnames which help abstract Operating System level differences in the way files are referred to. The practical chapter builds upon Pathnames to code up a truly portable pathname library using *FEATURES* to work across several Common Lisp implementations. This pathname package will be used in later chapters to code up other practically useful tools.

Post last updated on March 10, 2009

Book Chapter Review: (Python) Package Management

Chapter 9 of the book Python for Unix and Linux System Administration, 1st Edition discusses package management in the Python programming language.

When you read the chapter, you get a feeling that you are reading about package management on your favorite Linux distro, which IMO is a good thing. I, personally love to co-relate the new things I learn with things I already know.

It starts off with Python’s own apt-get (or zypper or yum): easy_install. Then it moves on to Python eggs, and how simple it is to create them.

You have written a Python package and you want to upload it to the Python package index. The book shows you how.

The chapter also looks at Buildout, and virtualenv (which helps set up more than one ‘virtual’ Python environments on your system, like chroot does)

Update: The book also talks about ESP Package Manager (EPM)