Simon Willison’s Weblog

Items in May, 2003

Filters: Year: 2003 × Month: May ×


Infrequent updates

My infrequent updates can be blamed on two things: revision for exams (three next week) and Grand Theft Auto: Vice City. One of these two has been taking up far more time than it should...

[... 35 words]

Golden Mean

Golden Mean is Doug Bowman’s first contribution to the CSS Zen Garden, and it’s a very nice piece of work. Even better is the fact that Doug has provided extensive coverage of the design process (including technical CSS details) on his blog.

[... 51 words]

Fun with links

Yesterday we talked about the box model. Today we’re going to put a small part of it to work, by investigating ways of styling links. Before getting stuck in, we need to talk a bit about pseudo-selectors (also known as pseudo classes). The CSS specification defines pseudo classes as “characteristics that cannot be deduced from the document tree”, but in practise the only widely implemented psuedo selectors are those that apply to links. The key psuedo selectors for links are:

[... 810 words]

Understanding the Box Model

Today’s tutorial is going to be all theory. The box model is an inevitable part of CSS, and understanding it is critical if you want to do anything remotely interesting. Like most of CSS, it’s a lot simpler than it sounds. Here it is:

[... 626 words]

CSS Tutorial: feedback so far

My CSS tutorial series has been getting some fantastic feedback, both in this blog’s comments system and elsewhere. This entry will summarise the most useful feedback, acting as a kind of errata to the previous entries. Thanks to everyone who commented, there are too many to credit individually but you can see most of the points in their original format by browsing the comments attached to each entry.

[... 661 words]

Browser bug swatting

Craig Saila: Browser bug swatting:

[... 128 words]

Learning Python, second edition

Mark Lutz has announced that he is working on a second edition of Learning Python. The first edition of Learning Python is probably the best learn-programming-language-X title I have ever read. It’s nice and short, but covers the whole core Python language comprehensively with excellent examples and a well targetted learning curve. I’ve lent my copy to several people, all of whom found it very helpful and one of whom went on to buy a copy themselves. I’ll probably be buying a copy of the second edition just so I can use it on my constant mission to get more people on my course to give Python a go.

[... 114 words]

Even more buttons

If the 309 buttons at Steal these buttons aren’t enough for you, you can now generate your own thanks to a clever PHP script on Minimal Verbosity. Bill Zeller has made the source code available as well.

[... 45 words]

Programming by Contract in Python

Programming by Contract seems to be a sister technique to unit testing—instead of (or as well as) writing a set of tests for a piece of code you write a set of pre- and post-conditions for the data being processed which are then checked whenever the program is run in debugging mode. Contracts for Python discusses the technique, providing a reference implementation and a PEP suggesting inclusion of support for the technique in the core language. Programming by contract was first demonstrated in the Eiffel language, and there’s a good introduction to it in Eiffel.com as well.

[... 105 words]

Quick tip: Styling blockquotes with CSS

Today’s tutorial is going to be short one, as I’m working on one last piece of coursework. This time I’m going to explain a clever CSS trick borrowed from Nick Boalch. Here’s a screenshot:

[... 475 words]

Defeating IE5 CSS bugs with the help of jwz

Today’s CSS case study will be Jamie Zawinski’s LiveJournal. OK, I admit that he’s something of a tempting target after his widely publicised CSS rant last month (which was the main inspiration for this course), but there are a number of sensible reasons his site makes a good case study as well. The theme for today is “bugs in IE5 for Windows”, and jwz’s site offers two classic examples that fit this theme nicely. The first is the fact that the design is centered on the page, and the second is his choice of Verdana, a font which requires some trickery to get working well in IE5. In addition, the design of the entries seems to be a natural fit for a table based layout, so demonstrating how much simpler the code can be in CSS will hopefully turn a few heads.

[... 2979 words]

Scripting.com, with added CSS

One of the aims of this course is to show how relatively simple CSS can be used to make dramatic improvements to existing sites. Today, I’ll show how CSS can be used to reduce the amount of code needed for a small part of the design of Scripting.com.

[... 1178 words]

The Selfish Class

The Selfish Class provides a set of related patterns to help design software objects that encourage reuse. They seem to make a lot of sense; I’ve only read a smal part of the paper and I’m already spotting things that are reflected in software I’ve found reusable in the past. Key example:

[... 118 words]

New Gestures Build

There’s a new nightly build of the Mozilla mouse gestures plugin which supports Firebird 0.6 and has a preferences panel, complete with options for setting up custom gestures. I missed the customise button at first (Tools -> Options -> Extensions -> Mouse Gestures -> Settings -> Edit Mappings) but it’s very powerful, if slightly confusing. It’s nice to be able to change gestures to the right mouse button without digging in to about:config as well.

[... 92 words]

Syntax Highlighting with Javascript

If you were curious enough to dig around the source code of yesterday’s CSS tutorial, you may have noticed a couple of classes that didn’t appear to be doing anything:

[... 264 words]

The anatomy of a stylesheet

To start my series of tutorials, I’m going to go over some of the basics of CSS. This is the boring bit: if you already know the difference between rules, properties and selectors you may want to skip this entry.

[... 1276 words]

CSS2 is five years old

No one appeared to notice, but the CSS2 Recommendation had its five year birthday on Monday the 12th of May. Maybe now people will stop writing it off as a new and unproven technology and start looking in to the benefits it can bring instead. Speaking of which, I’ve decided on the format for my CSS tutorial series and hope to kick things off with the first in the series tomorrow.

[... 75 words]

PyMeld

PyMeld is a concrete implementation of something I’ve been thinking about for months: A template system that takes an XHTML page as a template and manipulates it based on cloning and modifying elements within the template identified using their ID attribute. It’s a very elegant solution that makes good use of Python’s object overloading support to make manipulating templates as intuitive as possible. Maybe the same thing will be possible in PHP once the new overloading functions become part of the standard package.

[... 180 words]

Ninety percent of everything is crap

Via the comments on Robert C. Martin’s One per Pixel, I came across Sturgeon’s Law from the Pragmatic Programmers: Ninety percent of everything is crap. The article has the following to say about software development:

[... 311 words]

All Courseworked Out

I’m all courseworked out. After 4 hours sleep on Saturday night, I got up at 8am, headed in to Uni and spent the next consecutive 57 hours in the Library doing coursework (grabbing a total of about two hours sleep during that time). It was, with hindsight, a very stupid thing to do but I take heart in the fact that I was not alone: At least 20 other people from my course were there for almost the same amount of time I was (see Richard and Andy).

[... 304 words]

The CSS Zen Garden

This is something we’ve needed for a long time. The CSS Zen Garden demonstrates CSS as used by graphic designers, and is a truly beautiful sight to behold. It currently showcases 5 radically different designs all using exactly the same markup, and invites further contributions from other designers. Finally, a proper demonstration that standards compliant, accessible, CSS driven web sites do not have to be boring or ugly.

[... 75 words]

Delay to the start of my CSS tutorial series

I still plan to go ahead with a CSS tutorial series, as promised. I’m delaying the start, partly to give myself time to work out a good structure for the series, but mainly because I have a shed load of coursework due in a week today that desperately needs my full attention.

[... 56 words]

New mozgest soon

AndyEd on the Mozilla gestures project:

[... 68 words]

Living on a knife edge

In The XHTML 100, Evan Goer describes an experiment in which he checked 119 site claiming to be with an XHTML doctype for full compliance with the W3C standards. His test consisted of three parts—a validation check on the front page, a check on another “inside” page, and a check to see if the correct Content-Type header (application/xhtml+xml) was served to supporting User Agents (in his case Mozilla 1.3).

[... 580 words]

Instant caching with PHP

I’ve been getting more database timeout errors today, probably due to increased traffic from links to recent entries. A permanent solution would be to switch to generating static HTML (this site is currently dynamically generated for every request), but I don’t have time for a full re-write at the moment. Luckily, PHP offers an extremely simple solution to dynamic caching in the form of output buffering. The front page of the site (which generates by far the most traffic) is now served from a cached copy if it has been cached within the last 5 minutes. Best of all, I didn’t have to edit any of my core application logic—I just dropped in some extra code at the top and bottom of the index.php file. Here’s how it works:

[... 271 words]

Better structural markup rants

Better structural markup rants than mine: Owen Briggs’ classic Design Rant and Craig Saila’s Tables or CSS? Choosing a Layout. Incidentally, my rant has sparked some excellent feedback in the comments section.

[... 39 words]

Achieving standards compliance and a list of DTDs

Via the WaSP blog (I wish they would ping Weblogs.com), How to achieve web standards and quality on your web site and List of valid DTDs you can use in your document, both by the W3C QA team. The former includes a great selection of questions and answers to typical reasons for not using standards (as well as some great tips on how to create standard compliant sites) while the latter finally provides all of the DTDs in one place.

[... 95 words]

Strong Typing vs Strong Testing

In Strong Typing vs. Strong Testing, Bruce Eckel reconsiders the old idea that languages without strong typing can’t be relied on to create large programs:

[... 148 words]

Defending Structural Markup

I’ve been somewhat taken by surprise by the latest round of anti-CSS rants (initiated by JWZ, followups all over the place), mainly because I’ve been using CSS for long enough now that I’d started to forget about the legions of web developers out there who haven’t yet realised what they’re missing. Instead of getting stuck in to dissecting other people’s complaints I’m just going to lay down a few of my own core beliefs.

[... 841 words]

iTunes Web Service?

Via Tim Bray, it turns out Apple’s new iTunes Music Store is driven under the hood by a whole load of XML documents, which are available via HTTP. Here’s hoping this leads to something similar to the Amazon Web Services API.

[... 56 words]

Types

Years

Months

Tags