New look for Blog

Permalink 01:41:43 pm, Categories: Web Design, 173 words  

I've just changed the CSS for the blog - just before University starts! Ben said he had a new design he had to get round to creating and I said I'd probably make a new design for my site before the new year started and I've made it! Now to see if he makes his "CSS: Reboot" deadline.

There may be some areas that aren't working quite right at the moment (I know some of the areas need a bit more padding and the body background doesn't quite seem to be sitting perfectly) but what you see is pretty much what it is going to look like. Thanks to Studio 28 and their Fatal IE Windows XP Visual Style for giving me the idea of the nice subtle fade effect.

Update: OK, so the background problem was actually a problem with the background image (damn Photoshop and its laters, I thought they were merged!) Everything else looks fine at the moment. If anyone spots anything that looks odd/old-style-blue, then comment here or contact me :)


Odd searches hitting my site

Permalink 03:26:27 pm, Categories: General, 192 words  

Checking over stats, its always strange to see some of the things that some people search for. Some of them are obvious oddities such as the site domain, which is generally someone running a default Firefox homepage where the Google Search box steals focus when they meant to type it into the address field. Others are a little stranger:

  • i want to download badges for dawn of war - my site turns up top, but why do people use 'real language' sentences on search engines? and even stranger, why didn't they use the normal question format of "where can I download....?"? and why did the person come back with the same search an hour and a half later?! I still think Yahoo! should have turned round and said "good for you, go do it then!"
  • terra server uk - I don't know what they were looking for - nothing in the results seems close! I managed to get hit on the name, the "server load" and the fact that I'm a UK site. Do people not read the descriptions/excerpts?

I'm sure I have more burried away in my logs - just got to find them.


IBBoard.co.uk server uptime

Permalink 03:28:18 pm, Categories: Programming, 222 words  

After trying to get some server load/uptime scripts running for my sites, I had to submit a support ticket to the techs to find a way of getting the average loads without fread()ing the /proc/uptime 'file'. Apparently we don't get read access to /proc/ because of security/hacking issues. The solution? use PHP's backticks (` - not to be confused with apostrophe's) and run the uptime command through PHP's shell execution!

Now it seems slightly counter-intuitive to me that /proc/ can't have read access, but we can execute shell commands, but such is life. Here is my simple server load and apache uptime script (note: you'll probably need to highlight the text and scroll it sideways):

$uptime = @exec('uptime');
//echo $uptime;
preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/",$uptime,$avgs);
$uptime = explode(' up ', $uptime);

$uptime = explode(',', $uptime[1]);

if (strpos($uptime[0],"day")===false){
if (strpos($uptime[0],"min")===false){
$days = 0;
list($hours, $minutes) = explode(':',trim($uptime[0]));
$days = $hours = 0;
$minutes = (int)$uptime[0];
$days = (int)$uptime[0];
list($hours, $minutes) = explode(':',trim($uptime[1]));

Header('Content-type: text/plain');
echo <<<EOF
Average Load (1 min): {$avgs[1]}
Average Load (5 min): {$avgs[2]}
Average Load (15min): {$avgs[3]}
Uptime: $days days $hours hours and $minutes minutes

And if you're interested in the current IBBoard server stats, it's running at /uptime.php


PPHLogger speed improvements

Permalink 09:55:14 am, Categories: Programming, 132 words  

I've noticed recently (especially on my girlfriend's Perfect Imagination site where the counter is at the top) that PPHLogger (the hitcounter I use that is installed on my server) was giving very bad performance. It wasn't due to the large tables, but because of the slowness of the PHP getHostByAddr() function that converts, for example, into localhost (a reverse DNS lookup).

So what was the speed improvement? Stop it looking up the host every time and just store the IP (instead of host and IP). I've now got a separate process that I'll be putting into a Cron job to run regularly to keep my stats updated with the hosts. The only possible downside is that my country stats might not work, but then I never paid much attention to those anyway!


Extra functionality added to Beta Search

Permalink 04:56:31 pm, Categories: Programming, 95 words  

It isn't work for my site, but it is work on my CMS system. I've now added an extra two fields to the Beta Search module for my girlfriend's Perfect Imagination Beta Reader Search module. The two fields were a request that she thought might keep me busy for a while, but they were done this morning before the Formula One began :D

I've also got more functionality added into the Downloads module (or made more accessible and complete anyway), but I've yet to upload it - possibly when I've got a few more additions done.