Thursday, January 21, 2010

Geek says to movie fan: "Elementary!"

As a response to a query about whether or not Sherlock Holmes really ever said "Elementary, dear Watson" in Arthur Conan Doyle's stories, a Slashdot commenter demonstrated his own modern powers of investigation:


As a Holmes nut and a believer in free software and free information, this is an easy question to answer with a one-liner:

$ echo; wget -q -O - http://www.gutenberg.org/dirs/etext99/advsh12.txt http://www.gutenberg.org/files/2350/2350.txt http://www.gutenberg.org/files/2852/2852.txt http://www.gutenberg.org/files/834/834.txt http://www.gutenberg.org/files/108/108.txt http://www.gutenberg.org/files/2097/2097.txt http://www.gutenberg.org/files/244/244.txt http://www.gutenberg.org/files/3289/3289.txt | egrep -o -i 'elementary, my dear watson' | wc -l
  
0

Of course, the word 'elementary' isn't forbidden:

$ echo; wget -q -O - http://www.gutenberg.org/dirs/etext99/advsh12.txt http://www.gutenberg.org/files/2350/2350.txt http://www.gutenberg.org/files/2852/2852.txt http://www.gutenberg.org/files/834/834.txt http://www.gutenberg.org/files/108/108.txt http://www.gutenberg.org/files/2097/2097.txt http://www.gutenberg.org/files/244/244.txt http://www.gutenberg.org/files/3289/3289.txt | egrep -o -i 'elementary' | wc -l
  
5


For those who didn't get it, those commands basically search through the Sherlock Holmes stories found in Project Gutenberg (a website that hosts e-books that are in the public domain), counting how many lines contain a certain phrase ('elementary, my dear watson' in the first one-liner and 'elementary' in the second).



One thing I love about Linux is how empowering it is to think up these creative ways of solving problems using relatively small tools provided by this operating system*. In this case, the combination of a tool that obtains data from the web, a tool to search for text, and a tool that counts lines makes what might at first seem like a daunting "needle-in-a-haystack" problem actually quite trivial. Yes, it's just a silly little fan-boy problem about a fictional character, but the environment that promotes this same creative-thinking (here applied "just for fun") allows geeks like me to do much more serious and complex work that would otherwise be tedious (or impossible) in just a short amount of time. I can't even count the number of times I've saved time (and saved my ass!) in the office by using a one-liner in a Linux command line.

Of course, this particular solution for the "Elementary" question wouldn't even work if websites like Project Gutenberg didn't exist. Not only does this environment of openness and sharing in the Internet help the spread of knowledge, it is also probably one of the most important tools of our modern day Sherlocks. And by this I do not just mean the amateur detectives, but every single person with an inquisitive mind, a thirst, even obsession, for understanding and exploration. In other words, the geeks in general, and the hackers in particular.

Now, the word "hacker" might mean someone who breaks into systems for naughty or troublesome reasons, but that's just a narrow view of what a hacker in general really means. One definition (which I got from Wikipedia, another excellent source of shared information) of the word is "A person who delights in having an intimate understanding of the internal workings of a system." Sure, such people might turn out to be Professor Moriarty-types, those who use their ingenuity without regards to other people's rights. Yet who else could save us from the modern Moriartys of the world, with their Internet-enabled Linux* machines, but the modern Sherlocks who are similarly equipped and equally skilled?

They may be labelled as "freaks" for delighting in things that other people ignore or take for granted (just like how Sherlock makes it a point to notice even the tiniest detail in a crime scene), but when a problem arises in a system and everyone else is wondering if a solution could ever be found, it is these same geeky hackers, passionate as they are about understanding the system, who end up exclaiming proudly: "Elementary!"

--
* There are other operating systems that were deliberately made to be hacker-friendly. It's just that Linux is the most successful of those operating systems, and this post is already long-winded and nerdy enough without me referring to those.