Archive for Tech

Fun and (adventure) games at the London Python Dojo

Just saw a tweet from Rene saying that he’d enjoyed last night’s Dojo at Fry-IT. I did, too, and for much the same reasons: the small group format makes for a more engaged, friendlier evening. We were carrying on with our not-so-spectacular text adventure game built in previous weeks. Altho’ there had been discussion about different groups working on separate pieces which would then come together, I think our eventual choice for all groups to work on the same thing was the right one. As Nicholas — Dojo organiser and former teacher :) — pointed out (correctly): if you’ve all been working on the same piece of code and the same structures, it’s much easier to follow the show-and-tell at the end.

In the spirit of previous Dojos, which had been very much led by TDD-aware people, I’d got all test-y in our group and we spent way more time in generating meaningful tests than launching into functional code. (As well as reworking the crufty parser which everyone had to cope with). As far as I can tell, *none* of the other groups were testing. Just goes to show… testing really does slow you down for no nett gain ;)

It was definitely interesting to see the different styles & approaches adopted by the different groups. As well as their attitude to the source material: most were “respectful” of the descriptions and objects supplied (by Bruce & John) but others simply hacked them about to suit their requirements. And one off-the-wall group simply made up their own thing, generating random monsters doing random things. As far as I could tell.

Although this format worked well, I think varying from time to time is good — as we have been doing — not least because different approaches suit different people and we want people to keep coming! Thanks as always to Nicholas and Fry-IT for organising / hosting / feeding. Pictures are up here. (Apparently that site’s Django driven, in case it makes you any more likely to click on the link…)

What do we use Python for at work?

Not uncommonly, I suspect, Python was introduced here at work in stealth mode: it wasn’t on the list of products starting with “MS” which we genreally use, but it got the job done and the management has been pragmatic enough to accept its use to the extent that it’s now installed on the baseline image for company PCs and laptops.

So what do we do with it? Well, a surprising amount when I start to enumerate it. As is often the case, quite a few of the uses are of the “glue” style: creating an easy bridge between two other pieces of software, one of which is often the operating system. As an example I years ago wrote a (tiny) piece of code to enumerate the installed printers and pipe them out to a file. Our in-house business app calls the Python and picks up the result to display to the user as a pick list. That’s just one example among many others, some of which are so small that I tend to forget that they exist until some bizarre corner case arises which means I have to revisit the code. They just work and go on working.

A by no means exhaustive list of Python Pieces off the top of my head:

* That list of printers
* The startup wrapper for our main business app
* sql2xl — provider of data to the masses (and indirectly responsible for a world of Frankensheets, I’m afraid).
* Sales Boards - our Pygame-driven availability-visualisation app
* reports - a compact module combining simple dialogs and sql2xl
* screengrabber - capture parts of the screen to save to the database
* imageviewer - simple pygame-based image display
* convert images provided by our customers to thumbnails and place them on a replicating database for our handheld scanners
* convert a batch of Word docs to PDF & PCL
* simple manipulation of DXF maps to add our internal site ids
* absolutely loads of occasional AD / filesystem / WMI scripts for the sysadmins
* the internal contacts / portraits webpage
* web-based password reset for our HR system
* web front-end, mail ingest and alerting (a la Roundup, I admit) for our Helpdesk system

.. and a whole slew of other stuff which pretty much exists to demonstrate just how versatile Python is :)

Breathing life into the active_directory module

For a long time I’ve not been able to give my active_directory module the attention it’s needed, in spite of several people helpfully providing patches to, eg, escape slashes in monikers, bind to the Global Catalog and do other useful things. However… the need to do various things with it at work plus some questions from interested users has resulted in a flurry of housekeeping and — hopefully — improvements. It’s not done yet but, assuming I can sustain the effort, you should see the result in a few days time.

As with much of my stuff, the functionality I implement and the time I spend on it is largely a function of what the sysadmins here at work want me to for them (and how much else I can squeeze in at the same time). Just at the moment there are several initiatives to claw back wasted disc space and do other housekeeping exercises. So I get to allocate some time to my projects. Let’s see how long it lasts…

pycon as seen from across the Tweet

That was an interesting experience: I (re)started using Twitter a couple of weeks ago, for no particular reason except that it seemed to be an increasingly significant backchannel of information around Python, meaning that useful information passes through it which is then assumed or referred to in other forums [*] such as the Python mailing lists or people’s blog posts.

But by fortunate coincidence that meant that I was able to watch the #pycon Twitter stream and get a more immediate flavour of the conference than I would have by following later blog posts. Obviously it was quite fun watching people try to get their questions on the screen for Guido’s keynote speech (took me a while to realise what was going on…).

Throughout the conference you get a mixture of the very immediate (”Has anyone got a Mac VGA Adapter for Room C?”), the impending (”BoF Session for Ruby Enthusiasts in the downstairs toilets”), the infinitely retweeted (”Unladen Swallow….”), the humorously overheard (”OH: OK; Yak shaved”), the running-joke (”Bring goat food to the Testing Sprint”), the contentious (”We were more diverse…”), the you-had-to-be-there (”Looks like @djangopony was left unattended”), the gratitude (”Thanks to everyone…”) and of course the plain exhausted (”Back home now after #pycon”).

I obviously didn’t follow everything in real time, not least because of the time difference: I do have other things to do with my time :) But it was enjoyable watching other people enjoy themselves and feeling at least a spectator to an Occasion in the Python year. Now all I’ve got to do is find time to catch up with slides, video presentations, and A Little Bit of Python.

[*] Note to pedants: seems to me that “forum” has become an English word by adoption which means that you can justifiably form its plural by adding an “s”. If I were talking about meeting places of the Ancient World I might argue for the more classical “fora”.

Another Day, Another Dojo

My first Dojo of 2010 yesterday, as I missed the January one (which is a shame as it sounded like fun). This was a return to the conventional Dojo style with pair-programming at the front, the task being to merge the Adventure Game efforts from the previous month’s team-by-team effort. But first, a commercial break… Jonathan Hartley advertised the upcoming PyWeek competition and demonstrated his team’s previous effort as well as the amusingly literal Murder of Crows entry.

Meanwhile, back at the Dojo… Nicholas started off partly to set things up for people (like me, his co-pilot) who hadn’t been there the month before. As we moved through the programming pairs, we did manage to get a working codeset together by merging the location-parsing code from one team with the cmd-based loop from another. But it was clear that things were moving slowly and that the audience was somewhat disengaged…

So we finished off with a broad discussion of ways ahead, of what might work better, and of whether the artificial nature of the Dojo setting meant that people couldn’t “show off”, so to speak, their natural coding style — and ability. Michael G and others made a few cogent suggestions to the effect that smaller teams would work better but with some kind of DVCS (git seemed to be the front-runner) to assist the teams in collaborating. And it seemed that at least one team should be creatives, rather than coders.

I enjoyed it, as ever, but it _is_ difficult to keep 20+ people in a medium-sized room totally engaged. Even with the best will in the world, it’s hard to read code on a screen from some distance back. This was one of the reasons why a team-based approach met with broad approval. Also it is a little dispiriting when you’re doing your best up front but half your “audience” is otherwise engaged.

The point about how “natural” you should be in the Dojo was interesting. Everyone has a different way of coding, of approaching a problem, of looking for information and so on. Dave[*], the last pilot, mentioned that he’d normally take much longer sizing a problem up but that having a time limit forced him into action sooner. But you’re up there with a limit of 10 minutes, probably on someone else’s machine, maybe on an “alien” operating system. You’re fumbling with running up a command prompt; you’re not sure how to bring up the Python docs; the keyboard shortcuts which your fingers remember don’t work — or worse, do something else entirely! We did discuss each person bringing up his own laptop, although that has obvious drawbacks of getting the projector to switch smoothly and so on. It was out of this discussion that the move towards a team-based approach next time arose.

TJG

[*] Dave, incidentally, was the programmer of the BBC version of the Graphics Adventure Creator — did you know that?