My Octopress Blog

A blogging framework for hackers.

MacBook

This day had long been coming - new MacBook day.

Today I bought myself the new 2.0 GHz MacBook. It’s such a beautiful machine, and I think it will be serving me well in the coming years.

I don’t get the chance to make such a big purchase very often, but when I do, I consider it for a while from afar, and when I make my decision, I walk right in and up to the first employee, point to the computer and say, “I’d like to buy that MacBook.” “Do you know which one you want?” “Yes. This one.” From their reactions I have to imagine that they don’t see this happen very often. “And I’d like to upgrade the ram to 4 gigs.” A little confused, they call for someone to ring me up.

I walked into the 29th Street Mall Apple Store at 5:10, bought the thing at 5:20, and was assured that it would be just a few minutes while they switched out the ram. Forty minutes later, they bring out my computer, and I’m on my way. I get home, turn it on - all fun and games until I select “About This Mac.” Only 2 gigs of ram. I should have prefaced this by saying that this summer, Henrique bought himself a brand new MacBook Pro at this same location, upgraded the ram as I did, and found out the same thing upon arrival as I did - they hadn’t switched out the ram.

It was too classic for me to be completely irate, but I called the store and told them other places they could put the extra ram. I’ll be going in tomorrow morning to get it sorted, but this is unbelievable to me. Not only that the guy doing the job took out two sticks of ram, looks at the four sticks he now has sitting there, and decides to put the same two in. Bad as that is, what really gets me is that it takes 40 minutes to not switch out the ram.

That said, I very much enjoy Apple’s products, and I know a (now ex-) Apple rep or two who’re good guys, but this is just amazing.

Sex and Engineering

There’s a guy who’s perpetually in alamode (the lab of choice for the C.S. major of discerning taste) named Feineman. It was through him that I found failblog - he was tearing through the archive and it had some pretty funny stuff.

Yesterday he found yet another gem. Apparently there’s a mutex (mutual exclusion) on sex and studying engineering:

[caption id=”” align=”aligncenter” width=”400” caption=”It’s my future! I want to be an engineer… sex can wait!”]Its my future! I want to be an engineer... sex can wait![/caption]

KAUST Email

I received an email this morning with my login credentials for new KAUST email address. Those of you who would like this address, please email me at the current address you have for me.

At any rate, it really solidifies the KAUSTiness, and is oddly gratifying. I’m very excited for this.

NP-Complete

I had to give a talk on complexity theory and NP-completeness, and a friend suggested that I record it and post it for all the children of the world to enjoy. Well, something like that.

I apologize for my verbal ticks - had I recorded myself beforehand and listened to it, I might have made an effort to correct them. I make a few mistakes, but overall, I think there have been worse talks. Enjoy.

(Note: I’m working on getting an embedded version, but until then, you’ll just have to click the link.)

Complexity Theory

(Update: Here’s the video on Google Video. The quality is a little lower than the file above, so I’ll leave the link, and the choice to you.)

</embed>

Human Computation

Computers are awesome. They crunch numbers at mind-boggling speeds. Had the automotive industry kept pace with the computer industry for the last 40-50 years, the average car would cost $15 and fit in your pocket.

That said, there are limitations. Computer vision and artificial intelligence still have a long way to go. Even if we do get those things sorted out, there are still a large number of important problems that don’t have quick solutions in all likelihood. This is where people step back into the picture.

Luis van Ahn has done a lot of work in the field. Most notably, the Google Image Labeler, where two players work together to label photos with relevant tags. Traditionally, image search engines had to rely on the name of the image, as well as words orthographically near it to guess at the contents. A human can do this much more reliably by simply looking at the image.

So, people are good at some things, and computers are good at others. And so it’s very possible that computing in the near future will be more of a team effort for certain projects. Computers doing the heavy lifting in terms of cataloging, aggregating, recording, crunching, and humans doing the interpretive stuff. Lifehacker had an article recently about a tool called Foldit that turns manipulating virtual proteins into a game. People can do certain really complicated tasks easier than a computer could, and untangling proteins is apparently one of them.

To give you an idea of how many “human clock cycles” are wasted, in 2003, 9 billion hours were spent playing computer solitaire. If you have 50 minutes to yourself and would like to hear a really good lecture, van Ahn gives a great presentation.

Scientific Computing

A couple of weeks ago now, I spoke to a professor about the possibility of T.A.’ing next semester’s CSCI407 - Scientific Computing. It was one of my favorite classes at Mines, and I’m really looking forward to it. The professor will not be on campus from March onward, and so it will be an online class from that point, but I’ll likely be holding regular class hours during that time. Exciting!

This is all because one of my few regrets about KAUST is that I wouldn’t get a chance to T.A. or teach there as a student, so, I’m pursuing that here.

So, if you’ve still got Sci. Comp. left to take, take it next semester. I hear they’re going to have a sweet T.A.!

Mandelbrot

The Mandelbrot set is one of those things you’ve always seen on posters or in your math book, but never knew what it was actually. Well, it was that way for me, until recently.

It’s a graph of the complex plane, in which each point has an associated value. This value is determined by the series:

where c is the point in question. If this value does not approach infinity, then it’s contained in the set, and is colored in black. Otherwise, its color is determined by how fast it grows (and there are a number of ways of doing this).

A new friend of mine, Johnny, adapted code from one of our graphics projects to render the set, and so I had to do the same. Not one-upsmanship, but how awesome is that for a project. That said, this is the result of my work so far, but I plan to develop a better coloring scheme, as well as adding interactivity and exploratory tools to the interface. [caption id=”attachment_179” align=”aligncenter” width=”300” caption=”My rendered version of the Mandelbrot set”]My rendered version of the Mandelbrot set[/caption]

Soda Revelation

When getting a soda from the vending machine, it occurred to me that diet soda is not unlike a condom - it represents enjoyment without consequences.

Memory Leak

Memory management is a notoriously difficult aspect of coding in C++. Generally, the problems one runs into with pointers is that you get rid of the data you’re pointing to while you still need it. Gdb has become a good friend for finding segmentation faults.

For those of you who aren’t computer scientists, here’s a quick explanation - we need space to store variables and information. So, one way to do this is ask the system for some space, and then the system gives back an address. Imagine mailboxes at the post office - you don’t have the stuff stored in your mailbox with you at all times, but rather the way (the key) to access it. One problem that arises when you tell the post office you don’t need the mailbox anymore, but you don’t give back the key. Someone else is assigned this mailbox, and his mail starts arriving in there, and when you go looking for yours, it’s not what you expect (this often causes a segmentation fault). The other problem is when one patron keeps requesting mailboxes, and you’re only allowed to hold one key at a time, so you discard the old ones. If you request too many, no mailboxes are left (this is a memory leak)!

At any rate, I don’t have much experience tracking down memory leaks, and so when I came across this problem, I asked an open question to everyone in the lab of the best way to do this. Someone suggested I put soapy water on my program and look for bubbles.

I ended up looking through my code for places where this might be happening, and I happened to find it pretty quickly. That’s pretty lucky.

[caption id=”attachment_167” align=”aligncenter” width=”299” caption=”A memory leak gets out of control”]A memory leak gets out of control[/caption]

[caption id=”attachment_168” align=”aligncenter” width=”299” caption=”We get our memory back when the program is terminated.”]We get our memory back when the program is terminated.[/caption]

[caption id=”attachment_171” align=”aligncenter” width=”300” caption=”I got gdb to seg fault!”]I got gdb to seg fault![/caption]