SiteKickr Web Development

WordPress, SSH, Backups & jQuery | Week #3

Animated GIFs are way easier for simple screen capture

Until a couple weeks ago, I had been using Camtasia Studio to create simple 20 second screen captures to demonstrate a simple 4 or 5 step process.

Then, I discovered LICEcap, which basically does the same thing, only exports to an animated GIF file. I was actually amazed at how small the files were.

These turned out to be a great solution to create a bandwidth-friendly knowledge base, complete with short screencasts on how to accomplish various tasks.

LICEcap: http://www.cockos.com/licecap/

Progressive JPEGs – are you accepting them?

It appears that some IE browsers (I haven’t narrowed down the version), upload progressive jpegs under the MIME type image/pjpeg. This may be the technically correct MIME type, but it can throw off your server-side validation if you have specific MIME type checks.

Long story short, add image/pjpeg to your list of accepted MIME types if you have a photo upload feature on your website.

Putty for Windows – fix that annoying dark blue font color

This has irked me for years! And I finally found the time to figure out how to change it. I know many web devs that use Putty (it is free after all), so this will no doubt be a handy tip.

  1. Change Settings -> Window -> Colours
  2. Choose ANSI Blue in the Select a colour
    change to Red:80 Green:80 Blue:255.
  3. Choose ANSI Blue Bold in the Select a colour
    change to Red:192 Green:192 Blue:255.

Lazy Loading Images jQuery Plugin

I rarely find the time to hyper-optimize any of my sites, this includes lazy loading images that aren’t seen above the fold.

This plugin has an incredibly simple usage syntax and really takes the sweat out of lazy loading your images:

http://www.appelsiini.net/projects/lazyload

Example

$(function() {
    $("img.lazy").lazyload();
});

Keep it relative, WordPress

One of the most annoying things about WordPress development is that the “site root” is specified in the database as an absolute URL that all of your WordPress pages and posts will be relative to.

This, naturally, does not make for easy development on a staging site, unless you setup a complete separate database (which makes sense sometimes).

I just found this plugin, which converts all URLs in WordPress to relative URLs. Life saver!

Enhancing my backup policy

Three weeks after helping one of my clients to restore one of their dedicated servers, I’m still shaken by it’s occurrence. To recap from last weeks post, not only did their single hard suffer mechanical failure, but all backups were corrupted from the drive being corrupted for a few days before the failure.

This forced me to reevaluate my own backup policy. My latest addition is to FTP upload complete database backups for an entire week before they are overwritten. Example:

#!/bin/sh
USERNAME="nice"
PASSWORD="try"
SERVER="someserver.com"

# local directory to pickup *.tar.gz backup file
FILE="/home/backup"

# remote server directory to upload backup
BACKUPDIR="/mybackup"

DAYOFWEEK="$(date +'%A')"

# login to remote server
ftp -n -i $SERVER <<EOF
user $USERNAME $PASSWORD
binary
put $FILE/mysql.gz $BACKUPDIR/mysql-$DAYOFWEEK.gz

quit
EOF