One URL per page

A few weeks ago I was working on a web site that wasn’t getting as much attention from Google as the site owner expected.  One (of many) issues was that for every “interesting” page (those that had link-worthy material), there were at least three URLs for that same content. Depending on how the user navigated the site, they’d get to a different URL.

I pointed out that this is a Bad Thing, since distributing the incoming links across those duplicates would decrease the Google-worthiness of each… but hadn’t had time to write up the detals.  Today I was thrilled to see this detailed writeup of the phenomenon and this one about how fix it.  I’ve done the same thing in the past, but never written it up.

If your site has this “feature”, and you would prefer it gets more traffic, fix it.

Indentation as Block Structure – HAML instead of RHTML

When I starting with Python sometime in 2001, I was briefly frustrated by the intentation-as-block-structure syntax; but after a few weeks I found it  natural. Its most obvious advantage is that it avoid the duplication between indentation and braces / keywords. Yet this kind of syntax has not become popular outside of Python.

Today I saw an interesting use of it “in the wild”: HAML, an HTML templating mechanism for Ruby on Rails. I haven’t used HAML (and may not, since at the moment we have only some sample projects using RoR, nothing in production), but from the tutorial it appears to be a very tight (indentation-based) syntax for HTML templating. I’ve encountered a Rubyist or two who disdains the Python syntax – I wonder if that similarity will limit HAML’s adoption.

High Level Assembly Code?

A while back I needed to reverse the order of the 4 8-bit bytes in a 32-bit word, in some Delphi code. I worked out a way to do it with bit shifting, read the docs for a few minutes, and got something to work with AND, SHL, SHR, and some $FF constants. Later I encountered (on a usenet post which I can’t find at the moment), this implementation, which consists of some Delphi cruft around a single assembly statement:

function Swap32(aLong: Longint): Longint; assembler;
asm
BSWAP eax
end;

This is an unusual occurence: the assembly code is shorter, simpler, and more obviously correct (see this explanation of BSWAP), than the high level language implementation. Hmmm.