Archives for April 2011


Python Office Hours Trying something different

Python logo

I've decided to try something different and will be holding Python "office hours" in Tog on Thursday evening. It's not really a secret but I'm not exactly advertising it either. I sent an email to my former students for Thursday's test run, and depending on how it goes I may hold these regularly and be more vocal about it.

What is it going to be about? This is sort of a follow-up to an intro course, for people who have a project but can still get stuck and could use some guidance. Or for people who want to reinforce  their knowledge of Python/get up to speed by doing exercises, with someone nearby to give a hand if needed. Basically it's for people who want to do their own thing, with the knowledge that if things don't work there's someone who should be able to help in the room, rather than hours of frustration in sight. Or that's the idea! This isn't a course, I won't be teaching or lecturing or erm talking that much. If no one needs help I'll be working on my own stuff.

I look forward to seeing how it goes. Drop by Tog ( map ) anytime between 6.30 and 9pm this Thursday if you're interested! And feel free to drop me a note (see About page) if you're curious but not sure if it's a good fit for you.

Leave a comment

A Quick and Incomplete Intro to Jasmine Javascript unit testing

Recently I needed to find some sort of Javascript framework to start unit testing new code, some of which was using jQuery. I ended up deciding on Jasmine.

Why Jasmine?

  • Primarily and essentially, it's maintained, it seems fairly active and has a community around it: looking at the pull requests, github network, issues, code changes and glowing reviews all over the web
  • It can test asynchronous calls
  • It can integrate with a continuous integration system (though that seems to require an external plug-in, listed on the website? -- to be investigated more deeply when I need to set this up!)
  • It attempts to be platform/language/etc agnostic, though you do feel a strong tie to Ruby, rummaging around
  • Other nice things
  • And I've heard the name mentioned in local tech meetups and mailing lists, which is always good (it's good enough to be picked up by real people, who can potentially become a source of help in the future if needed :))

Getting started (~10 minutes)

Download

You should download Jasmine from this link: http://pivotal.github.com/jasmine/download.html. It's actually a bit unclear from reading the wiki, I initially downloaded the latest version from its associated tag and had trouble because the directory structure didn't seem to match the documentation.

Read the instructions

The main wiki page really serves as the user guide. Here're a few helpful links to get started, all short and useful:

There's a chapter on mocking as well, which I skipped until I need it -- it's enough to try out already!

Interlude: Vocabulary

I'm assuming this is because Jasmine is "BDD" (Behaviour Driven Development) and I come from TDD (Test Driven Development), but there was a bit of new vocabulary to get used to. Here's a short BDD to TDD dictionary.

  • Spec: Test
  • beforeEach: setUp
  • afterEach: tearDown
  • Spies: Mocks, mocking
  • .toBeTruthy: .assertTrue (it sounded like it could be approximately or almostEquals to my untrained ears)

Setting up

Have a look at A simple project for an extremely brief overview, and open the example specs, especially PlayerSpec.js which I found really useful. That should be enough to get you going!

Don't forget to include jQuery or whichever, in your spec runner file if using such a framework.

I'm not sure yet what's the best structure for organising Javascript tests. I'd like to find out what people do. At the moment I've put my spec runner file and tests in the directory that makes the most sense semantically, but this means that by default the file would end up accessible on prod after deployment, which does not sound ideal. Any reading suggestions for me or best practices to share?

Leave a comment

Python Office Hours 1st edition, roundup

Last Thursday was my first attempt at setting up "Python Office Hours", an evening during which people starting out with Python are welcome to drop in with questions, problems or just to work on beginner projects with someone who can give a hand within reach.

It probably wasn't a success, though it definitely wasn't a disaster. I only sent out the announcement to my former students, and several people were really excited about the idea though only one confirmed he would come. And indeed, although my opt-in "Python Office Hours" list now has a few more names in it, on Thursday there was only me and the one student, so not quite the successful evening turnout-wise. However, we had a very long discussion about the project he wants to do, how to go about cutting down the design into different Python projects manageable for a newcomer to the language, to a level that we wouldn't have been able to discuss had there been other students around. So this wasn't a wasted evening, although we probably went into more depth than I was thinking or hoping for! That's the advantage of showing up, you can get more than you bargained for :)

I will do a few more of these office hours. I think maybe people will get moving in their projects and/or learning if they know it's a regular occurrence. I'll likely expand the reach too, though I'm a bit concerned people will misread and show up expecting more (or any kind of) structure -- as I discovered a couple of courses ago, people read an email and focus on one keyword at the expense of what the actual course or event is about! Everyone ends up disappointed and frustrated, so I'll make sure to pen that email carefully, and work at learning which words to bold for maximum effect :]

Leave a comment | 4 so far

Book review: The No Asshole Rule, by Robert Sutton Building a Civilised Workplace and Surviving One That Isn't

"The No Asshole Rule: Building a civilised workplace and surviving one that isn't" by Robert Sutton is a short and interesting read. To understand what it's about, the title and subtitle say it all!

The definition of an asshole for the book goes like this: they do or say something that makes the target feel worse about themselves, and they target people who are less powerful.

The book goes on describing negative effects of assholes, at many different levels: emotional, organisational, and even financial, handy should you ever need a $$$ breakdown to make your bosses or company understand why it would be helpful to get rid of the assholes or at least prevent them taking over the company and culture. There'll be a lot of echoes and parallels you can draw with a few unhealthy open-source communities (e.g. earning the right to be a jerk once you've proven your technical chops, etc.), particularly if you've seen the excellent Poisonous people tech talk.

Other interesting aspects covered in the book include how to survive assholes when you really have no other choice, without becoming one yourself, and also what to do when you are the asshole. I thought that was really interesting! It's easy to get reading and imagine yourself as the recipient or appalled onlooker rather than the asshole dishing it out, but truth is we've all had our bad days. The book truly aims to be thorough, even touching on the benefits of behaving like an asshole, and how setting up a 'no asshole' policy can backfire: if it's only lip service, suddenly you become an hypocrite in addition to being an asshole.

Reading the book, it's obvious and clear that maintaining and establishing a workplace with a "no asshole" rule is a much better and healthier alternative for everyone, assholes included, and for organisations themselves. Hopefully the book will also act as a guide and help for people who want to expose, flee or get rid of the assholes around them.

Leave a comment

Kevin Warwick @ the Science Gallery Cybergenetics

Last Thursday I happily attended a talk by Kevin Warwick, with the catchy title of "Kevin Warwick: My life as a cyborg". He introduced his work by talking to us about experiments he or his students did on themselves, which made for an intensely interesting and entertaining talk, interspersed with video clips of documentaries about his work and robots, as well as the occasional joke dropped in passing like a bomb as British people are wont to do.

The first experiment was about RFID identity and having buildings react to you, for instance by opening doors when they recognise you. At the time of the experiment they were using radio waves. It's cool and all, but I wonder how this would resist to hacking nowadays, when people seem able to reverse engineer just about any air signal. He noted that we actually do use this today, e.g. pets have electronic microchips and in the US they are using them to monitor blood for people with diabetes.

He then showed us experiments his students did to link the brain and the body, e.g. implanting a magnet in their finger that they can hook into and use like a radar to feel how far or close an object is. Another student implanted an infrared device in his finger and can use it to detect heat remotely (they still need some crazy apparatus outside of the body that they hook around the finger etc., but this is still fantastically cool!)

After a brief video of a robot that can use sensory input to react, he moved on to the next theme, robots with a biological brain. Experiments done by hooking rat neurons onto a robotic mechanism and watching it learn and develop over a few weeks and months. This is done by growing brain cultures, and some of these experiments include or are ready to move to using neurons from human brains, which brings up interesting ethical questions. At what point is this culture considered a life? At what point is it wrong to just "turn it off" as you leave the lab in the evening? What about robot rights?

In the context of therapy, there are working implants that are currently being used to improve the life of patients with Parkinson, to prevent tremors and enable them to walk and live more independently. The only problem with these implants at the moment is that they stimulate all the time, making the batteries deplete quickly and requiring extensive surgery to be replaced every 2 years... They're currently working on making these systems intelligent so that they can learn and predict tremors and only stimulate when needed -- the current research is ready to be tested on humans.

The last piece of research was particularly inspiring, on creating a bidirectional interface between the brain and the implants. He hooked a chip into his left arm's nervous system for a few months, and his brain learned to recognise the new signals it was sending (which was not a given, a dangerous experiment!), and vice versa. Many experiments ensued. His wife got one hooked into her arm too and they experienced nervous system to nervous system communication, which sounds quite awesome :) When they removed the implant, rather than rejecting it his body had actually created tissue around it...

The questions at the end of the talk were fairly well-thought up and generated interesting discussions (I shut up because the only question I had in mind was "How does it work for your students at airports?"), on ethics and potential dangers (having some of our senses shut down or dim because the brain favours the new "sense"/signals given by the implant) and when do you call someone a robot or a human (there are people with e.g. "robotic" prosthetic legs after an accident, at what point do you stop calling them "humans", if ever? What when only the brain is human?)

Leave a comment

The Science Gallery

As briefly mentioned yesterday ;) I happily attended a talk by Kevin Warwick this week at the Science Gallery. The talk was fantastic as expected, and I'd like to take the time to tip my hat to the Science Gallery: if you haven't been yet, or if you plan to visit Dublin in the future and are into science, do take the time to stop by and visit whatever exhibition they have on at the time. They put a lot of thought into creating very well put together exhibitions on a specific theme that last one to three months usually, and you will be amazed, and every member of staff will be happy to spend time with you to explain the object or experiment you're looking at.

They also organise talks by speakers who are knowledgeable on the topic of the exhibition, for free or a 4 or 5 euro fee. Since I started working in the city centre recently, I was able to attend talks on the neuroscience of memory, and how first impressions happen and are stored in the brain, during the MEMORY LAB exhibition. This week, talks on organic bionics and cybernetics for HUMAN+. Warmly recommended!

Leave a comment

Re-imagining learning A conference on education

In 2 weeks I will be attending the "Re-imagining learning" conference in Limerick. I'm really looking forward to it! I'm not quite sure what to expect but I'm fairly confident I will have a great time and learn many new things. In particular, I'll pay close attention to talks and discussions on the cross-over of education and technology and ICT in education in general. I'm also quietly hopeful I'll be able to chat with someone who will have suggestions on how I can find and approach a local school about potentially teaching intro to programming classes to their students.

Can't wait! :-D Will be meeting old friends and acquaintances in Limerick while over there as well.

Leave a comment

Archives