Simon Willison’s Weblog

Subscribe

Items in Apr, 2003

Filters: Year: 2003 × Month: Apr × Sorted by date


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.

[... 134 words]

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.

[... 12 words]

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.

[... 98 words]

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.

[... 63 words]

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.

[... 129 words]

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.

[... 63 words]

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 :)

[... 28 words]

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.

[... 32 words]

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:

[... 158 words]

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.

[... 25 words]

Tim Bray on RSS

Tim Bray: RSS Needs Fixing:

[... 255 words]

CSS Feedback

My rambling post on CSS yesterday has had some excellent feedback, including some insightful comments on the weaknesses of CSS layouts. My call for a new bookmarklet drew responses (and implementations) from both Stuart Langridge and Jesse Ruderman! Both are well worth installing.

[... 55 words]

Wiki Wiki Blogroll

Dave Winer has launched an experimental “open” blogroll. It looks a bit too open to abuse for my liking (Wikis are protected to a certain extent by their revision historys) but the interface for changing the order of entries is one of the most elegant non-javascript solutions I’ve seen.

[... 58 words]

Comment Notification

Keith is calling for bloggers to implement a “notify me of any replies” feature for their comments systems:

[... 135 words]

What the F* Happened?

What the *F* happened to the internet? is a rambling but entertaining description of how big business stole the ’net, and how it doesn’t really matter (via Paul Hammond’s links blog).

[... 33 words]

MD5 in Javascript

One of the things that has always bugged me about creating login forms for web based applications is that the password is passed in clear text when the user logs in. Even if you then set a session cookie of some sort for future access the password has stilled been transmitted unencrypted at least once.

[... 235 words]

Flamin’ CSS

Dave Winer, in a follow up to his recent CSS problems:

[... 807 words]

Python Roundup

No blogging for a while; I’m getting stuck in to a whole load of University coursework. In the meantime though here are some Python links I’ve been hoarding for a few days on my private wiki:

[... 142 words]