Simon Willison’s Weblog

Subscribe
Atom feed

Entries

Filters: Sorted by date

Today’s pleasant surprise

Today’s pleasant surprise—while surfing around the Wireplay forums I came across a link to alliedassault.co.uk, a community site for Medal of Honour: Allied Assault. Imagine my surprise when I realised the news section was coded by me! It uses a news script I wrote over a year ago and never got around to finishing—I released it to a few people and it seems Reality ended up using it on the site. It’s great to see code you’ve written being used after you’ve all but forgotten about it—the site also uses my ssLinks link management script, the sequel to which I am working on now.

CSS image rollovers

CSS Image Rollovers describes a brilliantly simple technique for creating the effect of an image rollover using only one image and no javascript. The effect works by creating a gif with a transparent background, then using a :hover pseudo class to change the background colour of the the containing area. Pretty straight forward so far, but the clever part is that by making the transparent part of the gif an interesting shape (placing it around the outline of a shape in the image for example) you can give the impression of displaying a different image entirely.

Working on my blog

If I don’t post much today it’s because I’m hard at work on the new database driven version of this blog. I’m hoping to open souce it so I’m trying to design it to be as easy to customise and modify as possible, which means plugin support, themes and an extensible API. At the moment it will only work with mySQL but I’m trying to keep the data access routines abstracted away so they can be easily replaced with code for other databases or even a flat file or XML storage system.

PHP immune to SQL injection attacks

An interesting thread on SitePoint about SQL injection attacks. One of the points brought up is that PHP is by default virtually immune to injection attacks thanks to magic quotes (discussed here yesterday).

Tips for working from home

Another cracking article from Scott: 12 Tips for Working from Home But Keeping it Under Control. I worked from home for a while last year and these tips make a lot of sense (I know because I wasn’t doing any of them and I suffered as a result).

Why Scott doesn’t read your blog

Scott: Why I’m Not Reading Your Blog and Why Others May Not Be Also. Scott likes text he can resize and a decent update frequency. Tony Bowden responds that update frequency is no longer an issue for him ever since he switched to using a blog roll that shows him when the blogs listed were last updated. The same is true for me—my blo.gs powered blog roll has slashed the amount of time I spend keeping up with other people’s blogs as I only visit them when there’s something new to read.

A plan for spam

Paul Graham: A Plan for Spam. Paul suggests using content based filters that learn from users specifically marking messages as spam or legitimate mail. The system then picks emails apart looking for commmon terms (in both the body and the header of the message) that can then be used later on to identify spam messages. He claims his test have let through only 5 per 1000 spams, with 0 false positives. Impressive stuff, and great reading for the excellent explanations of some advanced alogithmic and statistical techniques.

Fiendish markup quiz

Hixie has posed a fiendish markup quiz—spot the four markup errors in a document that validates. It’s harder than it sounds. I’ve mailed off my answers, but I’m not expecting to get full marks.

[... 43 words]

Comments improvement

I’ve improved the comment system at the bequest of Adrian Holovaty. URLs posted in a comment (both those beginning with http:// and those beginning just with www.) will now be converted in to links.

Magic quotes solution

Pink Goblin (otherwise known as HarryF) explains why magic quotes are evil. This is an issue that every PHP developer should be aware of, as it can cause all kinds of problems in your scripts if you ignore it. He suggests using a custom myAddSlashes() function which only calls addslashes() if magic quotes are turned off. I have an alternative solution—chose your preferred setting (quotes on or off) and apply it at run time to all incoming data in one go. My code for doing this is available here. By a bizzare coincidence I wrote the script this morning, then spotted a link to the Pink Goblin article on tidak ada literally five minutes after finishing it.

New memes make Baby Jesus cry

Things that make Baby Jesus cry (stolen from Mark Pilgrim). Google as social commentary?

Python RSS locator

Mark Pilgrim has written an ultra-liberal RSS locator (in Python, naturally). I guess he had to scratch an itch. The amount of work it puts in to locating an RSS feed for a site is astonishing, especially when you consider how short the actual code is.

Zeldman played by a stand up comic

Eric Meyer has confessed.

css-discuss rocks

css-discuss has seen some interesting threads in the past 24 hours and the new archive means I can link straight to them—so here goes. Kentaro Kaji kicked off the topic of techniques for aligning an image with the bottom of a block of text. In the same thread, Benn Nunn advocated avoiding width and height attributes on images and keeping that information in an external style sheet. Other topics included accessible navigation and a tricky absolute positioning problem with Opera. The most informative mailing list I’m currently subscribed to just keeps getting better.

Today’s required reading

10 Tips on Writing the Living Web is full of invaluable advice for anyone who wants their weblog to be of interest to other people.

PHP numbered code listings

Michael V has written a couple of functions to apply my CSS numbered code listing technique to PHP’s built in syntax highlighting.

Patented IMBots

I wonder if these muppets have heard of eggdrop (created 1993). Something tells me prior art for this one won’t be too hard to find.

More mailing list etiquette

Madhu Menon: Avoiding personal conflict on mailing lists.

Hacking Las Vegas

Hacking Las Vegas (via Kryogenix)—the story of how a bunch of wizz kids from MIT devised the perfect card counting technique and took the casinos for the ride of their lives. Edge-of-your-seat stuff.

CSS Trickery

New CSS Experiment: Trickery with Floats and Negative Margins, inspired by this message on css-discuss. By applying both position: relative and a negative margin to a floated element it is possible to pull it out of the flow of text in to the margin of the document. I have used a variant of this technique in the third revision of my SitePoint in CSS demonstration.

Fun with FOLDOC

The Free On-Line Dictionary of Computing does exactly what it says on the tin. It is available under the GNU Free Documentation License so I grabbed a copy of the archive (which expands to a 4MB text file) and had a go at dumping it in to a mySQL database. I haven’t done anything with it yet (apart from putting together a rudimentary interface) but I have a few ideas for interesting ways of reusing the data.

Thanks for the link

Stuart has pointed out that this is the second time Jeffrey Zeldman (who is actually Eric Meyer) has spelt my name wrong :)

PHP and ID3 tags

MP3 Piranha is a clever application which indexes your MP3 collection and uses the Amazon Web Service API to look up the album cover, related albums and provide a link to buy the album from Amazon. Out of curiosity, I ran a search for a PHP library to decode ID3 tags to see if such a thing could be built with PHP, and came up with this script by Leknor. The class is well written and I learnt a lot about ID3 tags looking through it—it seems they take up the last 128 bytes of an MP3 file and can be decoded using PHP’s unpack() function.

Q tag bad

Mark Pilgrim explains why the <q> tag is bad for accessibility.

Alchemist contest

AlltheWeb.com introduced an innovative feature called Alchemist a while ago which allows visitors to customise the site by specifying the URL to their own style sheet. They have now announced a CSS design contest for the service, with top prizes of $750 in Amazon vouchers available for three categories (“Simple, Yet Beautiful”, “To CSS Infinity and Beyond” and “So 22nd Century”). This is a great oportunity for advocates of CSS to show just how powerful it really is.

Bulletin board spam

My friend Tim recently received a spam from a company called TrafficBBS, who specialise in bulk submissions to 50,000 search engines and 120,000+ BBS (web based bulletin boards). A quick look at their list of targetted forums reveals that they are spidering and spamming a whole bunch of simple web based forum scripts that don’t require user authentication, such as WWWBoard. This is a form of spam I wasn’t aware of until now. It’s scary to think how easily the system could be expanded to automatically register on more advanced widespread forum systems such as vBulletin.

[... 140 words]

Controlled vocabularies

Christina Wodtke: Mind your phraseology!, a tutorial on controlled vocabularies. The concept is very similar to that used by TopicMaps—relationships are defined between terms that take in to account hierarchies, associated terms and even alternative spellings. I’m planning an overhaul of the category / metadata system used on this blog in the near future and Christina’s tutorial has given me a whole load of new ideas.

SitePoint CSS experiment

SitePoint are trialling a new design for their front page. For fun, I had a go at recreating the new design using structural XHTML and CSS. The result isn’t my normal style (I normally avoid fixed pixel font sizes and go for liquid rather than fixed width layouts) but replicates the existing design nicely and looks good in IE 5/6, Mozilla and Opera 6 on Windows. Netscape 4 doesn’t get the stylesheet and I have yet to try it out on a mac.

Tidakada

Spotted in my referrals: tidak ada, a beautifully designed blog covering web development and other related topics. This is another great example of what you can achieve with some creative CSS.

Optimising Javascript

A thread on SitePoint lead me to these two excellent tutorials: Javascript Optimisation and Tackling JavaScript strict warnings.