Tophography

All things Topher, and other stuff too.

Browsing Posts in Programming

I had to start learning Perl this week for a little project that I was assigned. I spent most of Tuesday reading out of Programming Perl, and then spent all of Wednesday porting a Bourne Shell script over to Perl. Even though reading from the Camel book for 8 hours in one day was not particularly enjoyable, I now feel like I’ve finally gotten over the hump. Okay, now that I’ve shared that gem of a pun with you, let me also share the real reason for this post. I’ve found Perl to be somewhat artistically inspiring, and in honor of the language, I’ve created this fine piece of art that I now present to the world.Perl Cat

And remember,
Real Men use strict;

I happened to be browsing through the ivtv driver source last night, trying to find out how closed captioning gets recorded. Anyway, I came across an operator that I had never seen before. The ellipses! It was something like this:


    switch (val)
    {
        case 0 ... 10 :
            printf("Between 0 and 10.n");
            break;
        case 11 ... 50 :
            printf("Somewhere from 11 to 50.n");
            break;
        case 51 ... 99999 :
            printf("Really big.n");
            break;
    }

Isn’t that just crazy? Apparently, it’s an extension that gcc supports. I found a nice Red Hat manual that has some great stuff on gcc. I never would have found it without the assistance of Lord Byron. I had to ask the PLUG mailing list about it because I couldn’t find anything about it with Google, because I was searching for “C ellipses operator.” Lord Byron told me that it was known as a “case range.” It’s amazing what using correct search terms can do for you.

Anyway, I recall reading somewhere that you should never blog while drunk. This isn’t a problem for me since I don’t drink, but I’ve been told that lack of sleep can have a similar effects on a person, so I’m going to put my laptop down and go to sleep now.

[Disclaimer] This post took me about 2 weeks to write. I started it two weeks ago, then realized that my version of WordPress was _horrible_ at formatting code. It was ignoring my <pre> tags! I decided to upgrade WordPress before I drove myself insane trying to fight against WordPress, but then I got distracted, and never got around to doing the upgrade until now.