Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jtrammell (6222)

Journal of jtrammell (6222)

Wednesday January 16, 2008
05:27 PM

Heads Need to be Cracked In!

I'll admit it. In a moment of high spirits as a grad student, I posted an editorial from The Onion on a website. OK, it was the graduate student website. OK, I was a grad student at Fermilab at the time, so it's sort of a ".gov" website.

That was (counts on remaining fingers) ten years ago. And it's STILL THERE. Sorry, Fermilab. You can point the neutrino beam at my house in retaliation.

But if you do, I will drive down to Batavia and crack your fool head in.
Saturday August 18, 2007
07:52 AM

.ini file folding in Vim

Create file "~/.vim/after/syntax/dosini.vim" containing this line:

syn region dosiniSection start="^\[" end="\(\n*\[\)\@=" fold

and voila!

Tuesday July 31, 2007
10:49 AM

Technorati seal of approval

I claim this blog in the name of the King. Technorati Profile Technorati Profile
Thursday July 05, 2007
03:58 PM

MORE HORROR

Also seen today, from the same author:

sub deliver_emails_for_products_and_section_types_for_users_that_have_not_already_re ceived_email {
...
}

(any errant spaces in that sub name were inserted by slashcode...)

12:31 PM

THE HORROR

Found lurking in the codebase:

sub get_time_stamp_in_format_yyyy_mm_dd_hh_mi_ss {
    my $time_val    = $_[0];
    my $err_msg_ref = $_[1];

    my $date;
    my $day;
    my $fatal_msg;
    my $file;
    my $hasargs;
    my $hour;
    my $line;
    my $min;
    my $mon;
    my $msg;
    my $pack;
    my $ref;
    my $sec;
    my $subname;
    my $subroutine_name;
    my @time_attrs;
    my $time_str;
    my $want_array;
    my $year;

    $want_array = wantarray;

    $subroutine_name = 'get_time_stamp_in_format_yyyy_mm_dd_hh_mi_ss';

    if (ref $err_msg_ref eq 'SCALAR') {
        $$err_msg_ref = undef;
    } else {
        $err_msg_ref = undef;
    }

    if (! defined $want_array) {
        if ($err_msg_ref) {
            ($pack, $file, $line, $subname, $hasargs) = caller 1;

            $msg = $pack.'::'.$subname.' ('.$line.') : The method '.
                   (PACKAGE_NAME).'::'.$subroutine_name.' called in '.
                   'void context.  It makes no sense to call this '.
                   'method in void context.';

            $$err_msg_ref = $msg;
        }

        return;
    }

    if (! defined $time_val) {
        $time_val = time;
    }

    eval {
        @time_attrs = localtime $time_val;
    };

    $fatal_msg = $@;

    if ($fatal_msg) {
        if ($err_msg_ref) {
            $$err_msg_ref = $fatal_msg;
        }

        if ($want_array) {
            return ();
        } else {
            return undef;
        }
    } elsif (!@time_attrs) {
        if ($err_msg_ref) {
            ($pack, $file, $line, $subname, $hasargs) = caller 0;

            $msg = $pack.'::'.$subname.' ('.$line.') : Call to localtime '.
                   'failed to retrieve the second, minute, hour, day, '.
                   'month, and year given the value '.$time_val.'.';

            $$err_msg_ref = $msg;

            if ($want_array) {
                return ();
            } else {
                return undef;
            }
        }
    }

    $sec  = $time_attrs[0];
    $min  = $time_attrs[1];
    $hour = $time_attrs[2];
    $day  = $time_attrs[3];
    $mon  = $time_attrs[4];
    $year = $time_attrs[5];

    $mon++;
    $year += 1900;

    foreach $ref (\$sec, \$min, \$hour, \$day, \$mon) {
        if (($$ref >= 0) && ($$ref < 10)) {
            $$ref = '0'.$$ref;
        }
    }

    $date     = $year.'-'.$mon.'-'.$day;
    $time_str = $hour.':'.$min.':'.$sec;

    if ($want_array) {
        return ($date, $time_str);
    } else {
        return $date;
    }
}

Mommy!

Thursday June 21, 2007
11:26 AM

"question" ne "doubt"

A little clarification for those who use "doubt" and "question" (as nouns) interchangeably:

Question: an interrogative expression often used to test knowledge; an interrogative sentence or clause

Doubt: uncertainty of belief or opinion that often interferes with decision-making; a deliberate suspension of judgment

OK, Thanks!

Tuesday May 08, 2007
07:03 AM

Round & round

Witnessed recently:
  • The English language is imprecise!
  • Therefore it is a waste of my time to try to speak carefully and precisely!
  • Everyone is confused by what I am saying!
  • See, I told you the English language is imprecise!

Repeat ad nauseam.

Sunday February 25, 2007
10:49 PM

Literally

You know you're in for a ride when your textbook starts with a howler like this:

The amount of information available to us is literally exploding, ...

This abysmal textbook is literally giving me a headache.

Wednesday December 20, 2006
11:34 PM

Finally attained divinity

[ #31981 ]

For the most part I've been treated well by "Joy of Cooking", but until tonight their divinity recipe (pages 731-2 in my paperback edition) has eluded me. Mom used to make it every year for Christmas, and I haven't had it since a loooong time ago.

After a little experimenting I was able to adapt the JOC recipe into something that made divinity like Mom used to make. Here goes.

Divinity

Materials

  • 2 egg whites, room temperature
  • 1/2 cup light corn syrup (e.g. Karo)
  • 1/2 cup water
  • 2 cups sugar
  • candy thermometer
  • lidded pan suitable for use with candy thermometer (diameter of pan is less than length of thermometer, so that if the thermometer falls, you don't have to fish it out of boiling sugar)
  • heavy mixer + 2.5-quart bowl to go with it
  • waxed paper on heat-resistant surface (cooling rack, cutting board, etc.)

Instructions

  1. Bring the corn syrup + water to a boil in the pan. Cover the mixture while doing so.
  2. Add the sugar; turn the heat down slightly (on my stove, this is from "High" to about "7.5").
  3. Agitate the pan until the sugar dissolves. I don't know if this is necessary, but I find it enjoyable. :-) No need to stir the sugar after this.
  4. Stick the candy thermometer in the mixture. (Some people suggest preheating the thermometer in a pan of hot water. I've done this, but I'm not sure how important it is.) You're going to heat the sugar to 270 Fahrenheit, but first you have to whip the egg whites.
  5. Beat the egg whites until firm. This only takes a minute, and you should have plenty of time to do this while the sugar is heating.
  6. When the sugar hits 270 Fahrenheit, take it off the heat, and pour it into the egg whites slowly, while beating.
  7. Beat the divinity mixture until it's firm enough to stand on its own in little dollops. This may take a while, and is the most interesting part of the process. If you watch carefully, you can see the divinity go through at least one "phase change" where its gloss changes dramatically.
  8. Put dollops on waxed paper. Dollops will be pretty hot at first, but not too hot to touch with bare fingers. I get about 3 dozen dollops consistently from this recipe.

Nutrition

  • 2 cups sugar: 1550 calories
  • 2 egg whites: 34 calories
  • 1/2 cup corn syrup: 450 calories

So we're talking about 60 calories per item here.

Thursday August 17, 2006
03:44 PM

Election judging

I am very psyched to be chosen to be an election judge again this year, and proud of my state and county for using a decent (i.e. hand-recountable paper trail) ballot system. None of this electronic ballot malarkey. I'll be working the primary and general elections, and we just had training this week.

One addition this year (due to HAVA) is the new AutoMARK machine, which makes ballot marking more accessible. It has braille, audio, touchscreen with magnify/high-contrast, and "puff" interfaces for those with limited mobility. I'll probably use it to mark up my own ballot just so I get a chance to play with it.

One thing I really enjoy about being a judge is that I get to meet a lot of the people who live in my neighborhood. We had something like 90% voter turnout last year, so I had at least an opportunity to talk to most of the adults (any many of the kids) in my area.