Archive for 2008

Hackintosh: Installing OS X on my PC – Triple boot osx, ubuntu and windows xp

My macbook laptop was recently destroyed in a car accident, and since I now had a lack of os x and a unused leopard license to my disposal, I decided to become a member of the OSX86 group and install OS X on my PC.

The way to go about installing OSX on your PC these days are fairly simple. You figure out what instruction set your PC supports – is it AMD or Intel, and does it have SSE2, SSE3? Then you download a prepatched distribution for your particular system, install a vanilla attempt, and start tweaking drivers to get your system working.

Here’s the specs of my system:

Asus P5K-E WIFI motherboard with intel P35 chipset, 1333mhz FSB
Intel Core 2 Due E6550 2.33 Ghz dual core processor
8gb Patriot Viper DDr2 memory @ 800mhz
NVidia GeForce 8600GT 256mb video card
1x WD Raptor 150GB 10k sata hdd, three partitions (liux ext3, windows ntfs, osx hfs+)
2x Seagate 750gb baraccuda storage drives, one NTFS, one FAT32

When I started this process I already had linux and windows running, which I wanted to keep. I tried both the iDeneb and Kalyway distribution and found iDeneb to work the easiest.

I used Ubuntu to create a partition for this install, and left it unformatted as a primary partition on my main hard drive. I popped in the iDeneb 10.5.5 dvd, used the Disk Utility to format this partition as a mac extended (journaled) partition, and customized my installation as follows:

- Kernel: Sleep
- Chipset: ICH*
- Video: NVinject256
- all the available applications (specifically we want osx86 tools)

Everything else you can install later.

Once the install was done it booted into osx (with the cd still in the drive).
From the “applications->iDeneb App->osx86tools” folder in finder I launched osx86 tools, and clicked “Download and Install Hardware Drivers”. This is basically pure awesomeness. It will prompt you to install probe utilities – do so, and then restart the computer. Once you’re back in osx, launch osx86 tools again, open the same Download and Install Hardware Drivers box, and it will start probing for hardware.

I selected “AD1988b” for my audio driver – experiment to see what works! Everything else was listed. IMPORTANT: Before installing, I REMOVED the listed Graphics controller by selecting it and clicking “remove item”, since I found that this driver conflicts with the already-installed driver I selected during setup.

Click “Download and Install”, and after a couple of dialogs your install would be complete. Reboot your computer (keep that disc in the drive) and you should have an awesome setup ready to go now.

Setting up multiboot

I was getting annoyed at having the dvd in the drive to boot osx and I wanted access to the other OS’s on the system. To enable this I wanted to reinstall GRUB on my MBR, which I did by using an Ubuntu live cd, and the help of Restoring GRUB and OSx86 installation guides. Restore GRUB to the main harddrive, then add osx to your grub list.

You should be all set now! Go on and install Quicksilver and enjoy OSx!

PS: Using Parallels desktop, you can turn your windows partition into a virtual machine inside OSx so that you can run all those expensive apps you bought for windows inside osx. its awesome!

The Ending of an Era.

With graduate applications sent out and another semester coming to an end, I can’t help but look back at where I came from. If I have to choose one expression that really influences and reflects on life, something that touched me, that changed my outlook on life and that reinforced my awe and wonder at our magnificent world, it would have to be the words of Albert Knag in Jostein Gaarder’s novel “Sophie’s World”:

“Life is both sad and solemn. We are let into a wonderful world, we meet one another here, greet each other and wander together for a brief time. Then we lose each other and disappear as suddenly and unreasonably as we arrived.”

My response to this was (and still is) a humble “Wow”. Gaarder expresses both the majestical highs of exuberance and the unthinkable but ultimately true end of life without judging or diminishing both. And is that not how life truly is? Although this quote deals on a first level with life as a whole, it is just as true for our daily lives. It amazes me to experience the daily comings and goings of people, the connections we make with humans that we meet one evening and afterwards, as we walk away, not realize that we will never see them again. The profound sorrow that is a part of all existence, but also the profound joy of every moment that we share amongst those we connect with. I sometimes wish that we can hold on to the beautiful moments, the great achievements and the times of joy and happiness, that we can freeze time, that we can relive our profound moments in more than just memory. But as this quote so aptly conveys, this is not the way of the world. But that is not a reason for despair or sorrow. No, it is just a motivation to cherish every moment for all that it encompasses. If we could relive times at our slightest whims, if we could get a second chance at life, maybe we would find that, instead of finding recaptured glory and awe, we are only diminishing the worth of the moment. Maybe the biggest factor in creating the exuberance and awe that we experience is the fact that we can’t relive it. Why would we walk the extra mile now if we can do it tomorrow? But still, our heart yearns for the chance to recapture and relive. And not in vain, for by doing so, I believe we keep the memories unstained and unspoilt, the memories of our “brief time” in this wonderful world. Although we all spend only a limited time here, this world in filled with so much emotion, so much strength and weakness, so much love and hate, so much exaltation and so much sorrow, that “wonderful” fails to describe the awe, humility, joy and love that we find here on earth. I would not exchange my memories for any riches or glory.


“If you’re down, I’m down” – Jeremy Estrada’s reply to my suggestion of going Skydiving. We were somewhere in the Sierra Nevadas, standing above a waterfall, discussing Basejumping – the illegal and dangerous sport of throwing yourself off a cliff with a parachute strapped your back. Since we didn’t have the parachute or a big enough adrenaline addiction to jump off a cliff there and then, we figured we should go jump out of an airplane thirteen thousand feet up. Go figure.

I finished my internship at Pixar Animation Studios, where both Jeremy and I worked over the summer. Bay Area Skydiving was recommended to us by Jeff Jensen, and we were accompanied by coworkers and one of my roommates. We all had our reasons for going – the thrill-seekers, adrenaline-junkies, fear-facers and freedom-chasers were all represented in the car ride over to Byron. The skydiving organization calls an aircraft hanger their home, and it’s full of activity as skydivers move in and out and parachutes are packed for the jump. I called ahead and made a reservation, but that seemed to be unnecessary – they have enough instructors and flights that, upon arrival, you easily become part of the list of waiting jumpers. They provide some comfortable couches and a big television, screening videos and pictures of the previous jumps of the day to keep you occupied while you wait. We waited for about an hour – which was just enough to let the nerves settle and allow you to focus on what you’re about to do.

I was paired up with a friendly and professional instructor called Victor. I was handed a very attractive purple jumpsuit, and although I enviously watched my friend step into his dark green suit, at this point I bet any color would be attractive, as long as you get to step into that superman suit you’ll be wearing on the way down! I went through a simple lesson in the arch you need to form with your body while falling, and received instructions on the procedure for exiting the aircraft. Victor was extremely professional, and he was describing the actions you go through without deliberating on possible emotions or sensations you might encounter during the experience. I, for one, didn’t want a spoiler! Everyone gathered around, and the call came over the intercom – “Load 12, load 12, 5 minute call!”.

Right about now your whole chest feels like it’s being filled with rushing warm blood as your mind starts informing your subconscious that you will be boarding that plane to throw yourself out of it. The reply, in the form of sensations throughout your chest and abdomen, might be likened to butterflies before a big rollercoaster or when receiving an award for your achievements, but there’s a whole different edge to it. It’s a very pure and clean feeling of anticipation. You have to remind yourself that breathing is a necessary facet of life, and good thing to keep on doing despite the anticipation in your chest!

Victor stepped into the plane just ahead of me, and we nudged up against each other on the little benches, facing the rear of the plane. We were flying up in a PAC 750XL, with 14 skydivers and a pilot. Around 4000 feet they opened the door to let two jumpers out. These two were working on their canopy techniques – canopy being the time during which you have your parachute open – and subsequently did not go up far enough for a significant freedall. I don’t think I was quite ready to see what it looks like when someone jumps out of an airplane. The one moment the two folks were standing there looking down, the next moment a strange sucking-like sound was followed by their disappearance from the plane. You’re moving so fast, and you fall so quickly, that a skydiver literally disappears as he jumps out. Seeing this fueled the anticipation of my own jump, another nine thousand vertical feet ahead.

I was second to last in the airplane, and my instructor walked us forward to the edge of the door. Looking down is a completely unrealistic experience. Nothing in your conscious or subconscious understand what is going on. I experienced a certain amount of disbelief that this is actually happening. My body was simply following the instructions of my jumpmaster behind me. He scooted up to the door, and I grabbed my harness and curled my feet around the bottom of the fuselage. Hanging in the slipstream, with the wind gusting into my face and absolutely nothing below me except two and a half miles of air, I came the closest to what I believe to be the Buddhist idea of “living in the now”. At this point, seconds before a jump, your body suspended from your jumpmaster, you experience an absolute clarity, a lack of thought so profound and beautiful that you can very easily be completely lost in that moment. I don’t remember feeling particularly excited or scared. Even the anticipation of the moment was left behind by now, cast aside somewhere on the floor of the airplane in the crouched walk to the open door.

The jumpmaster leaned my neck back into the arch position, ready for the jump, and my body felt as if my heart was racing with pure adrenaline. His last words to me, shouted against the rush of air past the wings, penetrated my mind – “If it’s all black as you fall, it’s probably because your eyes are closed!”. In retrospect, these words are hilarious, but at that moment it was the perfectly calm, obvious, professional comment to purge the last fears and doubts from you. The strange battle between absolute excitement and pure calm reached it’s climax as he rocked off the jump.

“Ready, Set, GO!”


I was brutally ripped from my reverie on the similarities of Skydiving and Oriental philosophy. There is nothing, absolutely *nothing*, that can come *close* to the feeling of that moment. My stomach went straight up to somewhere right below my eyes, and I was gripping onto my harness with all my senses screaming at me. For a moment I felt real fear as I accelerated to one hundred and seventy six feet per second over the course of an infinitely long three seconds. The only action I could force my reeling body to take was to keep my eyes wide open as the earth tumbled below me.

As quickly as the jump started, it evened out, and as we reached terminal velocity my senses dropped their assault on my conscious, and I was immersed in an experience unlike anything I have come across in life. A feeling of immense peace, an absolute clarity and presence came to me as I was streaking to the ground at one hundred and twenty miles an hour. I looked up and saw Mount Diablo and the Bay Area in the distance, and became aware of the air rushing past my ears, and for a moment that deeply-ingrained rational mind of bullshit and idiocy attempted to intrude on the experience, reminding me that, rationally speaking, I should be scared witless at this point. I looked back down at the ground, almost in a challenge to these thoughts, and brushed aside all fear, purging my Self from all doubt and disbelief, and in a moment of intense passion, opened my mouth and yelled in awe and wonder at the beauty of the moment.

They say that the adrenaline of the first jump stays with you for weeks. What they mean when they say “adrenaline” is not the wide-eyed, heart-pumping image that it conjures up. It’s the clarity and peace of the experience that stays with you. The words I put down here pale in comparison with the actual experience, but in a frail attempt to convey what it felt like, I will describe it as “Beautiful”. It is, most definitely, a beautiful experience. The freedom of free fall cannot be compared to anything else. Jeremy and I discussed these sensations afterward, and he aptly summarized it by pointing out how skydiving allows you to experience, very directly, the peace and immediacy you can achieve by living without any fear.

As the parachute opened, nine thousand vertical feet of air later, the third part of the experience started. I had some discomfort from the harness as I hung off my instructor, but the quiet and floating sensation was pure bliss. I was laughing, telling my jumpmaster that that was the greatest experience of my life. There’s a certain tone in your voice that is only there when you’re truly passionate about something, and I heard my voice drowned in it. You might expect it to be a frightening experience to be hanging off a parachute, nothing below your feet and a lot of time to think about it, but it’s a very pleasant experience. There’s no concept of that “standing on a ledge” feeling. It must be some ancient feeling, some primordial immediacy, that you experience in these moments of flight. My jumpmaster handed me the parachute controls, and I steered us around the sky. My days of powerkiting made this very enjoyable, since a parachute and a foil kite steers exactly the same way. Swooping across the sky, turning tight circles downwards, I became aware of my body again, settling back into a now much more comfortable skin.

We had a very smooth landing, giving a couple of quick steps to come to a standstill as the parachute slowly collapsed to the ground. My jumpmaster deftly unhooked my harness, and a strange unfamiliarity with the ground greeted me. There’s a certain amount of disbelief that you’ve been living your whole life with your feet planted on the ground, now staring up at you from right below your feet.

The rest of the day we all had sensations of calm and beauty, and we spoke of it endlessly until, blissfully carefree, I fell into my bed, dead tired and ready to do it again next weekend.

Next time, be there with me.

Being the Boss – an incomplete opinion on managing teams from the intern in the group.

This is a post about management. It is a post about my observations of being a member of software engineering teams over the last two years. I’m compelled to comment on managing teams, not because I’ve been in that position, and I don’t presume to tell my superiors how to do it “right”, but it has been an educational process to be part of teams as an intern.

A Project for an Intern

For my sophomore year I worked for the research lab of a big internet company. We were a team of about 6 people, with 3 other teams reporting to the same director of the lab. My team lead was responsible for assigning projects to us. After the initial stage of getting accompanied with the different moving parts the team was using and doing some bugfixes on the codebase for about 2 weeks, my lead met with me to get me started on a project. He had 3 different projects that he offered me, talked me through each, and left me to pick one. The next day I chose my project, pitched my approach to it, and started work on my own project with more than enough excitement to get me started. When I interviewed, they gave me a fairly open-ended idea of the work I can do with them, and although these projects were more specific, the range the 3 projects covered reflected the original interview.

Keeping Track of the Intern

Since I chose the project, my interest and curiosity was my main motivating factor to work on the project. My team lead would check in on my anywhere between daily to twice weekly. This would normally start with him asking me whether I was getting stuck anywhere or whether I was making good progress. This opened the floor for asking questions and discussing blocks rather than me giving him a purely “status report” reply. He would pick a time when he could sit down and work through issues with me if I had any. These check-ins took on three different types. Sometimes it would be a quick “nothing to report” hello. Sometimes I would have an almost-complete feature or a major bugfix to show. Often I’d have a question. These meetings were especially good to get rid of those minor questions that’s not really worth asking someone only that one question, but that’s still handy to get answered.

Making The Intern part of the Team

The lab was applying the SCRUM concepts to manage the group. The biggest effect this had on me as an intern was the weekly “stand-ups” we did as a group. Every Friday, we had a team lunch with everyone present. We would then stand in a circle, giving each person the opportunity to say what they did during the week, what they hope to do next week, and what things were blocking them. This did fulfill all the ideas that SCRUM wanted it to do – create conversation, let the team know what each member is doing, help to get rid of blocks, etc. etc. Something far more important was happening here though – we were all standing on the same level, with everyone from the director to the interns talking about their challenges and successes. This integrated me into the team and made for several interesting conversations after hearing of something cool a person is working on.

Talking to your manager

It was almost ridiculously easy to go up to my team lead and ask questions, make suggestions, or even (on the off chance) complain about something. We were interacting on a level of two engineers working on a common problem, with me respecting his skills and experience and he acknowledging my passion and accomplishments. This managed to make troubles easy to address, since I had no qualms about asking for help when I came upon stumbling blocks.

This is a hard lesson to learn at my current internship, where the above three points are not as emphasized – having my own project, frequent check-ings on a problem solving level, and being on an equal footing with the team. An internship of bugfixing is mentally hard and forces you to jump all over the codebase. You learn a lot, but you never get to “own” some of the code. Now, there’s lots to be said about how good or bad the idea of code ownership is (I’ll leave it to Paul Graham, Guy Kawasaki and the rest of the smart folks in the blogosphere to talk about that, their opinion us much better developed than mine on this subject). I believe it’s good to have a specific project, whether you’re the sole owner of that piece of code or not. Its definitely much most satisfying than semi-random bugfixes.

Thus my observations on managing teams are as follows:
- Give team members specific projects, and let them choose it.
- Check in with members, and do it in a “Can I help you with anything?” manner
- Bring everyone together and make the doings of the team transparent

and to team members
- Interact, interact, interact!
- Let the people above you know about your experience

I hope this helps in the future!

Installing Eclipse on Fedora Core 5 (with its own Java JRE)

I’ve been dying to try out the new Eclipse Ganymede, especially throwing the multi-million-line codebase i’m working on at Pixar into the new CDT version to see what will happen. Until now I haven’t been able to get eclipse working on Fedora Core 5 – the machine i’m using at work.

The main difficulty is to get Fedora 5 to use the latest JVM from Sun rather than the default GNU 1.4.2 compiler. There are several resources on how to make the global switch (this being the most complete I’ve found) but for some reason Eclipse was still not using it. So here’s how I managed to do it:

* Download and extract Eclipse to a local directory
* Download the self-extracting Java version
* Run the Java .bin file and extract its contents.
* Copy the directory extracted from the .bin file (“jdk1.6.0_06″ in my case) into the eclipse directory
* Create a symbolic link called “jre” in the eclipse directory to the jdkx.x.x/jre directory


Rockband – with Computer Vision

Rockband Vision from njoubert on Vimeo.

We built this computer vision system that can play Rockband as our final project for CS184 at UC Berkeley.

In the space of two weekends we designed and built a system that uses computer vision to monitor the xbox display through a camera and play the game. More details can be found at

We were, well, sleep deprived for a good section of this work, which explains the craziness in some parts of the video.

Our system is similar to Slashbot and AutoGuitarHero, but we do not take a video feed from the console – no, we’re doing it through a panasonic handycam pointed at the screen. We’re interested in machine vision, and this was a fun project to get into the field!

Building OpenCV in Ubuntu 8.04

I’m using OpenCV for my current computer graphics project – hacking Harmonix’ Rock Band – so naturally I have to build it from source in Ubuntu. I downloaded the source from Sourceforge.

The procedure was fairly simple – the most important part was the packages needed to satisfy all the requirements. OpenCV depends on several other libraries to really get the full potential of our system (although simple installs are possible).

Since I wanted to do image input/output I apt-get’ted the following packages:

  • libpng-dev
  • libjpeg-dev

To do ffmpeg development – which is the library OpenCV uses for video campture:

  • libavcodec-dev – development files for libavcodec
  • libavformat-dev – development files for libavformat
  • libavutil-dev – development files for libavutil
  • libpostproc-dev – development files for libpostproc
  • libswscale-dev – development files for libswscale
  • libdlna-dev – development files for libdlna
  • libmpeg4ip-dev – end-to-end system to explore streaming multimedia

For all the funky GUI development:

  • libgtk2.0-0
  • libgtk2.0-dev

You can install all of this using audo apt-get install

Once this is done, I unpacked the TAR file, cd’d to the directory and ran the good old standard set of building commands:
<br />sudo ./configure<br />sudo make<br />sudo make install<br />

That’s it!

CHI 2008: Yay we made it in!

The CHI 2008 conference is winding down today, and I’m still excited that our Work in Progress paper got accepted to the conference!

CHI is arguably the biggest conference HCI/Design conference around – from their website: “CHI 2008 focuses on the balance between art and science, design and research, practical motivation and the process that leads the way to innovative excellence.”

Our paper was titled “Enhancing online personal connections through the synchronized sharing of online video” and came from the work that Ayman, myself, Marcello and Yiding did at Yahoo Research Berkeley during 2007. Some of our prototypes are making it into that allows for synchronous sharing of video. Also, our Yahoo messenger plugin Zync is not officially integrated into Yahoo Messenger – just click the “Watch with me” button when dropping in a video, and you get to watch video synchronously with the person you’re chatting with. Cool stuff!

DSLExtreme – my choice as ISP

“At last!” was the words I uttered after finally ending my Comcast contract. Not long after, my DSLExtreme modem (free with every contract) arrived by UPS, and I plugged it in with much anticipation. I called up their technical support since I was not getting an IP from their servers, and within 3 minutes from picking up the phone, I had an IP on my modem and I was surfing away. (Apparently you have to manually request dynamic IPs from them, so it was partially my fault that I was not getting an IP – although the process is a bit strange!)

Anyways, the average latency for web pages is half that of Comcast, and the download stats looks great too:

Unfortunately, you can’t compare this with any Comcast connection test, since their new “SpeedBurst” technology completely skews the result of any bandwidth test – they blast the first 10MB of data to you at high speeds, making these tests give you a very different result of what your long-running throughput will be.

Thus, my vote goes to DSLExtreme! They’re great.

The Tree Sitters of Berkeley

If you walked along Piedmont at the top of UC Berkeley’s campus sometime during the last months you would encounter an interesting sight – several people sitting high up in the oaks surrounding Memorial Stadium. These days they camp outside the fence erected to keep them out. What do these tree dwellers want? They are, according to their campaign boards, saving the trees. Since the University wants to upgrade memorial stadium by building a new complex where these trees are currently growing.

I’ve been fairly neutral in the situation – yes, i like trees, and berkeley happens to have lots of ‘em – but on the other hand i dont really see why those 38 oaks are the most important trees to fight for. I’ve been strangely pursued by a letter posted on craiglist, that made sme extremely valid points. Read it here:

The main point that the person makes, which I have come to support wholeheartedly, is that those 38 oaks are not endangered and are completely negligible against the deforestation happening in the Amazon. The man-power of these protesters and the police that are forced to check up on them are much better spent in places where it would actually make a difference!

How to get your roommates to clean up the apartment, or, writing SMS Gateway Apps

Update: After contacting the guys from Clickatell they sorted out my billing issues and were friendly enough to throw in some free credits. Very nice of them, thanks guys!

I’m always a big fan of interfacing with as many possible data inputs and outputs when i’m working on projects. So much so, that sometimes I do a project purely to plan with novel ways to interact with people. After being introduces to the CEO of Clickatell, a international messaging company that runs a very nifty SMS (Text Message) API, I figured I’d better build something with it.

Two interesting problems came up almost simultaneously that I attacked with a little text messaging scripts in both cases – server monitoring and, well, roommate monitoring!

As one of the development members on, an online art community started by Marcello Bastae-Forte, I’ve been dealing with keeping the server alive and running. Since we’re a team of only 4 at the moment, there is the distinct possibility that the server can go down, and without adequate monitoring utilities, none of us will realize this for a significant amount of time. Thus, what could be better than a text message crying for help if something goes wrong! In the same gist, I would like to remind my roommates (and myself) to go take out the trash and run the dishwasher according to our very intricate schedule we posted on the fridge. Thus, I registered a Clickatell account to start playing with text gateways.

Clickatell gave me a great initial impression. Their website is clean and informative, and their API is great to use. Once you’ve registered, you request an application ID and corresponding secret ID. Using these numbers for authentication you can send batch message jobs easily and securely. Most attractive to my problem at hand was their, as I call it, “one request, one message” API call. With one HTTP POST I can send all the necessary information to get a text message sent to multiple phone numbers. This allowed me to write a total of 12 lines of Ruby to wrap their API in a simple Ruby object.

Unfortunately, I hit quite a snag in trying to procure some text message credits from them. For some strange reason, I kept getting a message saying “Required Field” next to the State form field on their billing page. I did, quite naturally, fill out the form multiple times and made sure to fill out every field I could find, but to no avail. Their customer service response was prompt, but unfortunately did not help to solve my problem. Being slightly confused about how to continue using their service, I shopped around to see what else is out there. (I did manage to fix this issue, so keep reading!) I gave Ez Texting, UpsideWireless and CellTrust a try to compare. Unfortunately, each of these services has caveats that, if I had some credit on Clickatell, I would not have bothered to register. Since I did not, I pressed on and gave them all a try.

Ez Texting is, as their name suggests, super easy. Register, and you get 10 messages to use. They have the cheapest rates going (over half the price of Clickatell – $12 for 500 credits versus $12 for 200 credits on Clickatell), and their site indicates this strongly with a design that doesn’t exactly spell professional. I was here for the API, though, and it was a big disappointment when I was notified that I needed special permission to use the API, and to please send an email to their customer support group. Seriously, I don’t want to waste the time waiting for them. I did send them an email though, but have yet to hear back. They do have the same feature as Clickatell to send a text message with a single HTTP call, but since they do not support HTTPS your password will be floating along the lines in cleartext. Need I say more about security. Their messages also contain “Subject: ” and “Message: ” parts that you cannot get rid of, which looks stupid and annoyed me to no end. As an easy to use, online text center, they work well though.

UpsideWireless and CellTrust both looked like strong competitors to Clickatell, and probably are in the business world. Neither catered to the hackers out there, though, and to buy credit or get access to the API you had to get quotes from their sales department and access rights to their APIs. (I’m generalizing now, and each has their own process, but lets get to the code shall we?)

By now, 2 days later, I hoped that whatever bug was in Clickatell’s billing script would be sorted out by now. Alas, it wasn’t, but in filling out all my details on both the Administrative and Billing profile sections, and filling out their billing page that forms part of the buying process, I made it to the checkout screen. I was taken aback that they required a phone call to verify my credit card (for a total of $13), but they called within 10 minutes after filling out the form, so I did not complain too loudly! With such a prompt response, I applaud them for taking the security measures.

Once I had my credits and my ruby code, I could finally start doing some cool stuff.

To wrap the Clickatell API, I put together a Notify object and, with some Monkey-patching to the URI class, I was all set:

<br />require 'net/http'<br />require 'uri'<br />require 'cgi'<br /><br />#Slight modification to the URI class:<br />class URI::Generic<br /> #appends more data to the current query.<br /> def append_query(param, arg)<br /> if self.query<br /> self.query += "&#{param.to_s}=#{arg.to_s}"<br /> else<br /> self.query = "#{param.to_s}=#{arg.to_s}"<br /> end<br /> return self<br /> end<br />end<br /> <br />class Notifier<br />public<br /> #Takes a YAML object that contains the <br /> #hashes "phones" and "emails" to notify people<br /> def initialize(yaml_conf)<br /> @yaml_conf = yaml_conf<br /> end<br /> <br /> #see<br /> def clickatell_text(message, phonenrs)<br /> if (message == false)<br /> message = "_hmm, nothing's up. _is the script buggy?"<br /> end<br /> url = URI.parse(@yaml_conf["clickatell"]["send_uri"].to_s)<br /> url.append_query("api_id", CGI::escape(@yaml_conf["clickatell"]["api_id"].to_s))<br /> url.append_query("user", CGI::escape(@yaml_conf["clickatell"]["user"].to_s))<br /> url.append_query("password", CGI::escape(@yaml_conf["clickatell"]["password"].to_s))<br /> nrs = ""<br /> phonenrs.each do |value| <br /> nrs += value.to_s + "," <br /> end<br /> nrs[-1] = ''<br /> url.append_query("to", CGI::escape(nrs.to_s))<br /> url.append_query("text", CGI::escape(message))<br /> response = Net::HTTP.get_response(url)<br /> puts " code = #{response.code}"<br /> puts " message = #{response.message}"<br /> puts " response = #{response.body}"<br /> return (response.code.to_i == 200 && response.body.to_s.include?("id: "))<br /> end<br />end<br />

I tend to use YAML to store my config files, which is exactly what I did in this case. My config.yml file looked something like this:

<br />clickatell:<br />&nbsp&nbsp user: user<br />&nbsp&nbsp password: pass<br />&nbsp&nbsp api_id: appid<br />&nbsp&nbsp send_uri:<br /> <br />phones:<br />&nbsp&nbsp person1: 19999999999<br />&nbsp&nbsp person2: 19999999999<br />

The script to remind my roommates and I of our daily duties was a simple couple of lines on top of this:

<br />require 'notifier.rb'<br />require 'yaml'<br /><br />$LOAD_PATH.unshift(File.dirname(__FILE__)) <br />CHECKERCONF_FILE = "dutiesconf.yml"<br /><br />yaml_conf = YAML.load_file("#{File.dirname(__FILE__)}/#{CHECKERCONF_FILE}")<br />notify =<br />message = "Yo " + yaml_conf["people"][].to_s + "! Letting you know that House Duties is yours today. Aiight peace! -KitchenBot"<br /><br />notify.clickatell_text(message, [yaml_conf["phones"][]]).to_s<br />

I added a “people” and “phones” field, and indexed both of these by the day of the week, thus sending personalized text messages to whoever is the lucky person that day. A simple cron job entry on my little home server, and I was all set for a blissfully clean kitchen. (I’ll have to let you guys know how that works out though…)

Overall, Clickatell is easy to use once you have it set up, their response time if fast, and their service works great. Once their initial process of buying credits is more streamlined, they will undoubtedly be the top choice for anyone wanting to do some text message hacking. I haven’t yet tried using their 2-way text messaging, but if this is as easy to use as their one-way API, I’m sold.

Wanna reset your MySQL root password on Ubuntu?

Its easy!

sudo /etc/init.d/mysql reset-password

SVN: Converting from BerkeleyDB to FSFS

I’ve been working with Marcello on and after posting up the Alt framework we’re working on ( onto our SVN suddenly stopped working. What a mess, eh? Indeed. BerkeleyDB was apparently at fault, since our DB got corrupted as we were being hit by the masses.

Since we have about 8 repositories, I wrote up a little shell script to do the housekeeping in making the transition. The usage case is pretty simple:

$ ./ repo_dir

be sure to run this with the pure repository directory, no trailing slash!

<br />#!/bin/sh<br />echo "Converting $repo from BerkeleyDB to FSFS"<br />repo=$1<br />echo "Dumping to $repo.svn.backup"<br />svnadmin dump $repo > $repo.svn.backup<br />mv $repo $repo.bdb<br />svnadmin create --fs-type fsfs $repo<br />svnadmin load $repo < $repo.svn.backup<br />chown -R svn:svn $repo && chmod -R g+r $repo<br />cp -R $repo.bdb/conf/ $repo/<br />cp -R $repo.bdb/hooks/ $repo/<br />rm -rf $repo.bdb<br />rm $repo.svn.backup<br />


I’m late and I have interviews to get to, but here is the fruits of my night’s labor in writing shading algorithms. My first real C++ program, so proud!

Wiring the apartment – setting up DHCP and Routing on Ubuntu

I have a confession to make. I live with 11 engineers. In two connected apartments. And when we moved it, there was no wiring in the house… Only a telephone jack in each room. And now, we all have ethernet drops and multiple wifi access points through the area. I do hope our landlord sees this as a significant improvement!

In the process I bumped up my networking skill quite significantly. The network layout looks something like this:

[Border Router]
| |
[Switches for Subnet 0]
| |
| |
[Switches for Subnet 1]
| |
[Border Router]

Each switch is connected to about 8 desktops and two wireless access points, forming their own network. The idea is that each apartment (thus each subnet) has its own internet access point, but the fileserver is accessible from both apartments, and also routes between the two apartments so that it appears that they are both on the same network to things like SMB and the like.

I use DHCP on the server itself to set the correct information on all the hosts. Here is my dhcpd.conf file:

# Custom DHCP3 server for the EECS House
# Niels Joubert

### Add classless-static-routes option:
option classless-static-routes code 121 = array of { ip-address, ip-address };
option new-static-routes code 249 = string;

lease-file-name "/var/lib/dhcp3/dhcpd.leases";

default-lease-time 86400;
max-lease-time 604800;


subnet netmask {
option ip-forwarding off;

option subnet-mask;
option broadcast-address;

#option domain-name "";
option domain-name-servers,,;

option netbios-name-servers;
option netbios-node-type 8;
option routers;

#This is to get the machines on the two subnets to talk:
option new-static-routes 18:c0:a8:01:c0:a8:00:0a;


subnet netmask {
option ip-forwarding off;

option subnet-mask;
option broadcast-address;

#option domain-name "";
option domain-name-servers,,;

option netbios-name-servers;
option netbios-node-type 8;
option routers;

#This is to get the machines on the two subnets to talk:
option new-static-routes 18:c0:a8:00:c0:a8:01:0a;


There is a couple of hacks in here:
- to get machines from the one subnet to see the other subnet, i use the classless-static-routes DHCP option, that puts an entry into any host that gets a DHCP offer from this box. Unfortunately this only works for windows hosts! This is a huge caveat that I have not been able to solve.
For SMB use, I set the server itself as the netbios name server (more on this later). For each subnet, I set the default route as its border router. With this setup it is enough that each subnet has internet and should be able to talk to the other subnet through the server.


To forward anything through the server itself, I use a custom iptables setup that resides in a script that gets automatically run, as follows:

# Custom iptables script

# Clean up iptables (flush it)
iptables -F
iptables -t nat -F
iptables -X

iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

# Set firewall policies (default behaviour)

The idea here is to set up a nat table to masquerade ips, and the forwarding table to accept all forwarding. Simple, straight-forward and general. Possibly not the best security, but we are self-contained within the border routers right now, so if one of my roommates wants to be an ass and attack someone else, its easy enough to go hit him physically, right?


Samba itself also needs to be configured. Now, Samba is HUGE, as are its config files. I recommend a good book on Samba if you are going to do anything more than the most basic sharing with it. I personally prefer “The Official Samba-3 HOWTO and Reference Guide”.

The gist of my smb.conf setup looks like this:

workgroup = workgroup
netbios name = ubuntu
server string = Niels Server
dns proxy = no
name resolve order = lmhosts wins host bcast
smb ports = 139 240
# This tells Samba to use a separate log file for each machine
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0

####### WINS Services ######
wins support = yes

# Forces us to be the local master browser for WINS
local master = yes
preferred master = yes
os level = 34
domain master = yes

# Cache TTL
max ttl = 86400
max wins ttl = 86400

The important thing to note is that samba works on all interfaces and is the local wins browser (netbios name server).

This is the setup! It works fairly well too.

Reliability through two interfaces!

The one apartment’s internet died today because we’re in the middle of switching from ComCast (ewww) to DSLExtreme (YAY!). I remedied 7 very angry internet-less engineers by a very simple change in routing.

1) Change the subnet without border router to use the server as border router
2) Change the server to use as default route the border router of the other subnet

This took about 5 minutes, and we were piping the internet through the other apartment into our without a hiccup. Hooray for networking!

Feel free to ask me about my setup or use my config files.

Why I took my Shuttle XPC Back – Linux on the Shuttle XPC SG33G5

I returned my Shuttle XPC to Fry’s Electronics over the weekend. Not because I didn’t like it, but because of my issues to run Linux on it.

I managed to get Ubuntu 7.10 working on it as I outlined in a previous blog post, but Windows was complaining about the BIOS settings needed to get Linux working. Frankly, although I’m fairly certain that it is possible to run Linux and windows XP dual-boot on the shuttle, it is far too much of a hassle to get this working. Thus, back it goes. It was a nice box, but alas I won’t be running it anymore! My hard drive was also running far too hot in it to be happy with. Thus, on to the next post for my new baby…

Ubuntu on Shuttle XPC SG33G5 (Intel G33 chipset)

I recently acquired one of the very very nice shuttle small form factor PCs – the Shuttle XPC SG33G5. This is one of their mid-range boxes, and I spec’d it out the following:

Chipset (Standard): Intel G33
CPU: Intel Core 2 Duo E6550 2.33GHz
RAM: 2x 1Gb OCZ Ram
HDD: Western Digital Raptop WD1500

I installed my (legal) copy of Windows XP on it, and with the driver CD that came with the box I was up and running in less than an hour (fast hard drive!). The little box is responsive, fast, and runs fairly quite. I was very happy with my $600 investment!

This was all about to change when I popped in the current Ubuntu CD… To make a long story short, every kernel, distro version and boot flag I tried failed miserably.

I finally came up with something of a solution. A combination of the latest kernel, the correct boot flags and the correct bios settings are needed. They are as follows:

Distribution: Ubuntu 8.04 Alpha 3
Kernel: 2.6.24

BIOS Settings (From…d_Q33_Chipsets)
SATA = AHCI Native Mode
processor = Native Mode

Boot Options:
acpi=off noacpi nolacpi pci=conf1

This got me into the LiveCD fine. I’m still having some issues once I try to run GNOME after my install completed, but at least its a lot further down the line than no kernel at all! I’ll post more as I hack it.

ASUS eeePC – First Looks

After many a hesitant glance, I finally convinced myself to buy one of the new Asus eeePCs. For those who haven’t been following the news, the eeePC is a small form factor laptop with a 7″ screen, weighing in just under 1kg (about 1.5 pounds). It runs a custom interface on top of Xandros linux, and has all the programs the road warrior expects. Firefox, Thunderbird, OpenOffice and the like come pre-installed and it is fairly easy to add and linux program to your distribution.

I’ve only had it for about 24 hours, but I’m impressed so far! The build quality is excellent and it feels very sturdy. The keyboard is a bit small, but I’m already getting used to it. Its a pretty amazing little machine!

I’ll post more as I explore this gadget, but for now I’ll recommend it to everyone!

"Topgun according to Tarantino"

I never really understood what Top Gun was about until I watched this:

I love Quentin Tarantino