Inserting headers and footers onto an existing PDF document using pdflatex

When printing PDF documents it can often be useful to add a few quick notes to the document to help you remember context on the day you chose to print it. This is especially true as a reviewer of academic papers, where a submitted paper needs to be identified as such, with its ID number from the reviewing system, etc.

I recently discovered the pdfpages LaTeX package, which enables the \includepdf command to include an arbitrary selection of pages from an existing PDF into the resulting PDF. This makes it possible to throw together a .tex document in less than 10 lines that can do exactly what I want.

I went ahead and scripted this using python, available here:

$ ./ -h
usage: [-h] -i INFILE [-l LHEAD] [-c CHEAD] [-r RHEAD]
[-f LFOOT] [-o RFOOT]

Magic header/footer annotation inserter

optional arguments:
-h, --help show this help message and exit
-i INFILE, --infile INFILE
Input PDF File
-l LHEAD, --lhead LHEAD
Left Header
-c CHEAD, --chead CHEAD
Center Header
-r RHEAD, --rhead RHEAD
Right Header
-f LFOOT, --lfoot LFOOT
Left Footer
-o RFOOT, --rfoot RFOOT
Right Footer


‘svn up’ in multiple working copies

A cute one-liner that I use relatively frequently (e.g., when you checkout lots of different people’s svn repositories in a single directory named ‘work’):

for i in `find . -maxdepth 2 -type d -name .svn`; do pushd `dirname $i`; svn up; popd; done

Password reset for Mailman list administration

So far remembering the password for flickertcb-devel has proven more than my feeble mind can muster. Compounding this problem is that there is no obvious action to be taken (e.g., a Forgot Your Password? link) from the Mailman page that requests this password. Here is what to do (current as of the time of this post anyways; SourceForge has been making some design changes):

Sign in and go to your SourceForge project’s administrative home page. From the “Project Admin” drop-down menu, select the “Features” item. At the far right of the “Mailing Lists” row in the ensuing table, select “Manage”.

The three options below the list’s Description field are: “Mailman Admin | List Subscribers | Change Password”. Change Password does the trick.

Gmail Feature Suggestions

I just submitted these suggestions for improvement here.

  • I want to apply a label to an email as I draft it, so that a response that comes back is automatically labeled already. Today, I do this by clicking “View Message” immediately after clicking “Send”, but it is cumbersome.
    Update 2012-03-28: They have added this! Awesome!
  • Allow customization of subject line prefixes that suggest that a message is part of an existing conversation. E.g., I have a message in my inbox right now that is not threaded into an existing conversation, but it “should” be. Its subject currently starts with “Re: EXT :Re: Action Required: “. The “EXT” one is more annoying than the “Action Required” one, but there are others, such as “Out of Office:”, and “Re” in any of the world’s other languages.
  • Scroll the entire page when viewing the Inbox. The “new” Gmail look leaves the search bar and a few buttons permanently at the top of the screen. I would prefer to see all of my messages.
  • Update 2011.11.20: “Pop-Out” a message that I am reading, just like one can “Pop-Out” a draft email.
    Update 2012-03-28: They have added this! Awesome!
  • Update 2011.11.30: Search the contents of known extension types (e.g., *.pdf, *.doc).
  • Update 2012.07.16: Rename an attachment when composing or forwarding a message (it’s unprofessional to send Final Report (4).pdf).
  • Update 2012.07.16: Display sha1sum of attachments.
  • Update 2012.07.16: Delayed send.

The fact that these are my biggest problems with email is quite amazing.

Can I have text buttons instead of the new icon buttons [in Gmail’s new look]?

The question in the subject line occurred to me shortly after deciding to go ahead and jump to the new GMail look before they took away the old one. This thread clearly indicates that I was not the first person to wonder this, and it reveals that there is no planned support for text labels instead of icons. They have done a nice job of clear, explanatory “tips” when one hovers over a particular button, and I’ve already memorized the purposes of the new buttons, but there’s a subtle loss of certainty that I find a little bit uncomfortable, like GMail has lowered the bar for entry. Let’s hope that new bar is based on available screen real estate (i.e., consistent behavior on phones and tablets) and not users’ tolerance for constantly changing UIs.

The reason given is that with 60-something supported languages they had a lot of concerns about wrapping text. I can certainly appreciate that challenge, but I don’t necessarily need the entire word “Archive” to appear. I’d still prefer “Archi”. I can tell it apart from “Tra”. The size could be unrelated to the language, and the word display could be best-effort. I guess that would look unprofessional?

Effectively sshfs for Windows

sshfs is a great tool to use for temporary or non-performance-critical secure sharing of files between *nix systems. However, I needed to mount a share from Windows 7. Dokan-dev is an open-source option with various bits licensed GPL/LGPL/MIT, but unfortunately it seems to be a part-time project and it’s not clear that it would receive timely security updates. Thus, it’s something to watch, but it doesn’t solve my problem. If I’m willing to part with money, there seem to be two main contenders (which seem to work well, according to further web searching): ExpanDrive and WebDrive. These are both linked from the SSHFS WikiPedia Page, along with some other alternatives suitable for users who are a little more savvy.

I ended up going with SftpNetDrive, which is closed source but free for non-commercial use. It supports public-key based authentication using .ppk files created using PuTTYgen, and allows one to choose a consistent drive letter, auto-connect at startup, optionally mount a subdirectory instead of the whole remote user’s home directory, conditionally not show dot files, etc.

Thus, for giving a novice user a one-click way to mount a remote directory using public-key-based authentication, this solution works fairly well.

I plan to further constrain the user’s account on the *nix system using a chroot jail or similar, but haven’t worked out all the details yet. Debian Administration seems to have what I’m looking for, as usual. If there are any snafus, I’ll update this post.

Update: Using public-key authentication can be a challenge as .ssh becomes inaccessible to sshd when the user attempts to authenticate. The best solution seems to be using two different “home” directories; one that just contains .ssh/, and another that is the root of the chroot jail.

This is the type of thing to watch out for when setting this up; don’t lull yourself into a false sense of security.