Putting all your eggs in one basket can cause havoc

As users of UK Online are about to find out having all your email addresses in one ISP can be a pain, as UK Online is about to close down.

http://www.theinquirer.net/inquirer/news/1895999/uk-online-shut

As I understand it, users will have the Christmas period to move their entire backlog of email messages, and notify all senders of emails of a change of address. Come January 14 2011 all emails to that address will be bounced.

If, like us and most of the online community, you have decided to join the odd mailing list or two, you would need to track them ALL down and amend them. However, how do you deal with accounts that don’t allow you to change the prime email address?

Switching at such short notice is not going to be a quick or easy task. One of the reasons we use several email identities is to avoid this type of situation, so here’s hoping none of our independant service providers go the same way!

SQL Injection attacks

The recent attack on the Royal Navy site using SQL Injection techniques is a timely reminder to anyone still leaving their database unprotected.

The good news is you can quite easily reduce the risk of an injection attack. They take place when a site allows data input fields on a form access to basic SQL commands. By adding extra words to the end of a form input field SQL statements can be run in addition to the original designed statement. These commands can be quite simple for example, firstly select a list of tables, then select the data in the tables. As this operates at the database layer a connection has already been made by the software to the database so login details aren’t required.

There are simple functions that use basic escape mechanisms to protect the data input. The most common  is escaping the data, which may not be the strongest security measure. The input string is read and if the function finds certain characters it will ‘escape’ or add a ‘\’ character in front of the relevant character. There are still ways around this so to be safe the query to the database should be ‘parameterized’ that is the input string is broken up and selected parts are passed to the SQL query. Basic functions exist in most programming languages to do this task.

 Better yet, and good practice anyway, is to use stored procedures as these are totally parameterized. It isn’t particularly complicated, but it is a bit of a pain to do … if in doubt ask your web designer!

At last – a use for football?

I was trying to explain why an internet page used ‘F’ as part of the colour designation. “it’s because it is a hex number” I unhelpfully suggested. “How can F be a number?” was the instant reply.

I was surprised as this was a technically savvy user. So I tried to explain the rationale behind using ‘labels’ on a set of binary combinations and realised that I learnt hex as a Unix user as part of the package without really thinking too deeply.

It all stems from Binary, and I suggested that he think about the World cup, 1 winner, 2 finalists, 4 semi-finalists, 8 quarter-finalists, 16 round qualifiers, 32 top of pool teams. Each step is a doubling (or halving) of the teams. So in the same way we have in ’colums’ 1,2,4,8,16,32.

The real trick though is understanding that binary is not a left-to-right read. It is a right-to-left read so the world cup draws would actually be 32,16,8,4,2,1

If you want to express the world cup winner in a way that is simple, take the first ‘column’ and turn this from 0  to 1. As there are two finalists you make the first column 0 and the second 1 making a representation of 10. Third would be a 1 + 2 so that would represented as 11.

This continues and as you add more teams you may want to represent the whole 32 so you can position every team. Therfore to be fourth becomes 100 and so on. Twentieth is 16 + 4 so 10100. Thinking of it in that sense let him see that 16 isn’t actually a number, but a state, a ‘label’ for a binary code of 10000. It also helped him understand the funny numbers used, 512 1024 etc. in computing terms. It is a lot easier to put F on a keyboard input than 010000.

So as a Rugby Union fan I can at last say that football does indeed have some use!

Posted in IT | Tagged