Posts Tagged PHP

Posted on Programming

Duplicate emails, chrome, and favicons

Switching away from Mandrill, I found Amazon SES was sending two emails from my PHP test script. This only happened when hit from the web, running the same script through the PHP-CLI sent one email, as expected.

Looking at Chromes network tab, turns out it was loading the script as well as favicon.ico. Alas, there was no favicon.ico, and in the sites-enabled config for that location the FallbackResource was set to /index.php. Turns out it was loading index.php twice, resulting in two emails.

I used Bradicon! to create a quick favicon, uploaded it, and bam!, just one email from then on.

 

Posted on Programming

Pulling data from Google Calendar

I track my hours on Google calendar. I know, high-tech, right?

Like a savage, at the end of every month I’d count up the hours for billing — but no more! That’s for the machines.

If getting a list of events from Google’s Calendar API between a specified date range seems useful to you — well, here, have some code:
(more…)

Posted on Programming

A heavy swell in disk use

You shut the door behind you, hang your keys on the wall, and expertly slip out of your shoes. You’re home, the birthday party is over, and what else is there to do but check the status of your servers.

Oh, no, disaster has struck.

df -m reports your disk usage is at 100%. You feel the wave break over you as panic settles in.

But how?
(more…)

Posted on Programming

Handling every PHP error

Or, gotta catch ’em all.

Okay, I’m just going to throw this out there: You can’t reasonably account for every possible error. That’s just unrealistic. However, you can sure make a catch-all to alert you of any you haven’t foreseen, and then, you know, update your code to handle those conditions at your leisure.
(more…)

Posted on Programming

PHP autoload and smarty 3

I was setting up for some code today. Code which would use, among other things, Smarty 3, since that’s a thing now apparently. (It used to be Smarty 2, but I guess times change and numbers change.)

There’s an __autoload function that I wrote a while ago and often use to, you know, automatically include files when instantiating classes. But it didn’t work at all. The file itself included fine, but the autoload function was not being called.
(more…)