web development week

CSS, Hosting, Webmasters & Backups | Week #2

CSS Word Spacing

Yup, CSS has long offered a word-spacing style for those pixel-perfect designs that require non-standard word spacing. It’s been around well before CSS3, I just hadn’t taken notice of it. I had a layout that actually had a “double space” between each word in the headings. My first thought, “crap, do I really need to use non-breaking spaces in the headings?”

Then, I decided to check out the CSS spec. To my surprise, I had found the word-spacing style had been right under my nose for the past 10 years!

Do you really need arrow graphics for sorting?

The answer is very commonly no. While I used to use the old triangle border trick, and actually wrote a post on it, I’ve recently been on an HTML character entity hunt. My most recent discovery was this little gem (up and down sorting-style arrows):

▴ ▾

▾ ▴

Is Your Hosting Environment Reliable?

Last week, a client of mine experienced a detrimental hardware failure. Their server’s hard drive had failed suddenly, bringing their website to a halt.

No problem, right? Grab those backups and get back up and running within an hour.

I wish that were the case. It appears that the hard drive had actually been slowly failing for over a week. All files that were tarred and gzipped for external backup had actually been corrupted by the failing drive.

Typically, you’d expect to keep multiple days of backups for safe measure. However, this website (with all of it’s files) was multiple gigabytes in size.

This unfortunately left my client no choice but to send the hard drive to a data recovery company, which ended up costing them over $3,000 for the restore.

Lesson learned: Don’t rely on a single-hard-drive server. Get yourself some RAID redundancy or hop on cloud hosting.

Dropbox Free SSL Image Hosting for Email Newsletter

You have got to love dropbox! Just today I had a new client request that build them a quick e-newsletter. So, in usual fashion, I do my ancient HTML4 with tables song and dance to produce a cross-email-client friendly HTML newsletter. All the while, I had forgotten that this client did not possess a means to host secure images (at an https URL). With the popularity of web-based email, which is served via https, non-secure images isn’t an option anymore.

Through some web searches I had discovered that dropbox does in-fact allow hosting of secure images for public consumption. Simply drop your images in your dropbox public folder and you’re golden!

Webmaster Toolkit

Sometime last week I had need to restart Apache, only to discover that there was some instance of it that was “defunct”. Since Apache spawns multiple processes, it wasn’t easy to figure out which one was the culprit. I discovered the linux killall command and was able to quickly kill all Apache processes and start the server again.

killall -9 httpd

A new backup policy

I had a backup-policy epiphany this week. Wouldn’t it be easier to restore files if they were separated by website and database?

Putting that thought to practice, I have implemented the following scripts to tar and gzip my web files and databases in separate files:

MySQL

for dbName in $(mysql -u backup -pPASS -e 'show databases' -s --skip-column-names);
do
  mysqldump -u backup -pPASSWORD $dbName | gzip > "/home/backup/db/$dbName.sql.gz";
done

Web Files

cd /var/www/html
for file in *; do
  tar zcvf /home/backup/webdir/"${file}".tar.gz "${file}"
done

Why follow me on Twitter?

  • I tweet about new technologies, services or libraries I find interesting
  • Yeah, sometimes I'll post a pet-peeve or rant about something trivial
  • If I discover something that made my web development life easier, I share it
  • I'll shout out any handy tip that I think might be useful to other devs


Tagged , , , , .

Updated: 2014-02-17

Phil LaNasa follow us in feedly