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 […]


Encapsulate Reserved Words in Doctrine 2 Entities

When dealing with legacy applications and moving them to Doctrine (or any ORM), you will undoubtedly encounter poorly named columns and tables in need of migration. Unfortunately in the case of Doctrine 2, the default behavior for SQL query generation fails to encapsulate the column names properly, causing syntax errors with column names like “delete”. […]

DebugBar Second-Level Cache Collector

This will add a collector to handle Doctrine’s second-level cache and display basic information on puts, hits and misses on your PHP DebugBar. Then instantiate the cache logger, set it to the cache config and add it to the new collector.

Cannot declare class, PHP?!?

One of the most annoying errors to debug when working with a litany of autoloaders using required instead of include_once in PHP: PHP Fatal error:┬áCannot declare class SomeClass, because the name is already in use in /somewhere/SomeClass.php on line 1234 What makes it annoying is the lack of a trace. You know it was only […]

Get Video Duration with FFMPEG and Python

For this to work, you’ll need FFMPEG and Python on your machine or server already. Configuration of this is beyond the scope of this post, but installation through yum or apt-get should be sufficient (or equivalent on a Windows or Mac). To pull the duration of a video from any machine with FFMPEG and Python […]

FizzBuzz in 68k Assembly

Fizz buzz is a group word game for children to teach them about division. Players take turns to count incrementally, replacing any number divisible by three with the word “fizz”, and any number divisible by five with the word “buzz”. ORG $1000 FIZZ DC.B ‘FIZZ’,$0D,$0A,0 BUZZ DC.B ‘BUZZ’,$0D,$0A,0 FBUZZ DC.B ‘FIZZBUZZ’,$0D,$0A,0 CRLF DC.B $0D,$0A,0   […]

Arduino Default Fuse Settings

Here are the default fuse settings for each Arduino from the boards.txt included with the Arduino development software. To understand more about the fuse settings for your microcontroller, visit Engbedded’s AVR Fuse Calculator. To write fuse settings, you will need a programmer with this capability. I use Mighty Ohm’s high-voltage rescue shield available here. Arduino […]

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) […]