Happy birthday fon, and thanks for the free routers

Fon was one year old on Monday 5th of February, and now to celebrate they are giving away 10,000 free fonera routers. Once these have all gone, that will bring the total number of fon users around the world to over 80,000. An impressive feat for such a youngster.

So if you haven’t already, go get your free fon router!

Fon x (Skype + BT) = Bye Bye Vodafone?

Although Vodafone & co are still just about managing to add subscribers and revenue, the pace of growth in saturated markets such as the UK has slowed down to a mere trickle.

But what intrigues me the most is how the playing field will shape out over the next few years as innovative players in the wifi arena such as Fon, start to build a real free alternative to GSM and 3G networks for voice and data traffic.

Don’t get me wrong, I know it’s a big challenge, but if the rumours are true, and BT do get in bed with Fon, then in theory at least they could roll out a huge number of new fon hotspots (with over 3 million retail broadband customers).

In some respects, BT will be shooting themselves in the foot, as with all those fon hotspots about, why use BT’s fusion mobile when you could be using a skype wifi phone? Well the main problem for an all-skype solution is that you always need to be in range of a hotspot.

So where I think BT could be on to a winner is if they launch a hybrid fusion / skype phone that automatically switch between wifi and GSM networks for the skype and fusion accounts, effectively giving users both a skype and mobile number to be called on. If a potential caller is at their PC, or on another skype phone then they choose to route the call via skype, if not then they can fall back to the PSTN routed mobile number.

Of course BT will lose out on call revenue every time someone chooses to use skype over the PSTN, but BT should accept the fact that voice calls will eventually be free (ahead of their rivals) and just charge a flat rate for the convience of using skype on their hybrid network. Extra revenues could come through a tie up with Google to offer relevant geo located ads.

Whatever happens, the next few years will suck if you are a mobile operator who relies too heavily on voice revenues.

PHP function to convert from kilobytes to bytes

I was looking round the web this afternoon to see if I could find a function to convert from megabytes, kilobytes etc.. to bytes but all I could find were functions to go the other way. So I have written one, and I thought it might help a few people if I shared it on here:


function convert_to_bytes ($string) {
 if (preg_match('/([0-9\.]+) ?([a-z]*)/i', $string, $matches)) {
  $number = $matches[1];
  $suffix = $matches[2];
  $suffixes = array(""=> 0, "Bytes"=>0, "KB"=>1, "MB"=>2, "GB"=>3, "TB"=>4, "PB"=>5);
  if (isset($suffixes[$suffix])){
   $bytes = round($number * pow(1024, $suffixes[$suffix]));
   return $bytes;
  } else {
   return false;
  }
 } else {
  return false;
 }
}

// Convert 25.43 MB => 26665288 bytes 
echo convert_to_bytes ("25.43 MB");

Where to pre-order my Wii?

OK I admit it. I really want a Wii. I have always been a Nintendo fan since the SNES went head to head with the MegaDrive and ultimately won (look who’s still making consoles!), but never before have I anticipated the launch of a new console so eagerly.

So I am going to pre order one, thus hopefully propelling me into the league of elite Nintendo fan boys who will be playing on their Wii on December 8th. The question is, where to get it? Well today apparently, Amazon UK sold out of their pre-order allocation within 5 minutes of it going online. I had also tried play.com’s preorder list a few weeks ago, but they wrote to me saying there was no chance they could honour the order with such a small allocation.

However, I have now heard a rumor that Argos has loads of them. Wish me luck.

Photo of the new Nintendo Wii Console - available in the UK 8th Dec.

Cron not running straight after reload

I just noticed that if you update a cron job, and then set it to run in the next minute, it won’t work. Basically if a cron file has been updated, then the crond will reload it when it runs on the minute. The problem is that it reloads the file before it can see the new changes, and by the time the reload has finished, it is no longer on the minute and so the command won’t run. Anyway, to cut a long story short, if you are having problems with a cron command not running on the next minute after an update, then try setting 2 minutes ahead instead of one!

How to stop junk (snail) mail

If you are concerned at the level of junk mail you receive through your door that goes straight into the bin (and at the number of trees who lose their lives in the process), then you can opt-out of anonymous mail by contacting Royal Mail, and general junk mail by contacting the Mail Preference Service.
Unaddressed mail

Opt-Outs, 
Royal Mail, 
Kingsmead House, 
Oxpens Road, 
Oxford, 
OX1 1RX

Addressed mail

Mail Preference Service (MPS), 
Freepost 29, 
LON 20771, 
London, 
W1E 0ZT or call 0845 703 4599

SHOW GRANTS for all users on MySQL

Although there isn’t yet a command (that I am aware of) to show all user GRANTS in MySQL, you can write a quick bash script to do the job if you have shell access:

#!/bin/bash
tmp=/tmp/showgrant$$
mysql --batch --skip-column-names -e "SELECT user, host FROM user" mysql > $tmp
cat $tmp | while read user host
do
echo "# $user @ $host"
mysql --batch --skip-column-names -e"SHOW GRANTS FOR '$user'@'$host'"
done
rm $tmp

Job Centre Plus in a nice format

As an employer, I have found the UK’s national Job Centre to be totally underated. It offers a fantastic service that is completely free for employers to list on, but unfortunately there is a stigma attached to the job centre; that it is was once known as the Dole Office and it has since struggled to shed this image.

Despite this, we have successfully recruited many talented web developers from the Job Centre, and so I’m proud to say that our new site is embracing the Job Centre’s content and making it searchable and browseable in a Web 2.0 format. Hopefully this may help to encourage more high-tech and skilled professional employers to list on the site.

Fixing MySQL Replication with duplicate key error

Today our MySQL Master tracking db went down (due to host server crashing) which consequently screwed up the slave. Here are the steps I took to fix it.
Firstly, check the slave status with:

 show slave status\G;

If the slave is reporting something like ”Last_Error: Error Duplicate entry replication”, this can be fixed by the following:

 stop slave;
 set global sql_slave_skip_counter=1;
 start slave;
 show slave status\G;

It will take some time after issuing those commands for the slave to rebuild itself from the master, but you can check the progress by querying the db to see what record we are up to, for example:

 connect trackdb;
 SELECT * FROM `track` WHERE 1 ORDER BY id DESC LIMIT 10;