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!

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 :)

Another summer at Mozilla passes by

My last day at Mozilla this summer was last Thursday. I didn’t take a lot of pictures this summer, because, you know, I took a lot last time around. Also, this strategy turned out pretty well because now there are more pictures of me floating around on the tubes! After a longish trans-atlantic flight, I’m back in Amsterdam now resuming work on my Master’s (because hacking on Minix is awesome).

No other internship has been ever so satisfying: over the summer, I worked on a wide range of mini-projects which allowed me to exercise skills ranging from systems to application level programming. I even did a bit of work in the mobile space (turns out programming in limited memory and processing speed is a *lot* different).

One such project that I’m especially excited about is support for video recording in the browser. Yes, there is even a canvas-based live preview of your webcam feed, in addition to Ogg/Theora encoding support! Combined with the audio recording support I wrote sometime ago, some really cool applications are now possible. Skype-like dialer in the browser? Why not?! (*hint* anyone is free to send in a patch for multiplexing the audio and video, they’re currently two separate Vorbis and Theora streams *hint*).

We also had 3 major releases for Weave during the summer: 0.4, 0.5 and 0.6. The last one was especially big, given the completely new, HTML based UI (big kudos to thunder for pulling it off!) and a bunch of other performance fixes. Also, the web UI I wrote last year underwent so many great changes by the wonderful folks at Glaxstar. Now we’re putting up a community design challenge to revamp the UI so we can ship the thing! (*hint* if you’re good at UI design you should participate in the challenge *hint*).

There’s so many more cool things I worked on that I’d like to talk about, but perhaps they deserve a separate blog post. Soon… (I keep promising myself that I should blog more often, it never works).

To add the already good times, my two students in the Summer of Code this year passed with flying colors. Yay!

Labs Night: Openness and Competition

Last night, Joseph Smarr from Plaxo was our guest speaker and he talked about how the “web is going social”, and how the “social web is going open”. We discussed all the elements that make up the social web today: identity providers, social web providers and content aggregators, and how each of  them are leveraging open standards and protocols such as OpenID and OAuth to create better experiences for their users. Check out his slides here.

This talk was a nice prelude to some interesting discussion about the role that the browser can play in handling the user’s data and identity on their behalf. Very relevant to this was also the recent experimentation by Weave on identity in the browser, and Myk gave us a demo of the auto-sign-in features.

Labs Night is also a chance for everybody to talk about cool stuff they’ve been working on, so Brandon gave us an update on what’s new in Ubiquity 0.5. There’s some really neat stuff in there: Ubiquity is possibly one of the first pieces of software that perform truly internationalized natural language parsing (0.5 rolls out with support for Japanese and Danish). Do check out this blog post for a detailed discussion of the features in 0.5.

I followed with an update on some of the work I’ve been doing with Jetpack – namely providing the capability for “jetpacks” to record audio. The code to enable this is checked into the repository, but you’ll have to wait until a release later this month if you’re not feeling brave enough to build the extension from source to play around with it. I was especially interested to know the kinds of applications that might be possible with this capability, so you if you have any ideas, I’d love to hear them. Myk also gave us a demo of the new streamlined way of subscribing to feeds using Snowl, check out this release announcement for more details on what’s new with the message reader you know you want to use!

Paul Tarjan from the Searchmonkey team at Yahoo! gave us some really cool demos demonstrating Searchmonkey Objects and YQL. I’m especially excited about YQL because it can make some of the back-end ubiquity code really simple and efficient. Incidentally, the Bing team was here at Mozilla just a couple of days ago and they also demoed some features similar to Searchmonkey Objects, albeit restricted to video and snippets of data for now.

Search is starting to feel exciting again, a sentiment similar to one we feel in the browser space today. There’s a lot of innovation in the area outside of the big daddy, and it is indeed heartening to see that major players in the web are beginning to recognize the importance of openness and competition :)

Labs Nights are monthly events, so we look forward to seeing you sometime in July to discuss more cool stuff that everyone’s been working on!

SSH-HTTP Multiplexer

One of my friends wanted to run a HTTP server on his office machine, but the network it is connected to blocks all ports except 22 (SSH). Sure, he could run Apache on port 22 but that would mean he could no longer login remotely.

I wrote a quick hack in python: muxer.py, that will multiplex incoming connections between an SSH and HTTP server. It is slow, and makes all incoming SSH connections wait for 5 seconds before responding, but it works! The 5 second timeout is required because the SSH protocol specifies that the server should be the first one to send the client it’s version string, and only then will the client respond.

I should probably rewrite it in C at some point. Anyway, here’s your hack for today. Maybe someone will find use for it, or even better, come up with a better solution (this one is certainly the worst!)

FOSS.IN/08: Summary

As a developer, I have to say that FOSS.IN/08 is possibly the most productive conference I’ve been to until now! In just 5 days, I’ve got more things done than I have in the last 5 months :-)

Let’s start with the Beacon workout: Nandeep joined us via VoIP and we got started almost immediately, thanks to the dynamic nature and small size of our project – we didn’t have any infrastructural trouble as a few other C/C++ projects with huge codebases and complex build systems did. We had a list of 6 tasks in mind, and we managed to complete 3 of them. Salil Kothadia got started with writing a PDO data backend, and promptly submitted the patch to us next day. Thanks Salil, hope you continue to contribute to the development of Beacon (thereby increasing the development team size by 25%)!

I also attended Philip’s workout on porting HTML::Template to Javascript. As mentioned on the Wiki page, we mostly worked on the design during the first half or so, and then moved on to writing a skeleton for the whole framework. I think this is an extremely interesting project, and am very happy to be associated with its birth. Hope we can continue the momentum and work until it is finished.

Perhaps the biggest take-away from the conference for me was the ability to give a lightning talk about Glendix, with several kernel hackers present in the audience. Christoph then kindly offered to review some of the patches during the workout. Even the possibility of Plan 9 binary emulation being considered for inclusion into the main kernel tree is amazing, let alone the fact that I got the guidance of an experienced kernel hacker for a good 2 hours! I think the effort was largely successful – I now have a better idea of what I need to do in order to get a kernel patch in order, and also got a few hints as to how I can implement the missing bits.

My primary focus at the conference was to give a talk on Mozilla Labs and Innovation. I think I managed to stir up a decent amount of interest in the various Labs initiatives. I covered the different ways in which members of the community can contribute, specifically focussing on Weave, Ubiquity and the Concept Series. We even covered how easy it is to actually write an Ubiquity command. I now look forward to increased participation by the Indian Mozilla community in Labs projects. Don’t forget to thank Mary for all the goodies!

All this, apart from regular conference happenings like catching up with old friends, making new ones and free swag (great mugs and t-shirts this time around) makes FOSS.IN/08 one of the most successful conferences I’ve been to so far! I can’t wait for the 2009 edition :-D

Follow

Get every new post delivered to your Inbox.