Thursday Night

Paul Betts’s personal website / blog / what-have-you

Fixing iTunes “Unknown Error -200″ on OS X

View Comments

If you’re hitting this error on iTunes startup, possibly because you installed iLife ’11, there’s an easy way to fix it. Open, and type the following commands:

sudo update_dyld_shared_cache -force
sudo restart

Written by Paul Betts

September 26th, 2011 at 7:08 pm

Posted in Apple

Dear Designers: please put dialog box buttons in the correct order

View Comments

Windows and OS X arrange dialog box buttons differently

I see so many people making this mistake lately, even in Microsoft’s own shipping software. The order of the dialog buttons is specific to the OS you’re targeting. It is confusing to users when you switch the button order, and if they aren’t paying attention, they may click the wrong one.

On Windows and KDE

From the Windows UI Guidelines:

Present the commit buttons in the following order:
OK/[Do it]/Yes
[Don’t do it]/No
Apply (if present)
Help (if present)

This has the result of pushing “The Thing You Want To Do” toward the middle of the dialog.

OS X is different

From the Apple HIG:

The buttons at the bottom right of a dialog all dismiss the dialog. A button that initiates an action is furthest to the right. This action button confirms the alert message text. The Cancel button is to the left of this button

Usually the rightmost button or the Cancel button is the default button. The default button should be the button that represents the action that the user is most likely to perform if that action isn’t potentially dangerous. A default button has color and pulses to let the user know that it is the default. When the user presses the Enter key or the Return key, your application should respond as if the user clicked the default button.

On OS X (and GNOME on Linux), the “Thing You Want To Do” is near the corner of the window. Personally, I think this is more sensible, but I’ll value user interface consistency over “better” any day of the week.

Written by Paul Betts

May 11th, 2011 at 2:03 am

Lots of new stuff coming, but RxXaml is now in crazy experimental mode

View Comments

If you’re tracking ReactiveXaml, you most likely don’t want to use the code that’s currently in master right now – you’ll want to stick with either the released version, or a commit earlier than c2a4o. In the meantime, here are the three things that I’m currently working on that are totally wreaking havoc on the tree:

  • Using TestScheduler on tests, so that testing async commands happens instantly and 100% reliably, instead of using Thread.Sleep hacks
  • A new MRU cache designed to replace QueuedAsyncMRUCache called ObservableAsyncMRUCache – it will be usable on Silverlight and WP7, and has much more usable behavior than the old class

Oh, and one more thing – porting a version of ReactiveXaml to MonoTouch. Write the same declarative code against iOS, use super-powered Key-Value Coding via Observable Bindings, and handle async code easily and gracefully.

Written by Paul Betts

December 2nd, 2010 at 9:54 pm

Listen to your music from anywhere using Ubuntu and SSH

View Comments

What you’ll need

First, you’ll need a compatible iTunes music server. Unfortunately, Apple has decided to make their own music sharing intentionally incompatible with other applications. Thanks Apple. Instead, I’m using Firefly Media Server, which iTunes will gladly connect to.

In general, our goals are to tunnel port 3689 over SSH so that when programs connect to localhost:3389, they’ll instead get the remote music server. Then, we’re going to rig Avahi (the Bonjour implementation that handles “announcing” services over a local network) to register localhost:3689 as a valid music server.

The commands

SSH into your machine, and set up the tunnel:

ssh -L 6689:localhost:3689

Now here’s a tricky part that I had to figure out: by default, Avahi will register services to your normal IP address, yet SSH will only forward traffic over the loopback address ( We instead have to create a fake hostname that points to localhost, then create a service entry for that hostname.

avahi-publish-address Me.local &
avahi-publish-service -H Me.local Firefly _daap._tcp 6689

Spin up Banshee, and you should see Firefly show up in the shared library list. This only will work on your machine though, it’s not shared across the local network (even though other people can probably see it in their iTunes apps).

Written by Paul Betts

May 8th, 2010 at 2:41 pm

Posted in Apple,Linux

Amazon S3 backup just saved my butt

View Comments

My LVM volume

As I sit here waiting for dd_rescue to try to salvage what’s left of my 500GB hard drive, and wondering what will become of the 1.75 TB LVM volume that is now toast, I count my lucky stars that I decided a month ago to finally fix that new backup system that I was thinking about – had I not done that, 5000+ photos, including from our wedding, would’ve been down the drain. I feel like I just finished backing up everything yesterday, and it’s already saved me from disaster.

Let me take a step back. For years, I’ve used Logical Volume Manager to manage the volume that I store my movies and TV shows on. The advantage of LVM is, that it abstracts away the physical drives – to my apps, it’s just one large hard drive, but I can use the admin tools to add and remove drives without formatting.

That’s all well and good, but the big caveat to running drives like this, is that if any one of them fails, the whole volume is gone. I knew this going into it, so I made sure that any data I really cared about had another copy somewhere.

So originally, I had a setup which ended up rsync’ing to this website, which is hosted on Linode, who I very much recommend by the way – I’ve used it for years and support is fantastic and the site is pretty powerful. That worked fine until I bought my wife a DSLR, and her great but giant photos caused my 4GB of diskspace to vanish. So for a long time, I just gave up on backup, and since the photos folder is so gigantic, the only place I could put it is on the previously mentioned storage volume and symlink it to where it should be. Bad developer, no Twinkie!

Why backup using Amazon S3

Amazon S3 as a user-friendly backup solution sucks – it’s extremely developer-centric, and it’s about as friendly as the tram drivers in Berlin, which afaik are some of the least friendly/helpful people on the planet.

However, here’s why it’s great – it’s cheap, and it has no limits. All of the free file storage / backup services top out at ~4 GB or so, and the paid services start out at $50/yr for > enough space for us. I’ve backed up 20GB on S3 so far, and I’ve incurred about $3.50 in charges. For periodic automated backup, it’s hard to beat S3 as a backend.

If you’re a programmer, just think of Amazon S3 as basically a giant hash table (or Dictionary<string, byte[]> for you .NET people). First, you set up a bucket, which is an instance of the table – you won’t have more than a few of these, and probably need only one for backup. These bucket names are shared among everyone, so you have to make them unique – I just prefix my username to it since I don’t intend to share the files out over the web. Since S3 has no concept of folders, the convention is to just encode the path inside the key (the key can have slashes).

The great news is, that an anonymous coder has done all of the grunt work for you to make the backup scenario work, via a tool called s3sync. Basically, it’s rsync to S3 – you create an initial key to put a root folder under, then run s3sync to copy it over. Since s3sync only copies over the files that are new or have changed, it saves bandwidth (and by extension, cash). Here’s how to run your first sync:

# You find this on the S3 site when you sign up

tar -xzvf s3sync*.tar.gz
cd s3sync
chmod +x *.rb  # Just to make sure
./s3cmd.rb createbucket yourusername-backup   # Only need to do this 1x!

# -(r)ecursive, -(v)erbose –delete(old S3 files that no longer exist)
# Sync your Documents folder to S3
./s3sync.rb -r -v –delete "$HOME/Documents" "yourusername-backup:documents"

Seeing what’s on your S3 account

While you’re setting this up and making test runs, it’s pretty useful to be able to see what’s currently in your S3 account. To do this, there’s a great Java applet called Cockpit by James Murty

Runs in-browser, great for management and verifying the backup worked

Make it Automatic

Now that we know how to do one sync, making it automatic is the most important part – if you have to remember to do it, you’re bound to forget. I put it into a script:


### Make sure to fill in the blanks here!
export BUCKET_ID="paulbetts-backup"
export BACKUP_PATH="/storage"
export BACKUP_KEY="website"

echo "**** Backup start ***"
echo `date`
/root/s3sync/s3sync.rb -r -v –delete "$BACKUP_PATH" "$BUCKET_ID:$BACKUP_KEY"

And then, put that script into a cron job, so that it runs at 4am every morning:

# m h  dom mon dow   command
0 4 * * * /root/storage_backup >> /var/log/s3backup.log

What if I’m using Windows

If you’re using Windows, this approach is going to be an order-of-magnitude more annoying, due to the difficulties that Ruby has with the Windows filesystem (backslashes, ACLs, etc) – while you might be able to get it to work, I can’t recommend it. However, one of the developers from Cloudberry Labs Emailed me about some tools for Windows centered around S3 backup that look pretty promising, especially the potential for easy automation via their PowerShell Snapin.

Written by Paul Betts

May 15th, 2009 at 10:23 pm

Posted in Apple,Linux

Live Mesh – good UI changes how you use software

View Comments

This article was supposed to be longer, but I hit “Publish” too fast. Mea culpa.

Because once again, I’ve turned into a giant Microsoft shill now that I work there, I thought I’d try Live Mesh, Microsoft’s new file sharing/storage service; especially since they now have a Mac Beta. After using it for a few weeks, I can now definitely say that it’s a pretty well-written piece of software, and that’s not a compliment I give out lightly.

Good UI sucks to write

Good UI execution is hard for two big reasons. It’s hard because you’ll build a UI based on how the underlying code is set up, you’ll sit down to use it, and then you’ll find it completely unusable – programmers are bad at design because their entire mindset is to build it right the first time. Contrast this to Industrial / Product Designers, who from the very beginning of school are taught, “come up with 50 ideas for the same project and turn them in”. Making good UI is a process that requires a lot of iteration and experimentation, and a willingness to come up with 25 ideas and throw away 23 of them.

In design, iteration is made to be very cheap – you’ve got a pencil and a piece of paper, and you draw it all out; coming up with those 50 ideas doesn’t involve tertiary work, 100% of your efforts are moving your ideas forward. With making UI, it’s not so easy – even with tools like Expression Blend trying to make UI work easier, it’s still a ton of effort to create all of the little interactions that make a UI great. Writing a UI is difficult, and writing a great UI is difficulty multiplied.

So why is Live Mesh’s UI so good? No modal dialogs!

One reason that I like Live Mesh is, unlike a lot of other software products (mostly ones written by Microsoft), I’ve never seen Live Mesh pop up a message box forcing me to answer some question when it wasn’t prompted by me. That last part is important, because it touches on the concept of user intent. When I click on “Send/Receive mail” and it needs my password, it’s okay to pop up a dialog to ask it, because I asked the program to do something. When apps pop a dialog on their own, imagine someone suddenly walking up to you in the middle of a conversation with someone else – impolite at best.

Written by Paul Betts

May 15th, 2009 at 9:05 pm

Posted in Apple,Microsoft

Essentials 2008

View Comments

Continuing from last year’s edition, here’s the software that I use on a day-to-day basis. Because of my traitorous switch to Mac, this list looks quite a bit different than it did earlier. As before, this is cribbing from Mark Pilgrim’s series – his 2008 edition is also full of good recommendations.

  1. Mac OS X 10.5 – after using a Mac as my primary machine for over a year now, I’m on the fence as to whether I’d ever go back to Linux or not. On one hand, the UI design and software support is great, but there’s just enough proprietary bullshit to make me reconsider. For the time being though, it’s the best there is, because my other favorite OS Ubuntu and Linux in general seems to be on a steady decline to crap city. If anyone takes offense to this assertion, I’ll be glad to write up a detailed response as to why it’s a mess.
  2. F-Spot, delicious, Vim – still continue to kick ass. Because of the wedding, I ended up effectively doubling my picture library, mostly with U’s 2MB pictures from her SLR camera – F-Spot handles it like a champ.
  3. Git and GitHub – Git is so mind-blowingly useful to anyone who is a developer, power-user, or anyone who works with text files, that I can’t possibly leave it off this list. This program continues to help me out just about every time I program; at work, I use it to manage multiple in-flight hotfixes to certain train-wreck components who shall remain nameless (but not linkless), as well as whenever I have to do any large change to Windows source code. At home, GitHub is a great way to manage my developer tools as well as my personal projects.

    Seriously, if you’re any sort of programmer whatsoever, learn Git.

  4. Quicksilver – it’s hard to describe what QS actually is, the term “app launcher” betrays its real utility, but it’s by-far one of the best reasons to use Mac OS X. Basically, it’s a GUI version of a fast command-line interface, one that learns which commands you use most often and shortens the number of keystrokes you need to use them. Taking some time to learn everything that QS can do pays off quite a bit for your productivity.
  5. Firefox – continues to be the browser of choice, with its fantastic plugins (the “It’s All Text!” plugin being one of my favorite, lets me use GVim to type Emails or this blog entry for example). Great developer tools like Web Developer Toolbar and Firebug make it way better than Safari for most things. Speed and platform-integration are two of the things I do miss though…
  6. Live Mesh – file synchronization that just works. Works great with both Windows and Mac, and its remote desktop feature while somewhat anemic, is beautifully simple to use. If you don’t have a backup solution (and if you don’t, you will lose your stuff – storing everything on a USB stick does not count), this is a fantastic way to do it with almost zero work
  7. VMware Fusion – solid virtualization software for Mac, great integration with the guest without the evil hacks that Parallels uses (trust me as a Windows developer when I say this, you are much safer with VMware than with Parallels). These days however, I prefer more to use a dedicated VM running on another machine that I can remote desktop into rather than a local VM.
  8. Cygwin – without this, work would be way more painful. A Windows machine without Cygwin is nearly worthless to me.
  9. iTunes – …and I f’ing hate it. Please, someone write a music player for OS X that doesn’t epically suck. Amarok 2.0 and Songbird don’t count – Amarok went from the best music player on the planet without question, to a giant pile of gray crap. Trolltech systematically destroyed every decent KDE piece of software by releasing Qt4 and causing everyone to decide to make massive rewrites of their software, but I digress.

    Anyways, some of the few things that iTunes got very, very right are, how it remembers exactly where I am in a podcast and syncs it with the iPhone, its podcast support in general, and its great sync support with devices (letting me choose whether to auto/manual sync music, making automatic backups of my phone, etc). The iTunes store would also be a gigantic win if it wasn’t so DRM-encumbered, and I would spend way more money there, instead of at Amazon MP3, which is also a fantastic service.

  10. XBMC – I’ve been using this on the XBox for years, and now that it’s a 100% cross-platform app, it’s even more awesome. Playing back video on your TV with this is fantastic, I stream movies and TV from my desktop machine over wireless and it works near-flawlessly, and understands just about any format. Setting up a cheap box with XBMC on it is the best way to get your music and movies onto your TV, hands-down. There’s also versions for hacked AppleTVs, which turns an AppleTV to me, from “complete trash” to “very compelling”. If the AppleTV had decent audio/video outputs, it would’ve been my new media box.

Stuff I don’t use anymore

  1. Tomboy – only runs on Linux until recently, and is local-only. The original developer also annoys me by coming up with fantastic ideas then abandoning them (I could also point that right towards myself, but anyways…)
  2. sshfs – I still use this occasionally when I have to traverse firewalls, but for everything local, Samba is faster and a bit less of a pain on OS X
  3. Unison – since I do much less work on my desktop than I used to, having two-way sync isn’t as useful to me; I just rsync from laptop -> desktop.
  4. Ubuntu – too many things broken on MacBook Pros, most the fault of Apple’s strange hardware, but it doesn’t change the fact that it’s broken.

Written by Paul Betts

December 31st, 2008 at 10:00 am

Running your iPhone SDK App on iPhone without the App Store

View Comments

Writing your own iPhone apps is fun and all, but it’s completely useless to me if Apple’s going to make me pay $100 and wait for months to get it onto my phone – one of the flat-out stupidest things that mar an amazing product; well luckily, the hackers are stepping up and turning Apple’s cathedral into a bazaar by Jailbreaking out of Apple’s code-signing prison, and creating an awesome alternative to App Store called Cydia.

Using some elbow grease, you can write an app using Apple’s official SDK, test it in the simulator, then actually put it onto the phone to see how it works. If it works great, either host your own F/OSS iPhone repository, or pony up the cash and get it into the App Store.

Or, just click on this:

Here’s the steps to get an SDK app onto your phone:

  1. Since Apple enforces codesigning on the iPhone, you need to Jailbreak your phone – otherwise we have to have a dev key.
  2. Build your app using the “2.0 Device – Release” profile (*not* Simulator)
  3. Using Cydia, install OpenSSH, and use the network preferences pane to figure out your IP address
  4. Open up a terminal, and get your app onto the phone:

    cd /path/to/my/app/build/Release-iphoneos
    tar -czpvf MyAppName.tar.gz
    scp MyAppName.tar.gz   # Replace with your iPhone’s IP
    cd /Applications
    tar -xzpvf MyAppName.tar.gz
    rm MyAppName.tar.gz

  5. We need to “fake sign” our binary, so keep typing in the terminal…

    apt-get install ldid
    ldid -S MyAppName

  6. Now, restart your iPhone – you should see the app in your Springboard

I make no guarantees about this method, but it at least worked with the sample that Apple ships (and that ironically is completely useless unless it’s on an actual phone).

Update: Getting your apps into the Cydia list is as easy as going to this website and submitting a description / package – just like App Store, only way easier and Free’er!

Written by Paul Betts

July 22nd, 2008 at 10:41 pm

Posted in Apple,Programming

Yikes! for nerds: how to get the code

View Comments

I ran out of time yesterday, but as promised, here’s how to build and run Yikes!

Quick Start

git clone git://
cd yikes
rake && rake ffmpeg
ruby lib/main.rb -l /path/to/videos -t /path/to/ipod/output -r 1800 -b

Getting the code

By far, the best way to get the code is via Git; this lets you view the entire commit history, as well as send me changes. If you don’t have Git, you can download precompiled source code trees for Linux or Mac OS X 10.5. The Git clone URL via Github is git://

Building (“Huh? Building? On Ruby?”)

(If you downloaded the precompiled version, skip this part!) Even though the application is in Ruby, we need to build ffmpeg and its associated libraries from source, so you need to have the XCode tools installed, and you probably need MacPorts as well. While building this takes forever, it’s fairly easy:

rake && rake ffmpeg

Running the app

Right now, you have to run Yikes! from the command line, but the syntax is pretty easy. Here’s a sample:

cd yikes_public

# The long version
ruby lib/main.rb –library /path/to/videos –target /path/to/ipod/output –rate 1800 –background

# or if you want the short version
ruby lib/main.rb -l /path/to/videos -t /path/to/ipod/output -r 1800 -b

# If you want to run it on the sample files for development, there’s an easier way
rake run

Written by Paul Betts

June 5th, 2008 at 10:27 pm

Posted in Apple,Linux,Ruby,Yikes!

Yikes! It’s your videos on your iPod!

View Comments

For awhile, I’ve been working on a project that is pretty cool, and I’m finally getting near the “first 90% done” software development mark; now I’ve got the 2nd 90% to get it to production-quality, and the 3rd 90% will make it actually good. Here’s the screenshot:

Yes, the UI is rough-draft, I’ve got to go to town on it in CSSEdit

What’s it do?

In its simple mode, Yikes! will take a directory and convert all the movies to iPod/iPhone format (H.264 MPEG-4’s, so compatible with most players), and it will skip files it’s already converted. This isn’t too far off from what you could do with Handbrake and some clever bash scripts.

However, you can also run the program in background mode, and this is where it gets really useful. You give the program a folder of videos, and a place to put the iPod videos, and it will start a web site that you can go to on another computer, where you can see the converted videos, download them, or (and here’s the clever part), add it to iTunes as a video podcast, which will copy all the videos to your iPod automagically.

Where’s the code?

Update: Changed URL from earlier, merged webif-ramaze into master

Later today once I’m back at home I’ll put up a “how to get/build the code”, as it’s a little tricky. I’m working on official releases for Mac and Linux, and a Windows port is in the future; while I haven’t been coding towards it, I also have made sure to not choose anything that’s completely impossible for Win32.

Thoughts? Ideas? Comments? Want to help?

Since I’m always busy with work, it’s taken me quite a while to get to this point, and I’m definitely open to accepting contributions and making this a real open-source project; so far, I’ve set up Github and a bug tracker (but no mailing list, forums, documentation, etc). If you’re not handy with coding, websites, or art/design, I would even just appreciate suggestions or ideas for cool features. My Email address is paul at paulbetts dot org, let me know!

Written by Paul Betts

June 4th, 2008 at 12:14 pm

Posted in Apple,Linux,Ruby,Yikes!