Archive for February, 2014

Googling errors

14 Feb 2014

@roguelynn tweeted the other day:

If attendees of this weekend’s intro to python workshop leave with one thing, it’ll be to Google your error messages first and foremost.

I had just talked about the technique in my Tools for Reproducible Research course, and I had a few recent examples.

Gtk-WARNING **: cannot open display:

I was logged into a department server, trying to clone a private repository from GitHub, and got an error like

(gnome-ssh-askpass:1731): Gtk-WARNING **: cannot open display:

I googled that, and the first item was a stackoverflow question, whose answer said “unset SSH_ASKPASS”, which totally worked.

except KeyError, k: raise AttributeError, k

AsciiDoc was giving me this error:

asciidoc -a data-uri -a toc -a toclevels=4 -a num example2.txt
  File "/usr/local/bin/asciidoc", line 101
    except KeyError, k: raise AttributeError, k
SyntaxError: invalid syntax

Google the “except KeyError” line, and you get to a Q&A on the AsciiDoc google group, which says “Asciidoc is Python 2, not 3.”

mclapply isn’t working in windows

I got a report that parallel processing in my R/qtl package wasn’t working in Windows.

I googled “mclapply isn’t working windows” (because mclapply was the function I was using) and got this stackoverflow page, which says:

since Windows does not have fork(), it will run standard lapply instead – no parallelization

Emacs key bindings in MS Word

12 Feb 2014

Collaboration on grant proposals has forced me to spend a lot of time writing in MS Word lately. I find my self typing emacs key strokes and then getting annoyed when I have to move my hand over to the arrow keys. (It’s maybe not as bad as typing Markdown marks within a LaTeX document, which I’ve also been doing.)

A google search on the title of this post got me to this post. I should have looked before.

Following that suggestion, I was able to get these:

C-b – CharLeft
C-f – CharRight
C-e – EndOfLine
C-p – LineUp
C-n – LineDown
C-a – StartOfLine
C-v – PageDown

I can’t figure out how to have M-v for PageUp, though, because M-v seems permanently stuck to “√”.

The procedure, in MS Word 2011 for Mac, is:

  1. Tools → Customize Keyboard
  2. Select “All Commands” under “Categories:”
  3. Select the command (e.g., RightChar) under “Commands:”
  4. Press the keyboard shortcut in the “Press new keyboard shortcut” box
  5. Click the Assign button
  6. Repeat for the other commands you want
  7. Click OK

I needed two more, C-d and C-k; it took me a while to figure out how to do it, as there didn’t seem to be any built-in commands. But you can just record a macro. I created these:

C-d – [DeleteCharacter] (as a macro)
C-k – [KillLine] (as a macro)

Here’s the procedure, in MS Word 2011 for Mac.

  1. Tools → Macros → Record Macro
  2. Give it a name with no spaces
  3. Click the keyboard button to assign a keystroke to it
  4. Select OK
  5. Type the set of key strokes
  6. Tools → Macros → Stop Recording

Womacs is a really extensive set of Visual Basic macros that looks really useful, but I was getting Visual Basic errors and didn’t want to spend any more time on it; grants to write…

Copyright of video lectures

9 Feb 2014

Quite a while back, I was wondering about copyright of video lectures produced by university faculty. In particular, did I need to get the university to sign some sort of waiver in order for the Jackson Laboratory to post a video of a lecture I’d given for a course there? (The Jackson Lab lawyers wanted that.)

I spoke to my family librarian, who pointed me to Carrie Kruse, directory of the College Library at UW-Madison. And really, librarians are the people to talk to about this sort of thing, as they not only think a lot about copyright and fair use, but also they’re on the side of more access. (But don’t hold Carrie accountable if I say anything wrong below; this is my own interpretation, 14 months after corresponding with her.)

In most jobs, the product of your work is owned by the company, even if they didn’t have anything to do with it. But universities have a different tradition. Typically, the university doesn’t assert any rights over a faculty member’s instructional materials. For example, if you write a textbook, you don’t have to negotiate with the university over its publication, nor do you have to give the university a cut of the royalty income. That’s different than patents.

UW-Madison has an explicit policy about faculty instructional materials. (Really, it’s a UW System policy.) As I understand it, the university will assert some rights over your instructional materials only if they had contributed special resources or support to their creation (for example, if university staff assisted you with the recording and editing of a video).

Returning to the video issue: since the university wasn’t involved in the production of the video, I didn’t have to get their okay.

Carrie mentioned another important thing to pay attention to: if I had used any photos or other media to which I don’t have rights, I need to be careful about their inclusion in videos posted online. Within a classroom, or in a video posted online but only made accessible to a defined group of students, inclusion of such material could fall under fair use. But if such material is included in a video that is posted online for general viewing, others may question my fair use claim.

That may explain why so many instructors here are using password-protected sites, like Learn@UW and Moodle. I can’t even look at my colleagues’ course material.

I dislike web pages via online forms. (Well, except for you, wordpress; I wish I’d started this blog with GitHub pages, but you’re okay.)

And I despise the password protection of instructional materials. If I spend a bunch of time preparing material, I want to distribute it as widely as possible. If another instructor uses it in their own class, I consider that a Good Thing.

I still don’t like it

9 Feb 2014

I got a book in the mail this week, a book I hadn’t ordered and would never have ordered. The publisher sent me a complimentary copy, as I’d reviewed the book proposal last year. (It’s the one where the author refused to allow me to have an electronic copy.)

Actually, I soundly trashed the proposal in my review. In the nicest possible way, of course. For example, I said:

And then there are things that are just plain wrong. For example, “We then express our confidence in the H0 with a p-value, which might crudely be considered the probability that the H0 is true.” That is not a crude interpretation of the p-value; that is just wrong.

It seems like if a reviewer says, “This particular book should not be adopted,” the publisher can interpret that to also mean, “and whatever you do, don’t send me a copy.”

knitr in a knutshell tutorial

6 Feb 2014

I spent a lot of time this week writing a short tutorial on knitr: knitr in a knutshell.

This is my third little tutorial. (The previous ones were a git/github guide and a minimal make tutorial.)

I’m pleased with these tutorials. In learning new computing skills, it can be hard to get started. My goal was to provide the initial motivation and orientation, and then links to other resources. I think they are effective in that regard.

I’ve gotten really excited about the tools for reproducible research. I think the main reason that statisticians have been so slow to adopt a reproducible workflow is a lack of training.

I’m hoping that these tutorials, plus the other materials that I’m putting together over the course of this semester, for my Tools for Reproducible Research course, will help.

But take a look at the material that Jeff, Roger, and Brian are developing for their Data Science MOOCs; you’ll see that mine are pretty humble contributions.