rkrishnan is currently certified at Journeyer level.

Name: Ramakrishnan Muthukrishnan
Member since: 2001-04-06 12:31:31
Last Login: 2011-01-26 13:15:34

FOAF RDF Share This

Homepage: http://rkrishnan.org

Projects

Recent blog entries by rkrishnan

Syndication: RSS 2.0

On writing books

Posted on March 2, 2014 by rkrishnan

Off late, I had been reading the Plan9 papers from Bell Labs. The papers prompted me to go back and read some of the books written by the same folks at Bell Labs.1 What is so astonishing is that the books written by these finest engineers are the clearest form of writing about programming that has ever been produced. These books almost never exceed 300 pages. Let me list some of the books here:

  • The C Programming Language, Kernighan and Ritchie.
  • The Unix Programming Environment, Kernighan and Pike.
  • The practice of programming, Kernighan and Pike.
  • Software tools, Kernighan and Plauger
  • C traps and pitfalls, Andrew Koenig
  • The AWK programming language, Aho, Weinberger and Kernighan
  • Elements of programming style, Kernighan and Plauger
  • Programming Pearls, Jon Bentley.
  • More programming pearls, Jon Bentley.
  • Compilers: Principles, Techniques, and Tools, Aho, Sethi and Ullman.
  • The design of the Unix operating system, Maurice J. Bach.

I believe this covers the list related to Unix/C and other related tools. There could be more that I don’t know about.

At the risk of repeating myself, here are the salient features of these writing (and also the Plan9/Unix papers).

  • concise.
  • clear and unambiguous.
  • lots of clean code examples to illustrate the points.
  • wonderful exercises.
  • lots of real life examples.

The AWK book has an example showing a simple implementation of make, in ~5 pages. Tell me any other book that does that.

Why is it that these authors consistently wrote these high quality books and papers? I believe it is because they worked on it first and were genuinely interested in sharing their work with others. They also strived for the highest quality in all their work - be it writing software or writing documentation.

Contrast it with the modern world. Within a few months of a new language or a library or better a “framework” appearing in the Internet, a bunch of books gets announced on Twitter and twitter handles setup to announce the upates of the book. Most of these are written by people with the sole intention of getting more search hits for their names in the popular search engines and have not built anything big and “real world”. Some of these books only discuss very superficial examples and lack exercises and real examples. Some present-day authors like to fill their books with footnotes. If I were interested in history rather than content, I would rather look up elsewhere on the web.

The Bell Labs books were all “Real World” books without attaching “Real World”2 on the titles that some of the current generation books do in order to differentiate themselves from the non-real-world ones. This is a pity and is mostly the author’s fault. In their rush to fame, the poor reader and her money and time has no place!

If you are a potential author, please read at least some of the above listed books and try to emulate them, please, for the sake of computer science!


  1. Reading these papers also prompted me to think how much of an antithesis of Unix, the “modern unices” have become.

  2. I didn’t mean anything bad about “Real World Haskell” or “Real World Ocaml”. They are both fine books written by great authors with lots of experience on the topic and it shows.

Syndicated 2014-03-02 00:00:00 from Ramakrishnan Muthukrishnan

Haskell books

Posted on January 3, 2014 by rkrishnan

There are lots of books on the programming language, Haskell, which, the folklore say, has a steep learning curve. I am no Haskell expert, having embarked on the journey to learn Haskell myself two years ago and still very much learning. A friend of mine recently asked me for recommendations on Haskell books, which inspired me to write this post. Again, I am no Haskell expert, still very much a journeyman Haskeller.

Usually two books get recommended by almost everyone. Those two books are

There is no question that these two are great books. I have paper copies of both the books and still use them. I think everyone aspiring to learn Haskell should read these books, especially RWH. I am not a big fan of LYH though. I feel that the Haskell Tutorial or YAHT already covers everything in LYH in the same or better way.

There are some other books that I like along with RWH. One of the thing I look, in any programming book that I intend to buy (investing my money) and read (investing my time, because I am serious about learning the material) is that they contain exercises. I feel that testing one’s knowledge of understanding is extremely important and good exercises of varied difficulty (good books indicate the level of difficulty of exercise problems) is very important, as far as I am concerned. So, with that in mind, here are my recommended books on Haskell:

Actually I read the previous edition of this book co-authored by Phil Wadler but that book had its examples in Haskell’s pre-cursor language, Miranda. I think just about every programmer should read this wonderful book for the clarity of presentation.

Hutton’s book is probably what one should read (and work through) to get deep into Haskell. It has some great exercises as well. Some people compare this book to K&R C book. For those experienced in other Functional programming languages, this is a great book.

Writing real world programs

I found myself staring at my editor sometimes with just the below lines on it:

  main = 

The problem is that most of these books teach the purely functional part of Haskell beautifully well. While that is very important and requires a different mindset, especially if one has a prolonged exposure to imperative programming, it can only help to get the room warm by heating up the CPU. One need to interact with the real world to do some stuff in and out. It is extremely easy to do I/O in Haskell. Just start using it without worrying about Monads.

And that brings me to the next topic:

Do not learn monads by analogies. Do not read any Monad tutorials which compares Monads with anything else. Just start using it. Take some time to learn the type signature of Monads and start building programs with them.

If you really want to read a monad tutorial, I highly recommend these two papers.

If you are allowed to read just one blog post on the subject, I would suggest reading Chris Taylor’s post on IO Monad. Be sure to read it after reading Wadler’s and SPJ’s papers.

This is where RWH comes into picture. It has a number of great examples and is written by programmers who have contributed tons of great code to the Haskell community.

Algorithms

Traditional algorithm books describe algorithms in imperative style. Two great books exist in the Haskell world that beautifully describe algorithms.

Other misc resources

Another great resource is Don Stewart’s StackOverflow answers on Haskell and the #haskell freenode irc channel. I am not big into irc. I join the channel occasionally, it is one of the most friendly places to hangout with other Haskell programmers.

Happy Haskell Hacking!

Syndicated 2014-01-03 00:00:00 from Ramakrishnan Muthukrishnan

2013 in review

Posted on December 31, 2013 by rkrishnan

2013, like other years, was a mixed bag. For the first time in years, I had to witness the death of someone very close to me. I spent a lot of time in hospitals, in front of Intensive Care Units, slept on the benches on the hospital corridors, talked to many others like me who were anxiously hanging out at hospitals waiting to hear from the Doctors who made lightning visits, uttered a few words and left.

Some of the people went home alive, some unfortunate old and young didn’t.

On the positive side, I completed two courses on Coursera, Algorithms Part-1 and Algorithms Part-2. I really felt after completing these courses that I made a step forward in my own quest to become a better programmer.

I have no big ambitions for 2014. I just want to be a better human being, spend more time with family, do more of what I like and be with people I love.

I also hope that the world would judge people for what they are, rather than by the tags they carry (age, sex, qualifications, job…).

Happy 2014!

Syndicated 2013-12-31 00:00:00 from Ramakrishnan Muthukrishnan

Optimizing Iceweasel/Firefox for privacy

Posted on December 1, 2013 by rkrishnan

Ever noticed an apparel that you looked up on a website showing up as an Ad when you are browsing another website? What is going on here? How did a web page show you ads for products you visited on a totally different website?

Partly this is the work of those facebook like buttons and Google’s +1 buttons. Let us say you were logged into facebook on a browser tab. Now you visit many other pages on other tabs. Some of these pages make have the “like” buttons. Now, here is the deal: Every time you visit a page, a series of HTTP GET requests are made by the browser to get the elements (like images etc) on the page. Facebook knows from the cookies that who you are. Now they also get a HTTP GET request for a button along with this cookie and so they know which website this button appears in and so they know you visited that page.

In fact, facebook’s data usage policy page explicitly states this:

  Advertisers and their partners sometimes use cookies or other similar technologies 
in order to serve and measure ads and to make their ads more effective. Learn more 
about cookies, pixels and similar technologies. 

Here are a few plug-ins I use with Iceweasel (that’s the name of the popular Firefox browser on the Debian GNU/Linux system) that help in making web browsing, a pleasant experience.

1. Adblock Edge

Adblock Edge(ABE) is a fork of the excellent Adblock Plus (ABP). AdBlock Plus sold out to Ad companies like Google and included a bunch of ads in their whitelist. ABE is a fork before they made the change. I guess we are indebted to ABP author for the great contribution. ABE with “EasyPrivacy” and “EasyList” filters can make the web browsing experience a lot lot nice! To see the difference, try browsing a few popular websites with and without ABE for a day.

Install

2. HTTPS Everywhere

HTTPS Everywhere is a plugin to force https protocol if it is available, for safe and secure browsing. Most websites which requires one to login (like email, banking etc..) all implement https. But some still don’t or give an option for http vs https. In such cases, this plugin forces the use of https.

Install

3. Duck Duck Go search widget

I had been trying to move away from Google for most of my daily browsing needs including search. Duck Duck Go search quality has been improving steadily and is very much usable for most purposes. DDG explicitly has privacy of its users as one of their goals. They are a company like Google, so they can change their policies (like the way Google did with the “don’t be evil” goal). So, watch out. Until then, enjoy DDG. Unlike Google, DDG does not wrap URLs in the search results with a redirector to track clicks.

Install

4. Greasemonkey + NoScript

It is interesting to see the amount of code we execute on our machines without explicitly invoking a program. Every webpage include a number of JavaScript files which gets downloaded and executed when we visit websites. What do those JavaScript files do? Some of them are libraries like JQuery. Some of them are explicitly there to track users (like the Google Analytics scripts). We, the users, should have control on what should run on our machine and tracking should be opt-in, rather than opt-out.

It is also well known that a user can be uniquely identified from the Browser’s user agent string.

A number of websites work quite nicely without any JavaScript at all. GMail has a mode which works well without JavaScript. But unfortunately many don’t work well (like Amazon.com, for instance). But with NoScript, one could make this experience less painful.

Install Greasemonkey Install NoScript

5. RefControl

Everytime one clicks a URL on a webpage, which takes us to another page in the same website or a different website alltogether, the HTTP request message also sends a Referrer header which tells the website, where the request came from. This is a crucial piece of the puzzle in constructing a graph of anyone’s web browsing habbits. We could turn off those referral requests with the RefControl plugin.

Install

6. Disconnect

There is yet another privacy plugin called “disconnect” that promises to keep trackers (twitter, facebook, g+ buttons, cookies etc) away. Since I use it in conjunction with other plugins, I don’t know how good it is working. Looks like Disconnect is some kind of a well funded company.

Apparently there are many in this category being developed by funded companies like Ghostery, DoNotTrackMe and so on. I used Ghostery and DoNotTrackMe in the past. But currently I use Disconnect as its code is freely available.

Install

7. Other Misc settings

A few other tips:

  1. Turn On the private browsing mode in the browser if you don’t want to store the history. Some people like to have the history to make their browsing experience easy and it has its own merits and demerits. I visit facebook only on a browser in private browsing mode. This is not enough. One also need to make sure that no other websites are visited while the facebook page is open in a tab. One need not worry about logging off. If one closes a browser in private browsing mode, no cookies are stored, so the “like” buttons on other websites cannot track the identity. (Remember, they still can profile a user based on the User Agent string)

    I also clear history and cookies when I quit the browser. This can be set up on Firefox preferences.

  2. Turn on the “Do not Track” option. Both Firefox and Chrome has this option. But make sure that you turn the DNT option on, it may not be on by default.

  3. Use a browser that has its source code published as Free Software. This means, Firefox or variants, Chromium, or one of those webkit derivatives like Epiphany. Note that Google Chrome is not Free Software but Chromium is. Mozilla is a non-profit corporation and I trust them more with protecting the web users than a for-profit corporation that explicitly wants to know everything about everyone.

    Google has access to your emails(Isn’t it ironic that they filter out email SPAM and show you spam in the form of ads on the side?), your likes/dislikes/opinions, your location and also your DNA. They also wants to know what you see and also track your eye movements within the screen and elsewhere. The Moto-X phone from Motorola/Google has its microphones on all the time reportedly to take voice commands. But it is also the new stark reality. In the name of convenience, people are enticed to give up their privacy.

  4. Tor onion router is one of the best guard against censorship and tracking. There are many ways to use Tor along with Firefox at the cost of a bit of latency. I like to use the OS Distribution called Tails on a USB stick when browsing from an internet cafe. Tails is a special GNU/Linux based distribution that can be installed on a USB stick, which has a bunch of privacy tools built in, including a special version of Firefox with Tor button enabled.

  5. Turn on the “Block pop-up” windows option to block the annoying popups.

  6. Install only those extensions that have their source code published. It is a bit hard to find that from the Firefox add-on page. One has to go to the specific page for an add on and look under “Version Information”. Chose only those extensions that is made available under a Free Software license. Remember that browser is a very critical piece of software used by anyone in their daily work flow and it is extremely important that we don’t leave it to others to decide on the issues related to privacy.

  7. YouTube has become as anoying as the regular Idiot Box these days with a lot of ads before and in-between the videos. I use YouTube Center to get rid of them and also give me a few other features like download the videos for offline viewing and so on. Not related to privacy per se, but helps in making YouTube video viewing, a better experience. It is highly likely that YouTube may do something to break this extension by changing their protocol, so that show the ads and the developer has to play a catchup game.

  8. There is another Firefox plugin called RequestPolicy that can catch cross site requests. It is recommended for security paranoids. It gives information on the connections made by a website into other domain names (eg: http://foobar.org making connections to Google Analytics website). These connections are reported and can be blocked as well.

  9. If you are concious about your privacy on the Internet (which every Internet user should), you should read the articles on the Electronic Frontier Foundation.

Syndicated 2013-12-01 00:00:00 from Ramakrishnan Muthukrishnan

Finding the powerset of a set

Posted on November 25, 2013 by rkrishnan

PowerSet of a set S is a set of all subsets of S. For example, Powerset of {a, b, c} is { {}, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c} }. For any set of length n, the powerset will have a length of 2^n.

Writing a program to find the powerset is easy to write, if we can visualize powerset. A simple inductive way to think about it is that the subsets of the set S, either has an element in S or not. We recursively apply this rule, the base case being that the empty set is a subset of S. This can be visualized as a binary tree as shown below.

Members of the powersets are the leaves of this tree. You can now easily come up with a relation:

Powerset of S = (first element of S U x) U S’ where S’ = Powerset of {S - first element of S} and xS’

In other words, take the powerset of S without first element, let us call this set as S’. Now, for each of the element x in S’ find the union of the first element with x. This is the first part of the power set. The other part involves those that does not have the first element and this is S’ that we have already computed. The final answer is the set union of first part and second part.

This can be translated to the following racket program

  #lang racket

;; List -> ListOf List
(define (powerset s)
  (if (empty? s)
      (list empty)
      (let ([ps (powerset (rest s))])
        (append (map (λ(l) 
                       (cons (first s) l)) 
                     ps) 
                ps))))

Or even better, this version uses the Racket list comprehension functions and a more direct translation of our definition of the powerset function:

  #lang racket

;; List -> ListOf List
(define (powerset s)
  (if (empty? s)
      (list empty)
      (let ([ps (powerset (rest s))])
        (append ps (for/list ([x ps])
                     (cons (first s) x))))))

Here is an example:

  Welcome to DrRacket, version 5.3.6 [3m].
Language: racket; memory limit: 128 MB.
> (powerset '(a c))
'((a c) (a) (c) ())
> (powerset '(a b c))
'((a b c) (a b) (a c) (a) (b c) (b) (c) ())
> 

Syndicated 2013-11-25 00:00:00 from Ramakrishnan Muthukrishnan

266 older entries...

 

rkrishnan certified others as follows:

  • rkrishnan certified rkrishnan as Journeyer
  • rkrishnan certified raph as Master
  • rkrishnan certified cjwatson as Journeyer
  • rkrishnan certified rms as Master
  • rkrishnan certified jwz as Master
  • rkrishnan certified greve as Master
  • rkrishnan certified atai as Journeyer
  • rkrishnan certified jfleck as Journeyer
  • rkrishnan certified BrucePerens as Master
  • rkrishnan certified srivasta as Master
  • rkrishnan certified psg as Journeyer
  • rkrishnan certified joey as Master
  • rkrishnan certified mathieu as Journeyer
  • rkrishnan certified ajt as Journeyer
  • rkrishnan certified abraham as Master
  • rkrishnan certified walters as Journeyer
  • rkrishnan certified sjanes71 as Journeyer
  • rkrishnan certified sdodji as Journeyer
  • rkrishnan certified vivekv as Journeyer
  • rkrishnan certified logic as Journeyer
  • rkrishnan certified achitnis as Apprentice
  • rkrishnan certified ole as Journeyer
  • rkrishnan certified chalst as Journeyer
  • rkrishnan certified dpatel as Journeyer
  • rkrishnan certified sri as Apprentice
  • rkrishnan certified jLoki as Journeyer
  • rkrishnan certified RobinS as Journeyer
  • rkrishnan certified edd as Journeyer
  • rkrishnan certified werner as Master
  • rkrishnan certified davidw as Journeyer
  • rkrishnan certified etbe as Master
  • rkrishnan certified gary as Journeyer
  • rkrishnan certified zhaoway as Journeyer
  • rkrishnan certified gman as Journeyer
  • rkrishnan certified scjody as Journeyer
  • rkrishnan certified Archit as Journeyer
  • rkrishnan certified bratsche as Journeyer
  • rkrishnan certified amars as Journeyer
  • rkrishnan certified nixnut as Journeyer
  • rkrishnan certified Kay as Journeyer
  • rkrishnan certified ariya as Journeyer
  • rkrishnan certified cmiller as Journeyer
  • rkrishnan certified ianmacd as Journeyer
  • rkrishnan certified hacker as Master
  • rkrishnan certified Cardinal as Journeyer
  • rkrishnan certified hadess as Journeyer
  • rkrishnan certified RossBurton as Journeyer
  • rkrishnan certified jdub as Master
  • rkrishnan certified fejj as Master
  • rkrishnan certified arvind as Journeyer
  • rkrishnan certified dalinian as Journeyer
  • rkrishnan certified nullity as Journeyer
  • rkrishnan certified roshan as Journeyer
  • rkrishnan certified jamesh as Master
  • rkrishnan certified Chicago as Journeyer
  • rkrishnan certified TordJ as Master
  • rkrishnan certified jpick as Master
  • rkrishnan certified tromey as Master
  • rkrishnan certified Deepa as Journeyer
  • rkrishnan certified wardv as Journeyer
  • rkrishnan certified jaldhar as Journeyer

Others have certified rkrishnan as follows:

  • rkrishnan certified rkrishnan as Journeyer
  • fxn certified rkrishnan as Journeyer
  • greve certified rkrishnan as Journeyer
  • mathieu certified rkrishnan as Journeyer
  • sdodji certified rkrishnan as Journeyer
  • etbe certified rkrishnan as Journeyer
  • jLoki certified rkrishnan as Apprentice
  • nixnut certified rkrishnan as Journeyer
  • ariya certified rkrishnan as Journeyer
  • cmiller certified rkrishnan as Journeyer
  • dalinian certified rkrishnan as Journeyer
  • roshan certified rkrishnan as Journeyer
  • wardv certified rkrishnan as Journeyer
  • domi certified rkrishnan as Journeyer
  • derupe certified rkrishnan as Journeyer
  • nikole certified rkrishnan as Master
  • ahiliation certified rkrishnan as Journeyer
  • achitnis certified rkrishnan as Apprentice
  • dlc certified rkrishnan as Apprentice
  • ataridatacenter certified rkrishnan as Journeyer
  • dangermaus certified rkrishnan as Master
  • sye certified rkrishnan as Master

[ Certification disabled because you're not logged in. ]

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!

X
Share this page