Sunday May 20

Archive for the ‘SEO’ Category

May
17/10
Generate Random IP with Python
Last Updated on Saturday, 3 July 2010 03:43
Written by Cody Snider
Monday, May 17th, 2010

In need of an IP address on-the-fly that appears to be valid? Try this:

View Code PYTHON
from random import randrange
 
def generateIP():
    blockOne = randrange(0, 255, 1)
    blockTwo = randrange(0, 255, 1)
    blockThree = randrange(0, 255, 1)
    blockFour = randrange(0, 255, 1)
    print 'Random IP: ' + str(blockOne) + '.' + str(blockTwo) + '.' + str(blockThree) + '.' + str(blockFour)
    if blockOne == 10:
        return self.__generateRandomIP__()
    elif blockOne == 172:
        return self.__generateRandomIP__()
    elif blockOne == 192:
        return self.__generateRandomIP__()
    else:
        return str(blockOne) + '.' + str(blockTwo) + '.' + str(blockThree) + '.' + str(blockFour)

We’re skipping 10.x.x.x, 172.x.x.x and 192.x.x.x due to the fact that these are reserved address. RFC 1918

Version 2:

An elegant solution to serve the purpose of generating a random IP provided by Ben (explanation of changes listed in the comments below):

View Code PYTHON
from random import randrange
if __name__=="__main__":
    not_valid = [10,127,169,172,192]
 
    first = randrange(1,256)
    while first in not_valid:
    first = randrange(1,256)
 
    ip = ".".join([str(first),str(randrange(1,256)),
    str(randrange(1,256)),str(randrange(1,256))])
    print ip
Posted under Python, SEO  |  Comments  6 Comments
Mar
30/10
KEI and Competition Weight
Last Updated on Tuesday, 30 March 2010 10:54
Written by Cody Snider
Tuesday, March 30th, 2010

Normally, simple KEI is created using the following formula where P is popularity and C is competition:

KEI = P2/C

This will get you in trouble. Not all competitors are the same and looking at just the number of indexed sites using an allintitle operator does not take this into account. For example, a football game against 10 people would seem favorable to a game against 50 people, right? Would you change your mind if you discovered those 50 people were all amputees and the 10 were Olympic athletes?

How can we know the “physical conditioning” of our search competitors without extensive evaluation of each site? I suggest using PR distribution. Take the first 20 results and lookup the PR/MR of each URL (this is easier if you are or know a programmer) and get the average PR/MR value. This should be used in the existing formula in the following fashion where PR is PR/MR:

KEI = P2/(C*PR)

This may skew things a bit, so feel free to tinker with the weight till it meets your liking as in the following example:

KEI = P2/(C(PR*.25))

Posted under SEO  |  Comments  No Comments