soft-shell crabvietnam crab exporter

Simon Willison’s Weblog

Newsletter
Atom feed

Entries

Filters: Sorted by date

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.

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.

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.

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]