Disclaimer

The content of this blog is my personal opinion only. Although I am an employee - currently of Nvidia, in the past of other companies such as Iagination Technologies, MIPS, Intellectual Ventures, Intel, AMD, Motorola, and Gould - I reveal this only so that the reader may account for any possible bias I may have towards my employer's products. The statements I make here in no way represent my employer's position, nor am I authorized to speak on behalf of my employer. In fact, this posting may not even represent my personal opinion, since occasionally I play devil's advocate.

See http://docs.google.com/View?id=dcxddbtr_23cg5thdfj for photo credits.

Thursday, October 23, 2008

Perl RAII test banner

Wrote a somewhat neat Perl trick today:




    file RAII_Test_Banner.pm:

    {
    package RAII_Test_Banner;

    sub new {
    my $self = {};
    $self->{'message'} = shift;
    bless $self;

    print "START: $self->{message}\n";

    return $self;
    }

    sub DESTROY {
    my $self = shift;
    print "END: $self->{message}\n";
    }

    }


    if( $::TEST ) {
    {
    my $t = RAII_Test_Banner("Example of RAII_Test_Banner usage");
    print "something like START: Example ... should be printed above\n";
    print "This is inside\n";
    print "something like END: Example ... should be printed above\n";
    }
    }

    1;









This is just a Perl version of a C++ library I wrote years ago, when I first learned about RAII (Resource Allocation is Initialization) - aka using automatic scoping to reduce the need to write code that matches start and end.

I had not realized until today that Perl had deterministic finalization - at least for variables that are not referred to by live references.

IMHO one of the biggest weaknesses of Java is lack of deterministic finalization.

PC display driver problems: Quit instead of Reboot

Just came back from a meeting, attempted to dock my PC, and got "Error: OEMSPIF.DLL cannot be loaded", when my PC attempts to change its display size.

Some sort of software problem.

The usual way to "fix" such problems is to reboot.

Instead of rebooting, I will go home. I wonder how much time is lost when people quit, rather than spending the time to work around this sort of stupid PC problem.

I'm going home because of time fragmentation. If my PC were up, I could work; but if I have to spend the 15 minutes to half an hour, or more, that it usually takes to become functional after a reboot, I don;t have time to squeeze in any useful work before I go home.

I.e. PC reliability problems make it harder to deal with fragmented work time. And lots of working hours get lost to fragmentation.

Sometimes a quick blog entry is all that you can squeeze in.

---

Had a similar problem this morning: I required two reboots before I could get anything done. Software patches...

---

Lest it seem as if all I do is complain: I *am* trying to make this situation better. But I can't talk about that.