Archive for January, 2005

Where shall we three meet again?

3 old menAll aged approximately 38, here’s me, Tim and Shez out for Shez’s birthday. I didn’t see Shez for a few years until recently – and can’t have seen Tim for not much short of 20 years. We were mates at high school since we were about fifteen, and rode our bikes together, shared our cigarettes together, drank illicit alcohol together and pooled our pocket money for porn mags together. (In-depth scrutiny of the porn mags was an activity undertaken solo, however). Lemmy was there too (but took this photo and I got too drunk to remember to ask someone to take one of the four of us).

Friends you make at that age are often the ones that you keep all your life, as the bonds form when you’re completely free. When now would I get 6 weeks vacation in the summer to hang out with friends, build dens, pursue girls, jam guitar, listen to records?

(Last Updated on 10 May 2005)

The CSS Anthology, Rachel Andrew

A review I wrote for Slashdot, Jan 05.

I’ve read a lot of CSS books, but this one is the one I wished that I’d read when I was learning, and I suspect that other slashdotters may concur. It is firmly pitched at the coder rather than the designer, takes you from CSS virgin to upper intermediate level, with good attention to the process of (re)designing with CSS, legal issues such as Accessibility (section 508), and assumes that you’re not scared of mark-up.

Author’s credentials

Andrew is a long-term member of the Web Standards Project (WaSP) and programmer, technical project manager, technical team leader/senior developer and webmaster, according to her own bio.

Who’s the book for?

The book’s subtitle is somewhat misleading. There probably are 101 tips’n’tricks (I didn’t count) but it’s not the random miscellany that it implies. The information is structured so that a n00b could become proficient by reading the book from start to finish (I tested this out on a colleague). The tips’n’tricks structure does allow you to find what you’re looking for in a hurry. The table of contents is easily scanned, and there is an excellent index.

The book doesn’t offer advice on how to sex up the beauty of your site. That’s fine for me; my current work involves replicating someone else’s designs using xhtml and CSS, and as a coder I’m pathologically unable to design the type of showcases that you see at the CSS Zen Garden. A graphic designer might therefore find this book hard work; it jumps straight into a discussion of syntax, and there’s occasional geek-directed statements (CSS supports multi-line C-style comments). Similarly, if you’re completely new to html, this book probably isn’t for you; there’s lots of references to pre-CSS ways of working which could potentially be mystifying. Unusually for CSS books, there’s a refreshing lack of polemic telling you why you should use style-sheets. If I read another history of the browser wars in a technical book, I shall scream.

So the book’s constituency would seem to be those who know how to present information via html, and wish to take advantage of the smaller filesizes, greater flexibility and logical separation of the presentation layer from the mark-up that the (x)html/ CSS combination offers. The logical purity is my personal reason for moving to Web Standards; the trauma of writing text processing applications with VAX Fortran in the late ’80s left me with the propensity to weep when I see html as sorely abused I mangled dear old Fortran.

Are you sitting comfortably? Then I’ll begin.

Anthology kicks off in the conventional way for CSS books – controlling fonts and colours, styling hyperlinks, headings and the like. Each chunk is structured as a problem (How do I remove the indented left margin from a list?), a solution and sample code, and generally a discussion of related applications of the code, compatibility issues, accessibility notes etc. This is a pretty compact method of explication, and the basics of styling, syntax, pseudo-class order and the like are romped through in 40 pages, but not glossed over. The key to this is that Anthology assumes you know what you want to do, and shows you how to do it.

Chapter 4 (Navigation) is where the real meat begins – making navigation menus that are solely html unordered lists (because a menu is logically a list of links) and styling with CSS, adding rollover effects, styling navigation as buttons, changing the styling to a horizontal navbar, or even Amazon-style tabs without changing the mark-up. I suspect that, although these are techniques that can be found in most CSS books, the brevity and simplicity of the explanation will be revelatory to many. Chapter 5 (Tabular Data) may come as a surprise to those who mistakenly believe that web standards disallows the use of html tables, as it shows how to style tabular data – the examples are a spreadsheet and a calendar. Chapter 6 repeats the trick with that most mundane aspect of web development, the form.

Chapter 7 (Browser and Device Support) is about real-world CSS development. Unlike most books which instruct you to test in loads of browsers and leave it at that, this chapter lists all the main permutations of OS and browser (including tips on installing multiple versions of IE/ Win), and begins discussion of the tried and tested hacks to hide styles from Netscape 4, IE etc. All of this information is available on the web — but for a newbie who isn’t yet aware that it’s possible to hide styles from certain browsers, it’s a great way to introduce them to the murky practices of real-world CSS development. What’s also refreshing in a computer book for n00bs is a discussion of how to seek help on lists and forums, with a guide to etiquette.

Chapter 8 (CSS Positioning and Layout) is where the stuff that stumps many a table-based designer begins. Along with fonts and colours etc, CSS can lay out the stuff on your page. I’m unsure about the success of this chapter; the Q&A structure is great if you’re looking to build one of the sites that are explained (and the list is pretty comprehensive), but I came to the chapter hoping to cure a couple of bugs I’d found in a project I’d previously semi-successfully laid out with absolute positioning (A.P.).

Generally, I layout using floats as I also write the html, so it’s easy to ensure that the markup spits out <div>s (sections) in the left-to-right, top-to-bottom order that I want to lay them out in. Suddenly, I had two projects that required A.P. for the first time, as it was not cost-effective to change the way that the client’s CMS spat out the markup, so AP was required to position sections on the page regardless of where they appeared in the markup.

Anthology served me fine until I tested the page in IE and the layout was off. Nothing in the book gave me any pointers, and in the end I gave up Googling and just used a hack which exploits an IE parser bug to serve different co-ordinates to IE, after finding the hack co-ordinates through trial and error:

#APthing {position:absolute; top:34px; left: 758px; width:108px; height:88px;}
* html #APthing {position:absolute; top:19px; left: 785px;} /*for IE */

OK, so there may be a simple mistake I’m making — but then, as far as absolute positioning goes, I’m the kind of newbie at whom this book is aimed, and I imagine that others will make the same mistake that I did. If the book had explained where I was going wrong, or given me the above hack, I’d’ve spent less time with Google and more time with Guinness.

Chapter 9 (Experimentation, Browser Specific CSS and Future Techniques) is successful, except for one small gripe. I’m glad that the author, although a member of the Web Standards Project, isn’t an uber-purist. (I’m of the opinion that a little invalid code, if it’s the only way to get the job done, isn’t a hanging offense). So she shows how to implement IE-only proprietary CSS that can make colourful scrollbars, should you wish to do this. There’s also a Mozilla-only CSS trick to allow curved edges to CSS boxes, which I implemented on my homepage that very evening.

However (here’s the gripe), the most useful technique shown is one which allows fully-CSS flyout menus that don’t rely on JavaScript. The author notes that it won’t work for most people, as IE incorrectly restricts the hover pseudo-class to <a> tags only, while the CSS requires hovering over <li> elements.

Well, Yes and No. There’s a well-documented and elegant hack which allows a proprietary Microsoft behaviour to be attached to the CSS that attaches a small JScript that corrects the IE bug, and thus allows this extremely useful CSS-only flyout menu to work in IE. I’ve used the technique myself when required to mimic the look
and feel of a client’s site while making it DDA/ADA accessible, and it works perfectly. To me, the omission of the IE hack from Anthology is an unfortunate oversight.

Summary

There’s a couple of flaws in the book, though I suspect that in order to explain them, I’ve over-emphasised them. All in all, it’s a solid, professional no-B.S. way for someone with a code-oriented mind to get them up to speed, satisfactorily and quickly; a motivated reader could be churning out standards-compliant, bandwidth-friendly sites after a few hour’s experimentation.

Buy from Amazon.com or Amazon.co.uk .

(Last Updated on 28 June 2006)

Joys of parenthood, #23213

3 holes in a 4 year old's stomachApologies for the recent lack of entries; James had routine surgery, involving a laparoscopy in the navel and two keyhole wounds, which subsequently became infected and needed visits to A&E. He’s recovering fine, but I’m taking a little longer; holding down your panicking child while they’re being gassed asleep is not great for the soul, particularly as I’d billed the whole day at hospital as a boys’ day out …

(Last Updated on 10 May 2005)

After the Tsunami: Khao Lak memories

Nongyow and I had a lovely Xmas break in Khao Lak, Thailand, in 1997, with a big group of friends. We had to get back to Bangkok early, and stood in the sun waiting for the local bus to Takua Pa, where we could pick up the aircon bus to Bangkok. We waited, and waited, and after about 20 minutes a pick-up truck pulled up, with a young family inside it – a guy of maybe 25, dark brown skin, and wiry like most Southern Thais, his wife with a headscarf and shorts on, and their two smiling kids, a boy of seven and a girl of five.

They asked where we were going, and offered us a lift. The mother and children began to move to the back of the pick-up, but I asked to sit there, preferring the cool breeze to the heat of the enclosed driver’s compartment. The kids elected to sit with me in the back, in order to sit nearer the big-nosed foreigner.

Twenty minutes later, we arrived at our mutual destination; the family were off to the Taku Pa market in order to buy food for their small beach-side restaurant. As is customary, we offered them a couple of dollars, but the husband refused: "Mai Pen Rai" [It doesn’t matter]; we were coming here anyway".
Mindful of the offence caused by refusing hospitality, I didn’t press the point. "We’ll buy you dinner next time we’re here", I said as we waved them goodbye and entered the bus station.

We didn’t go back, and now the place is flattened – and that kind family is almost certainly dead.

(Last Updated on 6 November 2006)

Thai Tsunami

Well, I’m back after the bandwidth-crushing link to my joke Zen Garden, and want to say thanks for the emails asking if Nongyow’s family and friends are OK in Thailand. So far, we know of one member of her church who died, and others are missing. Her family are far North, and were unaffected.

We’ve nevertheless been glued to the news, watching the death rate tick remorselessly up. Places like Khao Lak, where we spent three Christmas Days, are completely gone, just washed way, presumably with the nice people who looked after us and made our stays enjoyable.

There’s other nastiness about the Tsunami, too; the Thai press reports that some of those who volunteered to help search for corpses have actually been an organised looting gang. There’s questions about why the government didn’t alert the Phuket authorities to clear the beach, as they had more than an hour’s notice after it hit Indonesia. There’s even reports that tourists are returning and complaining about the mess, the shortage of beer and lamentable lack of prostitutes.

(Last Updated on 16 July 2005)