Category: Uncategorized

Registry Pattern Hinting with PHPStorm

You probably use the registry pattern. Having a common place to store components you’ll need throughout your application is a must. The most frustrating part about this pattern is your IDE probably doesn’t know what you are putting in or getting back out. Our most common case is the Doctrine EntityManager, but this easily applies

Continue Reading →

Generate Random IP with Python

In need of an IP address on-the-fly that appears to be valid? Try this: 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)

Continue Reading →