Simon Willison’s Weblog

Items in Mar, 2003

Filters: Year: 2003 × Month: Mar ×

getElementsByClassName() rewritten

Andy has rewritten getElementsByClassName, resulting in much cleaner code and a method which can be called on any DOM element, not just the document object.

[... 32 words]

Playing with REBOL

Yesterday, inspired by Keith’s Programming page, I decided to take a look at REBOL. REBOL is a very high level scripting language designed for working with the internet. It has the interbnet built in to its very core—its 45 core datatypes include email addresses and URIs and it includes support for 14 standard protocols including HTTP, FTP, POP and even finger.

[... 209 words]

Getting Linux to talk to an iPAQ

I’m playing around with a borrowed Compaq iPAQ at the moment. Unfortunately I don’t have permission to go the whole hog and install linux on it but, as the next best thing, I’ve been working out how to get it to talk to my Linux box. A quick Google search brought up SynCE, an open source project providing all kinds of software to allow communication between *nix and handhelds running Pocket PC. So far I’ve got the command line tools working which allow me to transfer files to and from the iPAQ and start up iPAQ programs remotely. The next step is synchronisation with Evolution.

[... 124 words]

I can’t believe its not a table

Via Craig, Big John’s new CSS layout “I can’t believe it’s not a table!”. I’ve played with the key concept of this before: using a background-left image on the body and a background-right on an all-encompassing div to create the illusion of two columns stretching the length of the page, but I never got it working quite as well as this. Big John’s layout uses that trick and a few others to get it rock solid across all browsers, then explains exactly how it all works in excruciating detail. Essential reading.

[... 101 words]

Sitepoint XHTML tutorial

SitePoint are running an excellent new tutorial series: XHTML Web Design for Beginners. There’s little there for non-beginnners, but I’ll certainly be sending new learners in that direction.

[... 29 words]

Glastonbury does CSS

Cool—the new Glastonbury Festival website uses a CSS layout! Unfortunately it completely fails to validate as XHTML Transitional, but comes to within an inch of validating as HTML 4.01 Transitional (they just need to change the doctype, take out a few XHTML specific attributes and clean up a misplaced <b> tag).

[... 154 words]

Clearing out some more tabs

Clearing out some more tabs:

[... 384 words]

Smarter CSS positioning

Daniel Glazman’s proposal for smarter positioning in CSS (see also this blog entry) makes a lot of sense.

[... 23 words]

Usability myths

UIE debunk three usability “myths” (the three click rule, the idea that users give up on slow loading web sites, and the “5 to 8 test subjects should post most usability problems” idea). 37Signals do a pretty good job of debunking the debunkers.

[... 55 words] has some useful looking classes, including SmartTemplate (like Smarty but much simpler to use) and SmartCache, a very intelligent caching class that can be used to cache data objects as well as the output from whole pages. The example given caches a database query using the SQL statement as a unique cache key:

[... 108 words]

Ruler bookmarklet

This Ruler bookmarklet is really cool—it shows the current coordinates of the cursor within the browser window and allows you to draw boxes and see how large they are in pixels—invaluable for tweaking CSS layouts.

[... 48 words]

Time traveller busted for insider trading

“Time-Traveller” Busted for Insider Trading (via Tony Bowden). This just has to be some kind of early April fools.

[... 242 words]

Programming concepts

Two interesting reads relating to the Programming Languages course I’m taking at University:

[... 104 words]

Sergey Brin interviewed

Jeremy Allaire has posted notes on an interview with Sergey Brin of Google, conducted at the PC Forum conference. Some highlights:

[... 240 words]

Why XML doesn’t suck

Tim Bray: Why XML Doesn’t Suck (a follow up to XML Is Too Hard For Programmers). I’d quote the best bits but there are just too many—this article clears up all of the loose ends in my understanding of why XML is such an important technology.

[... 53 words]

Attribute selectors now supported

I’ve updated document.getElementsBySelector to support CSS2 and CSS3 attribute selectors, as described here. Attribute selectors allow you to match elements based on any attribute using a variety or different rules including begins-with, ends-with, contains and more. The new version is tested in Mozilla, Phoenix and IE5/Windows (and I’m almost certain it works in IE6). There is a slight bug in Opera 7 preventing the ends-with selector from working which I have been unable to track down—any Opera javascript experts out there?

[... 172 words]

Retrieving all DOM descendants

First observation of the day: IE 5 for Windows doesn’t understand element.getElementsByTagName('*') to retrieve all descendants of an element in the DOM. element.all has the desired effect for that browser. So to retrieve all descendants in a way that will work on standards compliant browsers plus IE 5, the following seems to be the best bet:

[... 71 words]


Inspired by Andy, I decided to have a crack at something I’ve been thinking about trying for a long time. document.getElementsBySelector is a javascript function which takes a standard CSS style selector and returns an array of elements objects from the document that match that selector. For example:

[... 172 words]

Date-centric vs Entry-centric

When I started this blog, I made the decision to use days rather than entries as the principle navigation unit of the site. Each day’s entries are grouped under a single heading for that day, archives are arranged by day (with permalinks linking to anchors on those pages) and individual entries come without titles, to emphasise the fact that they are part of a larger whole.

[... 602 words]

Freshly Blogrolled

Recent additions to the blogroll:

[... 145 words]


More handy javascript from Andy: document.getElementsByClassName.

[... 7 words]

Useful mySQL articles

Paul DuBois, the author of the huge great MySQL Book I have sat on my bookshelf, has a whole bunch of useful MySQL articles published on his site.

[... 32 words]

A PHP Installer

Wez Furlong is working on a generic PHP installation script. If he finds a nice solution to the safe_mode and open_basedir restrictions mentioned in his post this could be a hugely useful tool for the PHP community.

[... 48 words]

The goodness of binary search

Tim Bray provides an in depth, practical explanation of the binary search algorithm with example code in Java. Great revision material for second year computer scientists like myself.

[... 35 words]

Smart scripted URLs

Dan Kalowsky is realising the importance of using a smart scripting technique to generate “nice” URLs:

[... 62 words]

UltraEdit regular expressions

Every now and then I find myself needing to use a regular expression in UltraEdit, and whenever I do I invariably have to spend five minutes re-reading that section of the manual to remind myself how its syntax differs from more traditional regular expressions. This time, I’m recording the result in the hope that it might jog my memory next time I need to use them.

[... 104 words]

PHP5 info from Sterling Hughes

Sterling Hughes has posted the slides he will be using for his presentation on PHP 5 next week. They provide a great deal of insight in to the new additions to look forward to in PHP 5, including a few I hadn’t heard about before.

[... 209 words]

coWiki uses PHP5

coWiki is the first open source project I have seen being developed with PHP 5, using snapshots from CVS. It looks like a really neat wiki system. Of particular interest for PHP heads is the development log on the front page (sorry, no permalinks) which provides some insight in to the progress of PHP 5’s development.

[... 70 words]

Conference woes

Like Stuart, I’m severely tempted by the UK Python conference—as a student it would cost me £85 to go for the first day, not including train fairs. That’s a lot of money (considering I currently have none) for 4 sessions and the opportunity of a BOF meeting, but it’s quite rare for the UK to host a conference on something I’m heavily interested in (I’m yet to go to one). These tips on getting the most out of a conference would certainly come in handy.

[... 129 words]

Some PHP notes

I ran an intermediate to advanced PHP session at University today, on behalf of BCSS. The turn out wasn’t particularly impressive, probably because the only lecture today had been cancelled so there were a lot fewer people from our course on campus than I had expected (the session was arranged because a piece of group coursework we are working on at the moment uses PHP). The notes I put together from the course are available online. They were put together in a bit of a hurry, so please tell me if you spot any mistakes. Topics covered include sessions and cookies, classes and objects, references and some brief notes on writing secure code.

[... 125 words]