Wednesday, April 05, 2006

Redhat 9 Sucks


I spent the better part of 3 hours at work on Friday trying to figure out why my Perl script wasn't working. I had an arbitrary collection of binary data skimmed from the network that was perfectly coherent and viable when stored in a hashtable. However, as soon as I decide to write this data to a file, random garbage was interspersed with real data, resulting in a file on disk that was much larger than the file in memory, in addition to it being total garbage. Since my work is on an isolated system, I cant post details of what I was seeing. Nevertheless, it was a very perplexing problem. Perplexing that is until I remembered having a similar problem a number of years ago with Perl on a Redhat 9 system...back when Redhat 9 was relatively new and still in favor with me.

After several futile google searches to narrow down the problem, I decided to try the solution that I remembered from my prior disastrous experiences...open the file in binary mode. Even though the documentation explicitly says that this is only necessary on broken operating systems like Microsoft Windows, this simple modification made my script work flawlessly. I am not in the mood to run this issue into the ground much further since I don't use Redhat products by choice anymore and this work project is nearing its completion. However, I did find out what the culprit most likely was.

At some point around the release of Redhat 9, Perl was going through its transition to Unicode support. Apparently, parts of the system were not completely functional for the Redhat 9 Perl release. In particular, it seems that the print function was converting my binary data to Unicode before writing it to the file, translating certain bytes to the extended form. This would explain why I had extra data in my file on disk. Doesn't make me any happier though :(

Wednesday, March 29, 2006

Divorcing Religion

Ran across an interesting article that led me to this website:

http://www.barna.org

Apparently, these crazy folks have been doing alot of research on the religious affiliation of divorcees and some of the results are kinda sorta surprising. In particular those born-again crazies that always claim moral superiority have, at best, the exact same divorce rate (~35%) as most other religions including atheists. That's right...even the fear of Jesus Christ can't scare these people into suffering through the brutalities of a bad marriage. Interestingly, catholics had one of the lowest rates at 25%. I guess my former life as a catholic might be worth something afterall.

Thursday, March 23, 2006

This blog sucks


I don't understand why this blog doesnt let me have the ability to tag my entries. Isnt the whole point of a blog that you can add interesting metadata tags to your entries so that they can be easily searched? Oh well, I am too tired at the moment to set up my own blogging software on my home server, so I will have to live with this for now :P

In the mean time, I need to go back through my past posts and make them a bit more interesting...maybe add a few pictures or something?

Of course, if all of my freaking pictures are still on my old dead harddrive, how the hell am I supposed to do that? I need to work on being a better geek. Anyways, here is a picture from my last trip to the land of guys with big thingies...

Tuesday, March 21, 2006

No more tuesdays

Well, today was my last day of Tuesday volleyball for a while. I've decided to just play one night per week in leagues to leave room for free play with the club at work. With all the extra money I save, I'll surely be able to retire in my 40's.

Tuesday, February 28, 2006

My first Ruby

Well, I have been playing with Ruby for a few days now. I finally found something at work that I could legitimately use it for, so I had to give it a shot. To demonstrate its power, here is the code for a web server. Now, I don't have to install one each time someone wants to download a file from me since GAIM's file transfer mode seems to be broken. Anyways, try and you will like...GUARANTEED!

require 'webrick'
include WEBrick

if ARGV.length == 1
s = HTTPServer.new(:Port => ARGV[0], :DocumentRoot => Dir::pwd)
trap ("INT", proc{s.shutdown})
s.start
else
puts "Usage: ruby webserver.rb port"
end

For some reason, alot of the sources I found online didnt mention calling the proc function with the shutdown block. Without this, I was getting a segfault in the Ruby shipped with Ubuntu 5.10. Go figure. Maybe some day I'll be knowledgable enough to track down whats going on?

Saturday, February 25, 2006

Typical Saturday

It's kind of sad when you have to cheer against athletes from your own country because they make total asses of themselves. Sometimes I'm not so proud to be an american.

In other news, we finally had our whole team together today...at least most of it. Too bad I didn't play very well. Gonna have to practice a little harder.

Wednesday, February 22, 2006

against the law

Here is your fun fact of the day...apparently this guy named Frank Benford noticed one day that the number 1 appears much more often than you might expect as the first digit in any numbers you are likely to encounter in daily life. Given some random numbers, you might think 1 out of every 10 would have the number 1 as the first digit...not so says Mr. Benford. In fact, if you look at things like census data, news papers, and even the Dow Jones daily average, the number 1 appears about 30% of the time as the first digit. A formal mathematical version of Benford's findings exists in the form of Benford's law, and is often used in statistical analysis to find cheaters and such. So, the next time you plan on cheating on your taxes, which is probably quite soon I would imagine, make sure you familiarize yourself with Dr. Benford or you might have the IRS kicking your ass.