Happy New Year!

I’d like to take this moment and wish everyone a Happy New Year.  Let the new year bring more good to your life and take away the pains and troubles.  Be happy, healthy, wealthy, and have tonnes of fun!

Maybe it’s also a good time to take a brief look back at the year 2008, as well as examine some expectations for the year 2009.

Continue reading Happy New Year!

Fedora 10 booting issues

If it so happens that your Fedora install suddenly fails to boot, giving some error messages or a simple “GRUB ” string, then I advise you to boot into rescue mode, install all updates, regenerate initrd image and reboot.  All should be nice and sweet now.

Those of you who need more info, scroll through Common Fedora 10 Bugs wiki page.

Alexander Sorokin, rest in peace

Yesterday I’ve heard the bad news – my uncle, Alexander Sorokin, passed away at an age of 44.  He was on a business trip, almost a 1000 kilometers away from home, when he had a stroke.  He was a really good man.

He was the person who got me into computers many years ago.  He was always involved with technology, and it was him who first arrange a PC for our house.  At first it wasn’t for me, it was for my mother.  But he encouraged my curiosity.  More so, it was him spending countless days and nights in our house, trying to fix the consequences of my curiosity, when important documents got missing or system would get stuck with no way to boot.  All he said after would be “Don’t do this again”.  And on the next occasion: “Oh, that’s OK, I see it’s different this time”.

Strong, kind, smart, and funny.  A very good friend, and an example of a Good Man.  That’s how I will remember him.

Rest in peace…

Perl vs. PHP : variable scoping

I’ve mentioned quite a few times that I am a big fan of Perl programming languge.  However, most of my programming time these days is spent in PHP.  The languages are often similar, with PHP having its roots in Perl, and Perl being such a influence in the world of programming languages.  This similarity is often very helpful.  However there are a few difference, some of which are obvious and others are not.

One such difference that I came up recently (in someone else’s code though), was about variable scoping.  Consider an example in Perl:

#!/usr/bin/perl -w
use strict;
my @values = qw(foo bar hello world);
foreach my $value (@values) {
    print "Inside loop value = $value\n";
}
print "Outside loop value = $value\n";

The above script will generate a compilation error due to undefined variable $value.  The one outside the loop.

A very similar code in PHP though:

#!/usr/bin/php
<?php
$values = array('foo','bar','hello','world');
foreach ($values as $value) {
    print "Inside loop value = $value\n";
}
print "Outside loop value = $value\n";
?>

Will output the following:

Inside loop value = foo
Inside loop value = bar
Inside loop value = hello
Inside loop value = world
Outside loop value = world

In Perl, variable $value is scoped inside the loop.  Once the execution is out of the loop, there is no such thing as $value anymore, hence the compilation error (due to the use of strict and warnings).  In PHP, $value is in global scope, so the last value “world” is carried further down the road.  In case you reuse variable names in different places of your program, counting on scope to be different, you might get some really interesting and totally unexpected results.  And they won’t be too easy to track down too.  Be warned.

Hosting downtime

None of the sites hosted on my sever were accessible for most of yesterday.  That was caused by some emergency maintenace done by the hosting company.  They didn’t warn me before, so I weren’t aware of it coming and for how long it would last.

This is the third downtime for this month.  Needless to say, I am not satisfied with the service no more.  Firstly, the downtimes are too frequent and too lengthy.  Secondly, total absense of notificatios – either before the downtime or after.  No explanations.  Nothing.

I’ve been with this hosting company for more than two years now and it was OK most of the time.  But now, once again, I am thinking about moving somewhere else.   Suggestions?