webpad 3.0 Closing In

Seriously, this time I actually mean it ๐Ÿ™‚ webpad 3.0 Personal Edition is really close to being available for beta download. I’m really excited about this version, I think it has some awesome features and is an excellent upgrade from webpad 2.0 (it feels like a whole new product is has so much new stuff!).

Keep an eye on the project page and sign up to the mailing list to hear as soon as it’s available!

Nerdalicious Sub-Conscious PHP Debugging

I’ve dreamed in binary before, no big deal. When I was learning it (properly) and working with it a bit at university, I got a little carried away and would write my name on things in binary, that sort of ultra-cool nerd thing. Now I’ve stepped up from binary to PHP, and things appear to have accelerated from there;

Last night, I debugged the code that I was writing before I went to bed, in my sleep! I was working on my soon-to-be-released PHP Atom API package last night, as has been the case on many nights recently, and it got to be pretty late. I showered up, went to bed and all was well.

When I woke up this morning – I had memories of dreaming my way through the code that I had been working on the night before (1,500 lines, so no small feat ๐Ÿ˜‰ ), and in my dream, I had found a style of catching errors on some of my processing which wouldn’t actually catch anything, and would always evaluate as if there was no error. I got up this morning and checked it, and sure enough – I was more coherent in my dream than I was while sitting in front of my PC coding.

My friend Ray dubbed this “nerdalicious” and I think that’s a pretty awesomely descriptive word for it, so I’m calling this ‘nerdalicious sub-conscious code de-bugging’.

Random Hex

I needed some PHP code to randomly generate me a hex value for use as a color in a webpage. Here’s what I came up with (WARNING: Some colors are UGLY!)

function random_hex() {
	$color = '';
	for ($c = 0; $c < 6; $c++) {
		$i = rand(0, 15);
		switch ($i) {
			case 10 :
				$i = 'A';
				break;
			case 11 :
				$i = 'B';
				break;
			case 12 :
				$i = 'C';
				break;
			case 13 :
				$i = 'D';
				break;
			case 14 :
				$i = 'E';
				break;
			case 15 :
				$i = 'F';
				break;
			default :
				$i = $i;
				break;
		}
		$color .= $i;
	}
	$color = '#' . $color;
	return $color;
}