Adding extension associations to Mac OS X

Share

Whenever I have data that I want to save quickly in Python, I use the cPickle module to write the data to a binary *.pkl file. It’s a great module, but unfortunately the PKL extension isn’t recognized by Mac OS X. Here’s a neat little trick I found for teaching MacOS to recognize unusual/unknown extensions:

First, open Automator and save a blank Application. Right-click the application and select Show Package Contents. Navigate to Contents, and edit Info.plist in a text editor. Search for the string “CFBundleDocumentTypes” and replace everything from <key>CFBundleDocumentTypes</key><array> to </array> with the following:*

<key>CFBundleDocumentTypes</key>
<array>
	<dict>
		<key>CFBundleTypeExtensions</key>
		<array>
			<string>pkl</string>
		</array>
		<key>CFBundleTypeName</key>
		<string>Pickle Document</string>
		<key>CFBundleTypeRole</key>
		<string>None</string>
	</dict>
</array>

Save the file and you’re done!**

Now when I hit return to edit the file name, it only selects the part before the extension, rather than the whole thing. It’s a tiny change, but it will make using these files so much easier from now on!

Create new extension association and icon in SnowLeopard – Super User.

* Feel free to change the bold parts to whatever you want.

** If the *.pkl extension still isn’t recognized, move the application to another folder and then back again to update your OS’s Launch Services database.

Share

Bookmarklets for Google Maps Directions

Share

I just made a set of bookmarklets to give me Google Maps directions to the text I’ve selected in my browser. I thought I’d share them in case they’re useful to anyone else!

If you want to use a bookmarklet, click and drag any of the below links into your browser’s bookmarks bar. If that doesn’t work, you can try one of the other options here.

Bookmarklet #1: Driving Directions

Code:

javascript:window.open('https://maps.google.ca/maps?saddr=Your+Address+Here&daddr='+encodeURIComponent(document.getSelection()));

Bookmarklet #2: Transit Directions

Code:

javascript:window.open('https://maps.google.ca/maps?saddr=Your+Address+Here&daddr='+encodeURIComponent(document.getSelection())+'&dirflg=r&ttype=now&noexp=0&noal=0&sort=def&start=0');

Bookmarklet #3: Walking Directions

Code:

javascript:window.open('https://maps.google.ca/maps?saddr=Your+Address+Here&daddr='+encodeURIComponent(document.getSelection())+'&dirflg=w');

Bookmarklet #4: Biking Directions

Code:

javascript:window.open('https://maps.google.ca/maps?saddr=Your+Address+Here&daddr='+encodeURIComponent(document.getSelection())+'&dirflg=b&lci=bike');

These bookmarklets open the map in a new window, but if you’d like the map to open in the same window, you can edit the bookmarklet by replacing javascript:window.open( with javascript:location.href= and removing the closing parenthesis ) at the end. For example:

javascript:window.open('https://maps.google.ca/maps?saddr=Your+Address+Here&daddr='+encodeURIComponent(document.getSelection())+'&dirflg=b&lci=bike');

would become

javascript:location.href='https://maps.google.ca/maps?saddr=Your+Address+Here&daddr='+encodeURIComponent(document.getSelection())+'&dirflg=b&lci=bike';

Hope these come in handy!

Share

Bletchley Park: The Undiscovered Country Estate (where we used computers to beat the Gerries)

Share

Wrens operating the Colossus computer, 1943
Image from the BBC

I watched a documentary a few days ago called “Code-Breakers: Bletchley Park’s Lost Heroes,” about Tommy Flowers and Bill Tutte of Bletchley Park. Any time I watch a documentary about scientists or engineers who went unrecognized during their time, they are invariably women; Rosalind Franklin comes to mind, or Ada Lovelace. And so I kept expecting a woman to appear in the doc, but none materialized. I was disappointed, but it took me a few days to figure out why.

Continue Reading »

Share

Kids Today! (wherein I gripe about old people griping about young people)

Share

I dread elections for several reasons, but the main sore point for me is that I end up having to watch old people slander me for a month and a half. Every election, pundits joyously proclaim that my generation isn’t interested in politics, and they cite all sorts of wonderful studies and crow about their superiority and then they don’t do anything about it. They don’t even seem to care what’s driving the disparity in voter turnout; obviously, the only reason that we turn out is lower numbers is because we’re lazy, and there’s no need to probe any deeper than that into the issue.

I’m a young person, and I’ve voted in every single federal, provincial and municipal election I could since I hit legal age. I’m not a rarity, either, so I think the old fogeys at the CBC and at CTV need to stop being such dicks about the decrease in youth voter turnout. They’ll take advantage of any opportunity to complain about how our generation is lazy* or that the internet is killing society (because young people use it, obvs). That’s not productive at all. Instead, let’s accept this information (lower voter turnout among younger people) without blaming young people and without making ridiculous and baseless assumptions about Kids These Days.

I’m making a list of possible reasons why youth in Canada don’t turn out in the numbers that other age groups do. If we can pinpoint the reason, that will help us solve the problem. Here is what I have so far:

  • Getting to the polls is more difficult if you don’t have a car or a bike. Urban sprawl may be hitting a point where polling stations are further away than people are willing to walk. I’m fortunate in that I live about a 5-minute walk from mine, so it’s not a big deal that I don’t own a car, but that’s probably not the case for everyone. If older voters have cars and younger voters don’t, younger voters far from polling stations may be more likely to stay home.
  • Youth aren’t the heads of households, so canvassers may be ignoring them entirely when going door to door.
  • Young people are more likely to own cell phones than a home phone. Cell numbers may not be listed as frequently in the phone book, meaning that canvassing by phone may not reach them either.
  • Youth may not receive political flyers (the sort that list a candidate’s campaign platform) because they’ve moved out of their parents’ house and haven’t forwarded their mail.
  • If you’re living in a different area from where you’re registered, you may not get your form in the mail.
  • Youth may be better at blocking out advertising, meaning that political advertising and spam mailers may be less effective at making them aware of election dates and protocols, as well as party platforms.
  • Aside from having a Facebook page and sending out a few tweets around budget time, not enough effort is made to communicate with voters over the Internet.
  • Alienation due to negative coverage.
  • Politics is discussed in boring terms, natch. I will battle anyone who claims that my generation is lazier than the baby boomers, but I will acknowledge that I have the attention span of a mustard seed.
  • Lack of policies targeting youth. If none of the parties plan to do anything about youth issues, it makes no difference to the youth vote which one is elected.
  • Our generation is much more diverse than the last generation, but our politicians don’t reflect that diversity. This leads to further alienation and further apathy.
  • Baby boomers had parents who were willing to give their lives for their country; we had parents who were willing to smoke a lot of weed and read beat poetry. This might have an effect on our level of engagement and our appreciation for democracy.
  • Baby boomers grew up during the cold war, which could have lead to an Us-vs-Them mentality that increased political engagement. Politics seems like it was a lot more fun back then, with prime ministers pirouetting around all over the place and PM wives partying with the Stones. The most interesting thing about Stephen Harper is the possibility that he might be a robot.
  • The youth vote is likely more urban, with younger people moving into the cities at the beginning of their careers and then moving out when they want to start a family. If this is the case, their votes might actually be worth less than the votes of older people, because these urban ridings have higher population numbers.
  • We’ve seen a pile of elections in only the last few years, so voting may feel pointless.
  • If you’re young and you don’t earn enough money yet to pay taxes, you may not end up on the list of electors.

I welcome any other suggestions of explanations. Let’s fix this!

* You see, the generation before us broke the economy, but it’s not their fault that we can’t find jobs and have to move back in with our parents, it’s our fault because we’re lazy. That’s how it works. We can’t find jobs because of laziness.

Share

Howlin’ Tucker Plays the Blues

Share

This is fascinating. A scientist should study this.

Share

TRON.

Share

So today I want to talk about TRON: Legacy, but I am finding it difficult to find the words to explain why I love it so much. So I made a list instead, and I hope that at least one thing on the list will make you want to watch it and enjoy it as much as I did.

  1. Daft Punk made the music. There is no way to overstate just how much this makes the entire movie. Daft Punk are GENIOUSES at the top of their craft, and they could not have written a more perfect soundtrack.
  2. It draws heavily from Blade Runner and the Fifth Element, two of my favourite films.
  3. Rather than rejecting the camp, it embraces it. Even the cheesiest dialogue is done with a wink.
  4. The visuals are stunning, and I love the way they restyled the interceptor ships.
  5. It certainly helps that the ’80s are big right now, because this movie is super ’80s and it works really well.
  6. Jeff Bridges has an uncanny ability to jump back and forth from The Sage to The Dude.
  7. Some people may disagree with me, but I thought the story was actually not half bad. You got to know the characters, feel for them, there was a goal they had to accomplish and you wanted them to accomplish it. Yes, it may have been a little predictable. It may have been a little Hollywood. Most Hollywood movies are Hollywood, and that’s not a bad thing. Not every movie has to have a complex plot to be enjoyable. If you’re the type of person who wants every movie to be Eraserhead, then watch Eraserhead.

There are some down sides to the movie, but I wouldn’t necessarily call them down-sides as much as I would call them “things I ignored because the other parts of the movie enveloped them with their awesomeness.”

MILD SPOILER ALERT

Continue Reading »

Share

It starts with a Dalek and goes from there

Share

This is the greatest thing that has ever happened, in the history of the world, anywhere, ever.

Also, that’s an extremely deep V that he’s wearing.

Share