Project Assemble

Ever since I participated in the first Summer of Code 4 years ago, I’ve been using Macs almost exclusively.  I really enjoy using them – they’re great machines for developers, and the amazing virtualization options make them practically the only development computer you’ll ever need.

However, I felt like I was drifting too far away from what the majority of computer users operate on, even today. Not to mention, my roots are back in the Linux world, and in the back of my mind I’ve always wanted to switch back to a “PC” (the term in quotes, because Macs are PCs too!). I had heard great things about how much better Windows 7 and Ubuntu are than their predecessors, so I decided to take the plunge.

For work, I settled on a trusty, hardy Lenovo Thinkpad. The new x201s have great battery life, portability and power. I’ve really been enjoying dual booting Windows 7 and Ubuntu 10.10 on it.

When it came to my home computer, I wanted to get one of those beautiful 27″ iMacs. However, Starcraft2 happened to release around the same time, and I found myself questioning the value of a computer that could not run it in ultra graphics mode. For the same price as the iMac, I was pleasantly surprised to learn that I could hand assemble a computer with most components near the cutting-edge. Awesome!

Ingredients

So I got to work. It is very convenient to order all the parts you need for a computer on Amazon. Let’s go through what you need:

  • CPU: Processor manufacturers have already hit the ceiling for how many transistors they can pack per square-inch, but now the race is towards how many separate ‘cores’ are available. Most software don’t even bother using more than one core, so the quad-core CPUs from either Intel or AMD should be more than sufficient for the next few years: I opted to go for the Intel Core i7 950 3.06GHz. You’ll want to note the socket type of the CPU and make sure you get a compatible motherboard (the i7 CPUs fit into LGA-1366 sockets).
  • Motherboard: Pretty standard choices these days, the differentiating factors are usually overclocking support, USB 3.0 & SATA 6gb/s throughput, and the number of PCIe slots. You’ll want to make sure to get a motherboard that matches the socket type of your CPU. I opted to get the ASUS P6X58D Premium.
  • RAM: 32k may have been enough in the past, but you want to make sure you have atleast 4GB to stay competitive today ;) DDR3 is pretty much the faster consumer memory you can get in the market. I’ve heard that 1600Mhz is the sweet spot for i7 processors, going any faster won’t give you any significant performance boosts. I got a handy pack of 3 x 2gb sticks: Corsair Dominator 6 GB 1600MHz.
  • Graphics Card: It’s what puts pretty pixels on the screen; if you’re a gamer or design professional you’ll want to go all-out. I think having two cards in SLi (nVidia cards) or Crossfire (ATi cards) is much more efficient than getting a single very high-end card. Before you get two cards, make sure your motherboard supports the configuration and keep in mind that you can only link identical graphic cards. I chose to get two of the Gigabyte GeForce GTX460 1GB cards.
  • Power Supply: You get power supplies ranging typically from 400W to 1000W and you’ll want to choose one that keeps up with your hungry processor and graphics card, while still being economical. I got the Corsair CMPSU-850TX 850-Watt to fuel the two GTX460s and to give me a little room for expansion in the future.
  • Hard Drive: Solid state drives are catching on and becoming less expensive everyday. The performance boost is phenomenal, and I would highly recommend getting one for your boot drive. I got the Crucial Technology 128 GB RealSSD C300 because Crucial has been getting great reviews of late. You’ll still want a much larger regular spin disk, however, to store your movies, music and photos (the 128GB should be used only for your OS and frequently used applications). The Western Digital Caviar Black 1TB hard drive is a solid choice.
  • Tower: Finally, you need a case to put all of these parts in! While choosing a tower there are two sizes you need to consider: the ATX size which specifies the largest motherboard the case can accommodate, and the tower size itself which defined how much room for expansion drives, cards and ventilation there is. I got the Cooler Master HAF932 ATX Full Tower.
  • Keyboard, Mouse, Monitor, Optical Drive: These are all essential components of a computer but there really isn’t much to it. It’s mostly a matter of personal preferences. Just look around and pick one you are comfortable with. My choices were: Razer Lycosa Programmable Backlit Gaming Keyboard, Razer Mamba Wireless Gaming Laser Mouse, HP 2509m 25-Inch Diagonal Full HD LCD Monitor and Samsung Blu-Ray Internal SATA Drive with Lightscribe.

You do need a couple more things before you can being assembling your computer. A grounding wrist strap and a toolkit are highly recommended. Setup a nice hard, flat surface to work on.

Recipe

  1. The first thing you’ll want to do is to mount your CPU on your motherboard. For the LGA1366 this was as simple as gently placing the CPU over the socket to match the nudge and then pulling the lever to lock it in. I had to put some pressure to lock the lever, but I only did it after I was sure I placed the CPU in the right orientation.
  2. All the AMD/Intel CPUs will come with their own stock coolers. Mounting them on top of the CPU is very easy these days, as they come with pre-applied cooling paste. Just follow the instructions from the CPU box. I opted to get my own cooler and coolant, however, so mounting it was a little more involved.
  3. Now you’ll want to attach your power supply to your ATX tower. It usually goes in the extreme bottom or top of the tower.
  4. I prefer to attach RAM on the motherboard before mounting it on my tower so I have a better sense of where to place the PCIe cards. It’s also easier because your hands are constricted once the motherboard goes inside, and RAM sticks typically need to be absolutely vertical to their slots before they’ll go in.
  5. Once you have the RAM in place, it is time to secure the motherboard onto the ATX tower. The most important step here is to first attach the double-edged screws that came with your motherboard. They raise your motherboard and provide screw sockets for the ATX to attach to. Do not try and attach your motherboard directly to the tower without putting these in between. There should be a half-inch gap between the metal casing and the lower side of the motherboard.
  6. The hardest part is now behind you. Plug-in your video card, RAM and drives. Most of these are pretty much “push-click” based these days, really nothing much to it!
  7. Done? Now all that remains is to tie everything together. This might actually be intimidating to some, but cables these days are designed not to fit in something they weren’t meant to. The basic steps are to connect power to your motherboard, video card, fans, optical and disk drives. Then, connect SATA cables from your drives to the motherboard. Motherboard control pins go to the front of the ATX (for LEDs and power switch).
  8. Take a deep breath. Connect the monitor and a keyboard and flip the switch. If all goes well, the fans will start whirring; and you’ll get a beep from the motherboard indicating POST succeeded. wOOt!
    If that didn’t happen, maybe you got something other than a single beep. Different kinds of beeps can mean different problems, go the Wikipedia page on POST to troubleshoot. If you don’t get any kind of beep at all, and the fans aren’t spinning it means you missed a power supply cable somewhere. Double check to make sure the CPU cooler fan is running! If it isn’t your CPU will heat up very quickly — most processors will automatically shutdown when they overheat — but there’s a chance it may damage your computer, so double-check.
  9. Get your installation media and put your favorite OS on your brand new computer. Give it a name, and learn to love it ;)

That’s all there is to it. I certainly had a blast assembling my computer, it was a nice learning experience; not to mention very economical. Well, I’m off to play some HD-quality Starcraft2!

My third first week at Mozilla

After two years of juggling graduate school and Mozilla, I finally joined Labs last week to work on amazing projects full-time! Couldn’t have asked for a better transition to the “real world” :)

I’m very excited, and I think it’s a great sign that on my first day of work I could start hacking right away. I’m indeed very fortunate to be working with some of the most brilliant people I’ve ever met; on a very meaningful mission of building an open web for the public benefit through innovation.

Stay tuned for more! Oh, and, have you installed the Firefox beta on your Android/Maemo device yet?

Suspicion of Religion

I usually avoid debates on religion with anyone except with people I know well for fear of it turning into a heated argument, which often happens when dealing with such a topic. I’m going to make an exception and make a post about it because I read something recently that has changed the way I approach religion.

Indeed, I have observed many of my peers from different countries and cultures increasingly identifying themselves as agnostic or atheist. In the Netherlands, where I spent the last two years, a large portion of the population (42.7%) specify that they are not affiliated with any religion. Even though the country where I am from, India, is regarded by many as a deeply religious (secular) state; I never cared much for religious teachings or rituals. I’ve met many students like me, who regarded science to be a guiding compass, with a few basic moral principles (such as: don’t hurt anyone) at the foundation. With the abundance of destructive events all over the world – inspired by religious fanaticism – it is not surprising that I grew increasingly suspicious of the concept in itself. I found the TED talk by Sam Harris, on how science can provide a moral compass, greatly moving and convincing.

For those who think like me, and lay more faith on science than religion; or identify themselves as agnostic I present to you the following passages written by C. Rajagopalachari, a well respected Indian statesman, commonly hailed as the ‘conscience-keeper’ of the Mahatma. Though it is rather long, I found it quite interesting:

A little knowledge of the laws of nature and the wonders of science, specially when that knowledge is acquired second-hand without the chastening influence of effort and investigation, acts as a wine on some natures. Their sense of proportion is unset. The unknown is not only unknown but ceases to exist for them. Holy books and scriptures seem to them ancient folly; nay worse, they are looked upon as instruments and deliberate devices for the practice of fraud. But those who have struggled to obtain a deeper knowledge of the physical sciences and who, therefore, know enough to retain their sense of proportion and judgement know that the vast unknown is ever so much more than what is known and that while human intelligence may bring under its domain more and more as time goes on, there is a residue that cannot be either ignored or brought under the sway of man’s intelligence. Men of science not only preserve their humility but on account of their very knowledge of some secrets of nature, contemplate with increased humility and reverence that which must ever remain outside the pale of human analysis.

The cause of all causes, the law of all laws cannot be seized by the highest effort of human reasoning or investigation. Human reason is so perfectly fashioned and rounded off that there is no room for any sense of limitation. But the fact remains that the part cannot comprehend the whole, however excellent it may be shaped. The symbol of the serpent with the tail in its mouth as if swallowing itself illustrates the limitation of the human mind in its efforts to grasp the All. Even a giant cannot stand on a platform and lift itself also. We cannot jump off the ultimate cause on which we stand and on which we depend for every motion of the mind, in order that we may get round it or measure it.

This limitation of human knowledge is a familiar boundary in scientific and philosophical investigations. Dive into any truth or investigate any phenomenon or examine any distinction deep enough, and at a certain point we reach the unknowable and further progress is stopped. We strike against God, so to say, in everything. The unknowable is all-pervading. The known and knowable make up but a thin surface-crust over the mystery-sphere of infinite dimensions. Religions and holy books, and the saying and doings of holy men deal with this infinite unknown, not as a science deals with matter, but in a different way which is also the only possible way.

It may be asked why anyone should worry about the unknown. Of what use is it? The answer is that to ignore the real is foolish. The unknown is no less real because it is unknown. We know this much about it, that it is there and has profound relation to all that exists, including ourselves. How then, can we ignore it? The gap in human perception, we know, is not a void but filled with the most important reality, although we cannot dive into it, analyze it or understand it. In the material world, does not the mathematician deal with quantities that are too great or too small for definition, and with expressions that are for the human understanding wholly unreal?

Infinity, zero and surds are not neglected in mathematics, but go greatly to make up a science which actually helps engineers and mechanics to build real and useful construction. The insoluble and the infinite are thus neither unreal nor useless even for practical life. What is said in the holy books of the world may often not be as precise or clear as we would want it to be. The explanations are not as satisfying as the proofs we find in the physical sciences. This is necessarily so because the matter is wholly different and the approach and methods of application also must differ. Things within the domain of human reasoning can be defined and proved. But for the understanding of things beyond, faith and meditation have to function. The scriptures and holy books may be looked upon as helps to assist reverent meditation, by which alone the human mind can get glimpses into the truth beyond. By cultivation of purity of mind and action, and by meditation and prayer, what sounded first but as an empty jingle of antithetic phrases gets substance and meaning. What was obscure gets a strange and new light by which we may see through dimly, and though, even that, we may not all be able to relate to others. Thus it was our fathers saw, and thus again we may also see.

A reverent spirit is necessary to understand any religion. To start with a suspicion that the founders and teachers of religion in any land were skilful deceivers, interested in some sort of scheme of self-advancement or the advantage of some particular class, and that the rest of the people were duped to regard these deceivers with unbounded reverence and affection, is foolish in the extreme. The mass of people of ancient days, from whom, indeed, we have inherited all the intellect we possess were as practical as we are, were as interested in knowing the truth about men and things as we are, and were, if it may be so put, as suspicious as we are. They had probably as much intellectual acumen as we have, and had indeed more time to examine men and things. To believe that they were duped and that among them there were not men intelligent and bold enough to prevent the mischief is to proceed on a wholly wrong assumption. The religions that have commanded the devotion of successive generations of normal human beings in any country have done so because by direct personal contact at first, and by experience handed down as tradition from one generation to another, the founders and teachers of the religions were known by their contemporaries to be good, sincere and deep-thinking men, worthy of being followed. It is not merely wrong to display the detective-police mentality when studying a religion; it incapacitates one even to understand it. Undoubtedly personal and class interests have perverted religion as they have perverted other institutions. But to confuse the latter with the earlier and to impute fraud to the source is an unscientific attitude of the mind in the investigation of truth. It is in a spirit of reverent affection that we should approach the study of an ancient scripture.

This is perhaps the most convincing argument I’ve personally heard in favor of not dismissing religion entirely.

I believe that the root cause for many kinds of suffering is because of man’s nature to try and convince another of the ‘right’ way to live. I do not wish to fall in that trap, and thus I will leave it to you to interpret the passages as you please. But, I did feel it was worthy of sharing because the argument not only answers several doubts I previously had about religion, but has offered to me a scientific basis for at least being inquisitive about something that has survived for so long.

I’d love to know what you think.

So, are you on Facebook?

This post is entirely inspired by David Ascher’s talk on “Messaging with Mozilla Values” at the Mozilla summit, and is also a result of me deciding not to simply let blog posts sit as drafts forever (looks like I haven’t made a post in a while!)

It’s been a couple of months since I deleted my facebook account. It wasn’t an impulse decision, and I had been mulling over it for a while before actually going through with it. I don’t really miss it, which I suppose, is a good thing. As a technology enthusiast however, I do want to keep up with what the biggest social network in the world is up to. Create an alias you say? While signing up for one, I noticed that the form very strongly notes that one is to use their “real name only”. Interesting. I’m just going to wait and see if they decide that I am a fake person.

All that is well and good, but my conversations with new and interesting young people I meet almost always ends with “are you on facebook?”. My response is usually met with either mild surprise or a sliver of disappointment. I quickly explain that it doesn’t mean they can’t get in touch with me but that leads to a look that I’ve come to interpret as “yeah right”, also known as “ugh, email”. Which explains why my personal inbox only contains messages from my mom, the British lottery council and my very wealthy friends in Nigeria.

This leads us to the burning question of why “standard” messaging protocols like SMTP have failed (or rather failed to evolve) to capture the interest of this generation. As Chris Beard very succinctly put, if you had said we’d be using a single Internet based service to communicate with each other in the 90s we’d have thought you were crazy, simply because we were just finished with the nightmare that was AOL. Yet, only a couple of decades later it seems we’re at a full circle.

Hypothetically speaking, if Google had decided that Gmail could only be used to send messages to other Gmail users, would it have gained as much traction as it did? Yet, millions of Facebook users seem to miss the absurdity in the fact that they can’t use the service to talk to anybody who is not a member of the network. If users fail to recognize this simple drawback, it must mean that playing the ‘privacy’ trumpet or the ‘centralized control’ horn is just wasted effort.

What can we as computer scientists do about the situation (or does the situation even need our attention)? David very rightly points out that the last thing on our minds should be to ask users to stop doing things they absolutely love. I enjoyed facebook. A lot. There is a reason (actually several) for why the service is so popular. It certainly seems to me that understanding the basics of why such a service is a grand success is an interesting exercise in itself.

So, are you on facebook? What do you love about it? What do you think could be better? Do you see initiatives like diaspora succeeding?

Change

As you can probably see, my website has undergone major changes. I’ve decided to stop maintaining my custom WordPress installation and move to a more stable, hosted solution simply because the former was taking up too much of my time and my puny little VM couldn’t handle spikes.

So, here we are: fresh new website, clean design and a new name! I also used this opportunity to clean up the content from my earlier website – you’ll notice not everything is present on this one. Some content from the earlier website I definitely want to move (slides from my talks, for example) but most of it will probably remain gone because they are no longer relevant.

An unfortunate side effect of the migration, however, was that I seem to have lost a whole bunch of blog posts, most notably from 2007. The WordPress export/import feature seems to have dropped some content, but it also could be because my self-hosted version was running on SQLite and not MySQL. There were a couple of good posts that were lost, which I’m really sad about. I know, I should have taken a backup but like many cocky programmers I chose not to do so and I now I regret it. Lesson learned.

Please bear with me while I spend the next couple of days trying to: a) fix a few broken links in the posts that did make it to the new site, and b) migrate relevant content into wordpress pages here. If you were subscribed to my earlier feed, you will have to resubscribe because I am no longer using FeedBurner and the feed URL has changed. As always, I welcome feedback if you have any, just email me.

On another note, I’ve been working on a few exciting projects in the last couple of months, stay tuned for updates!

Figuring out the Goo.gl API

UPDATE: ‘Fatalis’ has pointed out in the comments that the POST should be made to http://goo.gl/api/url with User-agent set to ‘toolbar’. The code now works, Yay!

Google just announced their own URL shortening service. Their service can only be used from the toolbar or FeedBurner, and I don’t particularly like adding extra toolbars to my browser. Maybe I can figure out a way to use their service from the command line?

I downloaded the toolbar XPI, unzipped it and peeked inside. Horribly indented JS awaited me. Nothing jsbeautifier couldn’t fix though. Few minutes later, I arrived at this readable JS function:

var getUrlShorteningRequestParams = function (b) {
    function c() {
        for (var l = 0, m = 0; m  0 ? l : l + 4294967296);
        for (var o = 0, n = false, p = m.length - 1; p >= 0; --p) {
            var q = Number(m.charAt(p));
            if (n) {
                q *= 2;
                o += Math.floor(q / 10) + q % 10
            } else o += q;
            n = !n
        }
        m = m = o % 10;
        o = 0;
        if (m != 0) {
            o = 10 - m;
            if (l.length % 2 == 1) {
                if (o % 2 == 1) o += 9;
                o /= 2
            }
        }
        m = String(o);
        m += l;
        return l = m
    }
    function e(l) {
        for (var m = 5381, o = 0; o < l.length; o++)
            m = c(m << 5, m, l.charCodeAt(o));
        return m
    }
    function f(l) {
        for (var m = 0, o = 0; o < l.length; o++)
            m = c(l.charCodeAt(o), m << 6, m << 16, -m);
        return m
    }

    var i = e(b);
    i = i >> 2 & 1073741823;
    i = i >> 4 & 67108800 | i & 63;
    i = i >> 4 & 4193280 | i & 1023;
    i = i >> 4 & 245760 | i & 16383;

    var h = f(b);
    var k = (i >> 2 & 15) << 4 | h & 15;
    k |= (i >> 6 & 15) << 12 | (h >> 8 & 15) << 8;
    k |= (i >> 10 & 15) << 20 | (h >> 16 & 15) << 16;
    k |= (i >> 14 & 15) << 28 | (h >> 24 & 15) << 24;
    j = "7" + d(k);

    i = "user=toolbar@google.com&url=";
    i += encodeURIComponent(b);
    i += "&auth_token=";
    i += j;
    return i
};

So, I call getUrlShorteningRequestParams("http://www.kix.in/"); to get "user=toolbar@google.com&url=http%3A%2F%2Fwww.kix.in%2F&auth_token=78925814685". I see in their code that they do a POST request to the service to obtain a JSON return value that would contain the short URL. I punch it in using cURL:

$ curl -v -d\
   "user=toolbar@google.com&url=http%3A%2F%2Fwww.kix.in%2F&;\
   auth_token=78925814685" http://goo.gl/
* About to connect() to goo.gl port 80 (#0)
*   Trying 74.125.19.102... connected
* Connected to goo.gl (74.125.19.102) port 80 (#0)
> POST / HTTP/1.1
> User-Agent: curl/7.19.7 (i386-apple-darwin10.2.0) libcurl/7.19.7
> Host: goo.gl
> Accept: */*
> Content-Length: 77
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 405 HTTP method POST is not supported by this URL

Oops! Well, not really, the URL shortener from the toolbar doesn’t work either, I just get the full URL whenever I try to “share” something. Has anybody actually generated a real goo.gl short URL yet?

Their auth_token parameter seems completely superfluous to me as it is generated from the URL itself. Don’t we all know security by obscurity doesn’t work :)

Follow

Get every new post delivered to your Inbox.