Web Design

Books read: September 2010

Books read: September 2010 (covers)

The Lifecycle of Software Objects by Ted Chiang. I wrote about Ted Chiang’s new novella in July; our copy arrived in late August, and I read it in an easy Sunday afternoon on Labour Day weekend. If you like Chiang’s work as much as I do, this one won’t disappoint: as usual, a finely crafted work that blends a high concept with a powerful emotional punch. To explain what this book is about, imagine that we invented artificial intelligence. Now imagine that it only ran on the Amiga. That’s what this story is about: the struggle to keep artificial intelligences going when technology — and society — have largely left them behind.

HTML5 for Web Designers by Jeremy Keith. Slender book explaining the history of the development of the HTML5 specification and the changes in code from HTML 4/XHTML 1.1. Extremely concise and at least as effective as longer, more expensive books on the subject (e.g., HTML5: Up and Running by Mark Pilgrim). I read this one as an e-book, in which format it cost me all of $9.

Leviathan by Scott Westerfeld. Young-adult steampunk alternate history set during the outbreak of World War I, where Europe’s alliances are determined by their technologies: Germany and Austria-Hungary are Clankers, using machinery; Britain and France are Darwinists, using bioengineering. Readable, engaging and ultimately successful, but frustratingly reads as the first installment of a larger series, which it is.

The Lifecycle of Software Objects by Ted Chiang
Amazon.caAmazon.com
Leviathan by Scott Westerfeld
Amazon.caAmazon.com

Web design for the iPad

Creating iPhone- and iPad-specific web pages doesn’t require browser detection scripts or coding a special website for them; it can be done in CSS. The trick is the media queries part of CSS 3, which the onboard Safari browser supports. Media queries allows you to create a custom stylesheet based on screen width and height, screen orientation (portrait or landscape), aspect ratio, colour vs. monochrome, and so forth.

An iPad-specific mobile site can be made with a stylesheet limited to maximum device width of 1024 pixels; the iPhone will ignore that stylesheet. You can also create a different look based on whether the iPad is being held in portrait or landscape mode — a website that rejiggers itself as you rotate the screen.

Media queries also allow you to create a web page that dynamically changes depending on how wide your browser window is — and not just in terms of how wide your text columns are. Here’s an article from A List Apart that discusses this topic.

PHP superglobals as register globals workaround

My hosting company is upgrading those few remaining domains still running creaky old PHP 4 to PHP 5. That means me: I’ve been with them long enough that PHP 4 was the default when I set my websites up, and I never bothered to upgrade. It’s happening in about two weeks, but this week I decided to get ahead a bit — upgrade to PHP 5 myself and see what happens (read: see what breaks). My main concern was whether my ancient install of Movable Type would still run under PHP 5 (spoiler: yes), so I backed up my blogs and pulled the switch. Everything on the blog side still worked.

But it turns out that a number of my pages still used register globals, which are disabled in newer versions of PHP (or at least less ancient versions) for security reasons. The PHP Group: “When on, register_globals will inject your scripts with all sorts of variables, like request variables from HTML forms. This coupled with the fact that PHP doesn’t require variable initialization means writing insecure code is that much easier.”

Without register globals, my contact forms and the Trails section, among other things, stopped working properly. Fortunately, I was able to get them working again quickly without major code rewrites, which is good because I’m a lousy coder. (This site is what you get when a writer thinks he can design web pages.) The workaround is to use superglobals like $_GET["var"] and $_POST["var"] — essentially, if I want to do something like burstall_pass.php?photo=1, I have to add $photo = $_GET["photo"]; at the appropriate point in the page. Which is what I did, and it works fine.

This is, shall we say, not new, but I’ve never been on the bleeding edge of web design.

More entries below »