Helping ordinary people create extraordinary websites!

Go Back   Web Development Forum > Website Programming > Server-Side Scripting
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-27-2008, 05:57 PM
Ducani's Avatar
Administrator
 
Join Date: Sep 2004
Posts: 224
Default Tutorial Discussion - Effective Geotargeting with PHP

This thread is for all comments related to the tutorial
Effective Geotargeting with PHP
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-28-2008, 01:37 AM
ryanhellyer's Avatar
Super Moderator
 
Join Date: Dec 2007
Posts: 708
Default

This seems like a very effective technique for targeting particular markets.

I've been considering using this technique for the ice hockey site in my signature. It would make sense for that site to have a more prominent section for foreigners about coming here to New Zealand to play hockey. However this would be totally irrelevant for anyone already in New Zealand. So setting up slightly different content for the two countries would be quite sensible.

Many of our best players come from overseas (particularly Canada) so targeting other countries with information about why and how they should come to our country/city to play would be quite useful.


Thanks for the lesson on how to set it up
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-18-2008, 04:04 AM
Junior Member
 
Join Date: Jan 2008
Posts: 10
Default

Hey Ryan,

Glad you enjoyed it Give me a shout if you need a hand with it, I'd be happy to help.

-Akash
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-18-2008, 05:09 AM
ryanhellyer's Avatar
Super Moderator
 
Join Date: Dec 2007
Posts: 708
Default

Thanks Akash.

Your tutorial covers everything quite well though, so I should be able to nut it out quite easily.


I find the following quite fascinating ...
Quote:
script takes on average 0.05 seconds to execute .... an entire script to generate a database-driven page takes 0.01 seconds on the same server.
That's a really useful thing to know, as I often assume basic, small scripts like that won't suck up too much resources, but obviously this is not the case here.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-19-2008, 11:43 AM
Junior Member
 
Join Date: Jan 2008
Posts: 23
Default

Good tutorial, thanks Draicone
__________________
John C.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-24-2008, 02:50 AM
Junior Member
 
Join Date: Jan 2008
Posts: 10
Default

Quote:
Originally Posted by ryanhellyer View Post
That's a really useful thing to know, as I often assume basic, small scripts like that won't suck up too much resources, but obviously this is not the case here.
It's interesting looking through execution times for different scripts and servers. The length of the script isn't so much important as the complexity.

For example, there are some very bloated CMSs out there that take 10 seconds to generate a page, whereas a simple CMS like SilverStripe takes 0.01 seconds. Still, SilverStripe has a lot of code powering it, especially a lot of HTML.

This script isn't as small as it seems though - I don't show you the massive IP database that comes with it It has thousands of records that this small script sifts through to match the location of the current user.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 07-22-2008, 03:26 AM
Junior Member
 
Join Date: Jul 2008
Posts: 4
Default

Well my site gets around 20,000 page views per day and so far today it has gotten over 10,000 according to Google AdSense and I'm not seeing any problems.

Although the data table has some 150,000 rows, whomever created the original record search routine was sharp enough to use a bisection search, which allows the script to only look at a tiny fraction of the actual records.

Think of it this way, the script takes the middle record of the dataset and decides if the IP address is higher or lower than that record. If it is lower then it takes the record at the halfway point of the lower sub-set of records and again makes this determination. This continues until it gets to the correct record. This is one of the most efficient methods finding a matching record and allows the script to only need to every look at a very small fraction of the total records.

Here is what practically happens on a dataset of 100,000 records:
Check #1) 50,000 records eliminated. 50% remaining
Check #2) 25,000 records eliminated. 25% remaining
Check #3) 12,500 records eliminated. 12.5% remaining
Check #4) 6,250 records eliminated. 6.25% remaining
Check #5) 3,125 records eliminated. 3.13% remaining
Check #6) 1,562 records eliminated. 1.56% remaining
Check #7) 781 records eliminated. 0.78% remaining
Check #8) 390 records eliminated. 0.39% remaining
Check #9) 195 records eliminated. 0.20% remaining
Check #10) 98 records eliminated. 0.10% remaining
Check #11) 49 records eliminated. 0.05% remaining
Check #12) 24 records eliminated. 0.02% remaining
Check #13) 12 records eliminated. 0.01% remaining
Check #14) 6 records eliminated. 0.006% remaining
Check #15) 3 records eliminated. 0.003% remaining
Check #16) 2 records eliminated. 0.002% remaining
Check #17) 1 recored eliminated match made.

As you can see it is very very efficient.
__________________
how to gain weight data entry
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 03:16 AM.


Website Design by Ducani Media Group
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.