Archive for Dojo

London Python Dojo: does it have a keyboard?

Those of you who don’t frequent the London Python Dojo wouldn’t appreciate the in-joke behind the laughter which greeted the selection of “20 Questions” as the challenge for last night’s Dojo. For months Nicholas Tollervey, the main Dojo organiser, has seeded the list of Dojo suggestions with the idea of implementing a simple expert system where the computer maintains a taxonomy of objects and tries to identify an object of your selection within 20 guesses by a process of elimination. It’s become a source of humour that Nicholas has to offer the same explanation every month and that the idea is never selected as the challenge du jour. Well last night it was.

And I admit that it was much more involved than I had thought it would be. I honestly thought we’d be done in 10 minutes and looking for ways to fancy up the interface or whatever. How wrong I was! The teams split between a tree-based structure with nodes holding questions & answers and yes/no pointers; and a matrix of questions which attempted to eliminate possible objects with each question. Getting the exact looping and yes/no pointing right is harder than you might expect, especially when you’re pressed for time and you have a team of five people to consider.

We were hosted, not for the first time, by Mind Candy (of Moshi Monsters fame) in their gorgeously child-friendly offices with Mind Candy local Al Broomhead as MC. And, as always, O’Reilly provided a book for the end-of-evening raffle. I’m consistently impressed by O’Reilly’s readiness to support us: I imagine it doesn’t cost them loads to give away a book a month, but they could so easily turn us down and they continue to provide, month after month.

There have been discussions, on-list and in private, about various aspects of the London Python Dojo and the organisers have various ideas in mind, but we’re not planning to do anything drastic to the current approach. (Although our setup means we can easily experiment with something if we want). Our main idea is to emphasise our status as a beginner-friendly forum where everyone can and should get a chance to code in Python even if they’re a newbie amongst experts. I’m glad to say that, in our team yesterday, everyone got a chance to code, however lightly.

Beforehand, @ntoll gave a talk about the upcoming PyConUK and particularly about the education track, encouraging people who know or are teachers and who know or are children to come along to these special aspects of the conference. I also gave a lightning talk about the socio-political challenges in Python core development — and about how people could and should contribute.

[The title of this post refers to a commonly-asked question shouted out from the audience as the various teams were demo-ing their approaches. Demonstrating necessarily involves going through as a series of “Is it …?” “What question could I ask…?” prompts and this one turned out to be a popular question, especially if the object in mind was a Robotic Catfish!]

Python meets BoA

[tl;dr photos here]

Last night’s London Python Dojo was held, for the first time, at the very spacious Canary Wharf offices of the Bank of America. They’re big users of Python and, as we were told in an brief introductory, were keen to give something back to the Community.

They certainly did it in style. Their main reception is about the same size as Ealing Common. The meet-and-greet bar area where we had Pizza on classy platters & Beer served by bar staff is not much smaller than the whole of the offices of Fry IT, our long-standing default hosts. And the area below where a few of us gathered feels like a swimming pool with a long slide-like flight of stairs leading down. The function room where the main business of the evening was transacted was spacious with large tables (and *lots* of pencils!).

The guys at BoA had really done their prep work: power strips were already in place and every possible laptop-to-screen adapter was available. (For those who haven’t done this kind of thing: there’s *always* some kind of mismatch between a screen which can only take DVI-I and a Mac user who doesn’t have the Mini-HDMI-to-DisplayPort adapter. Or whatever: I use Windows which never has these problems ;) ).

As well as the friendly intro from one of the BoA guys, we had an enthusiastic lightning talk on Bitcoin from Sam Phippen (who comes in from Winchester or Bristol for the Dojos!). With over 30 people present, we had about 15 suggestions for the evening’s challenge, including old favourites (How does 20 Questions work, Nicholas?) and new ideas, some around the theme of banking. After the usual two rounds we settled on Steganography and made use of the generous table space (and pencils) which our hosts had provided.

The results are on Github (or will be, depending on when you’re reading this) as pull requests come in and are honoured. In short, two (three?) teams went for piggybacking on image bits; two teams (including the one I was with) encoded bits in the extraneous whitespace of a text document; and the last team tried to use the Python’s indentation to carry information in some way which I couldn’t quite understand at the time. I think that every team bar the Python-indentation one had a working result[*]; ours even had unittests!

FWIW my first idea for our team was to encode the characters in Morse code (using spaces & tabs as dots & dashes). We finally settled on binary but I still think Morse would have been cooler — and we could have played the message out as a midi file for extra points!

Of course at the end we had a draw for O’Reilly’s usual generous contribution to proceedings along with an added bonus: an historical map of programming languages. Appropriately enough, the book was won by Sal who’d been the driving force behind Bank of America hosting the Dojo this month.

Next month we’ll probably delay by a week to come in after Europython. Not sure where we’ll be yet, but follow @ldnpydojo or look out on python-uk.

And, of course, big thanks to Bank of America for being our hosts this time round.

TJG

[*] And they may have got things working after a live “Aha!” moment by Al who was demo-ing. [UPDATE: Al was actually in another team per his comment below; so many teams, so short a memory span…]

Yesterday’s London Python Dojo

Yesterday was the March Python Dojo, hosted as usual by the ever-generous Fry-IT, with a book donated by O’Reilly. We started with a couple of not-so lightning talks from Tom Viner — talking about his team’s solution for last month’s puzzle — and Nicholas Tollervey — talking about bittorrent. An artfully-worded late question had @ntoll on his soapbox for a while on the subject of copyright and payment to artists, until someone spoiled it by suggesting that maybe we ought to write some code in Python!

After the usual, only slightly convoluted, voting experience, we decided to pick up one of last month’s runner-up challenges: creating a compression-decompression algorithm. Naturally most people started from some kind of frequency table, replacing the most common items with the smallest replacement. The approaches ranged from a hybrid Huffman-UTF8 encoding to an attempt to replace common words by a $n placeholder, where the n would increase as the word became less common. The winner for the most optimistic approach was a lossy algorithm which dropped every other word on compression, replacing it on decompression by the most likely from a lookup table. Tested against a corpus of Shakespeare’s works it produced some quite readable poetry.

As an aside, I can assert after a wide-ranging survey that (a) the preferred editor background is dark (black or dark-grey); and (b) in spite of all the tech at their fingertips, programmers still reach for pen and paper when they need to work something out!

We survived! A London Python Dojo without @ntoll

[Note to self: blog about things other than the London Dojo…]

Nicholas “@ntoll” Tollervey has been the London Python Dojo’s parent for all its young life. Once it achieved toddler status, he felt confident enough to start letting other people look after his baby, so over the past few Dojos various other people have run things on the day, always with @ntoll in attendance. Yesterday was the first day on which he felt confident enough not to be there, leaving things in the hands of @tomviner (who could be seen consulting a trusty checklist throughout the evening).

As I re-read, I realise that it looks as though I’m accusing @ntoll of being over-possessive, which I most definitely am not. He’s done — and continues to do — a fantastic job at organising the Dojo and making it happen even when he’s not the evening’s MC. We’re just delighted, as Tom said last night, that he doesn’t feel that he needs to attend it every first Thursday for the rest of his life. (A little secret: the day before this month’s Dojo he was still sending mother-like emails to the rest of the organisers: don’t forget to … remember that … have you …?)

Last night’s Dojo was fun as usual: we were doing the famous Game of Life — probably a text book example of a text book example! Uniquely in my experience, every team had a working version to show after just an hour and a half. The team I was in managed to get something working while @john_chandler and I were still chatting in the background. We fiddled about with it a bit, adding a few preset forms to seed the board etc.

An unexpected visitor was @JohnPinner (of PyConUK fame). He was in London for a meeting and timed things so he could come along for the start of the Dojo, altho’ he had to dash after about an hour to catch his train home. He gave a lightning talk at the beginning outlining various Python-related conferences and training sessions which in the offing. Including this year’s PyConUK, once again in Coventry.

@tomviner’s novelty for this Dojo was the favourite-module question on the sign-up form, which was also used as part of the introduction session. Perhaps unsurprisingly, Kenneth Reitz’s requests module was the clear winner (the only one with more than one vote!). Other unsurprising entries included itertools and collections, but there was a variety of others. I was chatting with John Pinner about the line-up for PyConUK this year, and he pointed out that there’s some mileage for simple talks about a particular module, eg logging or itertools. I’m thinking of proposing such a thing for future Dojos…

There’s also been talk on the python-uk mailing list of a second London-based Dojo, or other Python event, on a Sunday. That might suit some people who can’t make a weekday evening in London but who could manage a weekend. And the more Python events in London the better!

Boggle at the London Python Dojo

(Yes, that is a deliberately ambiguous title offering two possible interpretations: as a description of what the programming challenge was at last night’s Dojo; or as an imperative to be awed at the might and wonder that is the London Python Dojo. You choose).

Last night was the first time I’ve actually run the London Dojo. For the two and more years since its inception, Nicholas Tollervey (@ntoll to his Twitter friends & acquaintances) has indefatigably turned up every first Thursday to clear up the Fry-IT offices, order the pizza, buy the beer, put up signs, leave out sticky labels, request free books from O’Reilly and then drum up support, keep everyone happy and actually run the show, finishing off by organising everyone to clear up, move chairs, dump the rubbish outside, and finally catch the last train home to Sticksville, Northants. where his wife and children have long ago fallen asleep over their sheet music, having gone da Capo al Segno one time too many waiting for him to return home.

A few months ago, Nicholas asked for volunteers to help out, and a small group of us got together to share the burden. Since then, Bruce, Jonathan, Tom and finally I have taken a turn at organising. And of course it’s not until you have to do it yourself that you realise how much work is involved… I was fortunate because Gautier (who actually works there) and Nicholas himself were both at Fry-IT for the day and were able to do some of the less proximate preparation, including ordering a dozen pizzas and buying three dozen bottles of beer. I was able to make a small contribution in the shape of a pack of sticky labels.

The Dojo itself was very slightly quieter than usual: just under 20 rather than just under 30. That’s not a bad thing in Fry’s offices which are not huge. There was a bit of an introduce-yourself session (which was made even more primary-school-like by the presence of big sticky labels on everyone’s chest with their names or cognomens). And then we had a lightning talk from Martin who has a sort of cut-down Nagios for app developers. (I hope I haven’t done it an injustice). And then a surprisingly straightforward vote on the evening’s programming challenge which gave us… Boggle. (Word game; 8×8 grid of random letters; form words by moving like a chess king).

Four teams; four solutions, all more or less different. Only one team ended up with a working solution at the end of 90 minutes (and they appeared to be optimising by removing all vertical whitespace; or maybe that was an aesthetic choice - who knows?). Our team had visible activity (which is more than Team 1 managed!) but no solution. It’s up to each team how they want to manage their collaboration. We’d gone for the split-team approach, dividing the problem into its eminently decoupled parts: a mechanism to read in a dictionary of words and provide efficient searchability (using a Trie, in case you’re interested); and a structure to hold the board (a dictionary, keyed on coordinates), generate the letters into the grid, and search for all possible words, relying on the dictionary code to indicate success, failure, partial success, or success with more possibilities.

The tweets were still flying this morning as people tried to tweak their solution (or, indeed, get it to work at all) on the train, on their phone or at home overnight. A friend of mine who’s a C++ coder came along mainly because I’d talked so much about the Dojo. He’s not really into Python - in fact he’s not really a programmer: he does medical image analysis. But he enjoyed the atmosphere and made a few small suggestions before simply sitting back and watching the teams get to work.

Look out for the next Dojo at the beginning of January. It’ll be announced on the python-uk mailing list and we’ll tweet about it when we’ve fixed a date.

UPDATE Dirk’s added a blog post of his own:
http://elazungu.wordpress.com/2011/12/02/solving-boggle-with-python/