Emergent Computing

www.emergentcomputing.com

Category Archives: Programming

PHP Interactive CLI Autoload Substitute

PHP CLI 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

Posted in Programming | Tagged , , , , | Leave a comment

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

Posted in Programming | Leave a comment

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

Posted in Programming | 3 Comments