Archive for December, 2009

Award for the most gratuitous use of the word “QAbstractItemModel” in a serious presentation

December 23, 2009

It seems I’m one of the recipients of the first annual NQDF award for outstanding achievement in the field of excellence. It seems the phone will be delivered in a few weeks, but they haven’t yet revealed when the big award ceremony is, or when I will get money, power, fame and influence as a result. I’ll be patient, but until then, thanks for the phone!

The schedule for CampKDE was published last week. I’ll be giving a talk on the challenges the Akonadi team faced in using the Qt Model View framework to implement the posted KDE PIM applications and how it results in reusable components and allows a lot of scope for innovation. I have been blogging on the subject for some time now, but there will be a lot of new content in the presentation that I haven’t covered here yet which is relevant to all users of Qt Model/View – not just Akonadi and not just KDE. Registration is still open if you want to come to attend.

By the way, I didn’t know this until just now. Very funny.

Advertisements

Community, Identity, Stability

December 13, 2009

The second beta release of KDE Software Compilation 4.4 is coming up in about a week and a half. It’s a long name for a release, but it carries with it additional meanings and allows emphasis in important areas which were not as strongly emphasized before.

KDE is a community, not a software release. Not a desktop environment.

KDE is a brand, part of an Identity. Something to be proud of.

This communications shift also marks a shift in the maturity and stability of the 4.x series of the KDE Software Compilation.

The thing is, ending is better than mending sometimes. People holding put for a return to the days of KDE 3.5 can take note that the time is once again coming to try out the 4 series. History is bunk and, well, progress is lovely isn’t it? Everyone’s happier nowadays. We haven’t any use for old things here. Particularly if they’re beautiful. Beauty is attractive and we don’t want people to be attracted by old things. We want them to like the new ones.

The upcoming 4.4 features subtle animations and visual feedback which is wonderfully pneumatic, a host of new features (I do love new features), elaborate games and more to help increase consumption through your computer.

The wheels of KDE must turn steadily, but cannot turn untended. There must be people to tend them, people as steady as the wheels themselves to help test new releases, and ensure that all is going well. The whole 900 meters (or more?) or more of conditioning the new release. It’s great being a Beta tester. You get to wear blue t-shirts as a real contributor, a real part of KDE. Happy and good.

You get to try out all the latest features and toys in the upcoming release. Never put off til tomorrow the fun you can have today. Nothing can be achieved without perseverance, and help is always welcome to achieve the best and a Fordly level of quality with the new release.

(As some of you can no doubt guess, I finished my book today, so I thought I’d action Stuarts suggestion. This has nothing to do with official KDE communications 🙂 )

Shall we play a game?

December 7, 2009

My solution to yesterdays tic tac toe problem is here.

The trick is explained in the comment at the top, but essentially I am storing the positions of markers for ‘X’ and ‘O’ only from the first 8 positions in the grid so that it takes up only 8 bits for each player. The state of the 9th box in the game is discovered by using a population count on both players game states and determining which if any is missing a mark. This requires the extra information of which player was last to make a move. You could call that cheating, but it does work, and the simulation is there to prove it.

The simulation runs 1 million games of tic tac toe in 14.905 seconds on my laptop. Not bad really. It’s good to get into the spirit of optimization now that we’re in bug fixing mode for 4.4. There’s lots of good tips in Jon Bentley’s Programming Pearls. I highly recommend it to anyone interested in this stuff.

As an exercise for the reader, modify the example to pick the best available position each time instead of a random box to place a mark.

Anyway, onto my next project, Global Thermonuclear War…

Tip top tic tac toe task

December 6, 2009

Yesterday I got linked to an article with interview questions for engineers and problem solvers at google including this one about tic-tac-toe.

The problem is to write a function which takes as arguments a Game of tic-tac-toe and a player, and returns whether the player has won the game. As an extension I wanted to do it in the most efficient way I could.

My first thought on reading it was that an sequence of bits could be used to store the state of the game for each player. Then the is_winner(Game, player) function would only have to test the bits for that player to see if the Xs or Os are in the right place to declare a win. As that would mean nine bits for each player, you would either need two 8 bit words each, or one each with a third shared between them to represent the extra bit.

Eventually I managed to squeeze the game into two 8-bit words which contain the state of play, but before I post and describe mine, I’ll give others the opportunity to do the same. To prevent cheating and so you know I didn’t steal your idea, make sure to save this somewhere I can’t tamper with it:


$ sha1sum tic_tac_toe.cpp
70ef68844d3173dd4363ff544e24aa57c28a7b52 tic_tac_toe.cpp

Akonadi porting explained

December 3, 2009

KDEPIM oldspeak doubleplusungood. Unbellyfeel Ingo.
Akonadi correctful newspeak.
Crimespeak is slavery.
MINIPIM make rectify fullwise.
Duckspeak Till.
Party members make KDEPIM unwith oldspeak.
Remake fullwise with newspeak.
Party members fulluse Akonadi. Newmake plenty KDEPIM.
Unapplication knotes.
Goodthinkers speakwrite kde prolefeed.
Goodmake prolethinkers newspeak pluswise.
Good prolethinker comrades make inner party members.
Newspeak centerward make easy newapplications.
Telescreen #akonadi wisewatch. Speakwrite helpful party members.