Category: Programming

Blogger adding an extra clear: both div to posts

Blogger adding an extra clear: both div to posts

Lots of people have noticed recently that Blogger has started publishing posts with a tag before the posting text. This broke my layout and have me invalidly nested tags since I was including the opening and closing tags in the template. The extra tag meant that the browser closed the previous block element (the ) …

+ Read More

PHP 5 Static class variable inheritence

PHP 5 Static class variable inheritence

PHP 5 doesn’t seem to attempt to implement any kind of inheritance for properties within static classes. This can be mean having to duplicate code within static subclasses. As an example, we would like to have a parent class (this is using the Singleton pattern) such as this: abstract class DataTable { protected static $instance; …

+ Read More

Technical solutions to web site visitor tracking

Technical solutions to web site visitor tracking

There are two main ways that the problem of identifying an individual when they visit a web site. This is assuming they are not willing to put their hand up and identify themselves by logging in. That may not always be likely to happen depending on the type of site or service on offer. So, …

+ Read More

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

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