Development

Protocol relative linking

An odd discovery today – if you don’t specify a protocol in your links, the browser apparently suppose it’s the same (be that http or https) as the current page. You can se it in action on Slashdot by viewing their source – none of the regular links has protocol specification – they just start with two slashes and the hostname (ie. //netfactory.dk/). In the case of Slashdot I suppose they don’t use it to save bandwidth, but in most cases it’s probably useless.

Mysql: (date) functions and indexes

Mysql is usually pretty fast by default, but to keep performance to the max sometimes requires knowledge on how mysql works and how to write queries that does their job most efficiently. Today we ran across a simple example which illustrates that mysql’s ability to use an index depends on the way you write the query. Let’s make a simple table and add an index on the date column: create table members ( m_id integer auto_increment primary key, m_name char(20), m_since date not null ); create index ix_m_since on members (m_since);

A database styleguide

Most databases seems to be well designed when the systems needing them are launched in the first version – but the slowly as the systems evolve (often grow beyond their initial requirements) – the database design seems to go down the drain. Here are a few tips on what to think about when you design a database or alter it. First rule: Remember the goal of the system. Different systems have different requirements and thus require different database designs.

Namespace crash in HTML forms

Today’s evil headache was caused by something as simple - yet annoying - as a two HTML form elements having the same name (but different types and uses in the form). The lesson learned is that if a field in a form is submitted but contains nothing - check if another object in the form has the same name and make changes if you need to.

To Mac or not

So, I’ve been wondering if I should by a Mac. Windows works for me, but causes a fairly large number of headaches. Linux is nice for server use, but I’m not nerdish enough to get a desktop running. With the many positive reviews, switching stories and others I was thinking of going Mac. Since OS X was introduced Mac machines runs on a BSD core which makes it almost familiar grounds for people who knows the Unix world.