Monday, 30 September 2013

AI for Robotics/Python/Paging Woes

Just started the Artificial Intelligence for Robotics (a.k.a. Programming a Self-Driving Car) course online at Udacity: https://www.udacity.com/course/cs373.  TIL 1: writing Python on a mobile browser is hard; I got about halfway through the first section before I had to give up on working on my phone in bed with inconsistent whitespace and weird backspace behaviour and switch to a real laptop and keyboard, which was much nicer.  Python does not deal gracefully with ugly whitespace.  It's partly what makes Python so beautiful but definitely what makes Python sometimes frustrating.  But being able to get started into the course on my phone was definitely helpful for actually doing it vs maybe coming back later.  TIL 2: the functional features in Python are super handy - doing something to a bunch of things in a list is way easier with a lambda function and a map call than trying to awkwardly do the same in Java (http://docs.python.org/2/library/functions.html#maphttp://www.secnetix.de/olli/Python/lambda_functions.hawk)  TIL 3: self-driving cars are cool!  So far the course is really interesting, I like how the sections are really short so you can stop at any time, or go as far as you want.  We'll see if it's able to hold my interest for the entirety of the course or if I get bored and wander off partway through.

In other TIL today, be suspicious any time you add an if without an else.  At some point we'd added a check for an index out of bounds case in our paging code so we weren't taking a sublist bigger than the original list, but neglected to deal with the opposite, resulting in bad behaviour if our sublist was smaller than the second page.  I've now refactored out that bit of awkward logic into its own method and peppered it with unit tests covering all sizes of things (empty list, list less than one page of data, list exactly one page, exactly two pages, more than one page but less than two pages) and it's all working happily now.




Saturday, 21 September 2013

First Post! Learn to Code Day.

Disclaimer: I've never blogged before (aside from Twitter and the like). This space is going to be about life as a programmer in healthcare, inspired by this post: how to blog about code and give zero fucks, so no promises that anything interesting will ever happen here, and feel free to not read along.

I'm currently mentoring at a Ladies Learning Code National Learn to Code Day event in Toronto; they've organized a huge event this year across 13 cities, with hundreds of people getting together to learn a bit of HTML+CSS, it's pretty cool. I myself have had a real easy time of things, I've always felt really supported in my quest to make computers do things, ever since my Dad introduced me to a 'Learning DOS' program when I was about 7; I used to love going into Windows 3.1 and Norton Commander and poking about in there. When I was 13, a friend of mine and I made a website about our favourite band with an interactive choose-your-own-adventure story and it was pretty popular (as I choose to remember it). We continually worked to improve the site by learning how to do fancier things in HTML like adding frames (ooh!) and CSS. When I first got involved with Ladies Learning Code, I was surprised at how many stories I heard from people who had earlier had an interest in computers, but were encouraged not to follow that for one reason or another, so they'd abandoned it and gone into some kind of artsy thing instead. Participating in Ladies Learning Code is my opportunity to pass on to others the support and encouragement that I've received.