How (and Why) I Wrote My First Twitterbot

This week, I wrote my first twitterbot.

For a while, I’ve been interested in Twitter robots – not spambots that auto-follow everyone who mentions Justin Bieber, but those that do something interesting with language or online data, such as Metaphor-a-minute, which uses the Wordnik API to generate random metaphors, or Library of Aleph, which tweets captions (without the photos) from the Library of Congress’s photo collection.

I’ve wanted to create a twitterbot, but didn’t think of an idea until this week while listening to one of my favorite songs, Elvis Costello’s “(What’s So Funny ’Bout) Peace, Love, and Understanding?”, and about to tweet (for the 2nd time) my favorite lines:

So where are the strong?
And who are the trusted?

It struck me that questions found in song lyrics could make a good Twitter account. Questions in song alternate between the profound:

– and the ridiculous:

A single line from a song can also be rich in memories and connotations. I now had my idea for my twitterbot.

How I Wrote It

There are a ton of “how to” options online. Because I want to learn more about Node.js, I chose this tutorial from Christian Paulsen to create the basic structure and functionality of the twitterbot.

Next, I needed questions. I put out a call on Facebook for my friends’ favorite questions from songs and ended up receiving more than 150 suggestions. I put all these into a text file and created a script that selects a random line and posts it on Twitter. If you’re interested in this sort of thing, I put the script on Github.

To automate posting the questions to Twitter, I downloaded LaunchControl, a small utility that lets you create and edit automated tasks on a Mac. Technically, LaunchControl just provides a GUI for Mac’s launchd process – see more here – but it makes launchd’s fairly confusing format much more readable. I have the script scheduled to run every three hours at the moment.

This process isn’t perfect – it runs whenever our computer is being used, but not if it’s asleep or off. So one of my next steps is to convert an old Mac into an always-on home server that can (among other things) run the Twitterbot 24–7. I’d also like to make the posting a bit less random by avoiding repeated questions too frequently or grouping some multiline questions together.

Overall, the project was very fast (started on Thursday night, finished by Saturday morning) and tremendous fun, and I’m collecting ideas for other bots. I’d like to try pulling texts from an API or a public domain source (Book of Common Prayer, perhaps?) for my next one.

Oh, and be sure to follow Lyrical Questions on Twitter.

Hey Dilbert: Don’t make fun of the unemployed.

Disclaimer: I take comic strips very seriously. Just ask my wife.

Dilbert (character)

Dilbert (Photo credit: Wikipedia)

I’m a fan of the comic strip Dilbert by Scott Adams. Last year, it provided some much needed humor during an awful work situation. But yesterday and the day before, Adams decided to turn his mockery toward the long-term unemployed. He has introduced an unnamed character who has been “out of work for such a long time.” First, he’s depicted as falling out of a chair, because he can’t figure out how it works. In the second strip, he’s told that the corporate policy manual is kept “in the cloud,” so he looks up to the sky to find it. Basically, the guy is stupid, incompetent, and ignorant of anything resembling recent technology (if “the cloud” can still be considered “recent.”)

Hilarious. Adams manages to reinforce all of the worst stereotypes about long-term unemployment through a couple of not-very-funny jokes.

Recently, I was underemployed for about six months, working part time for a former employer and doing several freelance projects to make ends meet. During this period, I met many people who had been unemployed or underemployed for far longer. Several of them had been actively searching for work for years. I met most of them at a local organization called the Job Search Focus Group, which I highly recommend for anyone in Greater Cincinnati looking for a new job.

The long-term unemployed fell into a few different groups:

  1. The largest, by far, were people in their 50s and 60s who were far OVERqualified for the positions they were applying for. They kept losing out to folks in their 20s and 30s who, because they had much less experience, were much less expensive to hire.
  2. For others, their entire industry had imploded because of structural changes in the economy. They were struggling, not to learn new skills, but to communicate how their already-polished skills transferred to other fields.
  3. Finally, there were those who had been out of the workforce because of non-job-related issues, such as taking care of their family or dealing with an illness. In a few cases, illness had left the person unable to continue in their former line of work, so they were in the midst of reinventing their entire career. It takes most of us 20 or so years to prepare for our first career, so you might see how starting a second career might take some time.

According to Adams, such people can’t even be trusted to sit in a chair.

Most of Adams’ humor is directed toward people in power, such as managers and CEOs, toward annoying office habits that all of us encounter (and have been guilt of), or towards absurd figures like talking animals who want to take over the world. Here, Adams has chosen to laugh at someone facing an extremely difficult personal transition, one which our society regards as shameful, and emphasize that his shame is deserved because he is too stupid to hold down a job.

Adams began Dilbert while working at Pacific Bell in the 80s and early 90s, and he’s had a long relationship with United Media. Telecom and journalism have both been through major upheavals since the 1980s. How many people has Adams worked with who have faced long-term unemployment?

You might reply that Dilbert is a comic strip and that it shouldn’t be taken too seriously. I’m not so sure about that latter part. One of the strengths of humor is its ability to “speak truth to power.” Dilbert’s caricatures of clueless manager and selfish CEOs have resonated with millions because those are the people with the power. Posting a Dilbert comic on your office cubicle is a small, harmless way to coping with the absurdities of American office life. Humor exposes truths that are too difficult to talk about with a straight face.

In this case, instead of “speaking truth to power,” Adams has chosen to “speak mockery to the powerless.” And that’s not funny.

Netflix is the New Superstation

Leave It to Beaver

TV: Teaching kids to vandalize sidewalks since 1957!

When I was a kid, some of my favorite shows went off the air before I was even born: Gilligan’s IslandThe Addams FamilyLeave It to BeaverThe Brady Bunch. Not only were there fewer channels on the television, but the channels that did exist had a much smaller back catalog of shows they could show. The two superstations on our local cable — WGN out of Chicago and TBS out of Atlanta — showed these old sitcoms on regular rotation.

Since there are now hundreds of channels, and a seemingly endless supply of new shows to choose from, I worried that my kids would be deprived of “vintage” programming as they developed their own tastes.

I shouldn’t have worried. Through Netflix, they’ve discovered plenty of classic shows — well, “classic” shows anyway. My 7- and 4-year-olds are currently obsessed with Mighty Morphin Power Rangers, but I have introduced them to The Addams FamilyLeave It to Beaver, and even newer programs like The Cosby Show.

And they don’t have to suffer through any Cubs games to get to the good stuff.

A Letter to My Daughter

Dear Daughter,

If you’re reading this, you’re finally old enough to know the truth. Or you’ve figured out how to disable parental controls, which means I can’t keep anything from you anyway.

First, please know that I love you. What you’re about to read will raise many questions, and you may begin to doubt all that you know about me. Never doubt that I love you, despite the terrible secret I’ve been keeping from you. Despite all that I’ve done without your knowledge for all these years.

You’re old enough to suspect that something is not quite right. I’ve been afraid that you will figure it out on your own one day. Frankly, it’s a bit surprising that you haven’t reached this conclusion on your own. The evidence has been right in front of you for years.

OK, here goes.

I’ve been eating your candy.

This comes as a great shock, I know, and you’re tempted to reject the idea. Just ask yourself a few questions.

  • Doesn’t it seem like your Halloween, Valentine’s, and Easter candy doesn’t last as long as it should? It’s a huge bag. Shouldn’t it last more than a day or two?
  • Why do you always seem to have so few Starburst, Butterfinger, and Skittles? Heck, have you even tasted a Butterfinger? I’m pretty sure I eat all of them first.
  • Don’t you wonder why your little brother acts so confused when you accuse him of taking your candy? Usually, he’s all “No, no, it wasn’t me!”, not “Why would I do that? Won’t the firemen be mad?”

I am so, so sorry to have betrayed your trust in this way. I hope you’ll forgive me. Also, I hope that you’ll tell me where you’ve hidden your candy.

Your loving father

P.S. Please don’t tell your brother that we aren’t giving his candy to firemen as thanks for their bravery.

The Worst Best Pictures of All Time

Over at Grantland, they’ve been running down the “greatest Oscar travesties of all time”. Since no one at Grantland has a cultural memory that goes back further than Rocky, their “greatest” travesties of “all time” don’t include anything earlier than, well, Rocky — which wasn’t even a travesty because the original Rocky is a very good movie.

Early in our marriage, my wife and I wanted some kind of hobby to do together. We both love movies, so we decided to watch every Best Picture winner, in order. It took us over a year, and some of the earlier movies were quite difficult to find. (This was the late 1990s, before Netflix, Hulu, etc.) Believe me, it was terribly disappointing to search all over town for a copy of an older film to rent or borrow, just to discover it was awful. These terrible Best Picture winners are etched into my brain forever.

5. The Lost Weekend (1945)

I lost 2 hours watching The Lost Weekend.

I lost 2 hours watching The Lost Weekend.

Being an alcoholic is terrible. You have now seen The Lost Weekend.

Though there are a couple of great scenes with Doris Dowling as a fast-talking bar floozy who doesn’t finish the ends of words. “Go out with you? Don’t be ridic.”

4. The Greatest Show On Earth (1952)

The Greatest Show on Earth

Not the greatest film, though.

Hey kids! Do you like the circus? Oscars voters of 1952 did, giving the Best Picture award to Cecil B. Demille’s The Greatest Show on Earth. This, along with Around the World in 80 Days, was basically an award for a really expensive, visually stunning (for the time) film whose production values are now dwarfed by most network dramas. It was also a bit of a “lifetime achievement” award for the great filmmaker Cecil B. DeMille, which means that the award was really given for how good all his earlier movies were, not for this one. If you’ve ever been to an actual circus, you don’t need to watch this.

3. Gigi (1958)


I still shudder.

The movie begins with a creepy old man (Maurice Chevalier) singing “Thank Heaven for Little Girls,” and only gets creepier from there. The plot involves a girl/young woman being trained by her family to become a prostitute courtesan, which is a woman who sleeps with men in exchange for money and gifts. This is all played as a romance between Gigi and the man to whom she is going to be sold given, who decides to marry her instead of taking her as his mistress. What a catch!

2. Kramer vs. Kramer (1979)

Kramer vs. Kramer

The perfect movie if you want to feel sad.

People in the late 70s liked being sad. Depression was the order of the day. If you’re feeling good about life, watch the three Best Picture winners from 1978 to 1980 — The Deer Hunter, Kramer vs. Kramer, and Ordinary People — and that won’t be a problem any more. Kramer vs. Kramer is one long, depressing journey through a couple’s divorce, with lots of sad shots of sad Dustin Hoffman and his sad little son walking around sadly. I think Chariots of Fire won in 1981 just to help everyone recover from the late 70s.

1. Cimarron


“Terrific as All Creation” – Also, the worst tag line of any Best Picture

Until 1992’s Unforgiven, Cimarron, about the settlement of the Oklahoma territory, had the distinction of being the only Western to have won Best Picture. Two scenes capture how perfectly awful this movie is.

Early in the film, Cimarron (actually, his name is Yancy, but I always just call him Cimarron) is asked to preach the inaugural sermon of the town’s new church, despite being an outspoken skeptic who runs the town newspaper and has no training, ability, or apparent reason to deliver a sermon. Whatever. In his sermon, he denounces the town bad guy and proceeds to shoot him dead in the middle of the sermon. No one sees a problem with this.

Later in the film, because Cimarron is a restless kind of guy, he abandons his wife (Sabra), family, and the newspaper business and disappears into the frontier. His wife, however, takes over the newspaper and makes a pretty good go at things. The movie jumps across several decades, showing her building the tiny newspaper into a frontier media empire and becoming one of the most important people in Oklahoma. Pretty great ending, right? Not exactly. Cimarron is discovered as a washed-up, homeless drifter who has spent the ensuing years working odd jobs in the Oklahoma oil fields. He’s reunited with Sabra — who announces that she has been keeping the business safe for him and hands it all back over to his control. Yes — having built a publishing empire, she gives it all to the worthless bum who abandoned his young children and can’t keep a steady job. This is supposed to be a loving act. I’m sure her hundreds of employees were pretty excited about the prospect of the company being run by a hobo.

Hands down, Cimarron is the worst Best Picture of all time.