When your USB thumb drive doesn’t show up in XP

Start->Run and type “diskmgmt.msc” then right-click the drive and select “Change drive letter and Paths” and change the drive letter to something completely different like T: or W:.

Hat tip to Java Jane.

How to use a notebook: 7 quick tips

You never know when your brain is going to flash on an idea, a great gift, or something you need from the store. That’s why I carry a small notebook around with me most of the time. Here are some productivity tips on how to use a “hipster PDA” effectively.

  1. Get one. I got mine for about a buck at Office Depot. It looks like this:
  2. Mead notepad

  3. Write the date on the outside of the notebook. If you start using notebooks a lot, you’ll find it very handy to be able to sort notebooks by time.
  4. Clear out your brain. When you think of a task for work or a book that you want to buy, just write it down. This lets you concentrate on important things instead of remembering small items.
  5. Avoid the temptation to write on both sides of the page: just write on one side. You’ll see why in a minute.
  6. Keep each separate subject on a separate page. One page could be things to get done at work that day. Another page could be a meeting agenda. Another page could be books you want to read, or movies you want to see. Yet another could be things you want to blog about. But don’t mix the meeting agenda with your blogging to-do list. You’ll see why in a minute.
  7. When you’re finished with a page, yank out that page. Crumple it up and throw it away. Maybe you’re back from the grocery store and everything is crossed off your grocery list page. Try to finish out the notebook with almost all your pages ripped out.
  8. You want the notebook to be empty or nearly empty when you run out of blank paper. It’s very satisfying to yank a page out of the notebook when you’re done with a task. You want the page to pull away cleanly, so look for a notebook that is perfect bound. That is, the spine of the notebook is square and the pages are held in place with glue. I’ve found the “Square Deal” memo pads from Mead to be just right for me.
  9. A bonus tip: if you’re about to head to a big event like a conference and think you might take a lot of notes, feedback, or details, then start with a fresh notebook.

The observation here is pretty simple: the notepad is not your entire filing system. That notebook is just your short-term working memory. Ideally anything that you jot down in the notebook (e.g. movies to see) can eventually go onto a longer-term list, such as your Netflix queue for movies.

If you want to get advanced, you can store some small amount of info in the inside cover of the notebook. For example, there’s a cafe that I like with free WiFi. Their WEP password is their phone number. So I keep that WEP password on the inside cover of my notebook. Arguably things like passwords could go in your head or laptop or phone though. I really only use my “hipster PDA” to remember things until I can move them over into a better place or take care of them quickly.

How to back up your Gmail on Linux in four easy steps

I really like Gmail, but I also like having backups of my data just in case. Here’s how to use a simple program called getmail on Unix to backup your Gmail or Google Apps email. We’ll break this into four steps.

Gmail image

Step 0: Why getmail?

If you browse around on the web, you’ll find several options to help you download and backup your email. Here are a few:

Step 1: Install getmail

On Ubuntu 7.10 (Gutsy Gibbon), you would type

sudo apt-get install getmail4

at a terminal window. Hey, that wasn’t so bad, right? If you use a different flavor of Linux, you can download getmail and install it with a few commands like this:

cd /tmp
[Note: wget the tarball download link found at http://pyropus.ca/software/getmail/#download ]
tar xzvf getmail*.tar.gz
cd (the directory that was created)
sudo python setup.py install

Step 2: Configure Gmail and getmail

First, turn on POP in your Gmail account. Because you want a copy of all your mail, I recommend that you choose the “Enable POP for all mail” option. On the “When messages are accessed with POP” option, I would choose “Keep Gmail’s copy in the Inbox” so that Gmail still keeps your email after you back up your email.

For this example, let’s assume that your username is bob@gmail.com and your password is bobpassword. Let’s also assume that you want to back up your email into a directory called gmail-archive and that your home directory is located at /home/bob/.

I have to describe a little about how mail is stored in Unix. There are a couple well-known methods to store email: mbox and Maildir. When mail is stored in mbox format, all your mail is concatenated together in one huge file. In the Maildir format, each email is stored in a separate file. Needless to say, each method has different strengths and weaknesses. For the time being, let’s assume that you want your email in one big file (the mbox format) and work through an example.

Example with mbox format

– Make a directory called “.getmail” in your home directory with the command “mkdir ~/.getmail”. This directory will store your configuration data and the debugging logs that getmail generates.
– Make a directory called gmail-archive with the command “mkdir ~/gmail-archive”. This directory will store your email.
– Make a file ~/.getmail/getmail.gmail and put the following text in it:

type = SimplePOP3SSLRetriever
server = pop.gmail.com
username = bob@gmail.com
password = bobpassword

type = Mboxrd
path = ~/gmail-archive/gmail-backup.mbox

# print messages about each action (verbose = 2)
# Other options:
# 0 prints only warnings and errors
# 1 prints messages about retrieving and deleting messages only
verbose = 2
message_log = ~/.getmail/gmail.log

Added: Run the command “touch ~/gmail-archive/gmail-backup.mbox” . If you change the path in the file above, touch whatever filename you used. This command creates an empty file that getmail can then append to.

The file format should be pretty self-explanatory. You’re telling getmail to fetch your email from pop.gmail.com via a POP3 connection over SSL (which prevents people from seeing your email as it passes between Gmail and your computer). The [destination] section tells where to save your email, and in what format. The “Mboxrd” is a flavor of the mbox format — read this page on mbox formats if you’re really interested. Finally, we set options so that getmail generates a verbose log file that will help in case there are any snags.

Example with Maildir format

Suppose you prefer Maildir instead? You’d still run “mkdir ~/.getmail” and “mkdir ~/gmail-archive”. But the Maildir format uses three directories (tmp, new, and cur). We need to make those directories, so type “mkdir ~/gmail-archive/tmp ~/gmail-archive/new ~/gmail-archive/cur” as well. In addition, change the [destination] section to say

type = Maildir
path = ~/gmail-archive/

Otherwise your configuration file is the same.

Step 3: Run getmail

The good news is that step 2 was the hard part. Run getmail with a command like “getmail -r /home/bob/.getmail/getmail.gmail” (use the path to the config file that you made in Step 2). With any luck, you’ll see something like

getmail version 4.6.5
Copyright (C) 1998-2006 Charles Cazabon. Licensed under the GNU GPL version 2.
msg 1/99 (7619 bytes) from <info@example.com> delivered to Mboxrd /home/bob/gmail-archive/gmail-backup.mbox
msg 2/99 (6634 bytes) from <sales@example.com> delivered to Mboxrd /home/bob/gmail-archive/gmail-backup.mbox

99 messages retrieved, 0 skipped
Retrieved 99 messages from SimplePOP3SSLRetriever:bob@gmail.com@pop.gmail.com:995

Hooray! It works! But wait — I have over 99 messages, you say. Why did it only download 99 messages? The short answer is that Gmail will only let you down a few hundred emails at a time. You can repeat the command (let getmail finish each time before you run it again) until all of your email is downloaded.

Step 4: Download new email automatically

A backup is a snapshot of your email at one point in time, but it’s even better if you download and save new email automatically. (This step will also come in handy if you have a ton of Gmail and don’t want to run the command from Step 3 over and over again for hours to download all your mail.)

We’re going to make a simple cron job that runs periodically to download new email and preserve it. First, make a very short file called /home/bob/fetch-email.sh and put the following text in the file:

# Note: -q means fetch quietly so that this program is silent
/usr/bin/getmail -q -r /home/bob/.getmail/getmail.gmail

Make sure that the file is readable/executable with the command “chmod u+rx /home/bob/fetch-email.sh”. If you want to make sure the program works, run the command “/home/bob/fetch-email.sh”. The program should execute without generating any output, but if there’s new email waiting for you it will be downloaded. This script needs to be silent or else you’ll get warnings when you run the script using cron.

Now type the command “crontab -e” and add the following entry to your crontab:

# Every 10 minutes (at 7 minutes past the hour), fetch my email
7,17,27,37,47,57 * * * * /home/bob/fetch-email.sh

This crontab entry tells cron “Every 10 minutes, run the script fetch-email.sh”. If you wanted to check less often (maybe once an hour), change “7,17,27,37,47,57” to “7” and the cron job will run at 7 minutes after every hour. That’s it — you’re done! Enjoy the feeling of having a Gmail backup in case your net connection goes down.

Bonus info: Back up in both mail formats at once!

As I mentioned, mbox and Maildir have different advantages. The mbox format is convenient because you only need to keep track of one file, but editing/deleting email from that huge file is a pain. And when one program is trying to write new email while another program is trying to edit the file, things can sometimes go wrong unless both programs are careful. Maildir is more robust, but it chews through inodes because each email is a separate file. It also can be harder to process Maildir files with regular Unix command-line tools, just because there are so many email files.

Why not archive your email in both formats just to be safe? The getmail program can easily support this. Just change your [destination] information to look like this:

type = MultiDestination
destinations = (‘[mboxrd-destination]’, ‘[maildir-destination]’)

type = Mboxrd
path = ~/gmail-archive/gmail-backup.mbox

type = Maildir
path = ~/gmail-archive/

Note that you’ll still have to run all the “mkdir” commands to make the “gmail-archive” directory, as well as the tmp, new, and cur directories under the gmail-archive directory.

Bonus reading!

What, you’re still here? Okay, if you’re still reading, here’s a few pointers you might be interested in:
– The main getmail site includes a page with lots of getmail examples of configuration files. The getmail website has a ton of great documentation, too. Major props to Charles Cazabon for his getmail program.
– This write-up from about a year ago covers how to back up Gmail as well.
– The author of getmail seems to hang out quite a bit on this getmail mailing list. See the main site for directions on signing up for the list.
– If you’re interested in a more powerful setup (e.g. using Gmail + getmail + procmail), this is a useful page.
– For the truly sadistic, learn the difference between a Mail User Agent (MUA) and a Mail Transfer Agent (MTA) and how email really gets delivered in Unix.
– I’ve been meaning to write all this down for months. Jeff Atwood’s recent post finally pushed me over the edge. Jeff describes a program that offers to “archive your Gmail” for $29.95, but when you give the program your username/password it secretly mails your username/password to the program’s creator. That’s pretty much pure evil in my book. And the G-Archiver program isn’t even needed! Because Gmail will export your email for free using POP or IMAP, it’s not hard to archive your Gmail. So I wrote up how I back up my Gmail in case it helps anyone else. Enjoy!

Added March 16, 2008: Several people have added helpful comments. One of my favorites led me to a post by commenter Peng about how to back up Gmail with IMAP using getmail. Peng describes how to back up the email by label as well. He mentions that you could use the search “after:2007/1/1 before:2007/3/31” and assign the label FY07Q1 to the search results, for example. Then you can back up that single label/mailbox by making the getmail config file look like this:

type = SimpleIMAPSSLRetriever
server = imap.gmail.com
username = username
password = password
mailboxes = (“FY07Q1”,)

type = Mboxrd
path = ~/.getmail/gmail-backup-FY07Q1.mbox

Peng also mentions a nice bonus: since you’re backing up via IMAP instead of POP, there’s no download limit. That means that you don’t have to run the getmail program repeatedly. Thanks for mentioning that Peng!

How to use Google’s calculator: convert to hexadecimal, binary, and decimal

One of Google’s goals is that you should be able to throw just about anything into a search box (package tracking numbers, airline flight numbers, etc.) and Google will try to do something reasonable, such as return the status of a flight. Recently I was trying to reverse engineer a USB protocol and needed to convert some numbers between base 16 (hexadecimal) and base 10 (decimal). On a hunch, I threw the conversion into a Google search box. Sure enough, it worked fine.

Converting hexadecimal to decimal with a search query like [0x607a in decimal]:

Convert hex to base10

Convert decimal to hexadecimal with a Google query like [1854 in hex]:

Convert decimal to base 16

You can even convert hexadecimal to binary with a query like [0x770 in binary]:

Convert base16 to base2

Of course, you can also use alternate queries like [convert 0x770 to base 2]. Pretty handy.

Bonus tip: did you know that you can do currency conversion too? Just type something like [one dollar in yuan]:

Convert my currency

If you have favorite tips for searches, leave them in the comments.

11 Power Tips for Gmail

Update: Here’s one more bonus tip. Use the ‘m’ key to mute a conversation. Suppose you’re on a mailing list and you don’t care about what’s being discussed. The ‘m’ key will mute/murder that entire thread so that you never see that email or any follow-ups. The only way you’ll see the conversation again is if someone adds you to the “To:” or “Cc:” line of an email in the conversation. Read more if you’re interested.

Wow, I can’t believe how many people commented on my late-Friday night post about desired features for Gmail. If you want to suggest something for Gmail, that thread is the better place to do it. But looking through the comments, I saw a few requests that can already be done today. Considering that real Gmail users didn’t know about these options, I’m going to call them power tips.

Stylized Gmail logo

  1. Wayne Schulz said “I want to be able to paste images into the email.” Wayne, it’s not quite the same as pasting images into emails, but one thing that makes image attachments easier is the dragdropupload Firefox extension. You know how you can click “Attach a file” and then you’ll see the familiar “enter a file location or Browse..” form appear? With dragdropupload, you can drag any file (e.g. from your Desktop) and drop it in that text box. It’s a fantastic extension that makes it much faster to include attachments or upload files, and I use it all the time.
  2. Jason Bartholme asked about “A sort that would allow for my unread messages to be at the top.” Jason, trying doing a search for label:unread label:inbox . That should show only unread messages that are currently in your inbox. By the way, did you like how I shared a search with you? That was a tip from the Gmail blog. There are other cool labels you can use as well.
  3. Julian says

    I would like to have a feature for inserting prepared text blocks, so I dont have to write some things over and over again.

    Julian, if you use Firefox, check out the Signature firefox extension to insert text macros. That might work for you.

  4. Daniel asked

    Crazy feature: I’d like to be able to have an easy way to migrate my entire Google account to a different gmail address, because I can’t find a step-by-step guide or anything to help me switch emails without losing various things.

    According to this post you can enable POP on your old account (look under Settings, then “Forwarding and POP/IMAP”), then import the emails (also using POP) into the new account. I think you could use Gmail’s Mail Fetcher utility to do this. To configure Mail Fetcher on the newer account, click on Gmail’s Settings link, then “Accounts” and then “Add another mail account.” Google Operating System (an unofficial blog that discusses Google often) has a couple relevant posts with a walkthough of using Gmail’s Mail Fetcher and a write-up on how to back up your Google account.

  5. Sankarananad asked a related question:

    I would love to integrate my google apps account with my default gmail account. Although right now google allows to associate email address there is no way to integrate or link two google accounts (say one @gmail.com and another yourdomain.com powered by google apps).

    Right now the only solution is to forward mails from one box to another! If google makes integration possible we can use a single inbox to check mails from all those email address

    I’m not as familiar with the interaction of regular Gmail versus Gmail on Google Apps. This post described a scary-looking way that might work. If there’s a better way, maybe someone will stop by and let me know?

  6. Search Engines Web asked:

    The ability to open Word, Excel, PowerPoint and PDF without going to another page and using another software

    S.E.W, this post from Lifehacker mentions that Gmail can offer HTML view or Google Doc options for Word and Excel.

  7. Easton Ellsworth mentioned

    I’d love to be able to resize the email composition box on the default page – so instead of having to click the icon to open the whole draft in a new resizable window, I’d be able to click and drag to make the draft box bigger (especially vertically).

    Easton, check out the Resizeable text area extension for Firefox. It lets you click on the border of any form textarea and drag the border so the textarea expands. I haven’t checked how it works on the latest version of Gmail though.

  8. 1001 noisy cameras said “I think the ability to open emails in new windows would be great – it would help those users who are always multi-tasking.” If you’re looking at an email look at the top-right of the page and click on “New window” to open that email in a separate email.
  9. Diego asked

    I don’t know if this would be possible, but how about, when clicking on the compose link (or reply etc) if I hold some key as I click on Compose, it opens the new email in its own window? Same thing could go for Replies etc.

    Diego, instead of using ‘c’ to compose a new email, type ‘C’ and you’ll open a new window to compose your email. It looks like using ‘R’ instead of ‘r’ to reply will open a new email for replies too.

  10. jonathon asked “Is it me or does the pop3 server sometimes stop working when downloading email from gmail?” I’ve been using getmail to back up my Gmail, and I’ve noticed that Google will only let you download a few hundred emails in one batch. If you fetch again, you’ll often catch up. So usually it’s just a matter of being patient.

I heard a lot of great suggestions that I wouldn’t even have thought of. For example, I liked the idea of a “bounce” option for unwanted emails to make it look as if your email address didn’t exist. Oh, and since so many people asked for cool features, let me add one more feature I want: let me set a different vacation message for co-workers compared to people outside Google. Maybe in Google Apps for Gmail, if you are managing example.com, let people on example.com set a different vacation message for people on example.com vs. other domains?

By the way, what was the funniest suggestion I saw? Jeff Hall won with “A USB breathalyzer kit for a friend who forgets how embarrassing her e-mails are when she gets drunk. The e-mails could be delayed until she provides a negative sample.” 🙂

And here’s your bonus tip. If you’re a Gmail power user, three links to check out are the Gmail tag on Lifehacker, the official Gmail blog, and Google Operating System. Lifehacker does so many posts per day that limiting to the Gmail tag will narrow down the posts you see. The Gmail blog is the best place to get official Gmail news first. And Google OS seems to have Gmail-related posts pretty often.