WordPress Plugin Update and Install Functions

On the page where they explain how to create tables for your plugin, there’s a link to the register_activation_hook function, which is run when the plugin is activated. However, right in the first section, it says:

Note: Don’t use activation hooks (especially for multisite). Do this instead:

It’s far better to use an upgrade routine fired on admin_init, and handle that per-site, basing it on a stored option.

That links to another page, which repeats the information, but doesn’t tell you how to do this. Here’s one way. Continue reading WordPress Plugin Update and Install Functions

Yet Another Parallax Effect, but This One Wastes Fewer Pixels and Bytes.

Everyone loves the parallax effect, and I’ve been swiping snippets of code to do it for a long time, but never really thinking about it too much. You load it, set some parameters, and that’s it. I was having a little glitch with one, and was tweaking it, and I started to wonder why the effect didn’t just start at one end of my image, and end at the other end.

After all, if I don’t show all the pixels, I’ve “wasted” all those network bytes to load the data, and all the memory to hold the data.

This parallax effect is stingy with network bytes.
Continue reading Yet Another Parallax Effect, but This One Wastes Fewer Pixels and Bytes.

Responsive Design + Mobile First = Automated Layouts

I’m shocked at how many businesses still have websites that don’t work in mobile. For the average person, reading web pages on a smartphone is the primary way they read content on the web.

Though I’m not 100% on board with “mobile first”, it should soon be the norm. To CSS hackers, “mobile first” just means implementing the mobile layout first, then making the wider-screen layout the exception.
Continue reading Responsive Design + Mobile First = Automated Layouts

The New Site

I’ve been doing a lot of WP hacking, but my website was on a very old copy of Drupal (version 6!) so I thought it best to transition to using WP for my personal blog.

The old site is here.

They’re both good platforms, but the WP market just seems to be dominating, especially for lower-cost sites.

WP’s core code is still a maze.

Every time I get a grip on one part of the codebase, I go into another part, and it’s completely different.  The code quality has improved, though, so, it’s pleasant.

End the Chaos, Get with the Program: Python Logging to Syslog, and Filtering with RSyslog

This article describes how to use Python’s logging
library to send logs to syslog. Then, using rsyslog,
a fancier syslog, we produce a log of pre-filtered
output.
Continue reading End the Chaos, Get with the Program: Python Logging to Syslog, and Filtering with RSyslog