Scripting Secret Santa

Posted: December 11th, 2011 | Author: | Filed under: Software | Tags: , , , , , | No Comments »

Every year, my closest friends and I do a ‘Secret Santa’ gift exchange. For the unfamiliar, the idea is to randomly draw the name of one other person, and to buy him or her a gag gift without giving away your identity. It’s a lot of fun, and we’ve been doing it for a number of years now.

Unfortunately, since we no longer live under the same roof (or even in the same city), it’s hard to draw names prior to the gift exchange. Of course, one person could draw all of the names and let each other participant know who to buy for, but then the person who drew the names would already know who was giving gifts to whom, thus defeating the spirit of the exercise. There are a number of websites that purport to solve the problem, but none of them are perfect.

Since I’m a giant nerd, I decided to script my own solution. I went into it with three rules in mind:

  1. Every person must receive exactly one gift.
  2. No person should draw their own name, or that of their significant other.
  3. Participants should be notified of the draw by email, without the person who runs the script ever knowing the results.

Because Python is a cool language that I’m not very experienced with, I decided to use it to hack something together. My results are shown below:

#! /usr/bin/python

import random
import smtplib
from email.mime.text import MIMEText

# a recursive function to match pairs
# the goal is to get somebody in participants to give a gift to each person in ungifted
# we don't allow people to give gifts to themselves or to their significant others
def match(participants, ungifted):
     # primary base case
     if len(ungifted) == 0:
               return True

     #processing case
     else:
          # ungifted reduces by one each recursion,
          # so this is counting down from end of list
          first = participants[len(ungifted) - 1][0]
          so = participants[len(ungifted) - 1][1]

          # error base case
          if (len(ungifted) == 1 and (first == ungifted[0] or so == ungifted[0])):
               print "algorithm failed, please start again"
               return False

          #can't get yourself or significant other
          second = first
          while second == first or second == so:
               second = random.choice(ungifted)

          ungifted.remove(second)

          pairs.append([first,second])
          return match(participants, ungifted)

# list of participants in tuples of <participant, significant other>
participants = [['Jim','Anne'], ['Anne','Jim'], ['John','Rachel'], ['Rachel','John'],
                    ['Joseph',None], ['Ed',None], ['Mark',None]]

# participant email addresses keyed on name
emails = {'Jim':'jim@live.ca', 'Anne':'anne@gmail.com', 'John':'john@johnsmith.net',
              'Rachel':'rachel@hotmail.com', 'Joseph':'joe@gmail.com',
              'Ed':'ed@live.com', 'Mark':'mark@gmail.com'}

# take the first name in each tuple
ungifted = list(couple[0] for couple in participants)

#the list of gifting tuples of <sender, recipient>
pairs = []

# perform the matches
if match(participants, ungifted):

     # loop through matches, sending emails
     for pair in pairs:
          you = emails[pair[0]]
          msgstr = pair[0] + ", your secret santa is " + pair[1]
          print "Sending email to ",you

          me = 'myemailaddress@mydomain.com'
          msg = MIMEText(msgstr)
          msg['Subject'] = 'Secret Santa Pairs v2.1'
          msg['From'] = me
          msg['To'] = you

          s = smtplib.SMTP('mail.mydomain.com')
          s.login('username', 'password')
          s.sendmail(me, you, msg.as_string())
          s.quit()

The vast majority of the magic takes place in the match() function. It’s a recursive algorithm that iterates over the ungifted list and randomly selects somebody from the participants list whose job it will be to purchase a gift for that person. The main downside of this approach is that it is possible to get to the last person and have no logical choice for a partner – i.e. when we try to select a partner for Jim, the only person left in the ungifted list is Anne, which violates rule #2. In that case, we fail out before sending the emails and instruct the user to run the script again.

In order to use the script, just copy it into a text file (paying very close attention to the indentation!), change the contents of the participants and emails arrays, and modify the last block to reflect your SMTP settings and email account username/password. Save the file with a .py extension, and from a terminal, run python <scriptname>.py

Happy gifting!


Seven Days of Rdio

Posted: August 9th, 2011 | Author: | Filed under: Music, Software | Tags: , , | No Comments »

As a regular listener of tech podcasts from the United States, I have long been interested in the idea of streaming music services, but have been frustrated by the fact that very few of them seem to be able to break the border and come north to Canada. In the past, I’ve held both a free and paid subscription to Last.fm, but found its music playback system to be extremely limited, due in part to licensing restrictions that dictate how many songs from any album or artist can be played in succession.

A few days ago, I was catching up on my subscription to Jesse Brown’s Search Engine podcast, and found myself listening to Episode 95: Cloud Music Comes to Canada. In this episode, Jesse interviewed Rdio CEO Drew Larner about the streaming service’s Canadian launch. Immediately interested, I headed over to the company’s website and signed up for their free 7-day trial subscription. The following is a collection of my thoughts about the service, in no particular order:

Beautiful and Functional:

I have to hand it to the Rdio web team – their in-browser media player is one of the best web apps that I’ve ever used. The screen is organized into two panels: A thin side panel that shows currently playing media and controls, and a wider main area that allows you to navigate through the Rdio music library. One of the best parts is that this view is built entirely on Javascript, so you can browser through available music and queue up songs to play without any interruption in audio playback.

A picture of the Rdio Dashboard, with media playback controls on the left, and the main navigation window to the right.

Speaking of audio playback, song quality is crystal clear, while tracks seem to start instantly, without any kind of buffering time. I’ve used a lot of media players in my time, and I think that this one might have the best user interface that I’ve ever seen. Navigating the massive library of available songs is simple and painless, and the prominently placed search bar provides a rich collection of query results:

Rdio Search Results for the term "love": Results include top artists, albums, and songs with the search term in their titles

The only major UI problem that I’ve encountered stems from broken links placed throughout the site. On more than one occasion, I’ve been reading an artist bio or album review, and clicked on a link to one of the albums mentioned therein, only to be transported off to a page for an album that shares the same name, but is by an entirely different artist. My guess is that all written content on the site is scanned wiki-style for clickable terms like album and artist names, and that the links are established without human intervention. In general, this process works, except when it fails to correctly choose between multiple potential targets.

A Truly Massive Collection:

Rdio has done an excellent job of collecting songs for their collection. During the aforementioned interview, CEO Drew Larner emphasized the fact that the company purposely negotiated US and Canadian rights to music at the same time. The result is that the vast majority of their collection is available in both countries, without the usual legal disconnect that other streaming services like Netflix suffer from.

Some of the usual suspects are missing from the Rdio library, namely the Beatles and Led Zeppelin. For the life of me, I’ll never understand what the publishing companies that own these pieces think that they’re gaining by holding them back from online streaming services. It’s a purely artificial shortage – like many fans of these bands, I already own my favourite Beatles and Zeppelin records in both digital and physical formats, so it’s not like holding them back is generating additional sales. It’s nothing more than a piss off for fans who would like to enjoy their music on alternative services.

Search results for "The Beatles": The available albums are almost entirely interviews or cover albums

With that said, the breadth of music available on Rdio is truly impressive. I’ve been able to find nearly everything that I’ve looked for, as well as a great deal of content that I’ve never heard, and intend to explore in the near future.

Finding New Music to Enjoy:

This is one of the few places in which Rdio makes a misstep. Other online streaming services that I’ve tried in the past (most notably the venerable Yahoo Launchcast) would start a new user’s experience by asking for a few artists or albums that the user enjoyed. Once this data was stored, the service would begin to recommend a mix of familiar and closely related songs that the user would rate in turn, thereby automatically growing their collection while introducing them to a great deal of new music in short order.

Rdio doesn’t seem to provide any such service. Even after I linked it to my existing Last.fm account, it scrobbled what I was listening to, but did not pull in favourite artists or songs from that account. Nearly every artist, album, and song on the site can be played as an “Rdio Station”, which plays of mix of the chosen content along with related material, and new users can choose to follow existing users and benefit from their plays and music suggestions. Despite these methods of discovering new music, there doesn’t seem to be a “genius playback” – a way to playback songs that you’ve added to your collection plus new recommended material.

Even after spending a few days with the service and growing my online “collection” of music to just under 250 songs, my account’s “Rdio Station” (music drawn from artists/albums that I’ve listened to, songs that I’ve added to my collection, and related material) was maddeningly boring to listen to.

In the image above, you can see that there are only 8 artists in a list of 16 upcoming songs – indeed, content from these 8 artists was repeated, and some individual songs (like that terrible What’s My Name song by Rhianna) came up in shuffle multiple times over a 2-hour listening period, even after I physically removed them from the list on more than one occasion. In my opinion, the concept of a personal Rdio station needs more work. It simply does not present a variable enough set of music, and does not expose me to music that I have not previously found on the site.

That said, the amazing breadth of the Rdio collection and the powerful search tools come very close to  compensating for this problem by making it incredibly easy to call up nearly any song that pops into your mind while listening. It doesn’t take long to get lost, wikipedia style, by following links in artist bios and one can quickly find themselves with more queued albums than they will ever realistically have time to listen to.

Finally, Rdio doesn’t allow you to rate music in a granular fashion like traditional media players do. Instead, it provides the more binary option of adding a song to your collection. This resembles the way that Last.fm allows users to “Heart” songs as favourites. Were I to adopt Rdio as a long-term replacement of my existing music library, I suspect that I would grow to dislike this design, as it does not seem (at least on the surface) to offer enough granularity to easily sort out a large music collection. With that said, a better automatic shuffle feature could solve the problem entirely.

The Big Question:

Will Rdio replace my traditional music collection? Probably not. I might use it to augment my collection, and to explore new music, as well as to listen to newly released albums before deciding whether or not to purchase them. The bottom line is that I probably won’t opt into the $5/month permanent account that is necessary to continue using the service once my trial runs out sometime tomorrow. The reasons behind this decision are varied, but ultimately come back to my experience with the site’s Rdio Station feature. Its lackluster performance means that listening to Rdio becomes a chore. I can’t just throw it on and sit back and listen; I have to intervene and queue up songs that I want to listen to every time my list runs dry.

With that said, I will most certainly come back to this service in 6 month’s time and give it another shot. It is one of the coolest sites that I’ve seen in a long time, and I do hope that it will continue to improve to the point where I am comfortable leaving my traditional media player behind.


Some Quick thoughts on Sony and the OtherOS

Posted: February 11th, 2011 | Author: | Filed under: Software | No Comments »

For anybody who follows tech news, this is an old story indeed. In early 2010, Sony released the PS3 ‘Slim,’ an update to their current generation gaming console. Along with the release came some new firmware that removed a previously available feature from the machine: the ability to run an alternative operating system such as Linux, on the hardware. As this story has been widely covered elsewhere, I won’t both to go into the details here – you can read all about them in the links at the bottom of the page.

Instead, I’d like to put forth an alternative theory as to why Sony removed the feature. Regardless of your thoughts on open source software or how you feel about the potential for game piracy on these systems, I doubt that Sony removed the feature out of an effort to fulfill some kind of evil plot for world domination. As I see it, this situation revolves around the pricing models that are traditionally built into the sale of consoles and video games.

Just like cellphone manufacturers, console manufacturers often sell their hardware at a hugely reduced price. They do this with hopes of making up the lost revenue potential in game sales (often measured with a ratio called ‘attachment rate’ by industry insiders). This is often called the ‘razor and blades’ model of economics. If you’ve ever purchased four razor blades for $20 in order to use a free razor that was mailed to you by a drug store, you’ll know why. But that’s another story.

The point is, a hobbyist who could run Linux on her PS3 might do something ridiculous with the hardware, like oh, say, build a supercomputer out of 1760 of them. Since she isn’t buying any games to go along with all of that hardware, she represents a serious loss for Sony’s bottom line. I’m not saying that this is the average activity that most hobbyists engaged in when using the OtherOS feature of the PS3, but I can’t help but think that it is an oft-overlooked point in this debate. If you stood to lose a significant amount of money for every person who purchased a product that you sold and stood to improve your potential earnings by disabling a feature that most of your user base didn’t even know about, I think you’d do the same thing.

Related Links:

It no longer does everything: no more Linux on PlayStation 3 (Ars Technica)

Norway: Sony’s PS3 “updates” actually downgrade system (Ars Technica)

Can’t stop the signal: Sony’s options limited in face of PS3 jailbreak (Ars Technica)

Playstation 3 (Wikipedia)


Seniority Does Not Equal Value

Posted: December 18th, 2010 | Author: | Filed under: Education | Tags: , , , , | No Comments »

Last month, Microsoft founder turned philanthropist Bill Gates gave a speech to the Council of Chief State School Officers, a US-based nonprofit made up of elementary and secondary educational administrators. While a transcript of the speech is available on the Bill and Melinda Gates Foundation’s website, most people only heard about the event from a poorly-written New York Times Article entitled “Gates Urges School Budget Overhauls.” Unfortunately, this article glosses over the entire point of Gates’ speech, choosing instead to highlight his controversial comments about restructuring educational budgets without any kind of explanation:

In a speech on Friday, Mr. Gates — who is gaining considerable clout in education circles — plans to urge the 50 state superintendents of education to take difficult steps to restructure the nation’s public education budgets, which have come under severe pressure in the economic downturn.

He suggests they end teacher pay increases based on seniority and on master’s degrees, which he says are unrelated to teachers’ ability to raise student achievement. He also urges an end to efforts to reduce class sizes. Instead, he suggests rewarding the most effective teachers with higher pay for taking on larger classes or teaching in needy schools.

The poor coverage of Gates’ speech lead to some understandably vitriolic but ultimately misplaced outrage on social networking sites like Twitter. The point that Gates tried to make in his speech, and the one that was ultimately missed by the New York Times article, is that school budgets are still constructed based on old and outdated ways of thinking about education. In light of recent advances, Gates advocates a move to a data-driven free-market based approach to improving the educational system for all involved.

Until very recently, it was nearly impossible to objectively measure student achievement, because students are dispersed geographically and come from a wide range of economic, social and religious backgrounds that impact their styles of learning and interactions with both teachers and other students. The introduction of standardized testing, while controversial, has allowed researchers to eliminate these disparate variables and isolate for the one factor that we’re actually interested in: the difference that one year’s worth of study has on student intelligence and accomplishment. After all, what is a school if not a place that we send our children to become more educated and informed members of society?

Once we can isolate for achievement, we can map it against the various factors that might influence it, including teacher salary, seniority, and education level; classroom size, and the ratio of adults to students in a classroom environment. These variables can then be altered and their configurations tested in order to optimize student achievement, thus producing a more efficient educational system that churns out smarter individuals who are more capable of contributing to society in a positive and meaningful way. At the same time, we can be certain that the money that is poured into educational reforms is spent wisely, and can be directly mapped to student advancement.

As Gates points out, these are important concepts, because the American educational system is reeling quickly towards a crisis of both funding and inadequacy. Reforms are required across the board for three main reasons:

  1. Since the 1970s, the cost of maintaining the educational system has increased dramatically, while measurable student achievement has stayed essentially flat.
  2. In the same period, graduation rates have dropped from 2nd in the world to 16th.
  3. The United States now ranks behind 16 countries in scientific achievement, and behind 23 countries in mathematics achievement among students.

Combined with the stresses of the recent financial crisis, schools are being squeezed between a rock and a hard place. They need to change the way that they do business, but can’t afford to do so. This has lead school administrators to react to shrinking budgets by cutting personnel, using old and outdated equipment and text books, and closing down poorly performing schools. Although each of these strategies may help a district to balance its budget in the short term, all impact students negatively over time.

Gates’ argument is that this problem can be sidestepped by addressing the way that we pay teachers for their efforts. As would be expected, a large portion of the educational system’s operating budget is dedicated to teacher salaries. With this in mind, we must consider the two primary components of personnel costs: student to teacher ratios and instructor compensation models. Gates suggests that by changing the way that these two factors are considered, we may be able to better allocate funding, and ultimately, improve student learning.

Past reform efforts have concentrated on reducing classroom sizes. In 1960, the average classroom in the United States put one teacher in front of 26 students. Today, that number has changed dramatically, with one teacher now in charge of just fifteen students. The argument in favour of this movement has been that students benefit from more face-to-face time with teachers. Standards-based testing has shown that this simply isn’t true: There is little correlation between smaller teacher to student ratios and higher student achievement.

Gates also points out that current pay structures reward teacher seniority instead of great teaching. Teachers who have been in the system longer tend to make more money, under the assumption that they get better at their jobs over time. Again, this isn’t necessarily true: studies show that after their first five years of teaching, most teachers don’t increase the positive effect that they have on student achievement, regardless of how many more years they spend teaching thereafter.

Gates argues that by stopping our race to shrink classroom sizes and taking some time to reconsider the elements that influence teacher’s salaries, we can spend educational funding in a more positive manner. In particular, he suggests that teacher salaries be linked to the performance of their students, thus rewarding great teachers and providing constant incentive of lackluster teachers to improve. He makes a point of noting that this pay restructuring wouldn’t mean lower salaries. The average salary of all teachers could stay the same, but those who perform well would be better compensated for their efforts, creating a positive feedback loop that ultimately benefits students. In addition, Gates advocates that the best teachers be paid extra for taking on more or troubled students, which means that his new proposal could even benefit traditionally troubled poorer neighbourhoods.

“Conservative estimates suggest that we can save more than $10,000 per classroom by increasing class size by just four pupils. If we pay some of that money to our best teachers for taking in more students, we accomplish three goals at once – we save money, we get more students in classrooms with highly effective teachers, and we give our best teachers a real raise, not just for being good, but for taking on more work.”

For me, the most important part of this speech was not the claim that Gates made, but rather the reasons behind it. Once you understand why he’s advocating larger classrooms, you can see that the motivations behind such a statement are pure, and start to understand what he would like to accomplish. Essentially, he is attempting to build an economy around great teachers that rewards the best and encourages the others, while always striving to increase student achievement. That’s an admirable goal.


Area Man Constantly Mentioning He Doesn’t Have Facebook

Posted: December 10th, 2010 | Author: | Filed under: Nonsense | Tags: , , , | No Comments »

I don’t have a Facebook account. Considering that half a billion people do, that makes me pretty strange indeed, especially among my group of decidedly tech-savvy friends and acquaintances. Once upon a time, my reasoning for closing my account seemed pretty solid. I was worried about the privacy implications of a site that is constantly changing its terms of service and actively working to make it hard for people to hide their information from its real customers, the advertisers who pay for access to users’ information.

Since then however, I’ve become a huge proponent of Twitter, kept up my own website here, written extensively over at The Linux Experiment, and started a podcast with a few friends called SlightlySauced. I may indeed be guilty of oversharing, and my original reasons for leaving Facebook now sound silly, considering how much content I create for the Internet without the help of the online social network.

Just to poke fun at me, a good friend of mine recently re-wrote one of my favourite Onion News articles, Area Man Constantly Mentioning He Doesn’t Have a Television, supplanting my name and vitriol for Facebook for the original article’s content. It’s pretty funny, so I decided that I’d share it here:

WATERLOO, ON–Area resident Jonathan Fritz does not have a Facebook account, a fact he repeatedly points out to friends, family, and coworkers–as well as to his mail carrier, neighborhood convenience-store clerks, and the woman who cleans the hallways in his apartment building.
“I, personally, would rather spend my time doing something useful than playing Farmville,” Fritz told a random woman Monday at Wilfrid Laurier University, noticing the distinctive blue layout of the site on her laptop. “I don’t even have [an account].”
According to Tyler Burton, a roommate of Fritz at Richmond Square, a Waterloo apartment complex, Fritz steers the conversation toward Facebook whenever possible, just so he can mention not having an active profile.
“A few days ago, Kayla [Orr] was saying her new contacts were bothering her,” Burton said. “The second she said that, I knew Jonathan would pounce. He was like, ‘I didn’t know you had contacts, Kayla. Are your eyes bad? That a shame. I’m really lucky to have almost perfect vision. I’m guessing it’s because I don’t stare at Facebook. In fact, I don’t even have an account.”
According to Burton, “Stalkbook” is Fritz’s favorite derogatory term for the social networking site.
“He uses that one a lot,” he said. “But he’s got other ones, too, like ‘Zuckerberg the weasel’ and ‘waste of time.’”
Burton said Fritz always makes sure to read the copies of The Cord lying around their apartment, “just so he can point out all the Facebook groups he’s never heard of.”
“Last week, in one of the papers, there was an invitation to a group supporting improvements to the pool,” Burton said, “and Jonathan announced, ‘I have absolutely no idea what this issue is all about. Crumbling structure? Am I supposed to have heard of it? I’m sorry, but I haven’t.’”
Dave Lahn, who lives in an apartment several floors below Fritz’s and occasionally chats with the 23-year-old by the mailboxes, is well aware of his neighbor’s disdain for Facebook.
“About a week ago, we were talking, and I made some kind of profile picture reference,” Lahn said. “He asked me what I was talking about, and when I told him it was from Facebook, he just went off, saying how the last time he looked at the site there was some group supporting fair copyright, and even then, he could only read for about two minutes before having to go to Michael Geist because it insulted his intelligence so terribly.”
Added Lahn: “Once, I made the mistake of saying I saw something on the news feed, and he started in with, ‘Saw the news feed? I don’t know about you, but I read Digg.”
Fritz has lived without Facebook since 2008, when it kicked his dog or something.
“When I learned about the Canadian privacy commissioner’s investigation, the profile got deleted,” Fritz said. “But instead of just going back and reactivating it–which I certainly could have done, that wasn’t the issue–I decided to stand up to Zuckerberg, that weasel.”
“I’m not an elitist,” Fritz said. “It’s just that I’d much rather tweet or write on my blog or record a podcast than sit there passively staring at some eternally boring party pictures.”
“If I need a fix of lame interactions with so-called ‘friends’, I’ll go and do it in real life,” Fritz said. “I certainly wouldn’t waste my time perusing the so-called Mini-Feed or, God forbid, any of the mind sewage the Zynga idiots pump out.”
Continued Fritz: “People don’t realize just how much time their Facebook-using habit–or, shall I say, addiction–eats up. Four hours of Facebook a day, over the course of a month, adds up to 120 hours. That’s five entire days! Why not spend that time living your own life, instead of watching fictional people live theirs? I can’t begin to tell you how happy I am not to have a Facebook account.”
Hey, if you can’t laugh at yourself…

Digital Copyright and Bill C-32: My Ignite! Waterloo Presentation

Posted: November 29th, 2010 | Author: | Filed under: Local, Politics, Software | Tags: , , , , , , | 2 Comments »

A few weeks ago, I gave a shortened version of my C-32 and You presentation at Ignite! Waterloo. It was a great experience, and really challenged me as a speaker. Although I do quite a bit of public speaking, the format of this particular presentation required me to know my presentation cold, and to cut down on the rambling that usually gets me by when I inevitably forget everything shortly after taking the stage.

If you’ve never been out to an Ignite! event, I highly suggest that you check one out. It’s kind of like a TED talk, but each presentation is only 5 minutes long, and consists of 20 slides that auto advance every 15 seconds. Since the event had a videographer, you can choose to either watch my presentation or to scroll down to see my slides and notes. I won’t fault you for either.

Talking Pictures

For all you ADD-riddled folks with no patience, here’s the video version:

In Words

For those of you who like to read stuff, here are my slides and associated text. Keep in mind that the text below the slides is what I was supposed to say, and is not necessarily the same as what I actually said.

Slide 1: Introduction

Good evening everybody, my name is Jonathan Fritz. Tonight I’d like to speak to you about intellectual property. Before I begin though, I should stress the fact that I’m not a lawyer. I’m just a computer programmer who has spent way too much time reading way too much legalese. To save you from a similar fate, I’ll try to quickly brief you on everything that I’ve learned about copyright.

Slide 2: What is Intellectual Property?

Intellectual property is a fancy name that lawyers have given to the ownership of ideas. Since ideas are non-physical, intangible, and infinite things, a new set of laws had to be developed so that they could be owned in the same sense as the physical objects that we’re all used to. This lead to the three primary types of intellectual property and their associated bodies of law.

Slide 3: Trademarks

The first type of intellectual property that I’d like to address is called a Trademark. This is a distinctive sign or indicator that is used by a business to identify itself, its products, and services to customers. Common trademarks include slogans, catch-phrases, jingles, and logos.

Slide 4: PatentsThe second type of intellectual property is called a Patent. This is a set of legal rights that can be issued to the inventor or discoverer of some method or process. Once a patent has been granted, its holder retains the sole right to benefit from any implementation of their invention or idea for a finite period of time.

Slide 5: Introduction to CopyrightThe third type of intellectual property, and the on that I want to focus on this evening, is called Copyright. Once granted, it gives the author of a recorded work the exclusive right to distribute copies of that work for a finite period of time. Throughout most of the world, whenever you commit something to record, you are immediately granted copyright to that work.

Slide 6: Differences

Now the differences between these bodies of law are key. Both trademarks and patents protect ideas and concepts – abstract stuff that isn’t tangible. Copyright on the other hand, protects the expression of those ideas, like a book or a compact disc. When a work is copyrighted, the copyright holder can control who makes and distributes copies of the work, but not the ideas or themes that the work deals with.

Slide 7: Balance

The idea behind copyright is to provide an incentive for authors to make more stuff. We all enjoy the stuff that they make, and so we agree to give up some of our personal rights to ensure that they can afford to continue to make it. This requires that we strike a careful balance; we don’t want to give up too many rights, but we do want authors and artists to be able to make a living.

Slide 8: Poorly NamedCopyright is a poorly named body of law. The truth is, the rights that it provides aren’t natural rights as the name implies. They are awarded by governments and courts. This means that we all have to agree on the rights that copyright provides to both the author and the user of her work. This fact is often lost in the rhetoric surrounding debates about the subject.

Slide 9: Creative Commons

The idea of copyright only works because of the temporary monopoly that it provides. When that monopoly expires, the works that copyright protects go into the creative commons. This means that anybody can use them in any way, shape, or form. As copyright terms lengthen, works enter the commons with less regularity, and we chance losing access to our history and culture.

Note: This slide should read public domain in place of creative commons. The two are distinct and equally important concepts that shouldn’t be confused. Sorry. – Jonathan

Slide 10: How Temporary?In order for this temporary monopoly to work out, it has to be just that: Temporary. When copyright was original proposed, the term lasted for only fourteen years. In present-day Canada, copyright terms last for fifty years past the death of their original owner. In the USA and the UK, terms last for seventy years past the death of their original owner.

Slide 11: Artistic Inspiration

Artists are inspired by the works of others. “Good artists borrow, great artists steal.” That’s a Pablo Picasso quote that was stolen by Steve Jobs. Because artists don’t create in a bubble, they need access to past works in order to create inspiring and relevant art. If our works of art stop being distributed just as soon as they are no longer profitable to their owners, we as a society lose access to them.

Slide 12: Intro to C-32

Back in June, the Conservative Federal Government introduced Bill C-32. The goal of the bill is to modernize copyright law in Canada. This is a great idea, because our current laws date back to 1997.

Slide 13: The Rise of Digital MediaIf you’ve been on the internet since 1997, you’ll know that a lot has changed. The rise of digital cloud-based media like Hulu, Netflix, YouTube, Last.FM, and Pandora have really challenged our conception of traditional copyright. We don’t really have anything in our existing laws to handle these technologies.

Slide 14: You are a Criminal

In addition, common activities like ripping a CD or DVD to your computer, or taping a television show on your VCR or PVR to play back later are technically illegal under current Canadian law. The proposed bill includes lots of positive clauses that correct these problems with our current laws.

Slide 15: Piracy and File-sharingIn recent years, file-sharing has kind of broken down traditional media economies. Today, it is possible to make an unlimited number of perfect copies of a movie or a song and send them to friends via the internet for next to nothing. This poses a serious challenge to traditional media companies who made their money by controlling the distribution of physical media.

Slide 16: DRM as a ResponseTo counter this trend, media companies started to encrypt their content and began selling licenses to unlock it. This practice is called DRM, or Digital Rights Management. It generally stops people from making copies of their media, and is currently used to protect video games, movies, television broadcasts, and other media. Bill C-32 aims to make it illegal to break this protection once it has been placed on your media.

Slide 17: So Where's the Problem?The problem with this approach is that it has already been tried, and has failed miserably. In 1998, the USA passed the DMCA, or Digital Millenium Copyright Act. It resulted in thousands of people being sued by record and movie companies, and yet piracy rates have only increased since its introduction.

Slide 18: Piracy TimelineIn 1999, Napster was introduced, and file-sharing became a household phenomenon. In 2001, BitTorrent improved on the technology, and file sharers started to move entire movies around the internet in addition to smaller music files. By 2005, YouTube had made a business model out of sharing largely copyrighted music and video clips that were all ripped from protected sources.

Slide 19: A Call to Action

So get in touch with your government and make your voice heard. Anti-circumvention laws like those proposed in C-32 don’t work, and just result in people getting sued by entertainment companies who are cannibalizing their own consumer base instead of modernizing their business practices. Slide 20: Contact MeI’ve only managed to touch on the tip of the iceberg during this presentation, so please check out my various online presences or come and talk to me after the show if you’d like to discuss copyright and Bill C-32 farther.

In Closing

That’s about it. Be sure to check out all of the videos from this and past Ignite! Waterloo events on their YouTube page, and to take a look at the reviews that my colleagues Tyler Burton and Phil Downey posted earlier this week.


Passwords and Why Yours Suck: My KWDM Presentation

Posted: November 23rd, 2010 | Author: | Filed under: Software | Tags: , , , , , , | No Comments »

This post has been a long time coming. These slides are from a presentation that I did at the Kitchener-Waterloo Web Design Meetup back in October. The goal of the presentation was to teach people the importance of strong passwords, how to create good passwords, and most importantly, some techniques that can be used to manage all of the passwords that you create.

Passwords and Why Yours Suck

These days, a lot of people use cloud-based services to manage their personal information and communications. These services are great because they’re available everywhere and naturally protect your data from loss and disaster.

Unfortunately, each service requires a username and password to keep the data that it stores safe from others.

A selection of the cloud-based services that many people use

Naturally, this is a lot of passwords to remember. Some people try to counter this problem by using short, easy to remember passwords. These often consist of names of loved ones, favourite sports, or curse words with numbers appended to the end.

A selection of common easy-to-remember passwords that people use

The problem with this approach is that it creates an easy target for people who try to break into your account by brute force.

Brute forcing is an attack method that tries to guess every possible password

The whole idea behind a brute force attack is to guess every possible password that can be created out of an alphabet of characters. As the length of your chosen password and the number of possible characters that it could be made up from increases, the number of possible passwords increases exponentially.

As the length of a password and the number of characters that it could be made up of increases, so does the number of possible passwords

Because most people make passwords out of common words, another approach that an attack can take is a dictionary attack. This is kind of like an educated brute forcing. The attacker starts guessing passwords from a dictionary of known words, names, and other significant strings. This can significantly reduce the time that it takes the attacker to guess the average password.

Dictionary attacks begin by guessing passwords from common words and phrases

The obvious defense against both of these attacks is to choose really long and complicated passwords that are made up of all kinds of different characters and don’t contain dictionary words. These will make brute force attacks infeasible and defeat dictionary attacks altogether.

IT Departments have been telling us to make our passwords more complicated for years now

Unfortunately, these passwords are extremely hard to remember. Every IT department in the world has been telling us to follow these rules for years now, and yet nobody does.

Realistically, the average person cannot remember a good number of suitably complicated passwords

Whenever IT departments insist on implementing draconian password policies, users become frustrated when trying to remember them, and some inevitably seek other ways to keep them in the forefront of their minds.

To compensate for complicated passwords, people often leave reminders on slips of paper around their offices

So what is a responsible computer user to do? Long, complicated passwords are necessary to keep your data safe, but writing them down is dangerous. Luckily, plenty of other people have had this problem before, and a few of them have come up with some solutions.

LastPass is a cloud-based utility that saves all of your passwords securely on their servers

LastPass is a pretty cool cloud-based application that stores all of your passwords in a securely encrypted container on the LastPass servers. The company provides plugins for all of the popular web browsers that allow you to access your passwords securely from any computer.

The combination of KeyPass and Dropbox is another possibility that will allow you to move your passwords between multiple=

Another possibility is the combination of an application called KeePass and a cloud service called Dropbox. KeePass (and its open-sourced linux-based cousin, KeePassX) store your passwords in an encrypted container format on your computer. If you store that container file in a Dropbox folder, your passwords are safely accessible from any computer in the world. Unfortunately, there’s always a catch.

Of course, a password is only as safe as its keeper

A basic rule of cryptography is that a secret is only as safe as its keeper. This is similar in concept to that old adage about the weakest link in a chain.

Although both LastPass and KeePass solve the problem of keeping a lot of passwords safe, it’s important to remember to keep the master password safe. Ideally, it should be committed to memory and not shared with anyone.


The Minister’s Response

Posted: August 23rd, 2010 | Author: | Filed under: Politics | Tags: , , , , , , , , | 2 Comments »
This evening I received an email from the Honourable James Moore. At first glance, it appears to be a form letter in response to the letter that I sent to him and other federal government representatives well over two months ago. Perhaps his tubes were clogged. According to Mozilla Thunderbird, it also appears to be a scam.

Perhaps thunderbird is right... Bill C-32 could rightly be called a scam

And so without  further ado, here is the Minister’s response, as annotated by yours truly:

Thank you for writing to me about copyright policy. I appreciate you taking the time to share your views with me on this important issue.

No, you don’t.

My colleague, the Honourable Tony Clement, Minister of Industry, and I are pleased to inform you that our Government has introduced legislation to modernize the Copyright Act, bringing it up to date with the advances of the digital age.

Yes, three months ago. If I wasn’t aware that you had done such a thing, I probably wouldn’t have written you two different letters about said legislation.

This legislation will bring Canada in line with international standards and promote home grown innovation and creativity. It is a fair, balanced and common-sense approach, respecting both the rights of creators and the interests of consumers in a modern marketplace. We are working to secure Canada’s place in the digital economy and to promote a more prosperous and competitive country.

On this note, we disagree. Perhaps you should take some time to review the aforementioned letters instead of sending me back a useless form letter response.

The popularity of Web 2.0, social media and new technologies such as MP3 players and digital books have changed the way Canadians create and make use of copyrighted material. This bill recognizes the many new ways in which teachers, students, artists, software companies, consumers, families, copyright owners and many others use technology. It gives creators and copyright owners the tools to protect their work and grow their business models. It also provides clearer rules that will enable all Canadians to fully participate in the digital economy, now and in the future.

And with the anti-circumvention clauses that are built into the bill, it does all of this at the cost of consumer rights, and applies a Made in the USA approach to Canadian copyright law. Digital rights management schemes do not protect against wide scale piracy, and anti-circumvention laws that give them legal protection serve only to limit the ability of everyday Canadians to use their lawfully purchased media in a fair and open manner.

Detailed information about the bill is available on-line at http://www.balancedcopyright.gc.ca.

Please accept my best wishes.

Sincerely,

The Honourable James Moore, P.C., M.P.

Hopefully his best wishes are better than his best efforts to acknowledge the concerns of people who disagree with his proposed legislation.

It’s probably silly of me to expect anything more than a poorly written form letter in response to my concerns. In truth, I didn’t expect anything at all, and was surprised when Moore’s ridiculously overdue response hit my inbox tonight. After all, Moore isn’t even my Member of Parliament. But as far as I’m concerned, nothing at all would have been better than this thoughtlessly canned response.


C-32 and You: My #kwdm Presentation

Posted: July 31st, 2010 | Author: | Filed under: Local, Politics, Software | Tags: , , , , , , , , , , , | 2 Comments »

This past Thursday, I did a presentation about the dangers of Bill C-32 for the Kitchener Web Design Meetup (KWDM). It went really well, and the audience had a lot of questions and provided some great feedback. Unfortunately, since I didn’t think to record the audio from the presentation, you’ll have to make do with my slides and notes. Enjoy.

  1. Introduction

    • Good evening, my name is Jonathan Fritz. Tonight I’m going to attempt the nearly impossible: I’d like to discuss copyright law, while not putting you to sleep
  2. Not a Lawyer

    • Copyright law is something that I’ve taken an interest in during my spare time. I’d like to make it clear from the outset that I am not a lawyer.
  3. I am a Programmer

    • During the day, I’m a programmer for a small company called Skybound Software, and the co-owner of another small company called inScope Software and Solutions
    • The only reason that I mention these is because I want to make it clear that everything that I talk about this evening is 100% my opinion, and does not necessarily reflect the opinions of my employers or business partners
  4. The Crowd

    • Now that the boring legal crap is out of the way, let’s jump into some more boring legal crap
    • Ok, so I’d like to see what kind of people we have in the audience tonight. Show of hands if you’re a:
      • Web developer
      • Web or print designer
      • Artist, photographer, or musician
      • Programmer or engineer
    • You may not realize it, but copyright law affects each and every one of you every single day
  5. Copyright

    • Any time you commit something to record, be it a computer program, a photograph, a piece of music or art, it is covered in Canada by copyright.
  6. What is Copyright?

    • Copyright is a poorly named body of law that gives people who make stuff a monopoly on the distribution of that stuff for a finite period of time
    • This is an effort to ensure that they make a decent living off of their stuff, and thus have an incentive to make even more stuff.
    • As a society, we enjoy the use of the stuff that they create, and so we give up some of our personal rights and freedoms to ensure that the people that create stuff can afford to continue to do so.
  7. Poorly Named

    • I say that copyright is poorly named because it isn’t actually a right
    • It’s a privilege awarded by law, and thus by society as a whole.
    • In order for this to work, we have to all agree that the terms set out in copyright law are an appropriate balance between personal freedoms, and creators’ ability to make a decent living.
  8. Lord Macaulay

    • During an 1841 debate in the British house of commons, one Lord Macaulay did a great job outlining this dilemma:
  9. Evil Quote

    • “[Copyright] is a tax on readers for the purpose of giving a bounty to writers. The tax is an exceedingly bad one… It is good that authors should be remunerated; and the least exceptionable way of remunerating them is by a monopoly. Yet monopoly is an evil. For the sake of the good we must submit to the evil; but the evil ought not to last a day longer than is necessary for the purpose of securing the good”
  10. Inspiration

    • So here’s the thing: In order for the temporary monopoly to work out as planned, it has to end within a reasonable period of time.
    • Society has to get their rights back at some point, or else they aren’t getting a fair deal.
    • Artists’ work is informed and influenced by the work of their contemporaries.
    • Without the ability to access, borrow from, or outright steal inspiration from other pieces of art, most artists wouldn’t be able to create with any kind of regularity.
    • Pablo Picasso by way of Steve Jobs: “Good artists borrow, great artists steal”
    • Imagine taking a photo haven never seen another persons’ work with lighting and composition.
    • Writing a song without ever nicking a particularly nice chord or melody?
    • Artists don’t create in a bubble – they filter and combine all kinds of different influences into works of their own.
  11. Ghosts

    • Way back in ancient history, the monopoly awarded by copyright only lasted 14 years.
    • After that period, it was assumed that the rights’ holder had made his money (and it was always his money), and the work moved into the creative commons, meaning that anybody could use it however they saw fit.
    • Today in Canada, copyright lasts 50 years past the death of the rights’ holder.
    • Some countries have pushed that up to 70 years past death
  12. Afoul of the Law

    • This means that far less media ends up in the creative commons while it is still relevant to society, which makes it increasingly hard for artists to create without running afoul of the law
  13. Preservation of Culture, intro to C-32

    • More importantly, when reinforced by something called digital rights management, copyright laws make it very possible that our culture will not be preserved in the same way that past cultures were – but more on that later
    • Back in early June, the conservative government released Bill C-32, “The Copyright Modernization Act.”
    • It has been sponsored by the Honourable James Moore, Minister of Heritage and Official Languages, and the Honourable Tony Clement, Minister of Industry.
    • Just like the title says, this bill aims to modernize Canadian copyright law. This is a really good idea, because our current laws were haven’t been revised since 1997
  14. 1997 Websites:

    • In 1997, the top five websites on the internet were:
      • Geocities
      • Yahoo (including services called yahooligans, yahoo sports, and my yahoo)
      • Starwave corporation “where more people click”
      • Excite, Magellan, and City.net
      • PathFinder, and the family of Time/Warner and CNN sites
  15. 2010 Websites:

    • In March of 2010, the to five websites were: (15)
      • Google
      • Facebook
      • Yahoo
      • YouTube
      • MSN
  16. You are a criminal

    • As you’ve probably noticed, a few things have changed.
    • Old folk may also remember that the infamous Napster, the first file-sharing service, wasn’t invented until 1999.
    • And BitTorrent, the American entertainment industry’s nefarious arch-enemy wasn’t invented until 2001.
    • Similarly, YouTube, harbinger of all things evil, didn’t hit the tubes until 2005.
    • Simply put, our existing laws don’t cover any of these massive shifts in technology, and many of the things that Canadians do on a daily basis are actually considered illegal under current laws.
  17. The Good

    • Some important sections of proposed law that aims to fix these problems:
      • Network Services section:
        • a safe harbour clause for Internet service providers and other network operators.
        • Provides legal protection for hosting service operators whose customers may have uploaded copyrighted works to their servers
      • Copyright Infringement section:
        • sets maximum monetary awards for copyright owners who successfully charge an individual with infringement of works for personal or commercial use.
        • Given the astronomical awards granted by American courts in both the Capitol vs. Thomas (2007) and RIAA vs. Tenenbaum (2009) cases, this is an extremely important clause
      • Non-commercial User-generated Content section:
        • Makes it totally legal for you to sample copyrighted works for the purposes of creating a non-commercial mashup.
        • Now you can legally use whatever music you like as the soundtrack to your cute kitten and dancing baby videos.
      • Reproduction for Private Purposes section:
        • Allows for time and format shifting practices, thus making TiVo and iPods legal technologies in Canada, which sounds like something out of that old Rick Mercer bit, Talking to Americans.
  18. The Bad

    • Technological Protection Measures and Rights Management Information section: counteracts every positive aspect of the proposed bill
    • Bans any technology or device capable of circumventing any technological protection measure (TPM) or called digital rights management (DRM) schemes that have been placed on the digital content by its distributor
    • The bill is written in such a way that this clause takes precedence over every one of those really cool sounding amendments that I just mentioned.
    • Basically, should C-32 pass, you’ll get a whole bunch of rights. But if the distributor of some media decides to put DRM on their products, they don’t matter, and you become a criminal if you attempt to exercise any of them.
    • At this very moment, DVDs, BluRay discs, video games, Cable television, Netflix digital downloads, eBooks, computer software of all sorts, online television services, and an uncountable number of other current and future consumer media products are all protected by some form of DRM.
    • Under the proposed law, none of this digital content can be backed up, moved to a different device, transcoded to a different format, or otherwise tampered with, because to do so would require that its owner break the DRM that has been placed on it, thus making that person a criminal in the eyes of Canadian courts.
    • So why do manufacturers use DRM anyway? Well, they seem to have gotten this idea that it somehow prevents people from pirating their media. Unfortunately, this belief could not be further from the truth.
  19. Passive Systems

    • To demonstrate this problem, I’ll give you a bit of background on how DRM technologies generally work, demonstrate why they often fail, etc
    • There are basically three kinds of DRM
    • Passive Systems: The distributor of a file encrypts that file with a secret key that’s so big that it is theoretically impossible to guess.
    • She then makes a deal with the manufacturer of the device that is used to play back that file, and embeds the secret key into that device.
    • When a user attempts to play back the media file, the device is able to unlock it, and everything is cool. This is how DVDs work
    • Why they Suck: These systems tend to be very insecure, because they’re susceptible to what cryptographers call a class break.
    • Because all copies of the media file are encrypted with one of a finite number of keys, if somebody figures out a way to break through one copy of the protected media, he can usually manage to break through any piece of media that is protected with the same scheme.
    • Further, all of those keys are stored inside of some piece of software or some device in your living room that you have access to. It is only a matter of time before one is broken into, and the scheme is broken.
  20. Active Systems

    • Just like before, the distributor of a file encrypts it with a massive secret key.
    • This time, however, she buys some servers, and makes a different deal with the people who distribute playback devices.
    • Now, when a user tries to play a file, the player connects to the server and asks for permission to play the file.
    • The server checks if the user is legitimate, and if so, gives the encryption key to the device. The media is then unlocked, and you can hear your tunes.
    • This is how video game DRM from services like Steam and Electronic Arts work.
    • Because these types of protection call home for permission to start playback, they require that the user has an always-active internet connection.
    • For those with dial up or using mobile devices, this is not always possible, so the scheme has to allow a certain number of plays without speaking to the home server.
    • By definition, this means that they can be attacked, because they can be fooled into thinking that they are always in this limbo state
    • Hybrid Systems: As the name implies, these present some combination of the previous two. In general, the media is encrypted, but in order to unlock it, the playback device executes some program that is embedded in the media that performs the authorization step.
    • This program can usually be easily updated, so that if the scheme is broken, it can be fixed in the field. This is how BluRay discs are protected.
    • These are far more complex than their simple cousins, but also quite a bit more resilient to attack.
    • Unfortunately, in the past, programmers have included malicious code in these types of systems that do some nasty low-level stuff to the users’ computer, potentially leaving it open for attack.
    • This is what happened in the Sony Rootkit case of 2005, in which Sony BMG released 52 CD titles that altered the way that Microsoft Windows functions in an attempt to block users from copying their contents
  21. Consumer Suck

    • From a consumer perspective, all DRM systems suck.
    • By design, they intentionally limit what users can do with their digital media (see Defective by Design). This means that using digital media that is protected by a DRM scheme is more like licensing it than like purchasing it
    • Additionally, all types of DRM can result in property loss.
    • In the case of passive systems, this can happen if the devices used to play back the media are no longer produced.
    • In active systems, this can happen if the servers that are used for authentication are shut down. This often happens when a digital store ceases to be profitable, or if the company that operates it goes out of business
  22. Getting in the Way

    • DRM systems that are designed to prevent people from pirating media also tend to get in the way of legitimate customers who are attempting to use their media in perfectly legal and acceptable ways
  23. Smart Cows

    • Perhaps the most compelling evidence against the legislation of DRM systems is that they simply do not prevent people from pirating media.
    • In general, if you can open a legitimately purchased file, its contents can be copied out to a non-protected format, which can then be distributed.
    • If you can’t said file, but happen to be a hacker or encryption expert, you can usually figure out how to do so in short order
    • As soon as the DRM scheme is broken by one person, they can distribute it all other interested parties by way of the internet.
    • This is called the Smart Cow Problem (it takes only one cow to learn how to open a latch, and then a method can be developed that allows others to follow), and is the biggest issue facing companies relying on DRM to protect their products.
    • Combine this with the fact that every DRM system that I have ever heard of has been broken, often within weeks of release, and that the cost of creating and maintaining a DRM infrastructure can easily run into the billions, and you can see that it isn’t really a great technology to rely on to protect your digital media.
  24. Ineffective Laws

    • If anti-circumvention laws were truly effective, piracy should never have become the problem that media companies claim that it is today
    • In the United States, the Digital Millenium Copyright Act (DMCA) put anti-circumvention laws like the ones proposed in Bill C-32 in place a full year before the invention of Napster and three years before the introduction of the BitTorrent file-sharing protocol
    • Although laws don’t translate directly into persecutions, they give authorities the tools to stop piracy.
    • In the United States, the MPAA and RIAA have used these tools to bring lawsuits against more than 20,000 of their own customers – and yet, piracy is still a major problem for their member organizations.
  25. Locks

    • DRM schemes are no more than the digital counterparts of real-world mechanical locks. There has never been, and will never be, a lock that cannot be broken by any determined party with time, knowledge, and resources on their side.
    • Because of these reasons, it is my opinion that the anti-circumvention clause in Bill C-32 makes its current form unacceptable to the Canadian people.
  26. What We Can Do

    • I’ve been trying to get the word out about this issue in my own way. Obviously, I’m here speaking to you tonight. I’ve also tweeted about the issue, written blog posts on my website and others, written letters to various members of parliament, and spoken personally with Peter Braid, my member of parliament up in Waterloo
  27. Contact Me

    • If you’re interested in getting involved, in telling me that I’m wrong, or just in talking more about this issue, please don’t hesitate to contact me

MP James Moore: Please Drop the Rhetoric

Posted: June 23rd, 2010 | Author: | Filed under: Politics | Tags: , , , , , , , , , , , | No Comments »

We tried to be civil. Unfortunately, Conservative Heritage Minister James Moore has decided to take the battle over Bill C-32 to a new low:

In the video, Moore frames all opposed to his precious copyright reform bill as fear mongers and evil doers who are against any kind of copyright reform. This kind of false rhetorical framing will not result in a copyright solution that benefits all affected parties. Instead, it just muddies the waters and makes it tough to have a real discussion about the important issues that are at hand.

As many have probably guessed from the contents of my website and twitter stream, I am against the current iteration of Bill C-32. That said, I believe strongly that copyright reform is necessary in this country. Our current laws were written before the internet really took off, and need to be modernized in order to effectively deal with new technologies and situations. Most of the proposed bill is quality content, but the Section 41, Technological Protection Measures and Rights Management Information, is not.

Mr. Moore needs to step down from his high horse, cut out the rhetorical bullshit, and join in on the discussion that we are having about his proposed bill. Plugging your ears and screaming ‘na-na-na-na-boo-boo’ just doesn’t cut it when you’re an elected representative of the people.