Archive for the ‘Fail’ Category

Fsck completely destroyed my OS!!!

Sunday, August 9th, 2009

My installation of Gentoo on my laptop was completely destroyed when I tried to make standard hibernation work. I had updated to kernel version 2.6.30 with the tuxonice-sources, but the TuxOnIce hibernation did not work for the 2.6.30-r4 ebuild for some reason.

The kernel worked fine and I was all happy, because it fixed the trouble I had with X not loading the drm module correctly. But when I was done and tried to hibernate my laptop, it refused to do so. So I decided to use the normal gentoo-sources with the normal hibernation for the moment. So I copied my settings to these sources and ran the hibernation and this worked. The next morning when I booted my OS, fsck complained that there were some error and refused the let the OS boot. It told me I needed to check the partition manually. So I did this using the Gentoo minimal installation disk and it found some things and put them in the lost+found directory. The content didn’t seem interesting so I discarded it. But the next time I had hibernated, it complained again. So I repeated the process of checking manually and told it yes to all. This was a big mistake! :@ When it was done The complete content of my root partition was gone and all that was left was a lost+found directory with thousands of files with numbers as names and some hundreds of folders with the same. They didn’t resemble the original structure at all, so there was no way of fixing the problem and I was only able to recover some important files. But most of the files, including some important files were untraceable. To bad my back-up was over a week old :s

Because I was in a hurry, I decided to install Ubuntu for now. Lets see how long I will stick with it…
For know it showed me Gnome can be quite usefull and is low on resources. (After killing and stopping the necessary unneeded services/processes ;) I choose the normal Ubuntu, because Kubuntu is complete pain in the ass, because it keep crashing and I wonder how they can call it stable. So it went off as fast a put it on my laptop.

One of PHP’s major OO flaws

Friday, July 10th, 2009

Today I tried to use type hinting for one of my methods. I wanted to hint that one should provide an arbitrary object. This sounds very straightforward, if you familiar with Java. But in PHP it seems this is not as straightforward as you might expect. At first I made the method declaration like this: public function test(Object $object). But this the PHP parser complained that it could not find the class Object. So I tried class, but this is a reserved word. Same for default.

So I started an investigation via Google, but I couldn’t find anything useful. So I made this code and executed it:

<?php
class Test{
public function __construct() {
echo 'Class: ' . __CLASS__ . "\n";
echo 'Parent?: ' . get_parent_class(__CLASS__) . "\n";
echo 'Parent?: ' . get_class(parent) . "\n";
}
}new Test();
?>

This was the result:

Class: Test
Parent?:
Parent?:

A standard class seems to extend noting…

In conclusion, it seems PHP has no main class that is extended by default. As a result you cannot request for a generic object via type hinting. The only work around seems to call this at the beginning of your method: assert( is_object($object)  );...