Slash Boxes
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 ]

grinder (1100)

  (email not shown publicly)
Yahoo! ID: perlgrinder (Add User, Send Message)

Editor of p5p summaries, member of the p5p peanut gallery.

Journal of grinder (1100)

Wednesday February 15, 2006
01:20 PM

Brute force compilation

I ran the following program:

% /usr/bin/perl /usr/share/dict/words
Semicolon seems to be missing at /usr/share/dict/words line 56367.
Semicolon seems to be missing at /usr/share/dict/words line 58414.
Semicolon seems to be missing at /usr/share/dict/words line 72599.
Semicolon seems to be missing at /usr/share/dict/words line 104537.
Bareword found where operator expected at /usr/share/dict/words line 109459, near "Maarten"
  (Might be a runaway multi-line MM string starting on line 109455)
Semicolon seems to be missing at /usr/share/dict/words line 124219.
Semicolon seems to be missing at /usr/share/dict/words line 136839.
Bareword found where operator expected at /usr/share/dict/words line 161158, near "qere"
  (Might be a runaway multi-line qq string starting on line 161157)
Semicolon seems to be missing at /usr/share/dict/words line 167505.
Bareword found where operator expected at /usr/share/dict/words line 171985, near "sab"
  (Might be a runaway multi-line ss string starting on line 171980)
syntax error at /usr/share/dict/words line 4650, near "Alaric
No such class Mya at /usr/share/dict/words line 121337, near "muzzy
"no" not allowed in expression at /usr/share/dict/words line 124778, at end of line
No such class Ouranos at /usr/share/dict/words line 133287, near "ouphe
Illegal declaration of subroutine main::subabbot at /usr/share/dict/words line 191503.

.. and wondered why I was getting such perplexing errors. Then I realised that I had omitted the name of the script, and was thus executing the word list file.

This reminds me of the time at school when I tried to compile a COBOL program with a Pascal compiler. I got a thick stack of fan-fold back from the computer room. Page after page of errors. It did nearly manage to parse one line correctly, when it got to


... but apart from that it recorded several thousand syntax errors. I like it when programs march on stubbornly in the face of impossible odds. It makes me feel smarter than them.

Tuesday January 03, 2006
05:29 AM

I suspect that this entry contains worms

Clearing out my inbox from the Christmas break, I ran across some virus backscatter with a most entertaining subject:

MailMarshal suspects that this message contains worms

I'm wondering if I should crush a couple of worm tablets and sprinkle the powder onto my keyboard. You just never know.

Thursday September 01, 2005
11:43 AM

Xah Lee on Python

It's time for my biannual journal entry!

Well heh, this makes me laugh. Seems like Xah Lee is now trolling the Pythoneers. I don't know if XL still trolls in Perl newsgroups...

I suppose this is a sign of a language's maturity. Godzilla come back! All is forgiven!

Thursday July 01, 2004
12:22 PM

Cool T-Shirt Idea

We were clowning around of the French Perl Mongers mailing list the other day. Someone moaned about the latest Python snipe (actually I think I saw this some time ago, but anyway): Perl Coder.

So in the spirit of that and a tweak from rafael I came up with:

perl -i -e 's/^\s+//' *.py

Compact and devastating. Well, I thought it was funny :)

Sunday August 25, 2002
05:07 PM

Stalling the pipeline in the checkout queue

I was in the supermarket the other day after work. I had a number of essentials in my basket and I was itching to get home.

Big problem: which queue to choose? Having learnt about Queuing Theory at school, and knowing that single queue-multiple consumer is as efficient as it gets, it's always an agonizing decision. You have to balance a number of factors: how many people in the queue, how many items do people want to buy, do they look impatient or vagued out. It's better to be behind a person buying 10 of one thing, than one item of ten different things. And, although it pains me to admit it, old people are Bad News. Statistically, you'll waste 30 seconds to five minutes with them in front of you.

So I was pondering this the other day, and reflecting on my worldview, how I tend to algorithmatise things (figuring out the shortest path between the four shops I need to go to, establishing contigency plans in case a shop doesn't have a product I need, that sort of stuff. When house-cleaning I try to keep my hands full. I hate going into room A to fetch something for room B, and realising there was something in room B which should be tidied away in room A). Geeking out, basically.

And as I stood there ruminating on this, I was idly watching the woman at the front of the line, and became more and more alarmed. She was just stacking up the products that the cashier swiped...but not putting them into bags. I couldn't figure out what she was doing, but figured it was bad news for me. And on and on it went, until the cashier had checked out every last item. Then she handed over her credit card, had it swiped, punched in her pin, and only once she had received her docket did she begin to bag up the stuff she'd bought. And I thought "You f5cking moron: can't you deal with asynchronous events?" Because the cashier couldn't start checking out the items of the next person until she'd cleared the decks. Which took a non-trivial amount of time, during which no other work could be done.

Meantime I note that the people who were at the ends of the other queues are now close to being served, and I've still got two people in front of me. But I'm in too deep at this point to bear the cost of cutting my losses and requeuing on another line.

The next person went through without a hitch: a few items, had cash ready, out straight away.

Then the person in front of me went through. Seemed to be okay: started bagging up the goods as soon as they came through, but she had a fair number of things to buy. Then it turns out that she has a Method. All the fruit goes together, the stuff that requires Refrigeration goes together, tins kept apart from packets and so on. And the cashier is done quickly and announces the price. But does she do anything? Noooooooooo! She just keeps putting stuff in bags. And the cashier, who is polite (the Customer is always Right and all that) says nothing.

At this point I just take a deep breath and resign myself. The people who were at the ends of the other queues are all long since gone. At times like this I can't help thinking that a lot of what we learn in Computer Science is applicable to the Real World. And one of the cardinal sins is stalling the pipeline. When you have people queued up to do something, you want to get in and get out as fast as possible, just like an instruction on a CPU. Because wait states are just time lost. Gone, never to come back.

I really, really hate when that happens.

Monday February 11, 2002
12:46 PM

Do's and Don'ts

Here is a list of Do's and Don'ts for enlightened program development.

  • First off, when the usual person in charge of backups takes Friday off, do not forget to insert a tape into the DLT tape drive so that Friday's files get backed up.
  • Do not work on a new version of an production script by running cp `which important-script` . rather, rename it to something else.
  • Do not use cp in a different session window to copy output datafiles from said script from one directory to another, simply because the second directory happens to be accessible from a Samba share so that you can import the data into Excel.
  • Do not get confused about which window you are in and re-run the cp command using !cp, thereby reinitialising the contents of your updated script back to how it was before you started hacking on it two days ago.
  • Do alias cp to cp -i. It's not just for root!
  • Do print out the script on hard-copy from time to time, even if it was Friday midday, because at least then you don't lose quite as much work.
  • Do get a better version of vi than Solaris' shi^Wbraindead implementation. At least one that creates ~backup files.
  • Do know how to touch-type, so that at least rekeying 12 pages of Perl code doesn't take so long, even if that is a meagre consolation.

Man I hate when that happens.

Thursday January 24, 2002
09:53 AM

Hello, world

If everybody else is doing it, why shouldn't I?

For Christmas, I got a kidney stone. Eeeeeeew, it really hurt, like, the pain was so bad that I was vomiting spontaneously. Not fun.

But then I got better and back to work, with an inbox a mile look. Various things at work were broken and I had to get them up to speed. In the past 10 days I have

  • Upgraded Apache from 1.3.9 to 1.3.22.
  • Upgraded from 2.56 to 2.79.
  • Wrote a script that extracts information from our tracking database to the accounting system.
  • Updated various documents in our bofh tech library.
  • Wrote a web script to allow people to cook^Wmodify financial details in the billings database.
  • Set up a couple of printers on the network.
  • Figured out why the primary DNS server was refusing ssh connections.
  • Got the Frankfurt office up and running (they had run out of disk space).
  • Posted a snippet to Perl Monks, only to have Merlyn point out that I had successfully reinvented CGI->Dump. Man I hate when that happens.