Blogs

MySQL-python on OS X

Simple way to get MySQL-python working on OS X

PHP - __autoload Hints

PHP5 has a great feature for us lazy OOP people. With __autoload() you can skip over some of the hell of including every class file. But wait. Don't use __autoload()! Instead, so that your script plays nice with others you should use spl_autoload_register('my_overload_function'); This allows multiple autoload functions so that yours doesn't hog __autoload.

Now, onto what tripped me up for a few minutes. I placed a class in the session and then registered the autoload function in my cart include file. Instead of having everything magically work, I got this error:

PHP - Remove Item From Array & Shift Keys

Removing a item from an array and maintaining a sequential key

Internet Explorer javascript checkbox quirk

Internet Explorer handles a checkbox's onChange improperly

Checking if TRACE is enabled

How to test your httpd server for the TRACE option.

Quickstart to PHP Screen Scraping

With the increased use of RSS, screen scraping is becoming less necessary. However, there's still plenty of times that it can get you out of a bind, at least temporarily. I think it's easiest to do screen scraping with PHP and the curl extension (a typical PHP configuration). This shows how I screen scraped the Michigan Lottery website to retrieve the Keno results I used in the article Michigan Keno Stats Over 16 Years.

MacBook Pro Core 2 Duo Wireless Flaw

I got my MacBook Pro Core 2 Duo Tuesday and I've been moving stuff over from my old PowerBook. But, there's an obvious problem. The wireless card or drivers (or both) are messed up. If I'm moving files over from either ethernet or firewire, the wireless fails to keep a connection. Sites stop loading, Adium loses connection, etc. It just doesn't work.

How to get your House Raided in 3 Easy PHP lines

Make an ANYTHING generator, which, if like other generators, will get your house raided and you possibly arrested.

Michigan Keno Stats Over 16 Years

After hearing a statistics professor told his class that some numbers in Keno have better odds than others, I wanted to check his claim. So, I went to the Michigan Lottery website and wrote a script to take all 16 years worth of Keno winning numbers. That's 83072 numbers drawn 22 at a time for a total of 3776 rounds of Keno.

Reload httpd via PHP (sorta)

The problem:
Apache forked processes (PHP, CGI, etc) runs as a different user (usually www or some variant) which doesn't have permission to restart Apache. To further compound the problem, PHP doesn't allow you to sudo to a user that does have the privileges (they call this a "security feature"). Also, if it did have the privileges, it cannot reload httpd directly because that's it's parent process.

Pages