Blog

PDF Collating/Merging

At home I have a wonderful Fujitsu ScanSnap duplex sheet-fed scanner. I can put a stack of double-sided pages into it, and it creates a perfect PDF.

At my office I have an HP all-in-one printer/scanner/copier. It's not quite so nice. It does have a sheet-fed scanner, but it can only do single-sided scans. If I wanted to scan any double-sided documents, I more or less had to take them home and do it there.

I got sick of doing this and decided to write a little Python script that can take two PDF files, and collate/merge them. The first file represents all the odd-numbered pages in the stack of paper, and the second file is the even numbered (i.e. the backs of the odd-numbered pages). My process now is to scan the stack of paper to produce the odd-numbered-pages PDF. Then I flip the stack over and scan again, generating the even-numbered-pages PDF. This PDF is in reverse order (when you flip the stack over, the last page gets scanned first), so my program knows to go backwards through the even-numbered document. I pass these two files to my program and it collates them and outputs a new PDF. The end result is the same as if I had used my ScanSnap at home, just with a little more effort. Better than schleping the documents back and forth from the office every time.

You can find it in all its glory here: https://github.com/parlarjb/PDF-Merge

Using Keyboard Maestro to enforce TweetMarker usage with Twitterific

A common request amongst Twitter users is for timeline syncing across devices. Personally, I use Twitter on my iPhone, iPad, MacBook Air and iMac. Checking on one, then later checking on another can be a huge pain, as the locations within the timelines are separate on all devices.

Tweet Marker


Recently Manton Reece released a new service named Tweet Marker. This is an API that authors of Twitter clients can take advantage, which will sync your location within the timeline up to a server, allowing other clients using the API to pull that location when you launch them. So if I check Twitter on my iPhone with Tweetbot, then an hour later load up Twitterific on my MacBook Air, Twitterific will automatically jump to wherever I was on the timeline when I exited TweetBot.

It's a terrific service, and works very well. As a long time user of Twitter, I'm happy we've finally got something like this.

One negative aspect of it (at least according to my understanding) is that the API is a little more focused on iOS devices. Namely, devices where you "quit" the Twitter app all the time, i.e. hitting the Home button. iOS Twitter clients taking advantage of Tweet Marker will explicitly sync their timeline position whenever you quit the app.

On the Mac, this causes a bit of a problem. It's more common to just leave your Mac apps running, rather than quitting them whenever you want to switch focus to something else. This results in Twitterific on the Mac rarely syncing its current position up to the Tweet Marker servers. If I could remember to quit Twitterific whenever I walked away from my Macs this wouldn't be an issue, but that's not something I'm going to remember.

What I needed was a way to automatically quit Twitterific after a set amount of time. They've got something like that coming in a future version, but even that functionality won't work for me. Namely, their support will only sync the timeline whenever the computer goes to sleep. My iMac *never* goes to sleep. I let the screen shut off, but my iMac runs a few server processes, so I can't have it sleeping.

The eventual solution I came up with was a combination of SleepWatcher and Keyboard Maestro.

SleepWatcher


SleepWatcher is a nifty little tool that runs in the background and can execute scripts of your choosing based on time-conditions. You can run scripts when the computer sleeps, when the monitor sleeps, after a settable idle time, when the computer wakes up, etc. What I want is to automatically shutdown Twitterific after my computer has been idle for 5 minutes.

To use SleepWatcher, you install it (follow the instructions that come with it) and create a .plist entry in your ~/Library/LaunchAgents directory. SleepWatcher comes with some example .plist files, but I've uploaded mine here. To tell your system to use this file, simply place the file into ~/Library/LaunchAgents/ and run the following command:

launchctl load ~/Library/LaunchAgents/ca.parlar.sleepwatcher.plist

(Of course you'll rename ca.parlar.sleepwatcher.plist to something related to you)

The two key aspects of this file are the --timeout=3000 entry, which tells it to use an idle time of 5 minutes, and -i ~/bin/quit_applications which tells it to run the script quit_applications after the machine has been idle (-i) for the time specified by --timeout.

quit_applications is a script that, for me, looks like:

osascript -e 'tell application "Keyboard Maestro Engine" to do script "20ADAD78-FAB4-4709-80B6-CF497FC6FF0E"'

Where does that come from? Keyboard Maestro.

Keyboard Maestro


Keyboard Maestro is an application that can seemingly do anything. It lets you build very powerful macros that can be activated by keyboard shortcuts, menu drop-downs, scripts, and lots of other events.

The scripts option lets an Apple/Perl/Python/Ruby/Shell script activate a Keyboard Maestro macro. My macro for this setup is:


I've got the macro doing a few things more than just shutting down Twitterific after an idle time, and those can easily be changed to reflect whatever you might want to happen on your own system.

Using this combination, I've now got Tweet Marker working quite nicely across all my systems. Twitterific gets shut down on my Macs after a period of time. As long as I don't run a Twitter client on my iPhone/iPad in the 5 minutes before the iMac has an idle event, then everything is great.

Thanks again to Manton for the awesome Tweet Marker service, and the good folks behind Twitterific for Mac and iPad, and TweetBot (my current iPhone Twitter client). Thanks as well to Bernhard Baehr for SleepWatcher and Stairways Software for Keyboard Maestro.

My VoIP setup with voip.ms

UPDATE (February 2, 2024): If this post is helpful, and you’re interested in signing up for Voip.ms, please consider using my sign-up link https://voip.ms/en/code/parlarsignup I’ve been using Voip.ms for well over a decade now, and continue to be thrilled with the service!

UPDATE (May 6, 2012): This is by far my most popular blog entry. If you read this post and feel it needs more detail, please let me know.

UPDATE 2 (February 10, 2013): I've gone ahead and written a second post, detailing my IVR and Callback configuration  

A few months ago, I decided that I was sick of paying $40+/month for our home phone service. We use the phone often enough that I didn't want to just get rid of it altogether, but I certainly didn't feel I was getting my money's worth. This post is a summary of what I found in my search, and a basic description of my setup with my eventual VoIP provider.

I started looking around, investigating which VoIP (Voice over Internet Protocol, i.e. telephone over the internet) options were available to me. My cable internet provider, Cogeco, has some reasonably priced phone packages, but as soon as you start adding "options", such as Call Display, Voicemail, etc., the price started to jump. I also looked into Vonage, the grand-daddy of consumer-level VoIP, but didn't feel that $19.99/month was cheap enough to "risk" moving to VoIP.

What risk am I talking about? The traditional phone system we're all used to, POTS, is incredibly reliable. Try to come up with the number of times in your life that you picked up your phone and there was no dial-tone. The number is probably somewhere in the vicinity of 0. Even in a power outage, POTS works just fine. Going VoIP means you're losing some of that reliability. You're taking a risk that the phone won't work when you need it to. We've all had our home internet connections go down, and experienced power outages. In either of those situations, VoIP won't work (note: You can get some battery-back-up solutions for VoIP setups so that you can still use the phone in a power outage. But these aren't the norm).

I did some more searching, and eventually voip.ms crossed my path. They're a Canadian-based VoIP provider (though they offer service to anyone in the world) with a fairly high reputation. One problem in the VoIP community seems to be an abundance of fly-by-night operations that might not be around in a few weeks. voip.ms has been around for awhile, and it doesn't look like they're going anywhere.

The initial advantage to voip.ms was cost. It's a pay-as-you-go system. Minimal-to-zero fixed monthly fees, and you only pay for the phone calls you make and receive. There are different prices for incoming and outgoing calls, and for each you can choose whether you want "Value" or "Premium" routing.

The Value routing costs about half of the Premium, but sound quality often won't be as good, and Call Display isn't guaranteed to always work. The Premium routing only costs 1.25 cents per minute for outgoing calls, and 1 cent per minute for incoming, so just do that.

With voip.ms, you can port over your existing phone number. There is a $25 cost associated with this, but it's a one-time thing. The amount of time for the port to happen is dependent on your existing phone provider. I was previously with Primus, and it took about a week before my number was moved to voip.ms.

You can actually assign multiple phone numbers to your account, which can be used for a variety of purposes, which I'll get to later.

The only fixed monthly-costs I have are related to the phone numbers. Each phone number you keep will cost between $1 and $2 per month, depending on which region the phone number is from. That's right, you can order phone numbers from almost any area code in North America, and assign them to your home phone. Have a relative that's too cheap to call you because they don't want to pay long distance? Just buy a phone number in their region, and they can thereafter make local calls to you. Most phone numbers only cost $0.50 to purchase, with the previously mentioned $1-2/month fixed cost.

In addition, any phone number that you want to support 911 calling will cost an additional $1.50/month. I personally have two phone numbers on my account, and 911 service tied to one of them. This brings my monthly fixed cost to $3.50.

I previously mentioned that while Cogeco was initially cheap, any calling features you added on later would increase your monthly bill. Not so with voip.ms. You get Call Display, Voicemail, Call Forwarding, custom Interactive Voice Responses (IVR), Email-forwarding of voicemails, Caller ID Filtering (i.e. block telemarketers), and more. All included.

One of the coolest things is the way they implement Caller ID Filtering. You can create custom rules which trigger actions based on the phone numbers of incoming calls. You can automatically send certain numbers to voicemail, automatically send phone numbers –—or even entire area codes— to an IVR, automatically hangup on incoming calls matching rules you create, and lots more.

In particular, I've created an IVR that gets activated on calls from certain telemarketer-heavy area codes. When a caller from one of those area codes calls my number, they get a recording of me, saying "Press 1 if you are a telemarketer, press 2 if you are not". If they press 1, it automatically hangs up on them. If they press 2, then the call continues and my phone begins to ring.

Anytime I get a call from a telemarketer in my own area code (which I can't filter out based on area-code alone), I hang up on the telemarketer, and log into my voip.ms account. Then I create a new rule specifically for that telemarketer's number. The next time they try to call me, they'll automatically get hung up on without my phone ever ringing.

In addition, I've got a rule that sends any calls with blocked Caller IDs to the IVR I described before. The great thing is that a lot of telemarketers use robo-dialers to make the initial call, and a human only picks up the phone once I answer and start talking. Those robo-dialers get tripped up by my IVR, and usually automatically time out after 30 or 40 seconds.

Another feature that's really handy is Callbacks. These are the reason I have the second phone number. This might be surprising to any American readers, but here in Canada, we typically have to pay extra to make long distance calls from our cellphones. What I've done to circumvent that is created a Callback on the secondary number. Here's what happens when I need to make a long distance call from my cellphone:


  1. Call the secondary number from my cellphone

  2. This will always give a busy-tone

  3. Hang-up after hearing the busy-tone

  4. Within 5 seconds, my cellphone receives a phone call from my VoIP account

  5. I answer and am presented with a standard dial-tone

  6. I can then dial whatever long distance number I want, and the call will be connected


The end result of this is that my cellphone is simply receiving an incoming call. My VoIP account is making two outgoing calls. One to my cellphone, and one to the number I entered when presented with the dial-tone. So the total cost to me is then $0.0125*2 = 2.5 cents per minute. WAY cheaper than what my cellular provider charges.

There's a lot more than you can do with voip.ms, but I think I'll leave it at that. I should mention there are two negatives associated with the service:


  1. You have to provide the VoIP hardware yourself

  2. Initial setup of the hardware and your voip.ms account can be a little tricky

The VoIP hardware I chose is the Cisco/Linksys PAP2T. I got it from Canada Computers for about $50. One brilliant aspect of VoIP is that it's incredibly easy to wire into your existing home phone lines. Simply disconnect the line coming in from the street (usually done at a junction box outside your house), and plug the PAP2T into any phone jack in the house. You'll be able to continue to use all the phones you already have in your house.

The PAP2T does need to be configured with appropriate settings for voip.ms, and other random things that I don't really understand. Your best bet for configuring both your voip.ms account and your PAP2T is to follow the large number of guides that take you through it step-by-step. The fine folks at the DigitalHome.ca VoIP forums are also quite helpful. voip.ms themselves have excellent customer support.

It took me a few hours to get everything configured exactly as I wanted it, but ever since it's been working beautifully, and I'm average about $6.50/month on home phone service instead of the $40+ I was paying before. Even factoring in the cost of buying the PAP2T, the switch to voip.ms more than paid for itself within two months. Call quality has been phenomenal, and everything has *just worked*.

I ended up staying away from the particulars of my setup in this post, but if there's demand, I can write another one going into more of the details about a decent voip.ms configuration, and explain some of the other terminology they use.

My OS X Backup Strategy

I take backups seriously. Very seriously. I currently use a combination of five different backup technologies, each with a special function. I've described my setup to enough people in person that I thought it might be worthwhile to get it down somewhere more permanent.

I don't remember where I first heard it, but a good rule of thumb to live by is:

Approach your back-up strategy as if your internal harddrive is always five minutes away from dying.


Harddrives die all the time. Often without any warning whatsoever. What everyone needs is an automated, reliable backup strategy.

The five technologies I use are:

  1. Time Machine
  2. Super Duper
  3. CrashPlan
  4. SpiderOak
  5. Dropbox

These represent a combination of on-site (the backup drive lives in the same location as the computer) and off-site (it lives somewhere else). There are advantages and disadvantages of both, and I'll get into those as they come up.

Note: Only two of the technologies I use here (Time Machine and Super Duper) are actually specific to Macs. The other three are platform independent, so there should be useful info even if you're running Windows or Linux.

Time Machine


Time Machine is the backup software built into every Mac (as of OS X Leopard). It's an on-site backup system, which backs up every byte of data on your computer. It requires an external harddrive be attached to your computer to perform the backups.

One of the key advantages of Time Machine is that not only does it back-up what's currently on your computer, but it also keeps old versions of backups. Let's say you've got a document that you've been working on for months, and at some point you remove a few pages from it. A month or two later, you realize you need to get those pages back. Time Machine will actually let you "go back in time", grab the old version of the document, and restore it alongside the new version. You can then pull out whatever you need from the old one, and you're good to go.

Time Machine does not guarantee that it will always have all old versions of documents, so it's not a replacement for a proper versioning system, but it's nice to know you've got some history. It does guarantee that at a minimum, it will have the full contents of your system (at the time of the back-up).

The other advantage of Time Machine is that it does full-system back-ups. Many backup technologies (including some I'll discuss here) only back-up certain portions of your system. Why do you want a full-system backup? Let's say that the harddrive in your Mac dies. You go to your friendly Apple Store, and they put a fresh new one in for you. Now what? You don't want to have to reinstall all your software by hand. Intead, you can instruct your Mac to "Restore from Time Machine". It will read the data off of your Time Machine backup, and configure your computer exactly like it was before your drive crashed. All your apps will be there, all your settings will be present. Even your desktop background image will be correct. This can save days of work.

Everyone who has a Mac should use Time Machine. Period. All it will cost you is an external harddrive. You don't even have to remember to back-up. As long as the drive is plugged into your computer, the backups will happen automatically.

Super Duper


Super Duper is another on-site backup system, which like Time Machine, requires an external harddrive. Also like Time Machine, it makes full-system backups. Unlike Time Machine, it does not do versioned backups. A Super Duper backup will represent exactly what is on your computer at the time of the backup, no more, no less.

So why use Super Duper? It doesn't seem to be getting us anything that you can't do with Time Machine. I use Super Duper for two reasons:

  1. On-site redundancy
  2. Bootable backups

I want on-site redundancy because I just don't trust having only one on-site backup. Things can always go wrong. The drive holding my Time Machine backup could go bad, or Time Machine itself could have a software fault which corrupts my backup. I've never seen the latter, but anything's possible. Better to have two separate technologies.

The real win of Super Duper is the bootable backups. What does this mean? Let's return to the scenario from before, where the harddrive inside your Mac dies. What happens if you just don't have time to go get a replacement drive? Some piece of work needs to be done, and it just can't wait. What Super Duper allows you to do is reboot your Mac, and when it starts up again, instead of using its internal harddrive, it'll actually start from the Super Duper drive! You can get right back to work. It won't be as fast as using an internal drive, but any drive is faster than a dead drive. This lets you get done whatever needs to be done, so you can go get your internal drive replaced when the time is right.

Like Time Machine, Super Duper can also do a full-system restore, so you don't need to reinstall the OS, applications, etc.

There's a free version of Super Duper, but the restriction on it is that whenever it does a back-up, it has to back-up the entire drive again. This can take hours. The paid version adds in smarts so on a backup, it only has to copy over what changed from the previous backup. Plus, you're supporting an independent developer who's built an awesome product.

CrashPlan


CrashPlan is the first of the off-site backup technologies I want to talk about. Why do I need off-site backups? I've already got two different backups at home, what's the point of having more?

I've got irreplaceable things on my computer. Every picture I've taken of my daughters. Tons of movies showing them growing up. All my software I've written. My Ph.D. thesis. Etc. etc. etc. What happens if my house burned down? Or someone broke in and stole everything? There's no way to get that stuff back. This is why an off-site backup is vital to anyone that takes backups seriously.

With CrashPlan, your computer sends its backups over the internet. You have a few choices in how you want to do that. The first, and most typical, is to have the data reside on CrashPlan's servers. Everything is encrypted before being transmitted so they can't read your stuff, but it'll live safe-and-sound on their machines. If you ever need to restore the data, you use the CrashPlan program to download it again. If you're using CrashPlan's servers to back-up, you'll have to pay a small monthly fee, which varies depending on how much space you use.

I don't actually save any data on their servers. Instead I use their alternate option, which I think is much cooler.

What's the problem with doing full backups over the internet? Upload speeds for most home users are *very* slow. How long will it take you to back-up your hundreds of gigabytes of pictures/movies/music/etc.? Days, weeks or even months, depending on how much you have. And if you have a major data loss (i.e. house burns down), it'll take a pretty long time to download it all again. Plus here in Canada, land of the internet-caps, you may end up getting charged overage fees for doing that initial backup.

What CrashPlan lets you do is attach an external harddrive to your computer, perform the initial backup onto that harddrive, then bring the drive to a friend's home to live attached to their computer. You don't have to incur the time/bandwidth cost of that first initial backup. All subsequent back-ups happen over the internet, updating the data on that harddrive. And if you have to do a restore, you can just grab the harddrive from their house and attach it to your computer again. The data is all encrypted, so your friend can't read your files. It's a fairly awesome system.

One thing CrashPlan can't do is full-system backups. You can back-up all the data on your computer, but you won't be able to do an automated system restore like you can with Time Machine or Super Duper. Personally, I have it back-up everything in my home folder. If my house burns down, it means I'll have to reinstall my OS and applications, but my pictures, movies and documents will all be safe and sound.

The other great thing about CrashPlan? It's completely free in this scenario. You only pay them if you're storing data on their servers.

SpiderOak


SpiderOak is a relatively recent addition to my arsenal. Like CrashPlan, it can't perform full-system backups. You tell it exactly which folders you want to back-up. All the data you back-up lives on SpiderOak servers. Their claim to fame is their security and encryption. They are technically incapable of looking at the contents of your files. Even under a court order, they could not reveal the contents of a customers files, due to the nature of their encryption.

I use SpiderOak for two things: Off-site redundancy (so I don't have to solely rely on CrashPlan) and syncing.

I have two primary computers. An iMac at home, and a MacBook Air that I take to the office. SpiderOak gives me the ability to keep folders in-sync across the two machines, so any changes I make to files in a sync folder on one machine will automatically propagate to that sync folder on the other. This lets me avoid the hassle of manually copying files back and forth, and worrying about which is newer or older. SpiderOak takes care of it for me.

SpiderOak's pricing is pretty great. If you're an education user, they charge $5/month for up to 100GB of data storage. It's $10/month for non-education folks. Either way, very cheap.

Dropbox


Dropbox is not designed as backup software, per-se. Instead it is designed primarily as syncing software, providing the same functionality I just described with SpiderOak. So why do I use both? Certain applications are capable of being configured to use your Dropbox account to automatically sync their settings and contents across machines via Dropbox. In particular, I use it for 1Password. Any passwords I add to my password database on my iMac will automatically be available on my MacBook Air, my iPhone and my iPad.

Dropbox does keep copies of your data on their servers, so you can access all your files via their webpage. The problem is that information has recently come to light that the data is not really encrypted on their servers, so Dropbox employees could read your files. My recommendation is to only store encrypted documents on Dropbox.

Conclusion


If it's not apparent by now, I'm really paranoid about my backups. A few years ago (before developing this strategy), I had a harddrive crash and almost lost every picture I'd ever taken. After a week of stress, hard work and black magic, I managed to pull the data off the drive. But this is outside the realm of possibility for 99% of people, so better to just be safe. All of the technologies I mentioned here are set-it-and-forget-it. Configure it once, and the software will take care of performing the backup for you.

It's an unfortunate fact that most people don't develop a proper backup strategy until after their first major data loss. My hope with this post is that at least one person will see how easy it is to have a solid back-up strategy. It shouldn't cost you much to buy a few external harddrives. And honestly, what's more important? One or two hundred dollars, or every single picture you've ever taken?

Bonus: 1Password


I thought it important I bring up 1Password a little more explicitly. This is software for auto-generating passwords for you, and securely storing them. Too many people use just one or two passwords, and share them across multiple sites. In short, this is a horrible idea. All it takes is for one of those sites to be hacked, and the attacker could get your password. Then it's just a matter of trying that password at various common sites. Use the same password for random site X as you do for your email, and they'll probably be able to get into your email account. And once their, they can initiate password-reset emails at a variety of other sites, and do all sorts of horrible things to you.

1Password is an infinitely better way of doing this. It can auto-generate incredibly secure passwords, store them in an encrypted database, and auto-fill them when you need them. It comes with plugins for every popular browser, so when you browse to a page that needs you to log-in, it can autofill your password. It's incredible, and I use it dozens of times per day. Go spend the money and buy this now. Please.