Friday, July 27, 2012

CS4HS UTM July 23-25

Instructional Centre
This past week, UTM hosted a Google CS4HS learning opportunity attended by 16-18 teachers (mostly from Peel and Toronto).  Interestingly, that's about the same number that attended the USask CS4HS event 3 weeks prior.  At last year's UT CS4HS on the main  Toronto campus, there were about twice as many teachers. I had never visited University of Toronto at Mississauga before (formerly called Erindale College).  They have just completed a host of new buildings and most of CS4HS was held in the Instructional Centre.  There were sessions on Python, HTML5/Javascript, general problem solving and sharing amongst the participants and UTM staff.  The level of the participants was quite high and the UTM staff put together a very full and useful program.  They posted a resources page which will be useful and I made some notes along the way for both CS4HS events.

My plan is to use Python instead of Java next year for grade 12.  I may even use it for both grade 11 and grade 12.  The only downside is GUI programming isn't so easy like with Visual Basic or Delphi! I've been working through some exercises and this excellent (short tutorial) Byte of Python.  There are really a ton of free resources out there (textbooks, game programming books, software).  I used Portable Python 2.7  and 3.2 at the UTM event.  It includes PyScripter IDE which I now prefer to Eclipse (less overhead).  Python has a lot of neat features that make problem solving rather than the language the focus.  I would have to say HTML5/Javascript is not so much in that same design mode!

In the past, I always thought using 2 languages (Basic in grade 11, Pascal then Java in grade 12) was a good idea.  Now I am thinking I'll use Python in both grade 11 and grade 12.  Hopefully, by grade 12, we can deal with more interesting (complex, thoughtful) problems and near the end of the class, introduce HTML5 / Javascript for event driven programming.  When I first started event driven programming with VB and Delphi, it took some getting use to compared to the console-type programming I was used to.  It seemed like an extra layer of complexity.  Python with a good IDE (Pyscripter) is very responsive (like QBasic in the past).  I noticed virtually nobody used Netbeans or Eclipse as their Java IDE because it was too much.  Some used BlueJ, others DrJava and I think that was probably a better choice (I've been using Netbeans).
UTM Library

The natural world is tough

On the evening Wednesday, July 25th, there were thunderstorms throughout the GTA.  Yesterday (July 26), I discovered two dead robin chicks in the backyard.  I saw no sign of the third chick, so I suspect it perished too.  One chick was smaller than the other.  A very short life of less than 2 weeks.

This is a video of this same clutch feeding:

Saturday, July 21, 2012

Urban birding

There's a pair of robins nesting at the back steps:


In the front, this dove has been seen a few times in the red oak tree:

Saturday, July 7, 2012

CS4HS USask July 3-4th

Note:  I also attended the UTM CS4HS event later in the month!

I attended the University of Saskatchewan CS4HS session this past week.  It focused on Python.  I really find Python, PyDev and Eclipse to be a very nice environment for learning computer science.  I've been using Netbeans/Java SDK with the Blue Pelican textbook, but it hasn't been that great for me.  I installed the 64-bit Windows software on my Dell Inspiron this morning.  It was easy.  First, I downloaded Eclipse and installed it (classic version 4.2) - just unzips a folder.  Then I downloaded and installed Python.  I downloaded the 64-bit version 3.2.3.  Then I installed PyDev from within Eclipse.  Earlier this week, I tried to install PyDev with a download, but I couldn't get it working, so I figured it must be a plugin install within the IDE (sort of like how Netbeans does it).  I made a Google doc with my notes.

CS4HS are Google sponsored PD opportunities organised by universities for high school teachers.  One of the participants mentioned he was going to the University of Alberta CS4HS event this month.  I had signed up for the UT Mississauga CS4HS Workshop on July 23-25.  They are free, so that's great for me.

One of the things I liked was how you could use Turtle graphics to teach recursion.  We were asked to do one involving triangles.  Here's a simpler one (a box within a box within a box ...).

The code is pretty simple:

"""
 A program that uses turtle graphics to draw an 'H' fractal.
 
 The documentation for the Turtle graphics module is in
 section 23.1 'turtle -- Turtle graphics' of the Python
 Standard Library documentation at python.org.
"""

import turtle

# Global name for the turtle that will
# do all of the drawing
Leo = turtle.Turtle()

def drawLine(x1, y1, x2, y2):
    """
    Use the global turtle, 'Leo', to draw a line
    from (x1,y1) to (x2,y2)
    """
    global Leo
    Leo.penup()
    Leo.setposition(x1, y1)
    Leo.pendown()
    Leo.setposition(x2, y2)
    Leo.penup()
   
def drawBox(N, size, x, y):
    """
    Recursively draw N 'H' fractals centered at (x,y)
    Input:
      N -- an integer indicating maximum recursive depth
      size -- size (width), in pixels, to draw the 'H'
      x,y -- integers. The coordinates of the center of the 'H'
    """
    if N > 0:
        halfSize = size // 1.2
        leftX, rightX = x - halfSize, x + halfSize
        topY, bottomY = y + halfSize, y - halfSize

        drawLine(leftX,  bottomY, leftX,  topY)
        drawLine(leftX,  topY,    rightX, topY)
        drawLine(rightX, topY, rightX, bottomY)
        drawLine(rightX, bottomY, leftX,bottomY )
        #3 triangles per triangle
        # top, bottom left, bottom right
        drawBox(N-1, halfSize, x ,  y)
        #drawT(N-1, halfSize, rightX, bottomY)
       

if __name__ == '__main__':
    # Set the ninja turtle's speed to 'fast'
    Leo.speed("fast")
    # Draw the H fractal centered at the center of the screen
    drawBox(20, 300, 0, 0)
    # Leave the window up until the user clicks in it
    Leo.getscreen().exitonclick()

Monday, July 2, 2012

Chief Whitecap Trail

Today, we drove down Chief Whitecap Trail (SK 219).  First stop was Beaver Creek Conservation area.  A former student of mine from Evan Hardy was one of the interpreters.  Haven't been to Beaver Creek in about 5 years.  It's getting older, but it was a nice trip.  I didn't know aspen bark has a natural sun screen you can use and some beaver slides were pointed out along the trail.
Beaver Creek
Chipmunk and Franklin Ground Squirrel



Next stop was the Gardiner Dam, about 100 km south of Saskatoon.  I've never been to this earth dam which is a major hydroelectric station.
SaskPower Coteau Creek Hydroelectric Station
Gardiner Dam
I thought the 5 concrete towers were generators, they are not.  There are three hydro generators at the Coteau Creek station downstream 1 km from the dam.

In the evening, I noticed my Saskatoon berries in the garden were ripe.  We put nets around the bushes this year so the pesky birds couldn't strip them clean before harvest. Some robins still had the guts to grab some berries.  This is the first harvest ever from our smoky cultivar bushes.  We also have a Thiessen cultivar, but it hasn't grown much in the 8 years we've had it.
Saskatoon berries
The ivory silk lilac tree is also blooming.