david.segonds.org Chronicles of an Agile Software Development Manager

28Jan/100

A crash course in modern hardware

If you have not reviewed lately how modern CPUs operate and how they differs from CPUs that you grew up with, you may want to watch this video. It is quite long but certainly instructive.

You will learn about what impacts performance today and how Donald Knuth was right all along. :-)

"We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil" — Donald Knuth

27Nov/090

Programming Puzzle

Tonight, I found a programming puzzle while reading the blog "It's common sense, stupid". I solved the puzzle, but I don't know what to do next. Do you know what I am supposed to do once the puzzle is solved?

Here is the puzzle for your enjoyment:

                      ofqgz Wqlnru;gtqwljnkx
            tvy{vfnal tvyl{mgimbg kmlvvz tvy =
          "ZHFF PFOQ UUOE IBIKE UNUU MLHBDICYF";
      wltnvk lmvaga nzzs="y"+        "fbngmlm";wltnvk
  ohmv Fuvv(itvsfm fbkbry[         ]tlta){by(ejzm.Ymgzxz
==0)Fuvv(tkk,skam);meli            {ay(ueol[0]=="")kilnla
;qy(tvyl[1]=="")ueol[               1]=tvys;pnz tkkm=tlta[
   0][0];otv skat=65;qgm            ejzj=nzzn-ejza;  vvm
    tvylm=nzzl[1][0]-97;          mx(Vbnz.BlPwmnrz(tkkm
    ))tltx=(tkkh-tltal+26)    %26;Vsfliym.Pkmlx((wuik
        )(tvyi+ueoz));Feag(ueol[0].Lytlneqgz(1),
             ejzm[1].Fculxjbht(1));}}}}

The solution to the puzzle is the following C# program. The puzzle is a simple cryptogram where the jey is 'unittest'.

using System;
namespace arg
{
    class args
    {
        static string arg = "GNSX WMKY BABW PIESL AAMB THPIJVUFM";
        static string argz = "u" + "nittest";
        static void Main(params string[] args)
        {
            if (args.Length == 0) Main(arg, argz);
            else
            {
                if (args[0] == "") return;
                if (args[1] == "") args[1] = argz;
                var argu = args[0][0];
                var argg = 65;
                int argp = argu - argg;
                int argss = args[1][0] - 97;
                if (Char.IsLetter(argu)) argp = (argp - argss + 26) % 26;
                Console.Write((char)(argp + argg));
                Main(args[0].Substring(1),args[1].Substring(1));
            }
        }
    }
}

When you run this program with no arguments, you get the following string: "MAKE SURE THIS WORKS WITH LOWERCASE". Ironically, the program does not process strings contains lowercase.

I used cryptanalysis and a bit of python script to solve the puzzle. This was entertaining.

29Sep/080

Stack Overflow


StackOverflow Home Page

If you have not seen StackOverflow, I encourage you to get familiar with it right away. It is a great resource for software developers among us. The site went in public beta two weeks ago and it is basically an hybrid between a wiki, a blog, digg, and a forum specifically dedicated to answer programming questions.

It is self-moderated and it works. Questions are answered in a matter of minutes and noise is quickly eliminated. It is fun to try to answer questions and it is certainly an humbling experience as many out there are much more savvy than I am.