taking a screenshot with phpunit and selenium RC

PHPUnit has built in support for taking a screenshot with Selenium and storing it locally (as in, on the server that is running the firefox instance)

This doesn’t work well when you’re running selenium RC, because you won’t know what server firefox eventually runs on.

Fortunately, PHPUnit also implements captureEntirePageScreenshotToString(), which will return a base64-encoded PNG that you can decode and store locally (for example, to provide to Jenkins as an artifact)

In this example, I want to capture the screenshot when the test ends, or when it fails.

require_once 'PHPUnit/Extensions/SeleniumTestCase.php';

class yourTest extends PHPUnit_Extensions_SeleniumTestCase {

//// rest of your tests here

   * On teardown, capture a screenshot.
  public function tearDown() {
    file_put_contents('result.png', base64_decode($this->captureEntirePageScreenshotToString()));

You can implement this code elsewhere if you wanted to take screenshots on failure only, after each test, etc…

raid5: cannot start dirty degraded array for mdN

rebuilding a software raid array and stuck with this error? for example, I was rebuilding on a live array and the server took a dive.

try tricking the array into believing its clean, then try to add a new drive or start the array again.

echo "clean" > /sys/block/md0/md/array_state
mdadm /dev/mdN -a /dev/sdXN
mdadm --manage /dev/md0 --run

then do a cat /proc/mdstat

raid should be rebuilding!

replace dolphin with konqueror

Dolphin is still missing some features that I have set up in Konqueror.

But EVEN AFTER changing your preferred “file browsing” application to Konqueror under System Settings ->Default Applications, Dolphin still runs on mostly any folder operation. I found that the easiest way to get Konqueror to run instead was to symlink dolphin to konqueror. as root:

cd /usr/bin
mv dolphin dolphinx
ln -s konqueror dolphin

Now Konqueror runs for everything.

PowerGenix NiZn batteries

nizn battery

I managed to pick up a PowerGenix 4-pack of NiZn (Nickel-Zinc) rechargeable batteries and a charger while I was at the International CES in Las Vegas – I saw them demoed at Lunch@Pieros and they were nice enough to donate a pack.

Well, that was back at the beginning of January. I’ve had them in my Wiimote since then, and my battery is still at 100% from a full charge. I thought they were full of bologna, telling me that it was the “next generation” of battery technology, geared towards high-draw use – seriously, how many times have we heard this in the past?

I have a pack of NiCds gathering dust now. They would be on their 37th charge if I was using them in my Wiimote this long.

It seems like we’ve finally seen a STRONG contender towards alkaline AA’s. These batteries even put out 1.6v, a little more than most AA’s, and the same as the best high-capacity lithiums. I really don’t have to mention that it puts the 1.2v of NiCd rechargables to shame.

And another thing, they are cheap.

Intel HDA/Realtek ALC800 surround sound in linux

actually just posting this so I’ll google it in the future and will get to this page. for some reason sound only comes out of the front speakers and is impossible to route to any others. adding this model parameter makes it happen.


options snd-hda-intel model=6stack

rinse and repeat, I mean, reboot