2007
04.30

Fifteen years ago from yesterday, there was without a doubt one of the largest riots in America’s history. Los Angeles erupted into rioting and the entire nation suddenly paid attention.

For those of you who were either too young or apathetic to know what was going on, I’ll redirect you to the Wiki page with all of the gory details. Retrospectively, people had grown tired. They were tired of being oppressed, tired of being poor, tired of their fellow man, and tired of being tired. The only way most people knew to react was by assaulting, killing, burning, rioting, looting, and destroying anything they wanted. The whole thing was sparked by the trial of the Rodney King beatings, but turned out to be just the straw that broke the camel’s back.

In the end, America hasn’t changed much. There is still oppression, negligence, hatred, racial tension, and turmoil as much as existed in 1991 and 1992. The only lesson to learn is America has selective short term memory.

2007
04.27

Dollars And Cents

Someone at work posed a riddle to me and I thought I’d share it with everyone:

Three women go to a motel. The manager charges them $30, so they each pay $10. Then the manager realized that there was a special on the room and it was really just $25. He sent the bellboy the $5 back to them. They decided that since $5 does not divide evenly 3 ways, they would get $1 back each, bringing their cost down to $9, and the bellboy could keep $2 as a tip. However, that total is $29 (3 x $9 + 2), so where did the remaining dollar go?

The answer will be in the first comment.

2007
04.23

Dear John

My dearest Video Games,

In the spirit of all of the farewell letters typically sent to soldiers from their two-timing worthless girlfriends, I felt I needed to finally make official my break up. It is with a heavy heart that I am going to have to break up with you, Video Games.

It’s been a 22 year relationship that has had its ups and downs. We’ve been through the arcade, the PC, the Atari 2600, the NES, the Sega Genesis, the Lynx, the GameGear, the Super Nintendo, the Turbo Grafx-16, the Saturn, the Virtual Boy, the Jaguar, the N64, the Playstation 1 and 2, the Gamecube, the Play Station Portable, the Game Boy, Game Boy SP, and the Nintendo DS Lite. We’ve played hundreds upon hundreds of great games (the list is simply too long to list). I still own most of the games I bought for the really good systems (NES, SNES, Genesis, PS1, PS2, GameBoy, Gamecube, DS). I didn’t keep all of those systems, I didn’t even own all of them (rented frequently at BlockBuster or a friend/relative owned it).

It’s a shame it has to end this way. Unfortunately, I have found someone else. Her name is Grad School, and she keeps me so busy, I simply don’t have time to waste with you. We had so many great memories and you’ve never let me down. I will always hold a special place in my heart for the interactive game. Any time I see a child playing a Virtual Console game as if it’s brand new, I will weep with all of the memories of days past. Any time someone rants about how great the new Mario game is or about how they’re tired of seeing MegaMan sequels, I will probably shed a few tears.

This has been a year in the making and I have been dreading making it official as I feel I will now be missing a part of myself. The seventh generation of console games has arrived with full-force and I am lacking the desire to continue our relationship at this point. The prospects look very promising as all the systems have something to offer a hardcore old-school gamer such as myself. I think this time, I’d rather spend my money and my time on other things.

I hope you understand. Best of in all of your future ventures; try to avoid the mediocrity of the movie industry and don’t over-glutton yourself like you did in 1983. In fact, I hope we can continue to still be friends. I have still have to ride a vanpool to work, which leaves me with about 6-8 hours a week to enjoy some great DS games. Also, I will probably keep my subscription to EGM (going on fifteen years strong).

Love,

s1n

2007
04.17

Tax Man Cometh

Undeserving Government Thieves

That dreaded time of the year: taxes.

Like every American, I loathe dealing with taxes. Every year, millions of Americans have to remind the government that they either paid them too much or too little. This year was the first year where my wife and I fell in the latter. While we didn’t have to pay much (less than $100), we fear that it will be worse next year because of a few big one-time deductions.

So I did what everyone should do who has to pay: procrastinate. I prepared my taxes about a month ago and decided to wait until the final moments. If I was going to have to pay the government (unjustly as I find it), I was going to make it as tough on them as possible. I filed all the paperwork TaxCut would allow. When given the option between a long form and a short, I always chose the long. Optional paperwork? You better believe I filed it!

Next year, if I have to pay again, I will be printing the paperwork out and mailing it in with a check. Why should they have an easy time with the eFile? I only did it this year because I waited just slightly longer than I felt comfortable, but I now know I can do every I want if I just do it the weekend before the week of the due date.

Despite what I always hear about getting a check back, I cannot fathom giving the government a interest free loan when they nickel and dime me to death with my student loans. I’d rather break even than anything else; I’ll let my online banking take care of automatically drafting the money into a separate account if I am that incapable of saving money.

2007
04.14

Beer Good, Fire Bad!

Beer Good, Fire Bad

So all week, I have been working on trying my best to understand Bayes Theorem and Belief (Bayesian) networks. My background in statistics is pretty pathetic, so I’m playing catch up before the semester ends. I’ve seen Bayes before, but only as a general classifier; I never had to actually work out the probabilities and CPTs to the belief networks.

Anyways, since I haven’t posted in a while, I have been wanting to drop a heartbeat. Thump thump. I also wanted to mention an article that has saved me so far dozens of man-hours finding bugs. If you deal with native applications, you’ll find gdb to be an indispensable tool. I found this article on developerWorks that showed me a few tips and tricks to harnessing the power of gdb.

Until I found about conditionals and watches, I had been using gdb like a caveman! Rather than wading through a function call being called correctly a few hundred times to find the one broken usage, conditionals can be used with your breakpoints to filter out all of the normal situations. I also found watches to be useful to see when and where a variable / memory address is accessed or modified to see what code might be breaking things.

I had to work through something where a function call works 99% of the time and many things have to be done to the application / system before the problem manifests itself. Rather than setting a blanket breakpoint on the function call, I sifted through for when a parameter matched a certain unwanted value or the function reached an undesirable state by applying a conditional on the end of the watch or breakpoint. Thankfully, IBM wrote a clear and concise article on the basic powers of gdb.

This week is the last week before the final. I have a 1 week break before the qualifier, so things won’t be so rushed this semester. Since I have some time to kick back and catch up on my rest, I think I will take up MensJournal on their article about the top 25 beers and enjoy as many of these as I can this week.

In fact, I’ve added beer as a regular part of my diet. The good news 3 beers a week (post-run drink) help add a little bounce in my stride. Unfortunately, I have put a few pounds back on. I really like beer and would hate to completely give it up. I might have to limit my intake to only after long runs on Saturdays.

2007
04.01

By The Grace Of Perl – Part 2

So I wanted to make at least one more post about some seriously powerful features of Perl that usually go unnoticed. Since most people who write Perl code to look like the crummy C/C++ code they normally write, I’m hoping at least one person will read this and start doubting the way they do things in Perl.

Tie. Not the sort of concept that needs a breaker, not the style of food or country of origin, but more like something that needs an interface. The tie keyword is probably my newest, yet favorite, feature of the Perl language. Basically, it allows a class to provide an interface, using specifically named subroutines, to access any form of data. The typical tie syntax requires a variable, a class name, and scalar. The class name provided is the class that will implement the required interface for the type of variable provided in the first parameter, and the last parameter is an optional parameter to the class’s constructor. To provide an illustrative point, let me show you a gorgeous example from Tie::File:

tie @array, 'Tie::File', $filename or die "Error loading $filename: $!\n";

At this point, the Tie::File module will provide the necessary interface to access any arbitrary file by random access to the array provided, @array. That it you can modify any arbitrary line in a similar fashion:

$array[13] = 'blah'; # line 13 of the file is now 'blah'

Now remember, since this technically ties the file to the array, all standard list context funtions apply, such as push, pop, shift, splice, and others. It should be noted that Tie::File is a packaged module (packaged with Perl, that is).

I marvel in the excellence that is tie and Tie::File. The mind reels thinking of the possibilities. You could sort an entire file’s contents, modify the file in place, and write it back out in a matter of a few (at most) lines of code! I can’t believe I used to do things any other way! Of coarse this module has its drawbacks, most notably is this could be a huge drain on very large files.

So many things have tie interfaces, it’s any wonder that most Perl programmers still do things the hard way. Go take a look for yourself, you might find a ton of modules that you never thought existed that could save you countless hours writing and debugging your own version of the same thing.

The last blurb I want to mention is about references. There are few other higher-order languages that are able to abstract memory management away from the developer, yet provide the capability of referring to something by its reference. C# has a crappy IntPtr, which is not only difficult to use but is also platform-specific. In practice, it’s use is akin to writing Java JNI code (large JNI interfaces can be Hell On Earth).

You can refer to all object by their references. Clever usage of context can result in serious performance improvements. Passing large arrays or hashes to a subroutine directly is akin to passing large C++ object by value.

I use references whenever I want to abstract out the type of the data or if I aim to improve the performance of something. I spent extra time switching to all reference usage in my 9 Man’s Morris project for AI and it was very easy to switch their context to the true type.

For more on how references work, refer to the perldoc page. I did find another great blog posting where someone detailed the joys of the more esoteric functions of perl. I do highly recommend reading it as it will make your coding more pleasurable.