Showing posts with label todo. Show all posts
Showing posts with label todo. Show all posts

Friday, June 12, 2009

Recommended Canadian Content of the Week: Barenaked Ladies

I remember first becoming aware of Barenaked Ladies when CBC Radio began playing If I Had $1,000,000 and Be My Yoko Ono and interviewing the band before the album Gordon was released. I was struck by their humour (Canadian spelling intentional) and their musical skill was evident.

I bought Gordon as soon as it was available, and it's still one of my favorite albums (by any group or artist). It was very popular in Canada, especially with my circle of friends. I've seen them live twice, and enjoyed their improvisation and sense of humor—they seemed to really enjoy performing, playing music and each other's company.

The Wikipedia article on them is very interesting reading. Don't miss the first two paragraphs under "Indie Origins". I searched YouTube and found this short excerpt of their Speaker's Corner performance of Be My Yoko Ono. (See the last paragraph under "Indie Origins".)

I admire the group for the unabashed Canadian references in their music, even after their success in the U.S. They seem proud of their origins, but are not humorlessly patriotic. Growing up in Canada I was always aware of Canadian artists, and it irked me when (it seemed to me) they forced American references into their music as if they were ashamed of where they were from. (I should collect examples of this. I don't think it would be hard to find several.) Now, of course, I realize this wasn't out of shame but was probably a desperate attempt to increase their chances of commercial success south of the 49th.

My father mentioned during my parents' recent visit that the band had broken up. Actually (at least according to Wikipedia), Steven Page has left the group. I'm sorry to hear that—the band of course won't be the same without him—but I wish him and the remaining BNL members good luck in their continued careers. I'll follow them all with anticipation of more good music.

A couple more of my favorite songs of theirs:

I also recommend their childrens' album Snack Time. I'm always happy to listen to that with the kids. The song The Canadian Snacktime Trilogy i) Snacktime is a lovely tribute to Gordon Lightfoot. And Crazy ABC's is hilarious.


Friday, March 6, 2009

A tr.im TextExpander snippet that works for me

At the end of A TextExpander snippet to paste quoted text I gave myself a to-do to create (or find) a TextExpander snippet to create a tr.im shortened URL. tr.im is currently my favorite URL shortening service. Not only is the domain short and easy to remember, but (if you sign up for an account) they provide stats for each “tr.immed” URL.

A Google search found this post on the SmileOnMyMac Blog (from the makers of TextExpander), where you can download a snippet that works. But it’s unnecessarily complicated. After reading the tr.im API documentation I simplified it to this shell script:
#! /bin/bash
curl -u yacitus:xxxxx http://api.tr.im/api/trim_simple?url=`pbpaste`
Note that Blogger refuses to make this column any wider or use a scrollbar to show all of this code. But the text is there; just copy it and paste into your favorite text editor. (You'll need to use the same trick to see all of the code for the other bash one-liner and the Python code below.)

(You’ll of course want to replace “yacitus” with your tr.im username and replace “xxxxx” with your password.)

The problem with this is that it doesn’t work for me at work, where I use the Authoxy proxy server. I can make it work with:
#! /bin/bash
curl -u yacitus:xxxxx -x localhost:8080 http://api.tr.im/api/trim_simple?url=`pbpaste`
…but then it doesn’t work when I’m at home (and not using Authoxy). curl, unfortunately, doesn’t auto-detect proxy settings.

Once again, Python comes to the rescue. I read in “Fuzzyman’s” urllib2 - The Missing Manual that the Python urllib2 module will auto-detect proxy settings, so I wrote this script:
#!/usr/bin/env python
"""
This script writes to stdout a tr.im version of the indicated URL.

"""

import urllib2
import sys


TRIM_API_URL = 'http://api.tr.im/api'
USERNAME = 'yacitus'
PASSWORD = 'xxxxx'


def main():
"""The entry function."""
url_to_trim = sys.argv[1]
if not url_to_trim:
print "ERROR: one (and only one) argument accepted--the URL to GET"
return -1

response = urllib2.urlopen('%s/trim_simple?url=%s&username=%s&password=%s'
% (TRIM_API_URL,
url_to_trim,
USERNAME,
PASSWORD))
print response.read().strip()

print response.code

return 0



if __name__ == '__main__':
sys.exit(main())
Like in A TextExpander snippet to paste quoted text, I put this in a file called trim_url, did a chmod +x on it, created a symbolic link to it in /usr/local/bin/, and created my TextExpander snippet:










I could have saved myself a lot of time if I had stopped there. But I read on http://tr.im/api that basic HTTP authentication is preferred over the query string parameters I used above. So I figured it would be a learning opportunity to implement basic HTTP authentication in Python. The problem is, I’m not done learning yet! I have yet to get it to work. I posted my question on the BayPIGgies mailing list where I got some good advice on how to debug it (but no one saw the problem), and I also posted a question on stackoverflow.com where I got one answer that may be an improvement on the query string parameters, but again no one saw the problem. I guess I’ll have to take jj’s suggestion and look at what is being sent over the wire. When I figure it out I’ll post the answer on my PyPap blog (and of course on the BayPIGgies mailing list and stackoverflow.com).

Sunday, January 18, 2009

I use two iPhone Twitter apps

Twitter has plenty of meta-discussion. (TODO: It would be interesting to approximate the percentage of tweets that are about Twitter.) Very frequently (at least among the people I follow) the discussion is about iPhone apps for Twitter. More often than any other, I see people recommend Tweetie. Though Twitterrific is mentioned frequently, and I see TwitterFon come up increasingly often.

I use Tweetie and Twitterrific Premium. The contrast between the two is interesting. They're both excellent, well-polished apps that illustrate two different approaches to designing a quality iPhone application.

I use Tweetie often enough that it gets a spot on my main launcher screen (reserved for the apps I use more frequently). It's full-featured. In fact, it seems like I can do just about anything in Tweetie that I can do from twitter.com.

But I use Twitterrific more often than any other iPhone app, so it gets the privileged spot on the bottom left (on the strip on the bottom that appears on all launcher screens). Twitterrfic is a good example of the "do one thing only and do it well" school. Twitterrific's one thing is reading tweets. It does that so well that I prefer it to twitter.com on my MacBook Pro (though I haven't tried any desktop Twitter apps).

Twitterrific Premium's killer feature (which I haven't seen or heard of in any other iPhone Twitter app) is how it "maintain[s] a reading position between launches of the application". (I think this feature is not in the free version of Twitterrific.) This is why Twitterrific is my most used iPhone app. I can very quickly launch is and scan through all the new tweets since the last time I checked.

As I'm reading in Twitterrific, if I see a tweet with a URL that looks interesting that I want to take the time to look at later (especially if I don't want to take the time to wait on EDGE), I'll mark it as a favorite.

Then later (when I'm on WiFi on my iPhone or my MBP), I'll use Tweetie (or twitter.com) to scan through my favorites and un-mark them after I read them.

I also use Tweetie occasionally to check for replies.

And Tweetie is better for writing tweets, especially if I want to include someone's name or a URL. And the new version 1.2 has an optional landscape keyboard.

Loren Brichter updates Tweetie much more frequently than Craig Hockenberry updates Twitterrific. But that is expected when you think about it, since there is always plenty of opportunities for new features and improvements to a full-featured app like Tweetie, whereas Twitterrific is so specialized and so polished that @chockenberry should be very careful not to fix something that isn't broken. But if @atebits adds a "maintain reading position" feature to Tweetie that works reasonable well, I may give up using Twitterrific and give Tweetie the place of honor on my iPhone.

But when/if that happens, I won't regret the $10 I spent on Twitterrific Premium. I use both often enough and both are so pleasant to use that the $10 and the $3 for Tweetie was money well spent. I recommend both.

Update: I remembered one more situation where Tweetie comes in handy. Twitterrific has a limit on the number of tweets it will hold, so if I can't make time to check it for a while, or if the number of tweets is much greater than usual for some reason (such as the inauguration), then when I come back to Twitterrific I'll notice that the "last read" tweet is at the bottom of the list and I won't remember reading it. In Tweetie's advanced settings I've changed the "Initial Load" to 100 (from the default of 20), so I can catch up on missed tweets often by just opening Tweetie and scrolling down (or maybe touching "Load more..." a single time). Yes, I know that Twitter isn't email, and I don't feel the need to read every single tweet that goes by, but if I've just missed an hour or two's worth, Tweetie makes it easy to read them.