Month: September 2009

What could be better than life balanced between golf, computer programming and spending time with the kids, wife and dog?

What's the link between childhood and old age?

When you dream are you in another more real world?

If God doesn't exist then is being compassionate still a logical alternative?

| 11 Comments

During my lunch break I meandered my way along the canals and through the narrow alleys to the local book-store.

This book-store is pretty big, five floors filled with millions of books. They've got this huge eating area which always smells delicious. My favorite section of course is the computers section (followed by modern literature, and then science, and then psychology).

Several weeks ago, I was there and noticed that there were very few Perl books on the shelves. Only two measly copies of Mastering Regular Expressions and one copy of Learning Perl whose cover had an ugly crease in it.

With a rather disappointed look on my face, I asked the guy how come there were so few Perl books. He shook his head and told me that lately they just weren't that popular. The previous day he had re-ordered some titles, and they'd arrive in about a week or so.

Well there I was three weeks later, and there was not a single Perl book to be found. Just an empty spot becoming ever so cluttered with overflowing JavaScript and ActionScript books which were taking over the section dedicated to Scripts. What a sad day for me.

I believe it is high time to come out with some new titles. If I had more time on my hands maybe I'd try to write a book. There are many talented writers out there and perhaps they are coming up with some creative variations on the subject.

Hopefully with all of the new and exciting Perl-ish happenings on the rise, there will be a new barrage of literature appearing on the shelves some day in the not so distant future.

Until then I'll just have to be patient and scour the Internet looking for interesting tidbits in order to satiate my hunger.

Par, par, par, par, par, par, triple bogie, triple bogie, par for a forty two.

One thing that has been plaguing my golf game all year is an acute case of inconsistency. As revealed in the previous series of scores, it can be quite frustrating when a pretty good nine holes is blasted into oblivion by two measly mess ups.

In general, I play alright shooting pars, bogies, and an occasional birdie for good measure.

However, at least once or twice and sometimes even more often, I choke badly on a given hole. In the water, between the trees, buried in the bunker.

At least if I happen to mess up one hole, it'd sure be nice to recover gracefully and continue my streak of pars and bogies as if nothing happened.

So what gives?

They claim that golf is more of a mental game than physical, so that's the area I'm going to have to improve during these winter months. When it's too cold or stormy to play golf, I'll have to meditate indoors and read books about golf (I have a pile of unread golf books about a meter high).

The great Ben Hogan always said to treat the next hole as if it were the very first hole of the day.

interapy-team.jpg
Interapy Team

See if you can spot the most enthusiastic individual (me) in the picture.

| 1 Comment

The Perl module CGI::Carp allows you to define a different error handler than the boring "A Software Error Occurred" one by using set_message() like this:


use CGI::Carp qw(fatalsToBrowser set_message);
...
set_message(\&handle_error);

Now all calls to die() are caught and sent to the user-defined subroutine handle_error() which will present the user with a nicer HTML page rather than the boring default one generated by CGI::Carp. Pretty nifty.

The only problem with this is when you are debugging. The contents of the HTML page are barfed up and scattered across stdout. This makes it hard to search through all of the HTML and find exactly where the error description, error code and line number is.

So what you need to do is define a simpler user-defined error handler which generates a plain-vanilla printf message.

How can the script detect whether or not it is in the debugger? Simple, just check if &DB::DB is defined. If it is defined, then call set_message() and pass it the simpler error handler like this:


set_message(\&handle_error_printf) if (defined &DB::DB);
...
sub handle_error_printf {
    my $msg = shift;
    print("$msg\n");
}

You're on your way to a happy and productive life as a Perl debugger kind of person.

| 3 Comments

I've been doing alot of bash scripting the last few weeks. Struggling with all kinds of nasty problems and error handling stuff, I have discovered what a powerful utility this bash thing is.

Of course, when it comes to powerful scripting languages there's no substitute for Perl. Sometimes certain problems are a bit too complex for bash and it is nice to be able to fall back on Perl.

Let's say that I have an input file config.tmpl with a single line containing [% base_url %] and I want to generate a configuration file config replacing the value of base_url with $BASE_URL as defined earlier in the bash script, e.g. BASE_URL=http://www.kiffingish.com/utils.

One way of managing this is by using good old sed like this:


cat config.tmpl | sed 's!\[% base_url %\]!'$BASE_URL'!' >config

Sure this is fine and dandy, but what do you do if you have multiple lines in config.tmpl which need to be substituted on the fly? This is where Template Toolkit comes to the rescue.

I've added another line in config.in containing [% index_file %] which needs to be replaced with the value of $INDEX_FILE. A bash one-liner with the help of Template Toolkit works wonders:


perl -MTemplate -e '$t = Template->new(); $t->process('config.tmpl', {base_url => '$BASE_URL', index_file => '$INDEX_FILE'})' > config

If you are bit paranoid, you can extend the above one-liner with some error checking just in case:


perl -MTemplate -e '$t = Template->new() || die "$Template::ERROR\n"; $t->process('config.tmpl',{base_url => '$BASE_URL', index_file => '$INDEX_FILE'}) || die $t->error()' >config

Now if you are like me and even more overcautious. one more sanity check is in order. Always expect the worst, and if this worst happens, make sure that you can trouble-shoot the situation quickly and efficiently.

That's why at the beginning of the bash script, I also double-check that the Template Toolkit module is indeed installed.


# Make sure that the Template Toolkit is installed
perl -MTemplate -e1 &>/dev/null
if [ $? -ne 0 ]
then
    echo Template Toolkit is not installed, please install first.
    exit $?
fi

Isn't the Template Toolkit truly magical? That's why I use it very often to help automate even the most complex chores. Thanks alot Andy.

Positive thinking often helps, but not always.

One must never over estimate the power of positive thinking, as if it alone can solve all of your problems.

There are many more other factors which can influence one's pursuit and mess things up for good.

Being prepared for unexpected obstacles and let-downs will gear one up for overcoming the disadvantages of positive thinking.

As we grow older we acquire certain insights into the way we are and our true relationship with the world which surrounds us.

In some ways this can be quite confrontational. Rather than fighting the truth it is more worthwhile to let it flow over you, like a series of waves splashing on the beach.

In other ways this realization can energize and give one a more powerful push in newer and more exciting directions.

While relaxing on the rubber raft a hundred or so feet from the beach, I can still hear those waves splashing in soothing, musical regularity. A distant drumming sound coming closer and closer.

I will open my eyes later when the time is ready.

All of a sudden I've acquired additional yardage to my shots. My 3 wood is flying past where my driver used to go. My wedge is easily flying as far as my eight iron.

This is good and bad. Good in the sense that my balls off the par five tees are landing within hitting distance of the green. Bad in that a simple chip shot to the par threes is flying way over the green.

So where did this added distance come from? I do not hit the ball any harder, in fact I believe that my swing has actually become smoother and less hurried.

It's all in the timing. The feel of the ball flying off of the club face during the perfect swing feels invigorating.

That is, as long as I aim properly and the balls I hit fly true.

You can imagine how very excited I was this morning to receive the following email.

"We are happy to inform you that based on our recommendation your outstanding Contract Fund of TEN Million, United States Dollars ($US10,000,000 ) has been approved to deliver to your doorstep.from MR LAMIDO SANUSI."

I can't wait.

Vouwwagen-for-sale.jpg

Vouwwagen Jamet Texas 1997

  • Bovag gekeurd 2008
  • In prima staat, ruim en comfortabel
  • Heel zuinig mee omgegaan
  • Binnen en buiten schoongemaakt
  • Nieuwe banden, rem gecontroleerd
  • Tentdoek waterdicht
  • Driepits gasfornuis
  • Binnenhemel en ritsbare verduistering voor de ramen
  • Ruime Disselbak met electra
  • Koelkast Stoelen en tafel
  • Ingebouwde kluis
  • 6 slaapplaatsen (2 extra onder)
  • Een echte aanrader voor de beginnende kampeerders.

Prijs: € 600, see Marktplaats.

Sold for € 500 after only one day!

Sometimes you just want to go out to the driving range and do nothing else but whack the balls as hard as you can.

Do not bother to take any practice swings in between those mighty hits, and whatever you do, make sure that you avoid thinking about what you are doing, how well or badly you are hitting the balls.

Perhaps this is not the best way to improve your game, but it sure makes you feel alot better, ramming through a number of buckets of balls. The little white balls are flying all over the place, and more often than not their trajectories are taking them on a very straight line landing many miles away.

Who knows, you might be improving your game without even realizing it, and having loads of fun while you are at it.

No matter how good such a round of bashing balls makes you feel, I do not recommend trying this on the golf course.

| 2 Comments

I think that I've finally solved my problem of always pulling the ball to the left, sometimes even duck hooking it.

The so-called solution seems easy enough: stand with the ball slightly further back, take a slow back swing slightly touching the grass as long as possible, and hit more down onto the ball without forgetting to follow through high and towards the target.

After hitting several buckets of balls practicing this technique, I noticed that in addition to hitting the ball straighter, I gained more distance when I turned more with my torso during the back swing without exaggerating the movement too much.

Doing this consistently is not easy, but that's where a strong and confident mind comes into play.

Believing that everything can be described by numbers is one thing, but using that as a basis to believe that everything is numbers sounds pretty preposterous to me.

In a previous life I might have been an avid follower of Pythagoras, but I would have gone my separate way if they insisted I take the extreme view above.

Imagine their shock (and my glee) upon discovering that pi cannot be described using a fraction made of natural numbers.

Boy were they a long ways from irrational and transcendental numbers.

| 1 Comment

The population here is still suffering from the remnants of a war that began more than seventy years ago.

Just yesterday they uncovered yet another middle-sized bomb just next to the railway tracks not far from the very spot that I get on the train every morning.

Unleashed from high above, the black object hurdles to the ground and embeds itself deep into the mud. Many explode upon impact killing those poor souls nearby, but not this one.

How many more hidden bombs are there still out there awaiting discovery from a generation which has nearly forgotten the atrocities of a time long lost?

Random entries

Here are some random entries that you might be interested in:

Recent Assets

  • interapy-team.jpg
  • Vouwwagen-for-sale.jpg

Recent Comments

  • Long time no see: I remember them, as well. I remember Donald was my ...
    - Charles
  • Bridge to the moon: Yes it was a drawing and my older brother told me ...
    - jpmcfarlane
  • Bridge to the moon: Wow, that's quite a coincidence that we both sent ...
    - Kiffin
  • Bridge to the moon: Hello I was in my teens when Gemini 4 went up that ...
    - jpmcfarlane
  • Back to work: Congratulations Kiffin, I hope it is something you ...
    - KathleenC

Golf Handicap

Information

This personal weblog was started way back on July 21, 2001 which means that it is 7-21-2001 old.

So far this blog contains no less than 2518 entries and as many as 1877 comments.

Important events

Graduated from Stanford 6-5-1979 ago.

Kiffin Rockwell was shot down and killed 9-23-1916 ago.

Believe it or not but I am 10-11-1957 young.

First met Thea in Balestrand, Norway 6-14-1980 ago.

Began well-balanced and healthy life style 1-8-2013 ago.

My father passed away 10-20-2000 ago.

My mother passed away 3-27-2018 ago.

Started Gishtech 04-25-2016 ago.