Category Archives: Programming
PHP Interactive CLI Autoload Substitute
Class autoloading doesn’t work in PHP’s interactive CLI. So you can rule out running interactive tests on your code if you are relying on your autoload function to load the necessary classes. But, here is a script that can recurse through a directory and include all the class files, in the right order! Continue reading
Calculate Next Birthday with MySQL
Today I thought I’d fire off a query to get customers next birthday, to send them a birthday reminder if it’s coming up. I quickly became aware of some caveats. Continue reading
C# Integer Bug: yes I went there!
What values could ints a and b take to make the following C# snippet throw an ImpossibleException?
if (a > 0 && b > 0 && a + b < 0)
throw new ImpossibleException();
In other words, what two positive integers add to a negative number? Of course, there is no such pair. Unless you ask C#... Continue reading