Author Archives: Caleb McDaniel

Winding Down

After a few meetings with students, a University lecture that I wanted to attend, and a midday workout (unplugging sometimes is essential to DH!), I’m winding down my day by getting my email down to Inbox Zero. I also spent some time posting comments to student posts at the course blog for RiceDH, which has been a pleasure because the students in the course have been so productive and sharp!

I also went to check in on our GitHub organization account to see if there had been any activity there from students. In addition to using GitHub to host code written for the class by students or myself, I’m also using GitHub this semester to host two private repositories—one to host the texts of the runaway slave ads we are analyzing, and one to host drafts of the essays students are working on, which they are writing in GitHub Markdown so that we can easily transform them to HTML later on.

I got the private repos for free by requesting an education discount, and so far I’ve been pleased. I’ve been interested in using GitHub as a potential course management system for a while, or at least since Chad Black posted about how he does it. Black suggested using Prose.io as the main interface for students, but since his post, GitHub has incorporated a pretty good web-based editor directly into the site. And new features like rendered prose diffs and a good introduction to Markdown have made it even friendlier for things like student drafts.

I am finding that so far students have been able to use GitHub without too much trouble (aside from a couple of issues that arose when two edits were being made at the same time), and all without having to know much (or anything) about Git or command-line git tools. Since you can edit and create files in a repo directly from the website now, and even enable a distraction-free editing window similar to Prose.io, the workflow doesn’t require much technical expertise or third-party tools.

All in all, it was a good day, and a little more relaxed than a typical day because I’m teaching Mondays, Wednesdays, and Fridays this semester. I’ll probably do a little more work tonight reviewing applications for a summer project that will update and extend a past Omeka project, sending some emails, and getting ready for my conference trip later this week.

Debugging the Twitterbot

In my earlier post, I explained how I set up a launchd job to run my Twitterbot script, but when 10:30 came around, the job didn’t seem to have worked. I calmly opened LaunchControl and saw that it was reporting an error for the job. But a quick look at the error log revealed the problem:

Traceback (most recent call last):
  File "/Users/wcm1/programming/ricedh/adbot/adbot.py", line 17, in 
    new_ads = os.listdir(new_ads_path)
OSError: [Errno 2] No such file or directory: 'new/'
Traceback (most recent call last):
  File "/Users/wcm1/programming/ricedh/adbot/adbot.py", line 52, in 
    l = open(log_file, 'a')
IOError: [Errno 13] Permission denied: 'twitter.log'

My Twitterbot script had been using some relative paths to directories because I typically ran the script from within the directory containing all the ads. To fix it, I just had to change the paths to absolute paths. Then, I loaded the launchd job again, and …

Eureka! It works!

My First Twitterbot

This semester, I am teaching an undergraduate Digital History Methods course in collaboration with a graduate class taught by Andrew Torget at the University of North Texas.

At the beginning of the semester, we did some general readings about digital history, and also some historiographical readings about runaway slave advertisements, which is the topic we chose to focus on for the course. In order to give students hands-on experience with digitization work, we also worked through homework assignments that required students to create a JSON representation of a runaway ad and to collect ads from historical newspapers on the Portal to Texas History, a wonderful digitization project at UNT.

At this point, students in the two classes have collected around 400+ ads from Texas newspapers, and are working on text mining projects with the collected transcripts. In the meantime, however, my class began an interesting discussion about what it would look like to "tweet" the runaway ads. Most runaway ad sites typically display the ads shorn of their context in the original newspapers, including this promising project at Stephen F. Austin. What would happen, we wondered, if we made our transcribed ads available with links to the original context on the page, and also inserted the ads into a very different contemporary context—the Twitter stream.

The result was @TxRunawayAds and a great introductory essay about our rationale written collaboratively by students in the Rice DH class.

To help with the process of tweeting an ad each day, I channeled Mark Sample, king of the Twitterbots, and wrote my first ever script to post to Twitter using Python. You can see the script here. It basically excerpts text from a randomly selected text file containing one of our ad transcriptions, and uses the metadata contained in the text file name to reassemble a permalink to the Portal to Texas History. It checks to make sure that the tweet is not too long before posting to Twitter. (This tutorial was very helpful, if you’re interested in building something like this yourself.)

So far, so good. But for the last week, I’ve been having to run the Adbot script manually from my computer to post a new tweet to the feed. So this morning I looked into setting up a launchd job on my Mac to have the script run automatically every day at a set time. I learned most of what I know about launchd from Nathan Grigg, and I think his site also directed me to LaunchControl, an easy-to-use GUI for managing jobs. So I downloaded that software this morning and was able in a few minutes to set up a job that looks like this:

LaunchControl screen shot

LaunchControl screen shot

If all goes well, then that should be all I need to do in order to have my Twitterbot script run automatically every day at 10:30 in the morning. We will see in about an hour if it works!

My First Day of DH

I decided to take the plunge and blog about my day of DH. But much of my day will also be a good ol’ Day of H—another day as a working historian. I’ll have some meetings with graduate students, try to pull together my thoughts after a weekend of conferences, and prepare to travel to the annual meeting of the Organization of American Historians this weekend in Atlanta. As part of this I will probably do some updating of my open research notebook wiki, which I see partly as an experiment in digital humanities publication and open access.

I do have some DH things to do, however. This semester I am teaching a Digital History Methods course at Rice University, and students are currently hard at work on end-of-semester projects designed to text mine and visualize a collection of runaway slave advertisements that we have collected in collaboration with students at the University of North Texas. One of our outputs for the class so far has been a Twitter feed that automatically tweets excerpts from our ads, for reasons that my students have described in this introductory essay. I need to do some upkeep on the feed today, especially by fully automating the process by which tweets are posted.