Archive

Archive for 2006

MySQL and Redhat Enterprise Linux 4

December 1st, 2006 No comments

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]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[/code]

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

Categories: Tech Problems Tags:

Google datacenter check

November 2nd, 2006 No comments

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

Categories: Coding Tags:

Double byte and PHP (unicode problems)

November 2nd, 2006 No comments

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]
function removeuni($content){
preg_match_all(“/[\x{90}-\x{3000}]/u”, $content, $matches);

foreach($matches[0] as $match){
$content = str_replace($match, mb_convert_encoding($match, “HTML-ENTITIES”,”UTF-8″), $content);
}

return $content;
}
[/php]

Categories: Coding Tags:

Good code ruined?

August 16th, 2006 No comments

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.

Categories: Uncategorized Tags:

New Zealand Postcode Database

August 9th, 2006 57 comments

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)

Categories: Coding, Postcodes Tags:

Colorado Sheriffs To WarDrive For Safety

July 14th, 2006 No comments

The Sheriff’s Department in Douglas County, Colorado says it’s going to start warning computer users that their networks may be vulnerable to hackers. It plans on equipping its patrol cars with devices that detect unprotected computer networks, and distributing brochures to computer users in vulnerable areas, instructing them on how to password protect their networks.

More info here

Categories: Uncategorized Tags: