Author: karlbunyan

Using importNode and appendChild with PHP 5 DOM

Using importNode and appendChild with PHP 5 DOM

importNode is one of the DOM functions in PHP 5 that I struggled with for a while. What I wanted to do was to take an XML node from one document and insert it into another, and somehow that wasn’t particularly easy. I tried using ‘appendChild’ but kept getting ‘wrong document’ error messages. Once it …

+ Read More

Using removeChild with the PHP 5 DOM

Using removeChild with the PHP 5 DOM

The documentation for PHP 5’s DOM functions isn’t at its most helpful yet, so I thought an example of how to use ‘removeChild’ wouldn’t go amiss. Assuming first that you have some DOMDocument XML in a variable called $xml, that may look something like this: My title The first thing to do is to get …

+ Read More

Review of the Honda CBR 1100 Super Blackbird

Review of the Honda CBR 1100 Super Blackbird

I’ve just had the pleasure of a week and a half with one of Honda’s biggest, and fastest, bikes: the Super Blackbird. Thankfully, no-one calls it the ‘Super Blackbird’ but just sticks to the plain and simple ‘Blackbird’. Before getting on the bike I was slightly unsure about whether I’d take to it. I loved …

+ Read More

The effects of browser settings on web analytics

The effects of browser settings on web analytics

Modern web browsers give the user some degree of control over their privacy and security settings. These can have a major impact in trying to measure how web site’s are used either through preventing web analytics products from registering the user at all or by altering the way data is captured such that the information …

+ Read More

Reliance on cookies in web site user tracking

Reliance on cookies in web site user tracking

In the field of web analytics, one of the permanently hot topics is how to track a user’s activity on a web site accurately with the information that the technology available to us is able to provide. There are two main aims: Tracking a user from their entry point into a site until they leave …

+ Read More

Deleting page elements using removeChild in JavaScript

Deleting page elements using removeChild in JavaScript

Here’s a handy(?) script to delete pieces of any page you’re on when you click on them: javascript:document.onclick=new Function(‘e’,’document.all?src=event.srcElement:src=e.target;src.parentNode.removeChild(src);return false’);void(0); Go to any page on the web, paste it into the address bar of your browser and then start clicking around. It works okay in IE6 and Firefox – I haven’t tried it in anything …

+ Read More

PHP loop benchmarking

PHP loop benchmarking

This benchmark of different ways of looping over a hash array is very interesting. Some things aren’t too surprising, such as counting the elements in an array before looping over them is faster than not counting them, could be expected, but it’s good to see how fast the built-in functions run. PHP loop benchmarking

Poker hand nicknames

Poker hand nicknames

I was given a book called Schott’s Sporting Gaming & Idling Miscellany for my birthday. In there is a list of popular nicknames for poker hands. I’m dubious about some of them myself, but they are: Ace, King, 4, 7 – The AK47 Machine Gun 4, 4 – Magnum (Colt 44) Jack, Jack, 5, 5 …

+ Read More