Dear students, I need your feedback!

I would like to get the feedback of students with whom I’ve worked this academic year. Please click on the relevant link:

I need your feedback to become a better lecturer. And there are only 6 easy questions to answer. And, naturally, this process is 100% anonymous.

Please pass this message to your friends! And, naturally, whatever you say, whether positive or negative, will remain private…

I’ve been interviewed by Google…

… and the Google hiring committee has decided that (I quote) “[I am] not a strong match for [the] position [they are offering]“

Chronologically, this is what happened.

28 March 2007: First contact

Google sent me a mail asking me if I would be interested in exploring opportunities in their Site Reliability Engineering (SRE) team. They had found my CV online and were keen to talk to me (I guess they used Google to find me :-) )

The SRE team members run the Google.com website as well as a number of other websites and they only employ people with very extensive knowledge of networking, Linux and programming.

I was extremely flattered to be contacted by Google. I knew, nevertheless, that the Google interview process was tough. And I couldn’t help thinking that (i) I am not an expert in networking and (ii) even though I know Linux and programming pretty well, I am neither a Linux administrator nor a software developer…

But I was ready to give the interview process a try and I replied affirmatively.

6 April 2007: First phone call

I got a first phone call from Mountain View, California, at 11pm(!) and, during our 45-minute conversation, I was asked a number of non-technical questions as well as three relatively straightforward technical questions on networking and Linux.

It was a positive experience for me and a few days later I got an email telling me that I did well enough.

26 April 2007: Second phone call

I was called by an engineer of the SRE team from Dublin, Ireland. We had a 1-hour conversation and I was asked a number of questions on networking (lots), Linux (some) and programming (two small programs to write).

Personally, I thought I replied well enough (as far as I know).

28 April 2007: Last email

I got an email from Google yesterday basically telling me that “[I am] not a strong match for [the] position [they are offering]“ that is, as an engineer in the Site Reliability Engineering team.

This is how I feel about the whole experience.

Negatives

  1. I was not offered a job at Google.
  2. It was a stressful experience.

Positives

  1. I was contacted by Google! It’s tough to explain how dreamy this feels…
  2. I’ve been through the Google interview process. In a few months, I’ll apply for a more adequate job at Google (more in line with what I am really good in) and I’ll be better prepared.
  3. I’ve realised that I need to do more real (as opposed to academic) programming and I need to administer more Linux servers and face more complex issues. Consequently I’ve decided to start working on a secret software development project (watch this space…)

Thanks to all of you who have encouraged me (family, colleagues, students and friends).

And thanks Google (specifically Cecilia, Erika, Andrew and Nikesh) for the experience :-)

I like Haskell a lot…

I am a fan of functional programming. I find that paradigm extremely elegant and expressive. I used Scheme when I started university and I was happy. I discovered the Haskell programming language some years ago and it was love at first sight.

According to the official Haskell site,

“Haskell is a general purpose, purely functional programming language featuring static typing, higher order functions, polymorphism, type classes and monadic effects.”

This is a mouthful but is actually a good description of the language. One essential feature of Haskell is its typing system: Haskell features static typing but types are never specified explicitly but are always inferred by the compiler!

Another “feature” is the absence of variables. Yes, you don’t have any variables (i.e. something that can change its value) in Haskell. And if you think about it it’s also the case in SQL, Prolog, XSLT, etc.

Hugs 98 is a nice and easy Haskell programming environment ideal for beginners. GHC is a state-of-the-art Haskell compiler which regularly produces executables that run faster than programs written in C! Both are multi-platform and open source.

Ok. I hope you are salivating. And, cerise sur le gateau, the Haskell syntax is beautiful.

Here is our old friend Quicksort:

quicksort [] = []
quicksort (x:xs) = quicksort [ y | y<-xs, y<x ]
    ++ [x]
    ++ quicksort [ y | y<-xs, y>=x ]

Quicksorting an empty list gives an empty list. Quicksorting a non-empty list (which can always be written as an element x followed by a list of xs (get it?)) is the Quicksort of all elements from xs which are less than x (the pivot) followed by x followed by the Quicksort of all elements from xs which are greater or equal to x. Beautiful isn’t it? In case you don’t think this can be an actual program, you are not alone (read part 7 Lessons learned)

A more involved example is this program I wrote some years ago:

data Tree = Empty | CreateTree Integer Tree Tree

flattenInfix Empty = []
flattenInfix (CreateTree v l r) = flattenInfix(l) ++ [v] ++ flattenInfix(r)

flattenPrefix Empty = []
flattenPrefix (CreateTree v l r) = [v] ++ flattenPrefix(l) ++ flattenPrefix(r)

flattenPostfix Empty = []
flattenPostfix (CreateTree v l r) = flattenPostfix(l) ++ flattenPostfix(r) ++ [v]

insert x Empty = (CreateTree x Empty Empty)
insert x (CreateTree v l r) =
    if x<v then CreateTree v (insert x l) r
    else CreateTree v l (insert x r)

putLeft Empty Empty = Empty
putLeft Empty a = a
putLeft a Empty = a
putLeft a (CreateTree e l r) = (CreateTree e (putLeft a l) r)

remove x Empty = Empty
remove x (CreateTree e l r) =
    if x==e then putLeft l r
    else if x<e then (CreateTree e (remove x l) r)
    else (CreateTree e l (remove x r))

which implements a binary search tree with a number of common operations (three kinds of flatten, insert and remove). Read the code. I’m sure most of you will understand it much more than the equivalent C or C++ program…

The binary tree can be used like this:

tree = (CreateTree 20
    (CreateTree 10
        (CreateTree 5
            (CreateTree 1 Empty Empty)
            (CreateTree 7 Empty Empty))
        (CreateTree 15 Empty Empty))
    (CreateTree 30
        (CreateTree 25 Empty Empty)
        (CreateTree 35 Empty Empty)))

> flattenInfix tree
[1,5,7,10,15,20,25,30,35]

> flattenInfix (insert 4 tree)
[1,4,5,7,10,15,20,25,30,35]

> flattenInfix (remove 30 (insert 4 tree))
[1,4,5,7,10,15,20,25,35]

> flattenInfix
*** Expression : flattenInfix
*** Of type : Tree -> [Integer]

Do you see that Haskell has inferred that flattenInfix is a function which takes a Tree and returns a list of Integers! Can you see why?

Welcome to the world of Haskell!

Synchronizing two computers using Amazon S3

I’ve moved to Amazon S3. I can now store 1Gb of data online at $0.15 per month (Rs 5). Transfers cost $0.20 per Gb (Rs 6.50). This is extremely cheap for the peace of mind you can enjoy when you know “your data is safe sitting on Amazon’s geo-redundant servers right between some bits describing a new book from Oprah and a bad review on latest Ben Affleck movie!”

I have downloaded and started using Jungle Disk and it works great! Jungle Disk (simply said) allows you to mount your S3 online storage as a normal drive. It even caches data and transfers in the background so, in most cases, you don’t even think you are working online. It is multiplatform (Linux, Mac OS X and Windows) and is free (for the time being – the source is also available)

This is all great… except for one major issue: I don’t want to do backups! I want synchronization!

Let me explain. I use my MacBook at home and one Linux PC at work. I want to be able to access my files both at home and at work. Naturally, I can do this by moving all my files to S3 and then use Jungle Disk to access them transparently. Unfortunately, this scheme does not work when the Internet connection is down and no local cached copy of the data exists. And having no Internet connection in our poor country is relatively common.

One solution would be to have the data locally on the MacBook and on the Linux PC. Then S3 would be used as an intermediate to synchronize the two computers. Unfortunately, I have no idea how to do this. I’ve been reading about s3sync.rb and rsync (over the Jungle Disk mount) but I do not understand how to do file synchronization with them. I’ve also read about unison but I am not too confident of its performance with respect to S3…

Any idea?

HTML5 is here

HTML5 is here courtesy of our friends from WHATWG. HTML 4.01 will have an officially sanctioned successor after all. For me, this indicates that XHTML 2.0 has no raison d’être now but who knows?

HTML5 has a bright future. And so has CSS and Javascript. I would advise all aspiring Computer Scientists to get familiar with the latter. Javascript is an extremely powerful programming language and will power the client-side portion of many of the applications we will use in the future.