Simon Willison’s Weblog

Subscribe
Atom feed

Entries

Filters: Sorted by date

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.

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.

XUL and PHP

XUL: rendering GUIs with PHP and XUL to PHP-GTK, both on the excellent phpPatterns(). If you’re using a Gecko-based browser be sure to check out the XUL Interface to phpPatterns() proof-of-concept, which adds an XUL powered menu bar to the browser chrome at the top of the page.

Feedster AND searching

Feedster finally supports AND as the default search operator. This is a very good thing. I’ve decided to leave this site’s search engine as using OR, mainly because I feel for a small search set (approximately a thousand entries) more search results is better than fewer search results and because relevancy algorithm used by MySQL to order the results appears to be working extremely well. For large data sets such as Feedster or Google I definitely prefer to only see results containing all of my search terms.

Firebird Switch Campaign

Why You Should Switch to the Mozilla Firebird by Ben Goodger is an excellent overview of Firebird’s advantages over other browsers, hosted on the Phoenix project site. I’m really looking forward to the release of 0.6 as a good, stable, easy to use browser I can recommend to non-geeky friends.

In praise of functional programming

Via Joe Gregorio, Functional programming in Python Part 1 and Part 2. I’m reading Structure and Interpretation of Computer Programs at the moment (available for free online, but I’ve got a library copy) and it has been getting me seriously interested in the functional programming paradigm. It’s also by far the most enlightening (in terms of “wow, that really makes sense”) computer science text book I’ve ever read. There’s something naturally elegant about the functional style, probably thanks to the encapsulation encouraged by the lack of global variables and the extensive use of recursion in functional code examples. It’s definitely true that exposure to a variety of programming styles encourages you to think about problems in different ways.

XmlWriter: Generating XML from PHP

Lars Marius Garshol’s XMLWriter class for Python struck me as a particularly elegant solution for generating simple XML documents without having to worry about encoding issues, missing tags and so forth—so I re-implemented it in PHP:

[... 112 words]

Skill Swap

Via Zeldman, Skill Swap is a community based new mania free training scheme based in Brighton:

[... 112 words]

Threads and Dynamic Content

Sterling Hughes: THOU SHALT NOT USE THREADS TO SERVE DYNAMIC CONTENT.

Tim Bray on Unicode

Tim Bray’s ongoing really is one of the best technical blogs out there (if it even is a blog). One of his current topics is Unicode, which is one of those topics that pretty much every software developer should try to get under their belt. On the Goodness of Unicode gives a thorough, entertaining overview of the subject (including its importance and why it isn’t as scary as it sounds) while Characters vs. Bytes is the first in a promised three part essay covering the technical details of modern character processing.

Fixed Point Arithmetic in Python

The Python Tutorial now includes a new appendix on the limitations of floating point arithmetic. Via Simon Brunning, who also linked to the lengthier What Every Computer Scientist Should Know About Floating-Point Arithmetic almost exactly a year ago.

CSS Headings

Via Craig Saila, Christopher Schmitt’s 50 CSS Headings. Free CSS code snippets is definitely an idea who’s time has come—there are hundreds of copy-and-paste javascript sites out there but hardly any for CSS (discounting the many excellent full layout sites). Mark Newhouse’s extremely popular CSS Design: Taming Lists article does the same thing for lists but other than that this kind of resource is extremely rare. Web developers not interested in moving to CSS completely can still benefit hugely from using it in their current sites in place of nested formatting tables and presentational tags used to give the visual appearance of headings, so the more of this kind of thing out there the better.

More fun with Search

While browsing around my phoenix/ directory I spotted a sub-directory called searchplugins, which appears to control the list of search engines available in the very useful search box at the top right corner of the browser. A bit of digging later and it turns out that adding new search engines to Mozilla based browsers is remarkably easy: The Mozilla Search Project.

[... 110 words]

Phoenix / Firebird nightlies hotting up

Word on the street is that Phoenix 0.6 (or Firebird or Mozilla Firebird or Mozilla Browser or whatever else you want to call it) could be out within the next week or so. I’m using the 28th April nightly build and it really is a big improvement on Phoenix 0.5, which is a very respectable browser in its own right. The new preferences panel (shown below) has been in the nightlies for quite a while now and really does add to the overall feel of the browser, and new features from Mozilla such as an editable about:config screen are handy as well.

[... 149 words]

position:fixed in IE, no Javascript required

Via Craig Saila, a method for getting IE to apply position: fixed without resorting to Javascript. It uses a conditional comment (slightly ugly but perfectly valid HTML) and works a treat. Kudos to Eric Bednarz for clearing up another of those niggling CSS problems.

Experimental feature: Related entries

I’m experimenting with using MySQL full text indexing to generate a list of “related entries” for each entry (click on an item’s permalink to see it in action). It works by concatenating the item’s title and entry body together and running a full text search on it, which sounds horendously inefficient but seems to work surpsingly quickly. If I decide to keep the feature I’ll probably cache the results somewhere to reduce the overhead, but for the moment it’s fast enough.

[... 141 words]

Site search finally available

I’ve finally got around to adding a search page to this site. It uses MySQL’s full text indexing, which is extremely fast and provides good results but comes at the expense of flexibility. Search terms less than 4 letters long are ignored, and multi-word searches are handled using OR rather than AND. This nearly put me off using it, but the relevancy algorithm is excellent which I think outweighs the disadvantage of not being able to use pure AND queries.

[... 138 words]

Show Computed Styles (yet again)

By jove I think they’ve cracked it: Show applicable styles from Stuart and List computed (cascaded) styles from Pixy. Talk about being spoiled for choice :)

Titles all the way

I’ve added titles to every single one of my archived blog entries; nearly a thousand of them. It took just over an hour, thanks mainly to my decision a long time ago to use camelCase for my permalinks. I put together a simple tool that displayed un-titled entries, ten at a time, with a suggested title based on the permalink (split in to words and sensibly capitalised). This probably knocked a good 75% off my workload.

[... 155 words]

Python 2.2 Quick Reference

The Python 2.2 Quick Reference, via Michael Twomey. All the essential bits of Python on a single (if quite long) HTML page. Magic.

Big news from Six Apart.

Ben Hammersley reports on SixApart’s (creators of Moveable Type) new venture, TypePad:

[... 166 words]

Acrobot

Ian Lloyd has a very neat new tool on Accessify: Acrobot, an abbreviation and acronym generator. It takes a chunk of text and wraps any recognised abbreviations or acronyms in the appropriate tag, with the expanded term as the title (it can also optionally just use IE friendly acronyms). It shames me to say that after a good 6 months of using these tags I’m still doing them by hand, so Acrobot is just what I need (at least until I get something similar working in my blogging system). Registered Accessify members can expand the tool’s dictionary, so maybe I’ll have to bite the bullet and sign up for yet another web site account...

[... 185 words]

Supporting Conditional GET in PHP

This site’s RSS feeds now support Conditional GET. Since the feeds are dynamically generated on every request, adding support took a bit of hacking around with PHP. Here’s the function I came up with (based on the excellent description provided by Charles Miller in the article linked above):

[... 398 words]

Entry Titles

As promised many times, I’ve finally implemented titles on my blog entries. I’m in the transitional stage at the moment—new posts will have them, old posts won’t. At some point in the near future I’m going to trawl through the archives (all 938 entries) and add titles to everything. Once I’ve done that I can look at changing other stuff like the RSS feeds, and maybe even get around to re-implementing some kind of search engine. Then there’s the new hierarchical category system, a whole bunch of accessibility improvements, better archives, comment email-alerts...

[... 114 words]

Introspection

Tantek: What to do with things to do:

[... 140 words]

Smarty Links

I’m using Smarty in a project at Uni at the moment, mainly as a tool to allow team members to modify different parts of the codebase without stepping on each other’s toes. I’ve seen some good arguments against templating solutions such as Smarty, based around the point that PHP is already a templating engine so the extra layer of abstraction just isn’t necessary. Never-the-less, I’ve been finding that Smarty dramatically improves my productivity even when I’m working on my own. Here are the links I’ve provided for my team members to help get them up to scratch on how it can be used:

Credit where credit’s due

Credit where credit’s due: It turns out the interface for re-ordering items I praised yesterday was designed by Bryan Bell.

Tim Bray on RSS

Tim Bray: RSS Needs Fixing:

[... 255 words]