Tuesday, February 17, 2009

Programmer Jokes

I was recently emailed this site of programmer jokes. I had to pass it along because some of them are hilarious. Here is one of my personal favorites:

Jesus and Satan have an argument as to who is the better programmer. This goes on for a few hours until they come to an agreement to hold a contest with God as the judge. They set themselves before their computers and begin. They type furiously, lines of code streaming up the screen, for several hours straight.

Seconds before the end of the competition, a bolt of lightning strikes, taking out the electricity. Moments later, the power is restored, and God announces that the contest is over. He asks Satan to show his work. Visibly upset, Satan cries and says, “I have nothing. I lost it all when the power went out.”

“Very well,” says God, “let us see if Jesus has fared any better.”

Jesus presses a key, and the screen comes to life in vivid display, the voices of an angelic choir pour forth from the speakers.

Satan is astonished. He stutters, “B-b-but how?! I lost everything, yet Jesus’ program is intact! How did he do it?”

God chuckles, “Everybody knows… Jesus saves.”

Labels:

Friday, February 13, 2009

C/C++ in Eclipse on Windows

I recently helped a friend setup Eclipse on Windows Vista to develop C/C++ code. I remembered how painful it was for me the first time, so, I thought I would write a blog detailing the process to make life easier on others. Thankfully, the process has been greatly simplified since I first tried it a few years ago.

I. Download Eclipse

I am going to assume you do not already have Eclipse on your system. If you do, simply go download the CDT package as an add-on to accomplish this step. For those who do not already have Eclipse, you can get it simply by going to the Eclipse website at http://www.eclipse.org. Then click on the Downloads link. Here you will likely see a listing of several different packages. You will want the "Eclipse IDE for C/C++ Developers." All that has to be done then is to extract it to wherever it is going to be kept. I tend to put it in c:/program files/eclipse/, but that is just personal preference. To run Eclipse, simply execute eclipse.exe.

II. Install MinGW

I am going to provide a link to a file, but I highly recommend grabbing the file from their website in case anything new has been released. The reason I am providing a link at all is because they do not currently have an easily distinguishable link on their own website. Anyways, their website is currently located at http://www.mingw.org. From there, I have to scroll down until I see "HOWTO Install the MinGW (GCC) Compiler Suite" on the left under "Popular Content." Then there is a link under the "Using the Installer" category to this page. This installer saves a lot of hassle. Download the .exe and run it. I recommend the default location which is c:/mingw/ last I checked. Make sure to install GCC Core Components, C++, and MinGW-make.

Right now, you should be able to run the command c:/mingw/bin/gcc and get a polite error message about no input files. This means MinGW is working! However, to make it easier to use, you will want to add the mingw bin to your system path variable. How do you do this? That is exactly what I am writing this for. Open a command prompt by either pressing <windows key> + R, going to "Run..." in the start menu and entering "cmd", or type "cmd" in the search field in the start menu on Vista. Once you have a command prompt open, type
PATH = %PATH%;c:/mingw/bin/;

and hit enter. Now you should be able to simply type "gcc" and get the nice error message. Voila! MinGW is completely installed!

III. Configuring Eclipse

There is one final step: configuring eclipse to use mingw. Start up Eclipse and go to Window > Preferences at the top. Mine down through C/C++ > New CDT Project Wizard > Makefile Project. On the right, click on the tab "Builder Settings". Uncheck "Use default build command". This will activate a text field just below it labeled "Build command:" with the default value of "make". Replace it with "mingw32-make". Click "OK" at the bottom to save your settings.

Voila! You have just installed Eclipse to compile C/C++ code on Windows!

Labels:

Wednesday, February 11, 2009

Living on the Edge

In a web of blogs relating to each other via the topic of failure, I came across this quote from here:
"I’ve come to understand that if I’m not making mistakes it means I’m not trying hard enough, and I’m not pushing myself far enough."
It reminded me of my efforts to learn to snowboard a few years ago. I grew up skiing and cannot remember anything about the process of learning to ski. As far as my memory is concerned, it has always been a natural process. However, through high school, an urge to snowboard grew up in me. I finally decided to give it a shot the winter of my freshman year of college. The first time was when AJ, my roommate, and I went by ourselves on a Friday night. It was a complete struggle the entire night and I learned very little about how to snowboard. Due to my epic failure on the smallest slope, I never attempted to advance beyond it to any of the more difficult slopes.

Then came spring break. I went with a group out to Colorado for four solid days of snowboarding at Copper Mountain. I was still determined to learn how to snowboard because as I've stated, I do not give up easily. It turns out Colorado does not have very many flat slopes for beginners to learn on. It also turns out that snowboarding is easier with a mediocre decline than a minimal decline. The process of skiing makes it easier to go straight down the hill than to turn or go across it. Snowboarding is the exact opposite. The slopes in Colorado forced me to go beyond my comfort zone, pick up a little speed, and just go for it. I most certainly fell my fair share of times and I had some impressive wipeouts including one Superman launch down the hill in which I even managed to get snow in my goggles. However, by the time the trip was over, I was halfway decent at snowboarding. I even went down a black diamond before I left.

Just last month, I went skiing with my girlfriend, Jess. She had never gone skiing before so I had to actually think about what I do when I ski so I could relay the information on to her. It helped that the resort was out of snowboard rentals which forced me to go skiing as well. It turns out I still have my skills by the way. I only wiped out a few times and it came from me really pushing myself by trying stupid things. Back to the point, Jess learned some of the basics pretty easily, but kept having problems learning to stop mid-slope. This is an important skill to prevent one's self from running over somebody who wipes out in front of them. However, after a couple more hours on the bunny slope and she still was not getting it. Finally, I told her she was coming with my friend and I on the larger, more difficult slopes. The idea was essentially to push her to the edge where she started to lose control. Essentially, it was to scare her enough to really start trying. It worked amazingly well. Within a few runs, she was starting to turn far better than she had been.

Sometimes, we just need to push ourselves beyond our comfort zone. When someone is in water deeper than them, their effort to keep their head above water greatly increases. If you are not challenging yourself, then you probably are not learning anything new. The purpose of school is to guide people along into new situations. However, when we are not in school, the responsibility falls on ourselves. So stop holding yourself back and start living on the edge!

Labels:

Monday, February 9, 2009

The Ol' College Try

I am twenty-one years old and a senior in college. I am 10 months and 10 days away from graduating with a bachelor of science in computer science and a bachelor of arts in history. I have spent my entire life preparing to go out into the "real world". You know how it feels the week of the first football game each season or the opening night of play when you have put weeks of practice for this one moment? That is the kind of feeling that is starting to well up in me. Sixteen years of schooling filled with sports, clubs, organizations, and relationships are all surmounting to this. So what about it?

This last week I have had several moments where my conscience has pulled away from what I was doing to take a look at the broader picture. My friends and I are at the pinnacle of our lives where all the preparation is ready to demonstrate its worth. We do not have all the talent or skills we will need, but that does not stop us from feeling all the confidence in the world. The reason is we are realizing there is little more for us to be taught before we have experience to compound it with.

I have decided against grad school because I feel it is time to go make an impact on the world. I will add that I do fully believe I can do anything. We were all raised on the idea. Remember when you were in high school and starting to think about what you might want to do with the rest of your life? Remember when you were a kid on the playground playing out your dreams? Remember when you were in middle school sports and your coaches told you that you could be professional athlete if you only dedicated yourself to it? I grew up watching Michael Jordan. I own Space Jam to this day. Its soundtrack has the song "I Believe I Can Fly". It pretty much sums up the whole idea.

Obama's "Yes, We Can" campaign is occurring at the perfect time in my life. The idea gives me a charge, an inspiration. However, it is not simply about the fact that we can do anything. I want to be able to look back and say, "Yeah, we did." If there is one thing I want to accomplish in my life, it is to leave the world a better place than I found it. Before you think I am some hippie, that is not it at all. I want to make an impact that results in a better quality of life. That can come simply from making the people around me more respectful or whether it is a technological revolution in the way we live our lives. Ideally, it would be both. I guess now it is just reaching the time to go give life "the ol' college try."Link

Labels:

Pushing Through

Eugene Wallingford just recently wrote this blog about embracing failure. The topic is one I often think about because it is an area I feel I tend to excel in above others. Thus, I thought I would provide my own opinion on the matter.

First off, when Wallingford says, "what other people call failure is learning to fly," he is wrong. According the analogy he is running with, failure is hitting the ground after jumping off a cliff. Taking the chance at hitting the ground in an effort to learn to fly is the same as risking failure in an effort to succeed. Just thought I'd throw that out there at the start.

My personal thoughts are it is not about embracing failure. Instead, it is about pushing through the failure until I finally reach success. That's why I did not title this "embracing failure" as Wallingford did. When I am struggling with a programming problem, I always define it to my friends as "beating my head against the wall." Please note that only occasionally am I actually beating my head against the wall. It is a fight. When I come up with a solution that does not work, it frustrates me further. If I never figured out a working solution, I would be left in a state of extreme frustration. This is one reason I rarely finish a programming problem unfinished for another day. It will irritate me and distract me from everything I do until I finish it. There is no embracing the problem. There is only beating it into submission.

What drives me to continue endure such aggravations? In some respects, it is about the struggle itself, but I intend to devote a full post to this idea someday so I will skip it for now. Ultimately, it is the euphoria after achieving success which keeps me going. The more frustrating problems are the most rewarding to conquer. I have been known to take off running down the hallway in my dorm yelling in excitement after discovering a working solution. It is because of this that I claim it is not about embracing the failure, but rather pushing through it.

My determination to excel is not only evident in programming. In high school, it was not uncommon for me to spend a couple hours out in 100 degree heat hitting a shopping cart full of tennis balls by myself just to work on a few shots. When I was in late elementary and early middle school, I would be out in my driveway shooting hoops quite literally until it was so dark I could not see the basket anymore. When I run or bike, particularly with long distances, I always end up going faster as I progress. It is not that I start off too slow, but rather that I become charged with the idea of reaching the finish line. In my Personal Wellness class just week, we had to jog a half-mile. I found myself almost sprinting by the last 200m. While playing videogames, I will repeat a particular task over and over again until I can finally beat it. Last year, it took me ten hours to be the final bonus mission on Call of Duty 4: Modern Warfare on the hardest difficulty. The mission was a maximum of 60 seconds long. You do the math.

Perhaps the best way to summarise my thoughts on the matter is with this well-known phrase:
"When the going gets tough, the tough get going."

Labels: ,