Archive for January, 2008

Tip: Tables containing people

Friday, January 25th, 2008

One of the most common things to store in a database are details of people, be they users, contacts, or third parties you record details for. People are also far and away the most common source of mistakes in the design of relational database schemas and applications. Here are some pitfalls with handling names.

  1. First name, last name - Japanese people, amongst many others, disagree with the West on this ordering.
  2. Christian name - I’m not a Christian.
  3. Title as an enumeration - do you limit the choices of prefix titles people use? Have you included Dr., Sir, Prof., Prof. Sir, Rt. Hon., Cllr., Mayor, Cpt., Cmdr., M., Mme., Mlle., Sheik, Pope, HRH, President etc? Do you think you can compile an exhaustive list?
  4. Are two names required? Sting, Lulu, Bono, Pocahontas, Countess of Wessex.
  5. Guessing initialisms - If you’ve asked for my full name, don’t assume you can address me as Daniel J. Pope or D. Pope. I very rarely use these forms. Joanne Kathleen Rowling is usually announced as J. K. Rowling. Similarly, I’d always initial myself DJP and never DP.
  6. Many US Americans (sadly lacking maps) require their generation after their surname for disambiguation. But you can’t turn John Davis III into Davis III, John. You would write Davis, John or possible Davis, John III.
  7. Don’t force Title Case - Mohammed al Fayed, Manfred von Karma, John Davis III and so on shouldn’t be put into title case.
  8. “Abdhul” is not an informal way to address an Arab whose name begins with Abdhul ie. the first word of a given name is not necessarily an informal name.
  9. Have you stored aliases? Should your database be able to record the fact that Thomas C. Mapother IV is also Tom “Only scientologists can save the world” Cruise?
  10. I happen to have a peculiarity with my names. I am not called “Dan Pope”. Dan is slightly diminuitive but “Pope” is slightly formal, and the combination shouldn’t be used. People have often assumed they may refer to me this way and they are wrong. To confuse issues, in recent years I sometimes sign e-mails this way because I’ve found it’s a good fit for the formality of the medium. But different criteria apply in the second or third person.

Names are a very individual thing and people feel strongly about how they should be addressed. How you index or sort names is your business and doesn’t influence how people wish to be addressed. If you’re indexing by surname, be aware that not everybody will identify themselves to you by the same surname you have indexed. If you’re sorting, you should perhaps be aware that individuals’ native collations may differ.

The tip, then, is this: store the forms of address you wish to use. Do not assume you can correctly derive other forms.

These are the variants I use:

Full Title: Daniel James Pope MA (Cantab.)
Full Name: Daniel James Pope
Name:
Daniel Pope
Formal Name: Mr. Pope
Postal Name: Mr. Daniel Pope
Initials:
DJP
Vocative: Daniel
Familiar Vocative: Dan
Nickname: Mauve
Preferred Username: mauve

application/javascript in IE

Sunday, January 20th, 2008

The application/javascript MIME type has stopped working in my copies of Internet Explorer (6 and 7). Both now silently ignore scripts linked with type="application/javascript", which is as far as I have since determined the behaviour most people experience. Indeed I’ve only found very sketchy reports of it working at all.

Because I had no idea I was unique in being able to experience scripts linked in the RFC-compliant and IANA-approved way, I have used this MIME type on quite a few sites. So it’s good news, because I would never have spotted this otherwise. Happily, most of these sites are not yet deployed, and the rest only use Javascript for very trivial polish. There now begins a hunt to replace application/javascript with text/javascript on all my sites.

Obviously, I’m at a loss to explain why Microsoft has failed to offer a consistent platform for development and I feel quite aggrieved about it. If I hadn’t already boycotted Internet Explorer this would be a pretty good reason to start.

On the assumption that some other piece of software has by accident or design disabled - or had previously enabled - application/javascript, this is my list of candidates:

  1. Microsoft Outlook 2007, installed for the first time on this computer this week.
  2. Word 2007, also installed this week for the first time.
  3. Some random Windows update I installed last weekend.
  4. Access 2007, installed two weeks ago (but I think I would have noticed sooner if that had caused this change).
  5. Removing something malicious with Spybot. I think it removed one or two dubious registry entries left over from an infection of Vundo/VirtuMonde last year, so it’s unlikely but there’s an outside chance of an effect.

Tip: Styling bullet lists

Friday, January 18th, 2008

Bullet lists are a wonderful way of formatting both because they convey structure and because they serve to visually break up otherwise impenetrable paragraphs of prose.

It’s possible to use a custom image for these bullets, by way of the CSS list-style-image property. This is a great way to carry your site’s theme through into the content.

If you can’t be bothered to draw custom images, you can at least make your bullets agree with the font using the list-style-type. With sans-serif fonts, square bullets usually look more professional. If you are using serif fonts - and this is a bad idea incidentally, because they aren’t as legible on a screen - use circle or disc (ie. unfilled circular) bullets.

Inkscape 0.46 preview

Sunday, January 13th, 2008

Inkscape 0.46 is drawing close. There’s a whole wealth of new features, some of which are incredibly exciting. I’ve not been using the SVN version since I replaced my desktop machine 5 months ago, so I’m only now discovering what these new features will let me achieve. It’s a process of discovering not so much how each tool works, but identifing useful little ways of combining features.

To whet your appetite, here’s a two-minute doodle demonstrating a turbulent displacement filter.

Watery Doodle

Update: here’s a more realistic style using a specular lighting filter.

Watery Doodle 2

Tip: Don’t forget the favicon

Friday, January 11th, 2008

In contemporary web browsers, favicons are prominently displayed in the browser’s UI. As such they have become an integral aspect of creating a site that looks professional. More importantly, they allow users to identify a website from a host of tabs or bookmarks. Alas only a third of web pages (based only on my bookmarks list, admittedly) offer a favicon.

What your favicon looks like is less relevant than having something distinctive. Favicons should trigger recognition, and need not stand up to examination.

Satchmo

Monday, January 7th, 2008

Since I’ve been using the Django framework for web development I’ve been pointed in the direction of the Satchmo framework a few times. Satchmo is intended to be the framework for e-Commerce development built on top of Django. I’ve looked at Satchmo more than once trying to weigh up whether it would be a useful thing to use for projects, because an e-Commerce framework certainly should be useful. Satchmo doesn’t satisfy this expectation.

I have written an e-Commerce shop in Django. It took three days, much of which was spent writing the backend - basket, order processing and so on. I am absolutely certain that I couldn’t have done that with Satchmo. The first reason is that Satchmo isn’t orthogonal; it’s impossible to use Satchmo’s basket/ordering system without using Satchmo’s products front end. Front ends are very easy to write in Django and I needed something custom for this shop. Custom front ends are very hard to write in Satchmo - they involve writing custom extensions to the product model. The second reason is that Satchmo doesn’t use Enterprise Design Patterns like Money.

Satchmo also provides code that is very much outside its remit as a framework, like this strange configuration property which embeds Google Analytics. Google Analytics code is trivial to paste into the templates should I want to do so. Why would I need this built into the platform?

Satchmo doesn’t satisfy as a framework; it’s more of an off-the-shelf application regardless of what the authors claim. Now I have Django web shop code, I won’t be needing Satchmo.

Tip: Mock up your designs

Thursday, January 3rd, 2008

A lot of hobbyist web designers start by creating the content for their web pages, then try to add graphics to “spice it up”. This is a mistake. It’s very hard to make a page look appealing in retrospect.

Start with a high-quality vector graphics tool - I recommend Inkscape - and properly design the website. To represent where to put content use Lorem Ipsum or simply rectangles to represent individual paragraphs. Once you are satisfied with a design, recreate it in HTML, exporting any graphical elements you need from the mockup.

You can use this approach even for sites that don’t need graphics; it is beneficial for choosing colours, fonts and layouts as well as for creating fully graphical sites.

Be careful though - you need to design a mockup that you can successfully convert to HTML. Graphics programs are WYSIWYG but the web is not and this places constraints on what you can successfully produce. Beware in particular of how the site changes as your browser window or text size changes.