Microsoft Gold Certification means nothing…

Many years ago I worked for a company who was a Microsoft certified partner. This was a long long time ago and I must admit that back then I was quite impressed by the fact that they were Microsoft certified partners… until I started working there. Redmond hands out certifications like a crack whore hands out cheap tricks — indiscriminately and to anyone who’s willing to pay fifty bucks.

Needless to say, this morning I was reading my gmail when I saw an ad for a “Microsoft GOLD Certified Development Partner based in Cape Town” and being the sado-masochist I am I clicked on the link… it was one of those /showpage.aspx?page_id=36 sort of sites. Ugly, but not necessarily dodgy. I put an apostrophe in the page id to see if they were cleaning their inputs and behold:

Line 166: Octigon.Octane8.Containers.Page tempPage = this._page;
Line 167:
Line 168: while (tempPage.Id != 1)
Line 169: {
Line 170: if (tempPage.Parent.Id == 1)

This shows that the site is vulnerable to sql injection… which, while not necessarily implying that the site can be hacked, does imply that, given enough time, you probably could hack it or at least cause some damage. The page also pukes out all kinds of file paths and stuff that would be useful if you were trying to do them harm.

The point here is this. Why is a web development company who are obviously bad web developers Microsoft Gold Certified?

The answer can only be that Gold Certification means absolutely nothing.

L10n, gettext, php5 and Afrikaans

I’ve been playing with the concept of creating a multilingual site and after polling the experts I started toying with php’s implementation of gettext. What a ball-ache.

Ok, so some things you need to know before we start.

  • L10n stands for Localisation or Localization… the abbreviation is therefore obvious due to the words length and different spellings.
  • gettext is a GNU standard. I shouldn’t need to explain why standards are cool, but needless to say, there are plenty of tools to make using gettext a lot easier than a “roll-your-own” solution.
  • The PHP implementation of gettext is good when it’s working. But when it’s not working it’s like a scorned girlfriend — it will *not* tell you what is wrong. You have to figure it out yourself.
  • Your solution might not be *exactly* the same as mine because gettext relies on system locales, which in turn are structured differently on pretty much every linux distribution… having said that I’m sure the stuff you’ll read here will get you going.

Firstly, why gettext? Besides the fact that it’s a standard, gettext is good because:

  • gettext’s database files (.mo) are indexed and compiled.
  • PHP’s implementation is written in C or C++ by programmers who are probably better than you and I at writing efficient searches.
  • The gettext domain (your strings) are cached by the implementation so it really is quite fast.

Ok, so let me run through quickly how it’s meant to work, starting with some code

<?
setlocale(LC_ALL, 'af_ZA');
bindtextdomain('messages', '/var/www/myapp/locale');
textdomain('messages');
echo gettext("Hello World!");
?>

Line for line:

  • setlocale tells php which locale to use; in this example I’m using af_ZA (Afrikaans)
  • bindtextdomain tells php which domain to look for and where your gettext locale folders are. A “domain” is really just a collection. In this case we’re arbitrarily calling it “messages”.
  • textdomain is telling php which domain to use from now on. (seems redundant I know but I assume you might be able to bind multiple text domains)
  • gettext will look to see if it can find a translation for the locale you set earlier (af_ZA) for this index. gettext’s index is the original string in the original language. In this case we originally used the phrase “Hello World!”. If the locale can’t be found or there isn’t a translation for this index in the locale, gettext will return the original language — in this case “Hello World!”.
  • What is really important to note at this point is that there are a million or so variations of this code on the Internet. This is the stripped down version that works fine under PHP5 and Apache2.

Next we have to create our locale directory structure. This is what it looks like:

/locale
    /af_ZA
        /LC_MESSAGES
            messages.po (You'll create these later)
            messages.mo (You'll create these later)

Obviously you would create one per language you are wanting to support. I therefore have one for en_ZA and one for af_ZA.

Next we need to create our .po file. The .po file is the unindexed, uncompiled “language” file. Basically it has human readable plaintext in it. If you had a hoard of translators working for you you would send them your .po file/s, which they would add their translations to and then send back.

The important stuff in a .po file is:

msgid "Hello World!"
msgstr ""

Now, the cool thing about using gettext is that there are tools to generate a messages.po file from .php files automatically. The following command will scan all php files looking for references to gettext and will generate messages.po file for you.

xgettext -n *.php

The next step is to copy your messages.po file into your LC_MESSAGES folders. Once you’ve copied them you can make the change to the af_ZA one.

msgid "Hello World!"
msgstr "Hello Wêreld!"

Next you need to compile both your messages.po files by running the following command in the respective directories. This command will output a binary, indexed messages.mo file.

msgfmt messages.po

Once you’ve done that you should be able to rerun your code and it should give you the afrikaans version… although it won’t because here’s what you don’t get told. gettext will only work for locales it recognises, and even though you selected South Africa when you installed your ubuntu, it still doesn’t know what Afrikaans is. Enter the myriad of confusion solved, as usual, by one simple command.

locale-gen af_ZA

This will, if you’re on a newish debian-ish box, enable the af_ZA locale and then, after restarting Apache (remember it caches), your app should be speaking Afrikaans fluently.

Things that make me smile…

Ever have one of those weeks when you just can’t stop smiling because the world is just being so damn inspirational?

Ok, so here’s my list of things I am currently happy about:

minicards.jpg1. My Moo Cards arrived: You have no idea how friggen happy I am with them. Moo is an inspirational company and yes, I would even consider living in London to be able to work there and learn from the Moo’inistas. Since everyone wanted to know, they cost $19.99 (R145) for 100 cards. Next time you see me ask for a moo card. I’ve even made my first Moo friend.

2. Civil Twilight made my day: So a couple of days ago I got a message on facebook to say that there was a CD waiting for me in Hout Bay… Apparently I was on the “list” of complementary CDs… getting a free CD is much more of a big deal when there are probably only a few in the country at the moment. Thanks boys. Much Appreciated! The album is awesome, my only fear is that I might wear out the CD. Check out their other video.

Civil Twilight Press Pics3. Mix two of my favourite things…: If I was into American football I could have called this one “mix three of my favourite things” because one of Civil Twilight’s songs, ‘Human’ will be featured on this Sunday’s special Superbowl episode of ‘House’ guest starring Academy Award winning actress Mira Sorvino. House is one of my favourites… so is Civil Twilight. Mira is ok. 😉

4. An awesome GeekDinner: The 6th GeekDinner took place in the cosy Sloppy Sams. I was MC for the evening and really enjoyed it. About 70 of us crammed into the tiny little restaurant and had an absolute blast. Thanks to everyone who helped out.

5. Friends: I guess it goes without saying that friends are important, but recently I’ve been finding my friends to be more than just important, they’ve been critical. Sometimes your friends can give you the kick in the bum you need to get your ducks in a row… Other times they just need to be there to make you laugh. Some friends are their to guide you, others to chide you and still others just to make you feel good about yourself. Tonight I’m going to see kitty! My long lost kitty from London!… Super stoked.

6. Synchronicity: A while back I was looking for a maid/domestic worker/housekeeper whatever you want to call them. I asked around the apartment building I live in and someone suggested an awesome woman called Nokulunga who’s been my angel for the past few months. I can’t tell you what a pleasure it is to come home to a clean apartment every friday. Anyways, the reason I’m mentioning this is because she’s looking for somewhere to work on mondays. She comes highly recommended.

7. Last but not least: As some of you may know, I’ve been seeing someone recently. Anything I say here will be dripping with cheese and I’d rather not put you all through that. Maybe I’ll just say yay!

2 weeks of search terms

I finally did something that I really should have done a long long time ago. I installed Google Analytics on my personal blog. This is just short of 2 weeks worth of data.

A few things that suprised me.

  1. I didn’t expect to be getting this much search engine traffic
  2. I am suprised how many people search for things Computer Mania, Computicket and Nonna Lina and end up reading my blog. If you take Computer Mania as an example, every day almost 2 people search for “Computer Mania”, no doubt looking for a phone number etc, and end up reading my rant about their crappy service.
  3. I come up for some pretty weird search terms like “what to do when your computer takes a crap“. My answer to that is simple. Install an operating system that doesn’t poo on itself. My suggestion is Linux.
  4. I get some “interesting” traffic ending up at my penis enlargement email spam collection. Most of it has to do with either fetishes or worried men looking for answers to the “does size matter” question. Perhaps I’ll update that page with the search terms… I’ll keep this post clean.
  5. Did Alan Levin break his ankle?

The Results:

Computer Mania Related 26
Computicket Related 18
Alix Linux Related 10
Penis Size Related: 8
Ubuntu Gutsy Related 7
nonna lina 6
arbitrary user 5
cna.co.za related: 4
civil twilight human 2
krugmans grill 2
two faced bitch 2
aslam khan 1
neil garb 1
never had a bad day 1
pascal dornier 1
skye aspden 1
adsl provider for george frogfoot 1
alan levin breaks ankle 1
alcohol promotion girls 1
amphibian 1
animated picture of a boerewors roll 1
arbitrary 1
arbitrary meaning 1
average restaurant mark up 1
bad come in threes 1
bad luck 1
buy computer 1
buying a laptop computer 1
chilli chocolate steak 1
codecaine.co.za 1
cold calling free wine give me home address 1
computer resell 1
disturbing the peace 1
first aid mr muscle 1
food guru 1
funny picture of bush running in special olympics 1
futureshop reginal manager + complaints 1
ideas of setting up a new restaurant 1
mame arcade cabinet +south africa 1
mattress for exercise condense density 1
new ideas to do a restaurant 1
ok,please give me ideas to make money 1
pascal dornier 1
pictures inside the womb 1
pictures of physically retarded children 1
redhill simonstown 1
restaurant it system domain class ideas 1
restaurant review 1
restaurant review jobs 1
restaurant reviews 1
sharpeville massacre 1
shit 1
shit can this computer 1
shit to do on computer 1
user reviews 1
vodashop hout bay close times 1
vpxl 1
what is computing so shit 1
what to do when your computer takes a crap 1
where does luck come from 1
restaurant review costs 0

The positive power of a brand and a strong community

About 5 days ago we officially announced the upcoming GeekDinner… We’d left things a bit last minute because of everyone getting back to work late in Jan etc.

Anyways, cut to the chase, its been 5 days and we already have our quota of 70+ people on the wiki. As usual we had our original stalwarts; the addicts who added themselves 2 months ago when the new dinner’s page was created (before we had a date or venue), but we’ve picked up about 40 people in 4 days. (Not counting the maybes)

Capetonians are crap at arriving at things they say they’ll go to so we have quite a high last minute drop out rate; sometimes as high as 20% against the number on the wiki. It’s fine because that allows us to go over the venues allotted 70 seats. We’re currently on 72 “confirmed” with 13 “maybes”. I think we can safely let the “confirmed” number get to about 90 before we create a “waiting list”. ie. If you haven’t already done so, go sign up now.

Anyway, the point I’m trying to make is that we have a brand and a community that’s growing and making it easier and easier for us to put these things together. We’re always looking for people to lurk/participate on the planning mailing list, so if you feel like lurking, and perhaps maybe helping with some stuff, join the list.

Frugal Fennel

GeekDinner Time.

Ok, so if you’ve never been to a GeekDinner, why not make 2008 the year when you start going. It’s hugely fun and can possibly maybe be a little bit educational… Did I mention that at the last GeekDinner we discussed what to do if the Queen of England happens to start flirting with you on Facebook?

31 January 2008, Sloppy Sams, 51a Somerset Road, Greenpoint. 19:00ish

It’s open to everyone, all ages, all genders and all levels of technical innefficiency.

As usual, sign up on the wiki.

The Cathedral and the Bazaar

Below is the opening chapter from the Cathedral and the Bazaar, an excellent book written by Eric S. Raymond in 1996. It attempts to explain how it is that thousands of people from all over the world can work on something as incredibly complex as an operating system kernel and end up with an excellent result. I read it many years ago and ran across it again today. Rereading the opening chapter encouraged me to read the entire book again. Note to those non-technical people reading this: CatB is not a technical book and is an incredibly interesting read for anyone interested in human psychology.

Linux is subversive. Who would have thought even five years ago (1991) that a world-class operating system could coalesce as if by magic out of part-time hacking by several thousand developers scattered all over the planet, connected only by the tenuous strands of the Internet?
Continue reading “The Cathedral and the Bazaar”

cna.co.za fixes themselves…

A while ago I was moaning about how CNA’s website didn’t want to let me on with my never-before-heard-of-crazy-combo of Ubuntu and Firefox… It seems they’ve fixed that problem which probably also fixed the “telling Google to go away” problem.

http://www.cna.co.za and http://www.google.co.za/search?q=cna.co.za

I wonder if that had anything to do with me? They never said anything. Probably because I’m such a big bully.

ath.