Magic __callStatic catches parent::foo() calls before __call. This makes me angry

Rather than try to explain this in words, here is a code example.

class A
{
    public static function __callStatic($method, $args)
    {
        echo "Called a static method\n";
    }

    public function __call($method, $args)
    {
        echo "Called an instance method\n";
    }
}

class B extends A
{
    public function foo()
    {
        // extends the functionality of foo.
        echo "Called new foo\n";
        // and runs its parent's version too
        parent::foo();
    }
}

$b = new B();
$b->foo();

The issue I have is that really I want the parent::foo() method to be caught by the __call() and not the __callStatic(). It always struck me as a bit odd that you call a parent method using static looking syntax (and that any instance method can in fact be called like this) and now it seems it's more than just ugly but actually stopping me from getting at my __call().

Does anyone know of a solution for this? Obviously, in my example, I could explicitly define foo in the parent class but my actual use case is far more complicated and this is not practical. It seems that really we need a way to distinguish between calling static and instance methods on the parent.

Cufon causing VideoJS to load a minuscule player in Internet Explorer

I've just battled for some time to resolve an issue I was seeing on one of our sites where, in Internet Explorer 6 through 8, Flash fallback videos (using Flowplayer) were loading up only about 3 pixels high and 4 pixels across, a tad smaller than intended.

The first thing to note is that both Cufon and VideoJs are quite particular about being loaded in the head of the page. For Cufon, this is to allow replacement of the text before it's displayed and for VideoJs this is to allow it to do something analogous to Remy Sharp's html5 shiv (but only for the video tag).

The VideoJs embed code looks something like this:

<!-- Begin VideoJS -->
 <div class="video-js-box">
   <!-- Using the Video for Everybody Embed Code http://camendesign.com/code/video_for_everybody -->
   <video class="video-js" width="640" height="264" controls preload poster="http://video-js.zencoder.com/oceans-clip.png">
     <source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
     <source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm; codecs="vp8, vorbis"' />
     <source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg; codecs="theora, vorbis"' />
     <!-- Flash Fallback. Use any flash video player here. Make sure to keep the vjs-flash-fallback class. -->
        SNIP - object tag
   </video>
   <!-- Download links provided for devices that can't play video in the browser. -->
   <p class="vjs-no-video"><strong>Download Video:</strong>
     MP4,
     WebM,
     Ogg<br>
     <!-- Support VideoJS by keeping this link. -->
     HTML5 Video Player by VideoJS
   </p>
 </div>
 <!-- End VideoJS -->

Edit: It seems that a browser somehow manages to embed an object even if it is converted to entities and sat inside pre tags. Not sure if it's posterous' fault or mine.

Edit again: It is posterous' fault. It is doing naughty things with entities within pre tags.

Note that the <object> we wish to fallback to is inside the <video> tag, something IE doesn't ordinarily recognise.

Strangely, if I put a delay on the "VideoJS.setupAllWhenReady();" call that actually runs through all the items on the page, everything is fine. Similarly, if I just remove the video tag and let the object embed itself, all is well. This excluded Flowplayer as the culprit.

In desperation, I tried removing a whole load of other javascript from my pages, and getting rid of Cufon brought things under control. After a lot of messing around I spotted in IE8's developer tools that the video tag was getting a size of 0x0. This in turn seemed to be making the object inside it extremely small. Remembering that the shiv was there specifically to stop this, it occurred to me that this could be where the conflict was. After all, the shiv is the only part of videojs that needs to be in the head with Cufon.

Pushing videojs down to the end of the body i.e. bypassing the shiv entirely, miraculously fixed the issue. I guess because IE now decides to render it as an inline element and it therefore no longer has an effect over the size of the object tag within it.

For once, ignoring the advice of the person who developed the software in the first place would have worked out after all.

Resize EXT3 partition on AWS EBS volume

umount <mount point> 

# Create new snapshot from volume

fdisk <block device>

# Type 'd' to delete the primary partition 
# Type 'n' for new partition 
# Type 'p' for primary 
# Type '1' for 1st 
# Type Enter for 1st cylinder 
# Type Enter for last cylinder (full disk) 
# Partition is not bootable, so 'a' not necessary 
# Type 'w' to finish 

fsck -f <block device>
resize2fs -p <block device>
fsck -Cfy <block device>
mount -t ext3 <block device> <mount point>

DPKG locale problems on Debian Lenny

For the techs. If you find that dpkg is churning out the following (or similar) on Debian Lenny:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

You can fix by:

aptitude install locales
dpkg-reconfigure locales

and make sure that at least one locale is selected and generated.