Female body builder picture galore

February 12, 2009
1 comment

Female body builder picture galore If you, like me, is equally fascinated by female body builders this is a great page. It's quite incredible. I'm sure there's a large community of those who do it (men and women) and there's probably men out there who actually like this. I wish Michael Moore would do his next documentary on this instead.

The Albion, Shoreditch

February 4, 2009
1 comment Web development

The Albion, Shoreditch There's a new restaurant on my street called The Albion. I went there for lunch today and had the steak and kidney pie with bread. It's a proper restaurant so including tip it came to £11 with tap water. Not cheap but the service was good and the food was really great. They've got a great delicatessen section with the usual tins of overly prices Italian olives and organic vegetables and yummy desserts.

Now, this blog is not a restaurant review blog but rather a (web) technical one. What strikes me is that these guys don't have a website! How can you not have that these days? Or perhaps they do but I just can't find it anywhere on Google. There's a Albion London advertising agency a stone throw from the restaurant and there's a The Albion in Islington but no Albion restaurant in Shoreditch London on Google.

If you're going to spend thousands of pounds on a nice chairs and lamps, like this restaurant clearly has done, then why not spend a couple of pennies on SEO and getting a decent website. Granted, it's a new restaurant but it only takes Google a couple of weeks to review its indexes. Come on my-new-favorite-restaurant-around-the-corner!

Acupuncture works for headaches

January 22, 2009
0 comments Misc. links

Acupuncture works for headaches But so does poking needles in at random places. Basically, this article talks of a study that proved that acupuncture does work to treat headaches.

"The Cochrane reviews involved a total of 6,736 patients, who were given acupuncture to prevent either mild to moderate "tension" headaches, or migraine attacks.

Following a course of at least eight weeks, acupuncture patients suffered fewer headaches than those given only painkillers."

That's interesting. So it is better than painkillers. But like my colleague Shane said "I bet it's because it's so relaxing to take a break and sit down and get the treatment unlike painkillers where you don't stop". The report continues

"The scientist leading the review said the results showed that putting needles into particular locations might not be that important."

If you're wondering. I take neither painkillers or acupuncture and I personally think both western and eastern medicine has merits.

Nasty surprise of Django and gettext

January 18, 2009
3 comments Django

I've done a site that is initially only going to be in Swedish. So I set the LANGUAGE_CODE like this:


# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'sv-SE'

I then go ahead and mark my templates and code and run django-admin.py makemessages -l sv-SE. Then I fire up Poedit to translate the .po file and then compile to make the .mo file, so now I had a file called <my project>/locale/sv-SE/LC_MESSAGES/django.mo but it just wouldn't work!! I tried debugging django.utils.translation with little success. Eventually through trial-and-error I found that if I change it to "sv" instead of "sv-SE" it works.

Is this a problem with gettext or a problem somewhere in Django? It might cause equally much headache for other developers so I wouldn't mind that we get to the bottom of this.

Formatting numeric amounts in Javascript

January 16, 2009
1 comment JavaScript

Dear Lazyweb,

Is there a better method than this to format numeric amounts? Here's a solution I picked up from somewhere and slightly modified. It's heavily string based but passed the tests:


function format_amount(i) {
  if(isNaN(i)) { i = 0.00; }
  var minus = '';
  if(i < 0) { minus = '-'; }
  i = Math.abs(i);
  i = parseInt((i + .005) * 100);
  i = i / 100;
  s = new String(i);
  if(s.indexOf('.') < 0) { s += '.00'; }
  if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
  s = minus + s;
  return s;
}

The "tests" are:


format_amount(100)       == "100.00";
format_amount(100.0)     == "100.00";
format_amount(100.05)    == "100.05";
format_amount(100.051)   == "100.05";
format_amount(-100)      == "-100.00";
format_amount(-100.0)    == "-100.00";
format_amount(-123.45)   == "-123.45";
format_amount(-123.450)  == "-123.45";

So functionally it's OK but I'm not sure it's the best way to do it.

Hellsongs

January 14, 2009
2 comments Music

Hellsongs Swedish band that plays classic heavy metal songs slower and acoustic. It wasn't until I listened to their songs that I actually stopped to think about the lyrics in some of the classics I thought I knew the lyrics to already but found out I didn't. It makes for a very cute blend that is irresistible. It's kind of like watching a hot girl changing the oil on a truck.

Their latest album has an equally "cute and catchy" title: Hymns in the key of 666

For Spotify users here's Paranoid on the album Lounge