Using the MaxMind geoip database - Part 2 - Testing the data

By now you’ve got your geoip data in the database. I know many people would hate the idea of the duplicated rows of the country codes and country names, and would set up a link to a country table instead with a foreign key. But I can’t be bothered with all that. If you’re interested in doing that read: HOW-TO Import the MaxMind GeoIP Free Country CSV file into MySQL and save diskspace.

Anyways, enough gibbering on. This simple script will take your own IP Address and should hopefully tell you what country you’re in (unless you’re in Europe on AOL and then it could get it all wrong, but anyway). Continue Reading »

Using the MaxMind geoip database - Part 1 - Installation

First things first, you need to download the database itself from maxmind. Then upload this to your website to import into the database. There are ways to import this directly using phpMyAdmin’s upload tool, but when I tried my connection kept timing out or other errors occured. I also thing it’s better to wrap up the database creation and upload into a script so that you can simply blat it over the top when MaxMind release an updated version of the database (which they do monthly I think).

Okay, where was I? Yes, so we’ve uploaded the GeoIPCountryWhois.csv file to your website’s space. Personally I created a data folder outsite the public_html folder, because there’s no point making it public. Continue Reading »

Could not find ParserDetails.ini in C:/Perl/site/lib/XML/SAX

Cursed damnation. The problem is caused I think by the ActiveState installation for XML::SAX. So you’ll need to uninstall it from the using ppm tool. I had to uninstall in this order:

  • XML-SAX-Writer
  • XML-Filter-BufferText
  • XML-SAX-Simple
  • XML-SAX-Machines
  • XML-SAX

Then try to install in that order using the cpan shell:

perl -MCPAN -e shell

But that didn’t work on my machines, so you could download the packages from CPAN and drag the files over to your c:\perl\site\lib folders or reinstall over PPM and forget about the error… if you can’t find the needed packages from your default set up then look into installing them from another server.

Not much help to my own problems, am I?! :)

MSN Adcenter, just like explaining stuff to your Dad

I was researching MSN’s contextual copy equivalent of Google’s Adsense or Yahoo’s Overture (or I guess GoTo.com or whatever, you get the point). I stumbled across this great page of crapness. Possibly a useful page on the most basic of SEO ever, but full of half mistakes like:

Try not to embed links in Java - Some web crawlers may minimally analyze Java, but in all likelihood they will not find your pages if they are only accessible via Java.

Now, do they actually mean Java? Or are they making the mistake that thousands of arguments have now been based upon with the confusion over Javascript and Java since Netscape were retarded enough to called Javascript and not Actionscript. The idiots.

Then there’s this great section…

Avoid using techniques that e-mail spammers use:
• Don’t indulge in “keyword stuffing” - Don’t overload the number of keywords on a page or in meta tags.
• Eliminate duplicate copies - Don’t create duplicate copies of your content and place them on multiple hosts.
• Don’t cloak content - Don’t in any way show different content to our crawler than you do to a user.
• Don’t use hidden text - Truthful metatags are an exception to this.
• Don’t contribute to “link farms” - Our recommendation is to only link to those pages that are relevant.

E-mail spammers do those?!? NO THEY DON’T. Not one of them. Quite the opposite in some cases like keyword stuffing.

And deary, deary me. You don’t contribute to a link farm by linking to the damn thing now do you?

Do you think MSN got a $5 cheesy content writer to do that page?

Hmm, will it be called Adcentre in Europe I wonder? Anyways…

Technorati Tags: , , , , , , ,

Modify a string passed by reference in perl

I don’t know why I feel the need to write this down, but I was having a slow brain day and needed to actually sit and think about using string references within a perl subroutine!

my $string = "STRINGY";

print "Before: $string\n";
modify_string(\$string);
print "After: $string\n";

sub modify_string
{
my ($string_ref) = @_;
my $length = length($$string_ref);
$$string_ref .= "-$length";
}

This tries to demonstrate two things. Firstly using the string reference (i.e. into the length command and secondly modifying the string itself (appending a dash and the length of the string to it). Don’t worry about the “-$length” bit — it’s not trying to do anything cleverer than append to the string… :)

Technorati Tags: ,