Multiple versions of IE on one PC

August 3rd, 2007

I’m always getting grief from my managers about not testing in IE6, which is hard when IE7 is installed on all machines these days. I recently found a little install tool which allows you to run multiple versions of IE on the same machine. It doesn’t fully install IE, just the dll’s and uses dll redirection to trick windows into running an older version of IE.

Although it’s not perfect, it’s a lot easier than running a virtual PC for each version.

The install can be found here: http://tredosoft.com/Multiple_IE

Postcode Database Update Pending

July 5th, 2007

I’ve just received some data from Owen for RD and PO Box postcodes, so I’ll be added these into the database.

Also, stay tuned for Long/Lat coordinates for streets and postcodes.

Monitoring Apache with LARRD and Big Brother

May 25th, 2007

I managed to figure out how to monitor Apache with Big Brother and LARRD. As it's not very well documented I thought I'd share it with everyone.

First set your apache server to display status in the apache httpd.conf:

CODE:
  1. <Location /server-status>
  2. SetHandler server-status
  3. Order deny,allow
  4. Deny from all
  5. Allow from 127.0.0.1
  6. </Location>
  7.  
  8. ExtendedStatus On

Setting extended status to On does slow down the server a little bit, but it's usually not noticeable. Remember to limit access to the status page to just the IP where your Big Brother server is monitoring from.

Add apache to @DATALIST in larrd-config.pl

Then in your apache-larrd.pl (under the larrd directory) you'll need to hardcode the servers you want to monitor.

CODE:
  1. %host_h = (
  2. 'server01' => {
  3. port => "80",
  4. url  => "http://www.yoursite.com/server-status?auto",
  5. }
  6. );

The first part of the host_h array is to identify which server to attach the RRD file with. In this instance I'm monitoring a server called server01 and the website I have setup with the server-status page is http://www.youresite.com/server-status?auto. If your host is a FQDN (fully qualified domain name) then you can omit the full url and just have /server-status?auto and Big Brother will work out the URL.

With any luck you'll have 4 new graphs on your trends/LARRD page.

Valid Email Addresses

February 22nd, 2007

I found a good page which outlines which characters can be used in email addresses:

http://www.remote.org/jochen/mail/info/chars.html

Google Sitemap Generator

January 31st, 2007

I was dissapointed when I saw the current Google sitemap generators available, so I wrote one.

Features:
- Generates Google sitemaps
- Generates Yahoo! sitemaps
- Generates plain text sitemap
- Splits sitemaps up into smaller files (as per Google's instructions)
- Creates sitemap index file
- Pings Google/Yahoo!

This is the first release, so there's probably some bugs in there somewhere. Please let me know if you find any. There are some examples in the zip file.

To best use the classes, set the variables on the page you call the class from, rather than editing the class file (so changes aren't lost when you upgrade).

E.g.

PHP:
  1. $sitemap = new Google_Sitemap();
  2. $sitemap-&gt;doPing = false;
  3. $sitemap-&gt;gzip = false;
  4. $sitemap-&gt;baseurl = "http://www.noodles.net.nz";

Download:

http://www.noodles.net.nz/downloads/sitemaps.zip

Version 0.2 - 14/05/2007

Fixed problem with script using too much memory when trying to sitemap hundreds of thousands of pages.

MySQL and Redhat Enterprise Linux 4

December 1st, 2006

I ran into some problems with MySQL on RHEL 4 when SELinux was enabled. When starting MySQL it would come up with this:

Starting MySQL...................................[FAILED]

And the following in /var/log/messages:

CODE:
  1. Dec  1 14:02:52 searchdev kernel: audit(1164934972.432:5): avc:  denied  { append } for  pid=3071 comm="mysqld" name="searchdev.err" dev=sda6 ino=1687755 scontext=root:system_r:mysqld_t tcontext=root:object_r:var_lib_t tclass=file

All fixed though thanks to this page: http://bugs.mysql.com/bug.php?id=12676

Google datacenter check

November 2nd, 2006

I've written a crude datacenter checker. Unfortunately I cannot host it for everyone as Google would ban my server's IP, so I've packaged up the code so anyone can run it.

http://www.noodles.net.nz/downloads/googlecheck.zip

Double byte and PHP (unicode problems)

November 2nd, 2006

A while back I ran into a problem with PHP, how can I read in files that have double byte (unicode) characters and display them in a form that any browser can read. Most programming languages don't handle these characters very well, and end up with non sense instead of passing through the correct text.

This function should be able to strip out any unicode characters from text and return them as html entities (something none of the core PHP functions are able to do).

PHP:
  1. function removeuni($content){
  2. preg_match_all("/[\x{90}-\x{3000}]/u", $content, $matches);
  3.  
  4. foreach($matches[0] as $match){
  5. $content = str_replace($match, mb_convert_encoding($match, "HTML-ENTITIES","UTF-8"), $content);
  6. }
  7.  
  8. return $content;
  9. }

Good code ruined?

August 16th, 2006

I happened across a really neat site the other day, called codegolf.com. Some of you might recall a similar scheme going on a while back called perl golf - well this is the same idea.

The deal is, there is a load of challenges set, and you have to write and submit the code to supply the required output of the challenge. However, there is one snag - you have to write it in as little code as possible. It has you really thinking laterally - outside of ways you might normally think of writing code, which I personally find fantastic (and depressing, realising how little shorthand I know!)

There is currently four languages you can submit in - PHP, Perl, Ruby and Python. Suggest that you hardcore execution-time monkies take a look at it and get scoring.

New Zealand Postcode Database

August 9th, 2006

Due to the lack of data from NZ Post, I've created this mysql database from the PDF on the NZ Post website.

All efforts have been made to ensure that there are no errors, but there are no guarantees, if you need 100% accurate data please buy NZ Post's PAF data.

Update: New Zealand Postcode Database version 2

Version 1:

nzpostcodes.sql.gz (467KB)
nzpostcodes.sql.bz2 (313KB)