Joe Maller.com

iTunes Store DNS Connection Problems

Recently I’d been having some bizarre network problems, the most consistent of which was that I couldn’t connect to the iTunes Store. After a short round of testing, I was quickly able to determine that the problem was DNS servers I was using.

Yes, I’m one of those people who uses those 4.2.2.x DNS servers, for probably 10 years they’ve worked perfectly.

Methodology
While DNS servers can be set in the Mac’s System Preferences, that requires a lot of clicking and it’s faster to just use the networksetup command line tool. Since we’ll also be flushing the Directory Services cache with dscacheutil, switching servers can be condensed to one line making testing faster. Here’s an example of the command I’m using:

sudo networksetup -setdnsservers "AirPort" 4.2.2.1 && \
dscacheutil -flushcache

I repeated the above for each of the six known 4.2.2.x DNS servers. After individually setting each DNS server, I switched over to iTunes and attempted to access a different section of the iTunes Store.

Results
4.2.2.1, 4.2.2.2, 4.2.2.3, 4.2.2.4, 4.2.2.5 and 4.2.2.6 all failed to connect to iTunes. Each of the servers appeared to be online and responded to pings with an average response time of about 12 ms.

When I switched to any of the top three recommended DNS servers on DNSServerList.org, I was able to connect to the iTunes Store instantly.

There have been a few tweets with similar problems, but I couldn’t find anything related to upgrades or other problems with the 4.2.2.x servers. I haven’t yet been able to test this on other connections but will post an addendum once I have.


Last Minute Macworld SF ’09 Predictions

If this isn’t the last Macworld Expo, in 2010 everyone will say it should have been.

What I think we’ll see

  • New Mac Minis. [ wrong ] I don’t even care what the specs are, I’m buying at least one for the office. I’ve been putting this purchase off forever waiting for a newer revision, the current model has been unchanged since August ’07.
  • Unibody 17″ MacBook Pros. [ right ] This just seems obvious. I don’t know how much stock I put in the non-removable battery rumors, though it’s not inconceivable that battery access was reducing rigidity in the aluminum and was dropped for structural reasons. [ wrong ]
  • iLife and iWork 09. [ right ] I just hope Apple looked long and hard at Mobile Me and then ran as fast as they can in the opposite direction.
  • A new 30″ Cinema Display with Mini DisplayPort connectors and a camera. [ wrong ]
  • Phil Schiller will be wearing buttons. [ right ] Consensus will be that he was boring because he didn’t do anything insane.
  • Steve Jobs will not appear. I get the impression he’s so far past completely annoyed with the media attention that there’s no chance he’ll iChat in just to bump the stock a few dollars. [ right ]
  • The stock market is just too erratic these days to call any dependable reaction. I have some feeling that the stock will be punished for less than earth-shattering announcements, [ right ] but it all depends on the broader market. I’m going to be watching the UltraShort tech ETFs.

What I’d like to see

  • I’m hoping for a significant update to the AppleTV. If Apple don’t start taking this product seriously, they’re going to lose this market — if they haven’t already. Roku and Tivo are cutting deals with Amazon and Netflix for huge libraries of TV and movies on demand. These alternates are tempting, especially compared with the often anemic rental selection available from iTunes.

    There’s a lot to hate about the current AppleTV, the movie browsing interface, where you have to scan movie poster thumbnails with text that only appears when active is just horrible. AppleTV doesn’t have to suck like this, make it awesome, just don’t break Boxee.

  • Time Capsule, the Mac Mini and Apple TV… seems like there’s a lot of crossover there.
  • iTunes needs some fresh thinking regarding some interface and usability features, especially regarding video content and large libraries. I’d love to have a media server where I could create playlists from any of the computers in the house, all accessing the same media library. I also would love to be able to sync a subset of my library onto my portable for traveling.
  • iPhoto: Faster please, with less sucking. And share movies already. I’m definitely going to be checking out Picasa and I hope the competition pushes Apple to make iPhoto really shine.

Is Apple pulling out of MWSF so they can attend CES in Las Vegas? I just don’t see it. No matter how much of the Consumer Electronics Show revolves around the iPod ecosystem, CES just feels kind of lowbrow for Apple. Besides, these days Apple can get a gaggle of media assembled in Cupertino on a moment’s notice with five-words and a picture of a light beam. Whenever they want.

I haven’t been to a Macworld Expo in years, but I have fond memories of attending the Boston Expo in the mid 90s. I wish I could go this year, the last-hurrah zeitgeist seems like it would be fun to share in.


Fixing Mail import crashes on Leopard

After restoring from a Time Machine backup, Apple Mail would crash every time I tried to re-import my email archive. The problem seems to be affecting a lot of people who have mail that pre-dates OS X. The same crash also happens after migrating to a new machine.

Quick fix

Copy the following command and paste it into your Terminal. Press return and wait a few minutes. Once the command finishes, Mail should be able to import your messages.

grep -lZr 'Content-disposition: attachment' ~/Library/Mail/Mailboxes/ | xargs -0 ruby -i -pe 'gsub(/(Content-type:[^;]*;\s*name=)"(.*)"/){$1+(if !$2.nil? then $2.dump.gsub(/\\\\/, "\\") end)}'

The problem

The problem is specific to older, MacRoman encoded email messages with attachments whose filename includes non-ascii characters. For whatever reason, that freakshow edge-case combination will crash Apple Mail every time it tries to import those files. If by some stroke of luck you already have these messages in your email archive (I did), they can still crash Mail when trying to rebuild the containing mailbox.

The solution is sort of simple, just rename the attachment in the .emlx file. The harder part is finding which file to edit.

We’ll use grep to recursively search for a common token in these older files, then pass the filenames to a Ruby snippet which will filter the line containing the bad characters. Here is a section of a suspect message’s header:

--B_3113094650_866203
Content-type: application/octet-stream; name="SPWH 4.01ü.sit";
x-mac-creator="53495421";
x-mac-type="53495435"
Content-disposition: attachment
Content-transfer-encoding: base64

The first bolded line contains the attachment name which is causing the problem, who knows what that umlaut was originally. The second bolded line is what we’re telling grep to locate, I couldn’t get anything to dependably match the oddball characters. “Content-disposition” appears to be an older attachment syntax and didn’t appear in any of my messages from after 2001.

While the Ruby script could be run from find’s exec command, it wouldn’t be particularly efficient. Calling the script from find would pass every .emlx file in the Mailboxes directory through Ruby’s gsub, which is almost wholly unnecessary (and much slower). Only 10 of my 57,007 messages needed fixing, 99.98% of them were fine.

Is this safe?

Since the most common way to encounter this bug involves Time Machine restores or migration to a new machine, most users should already be backed up. If something should go wrong, just restore the backup’s Library/Mail folder over the messed up one. You can also copy or zip the Library/Mail folder to another drive to be even safer.

That said, I ran dozens of iterations of this solution against copies of my personal Mail archive without issue. And besides, if you’re reading this, you might not have any of your old mail, so how much worse could it really get?

If you’re still worried, copy your ~/Library/Mail/Mailboxes folder to another drive, run the script, then compare directories with something like Apple’s FileMerge. That will show you exactly which files have changed and what was changed inside them.

Renaming the attachment should be perfectly safe since the full encoded file contents are stored in the message. All the attachment name does is specify the filename, in a sense, it’s totally arbitrary.

I first submitted this bug with Apple back in May, if you have a developer account with Apple, please file a dupe for radar: 5912997


HP Photosmart Pro B9180 “All Print Heads are missing…”

We’ve got an HP Photosmart Pro B9180 printer on the office network. Whenever anyone prints, the printer queue flashes this error message, “All Print Heads are missing. Please install and snap print heads in completely,” then proceeds to print normally.

HP B9180: All Print Heads are missing. Please install and snap print heads in completely.

After going over this for about an hour on the phone with HP’s Tech Support, and after much cable swapping, HP sent a replacement printer. Which, of course, has the same problem.

I’m fairly convinced there’s a bug either in the HP printer’s firmware, or, more likely, in their Mac printer drivers.

Here’s what I know:

  • The error only shows if the printer is connected with an ethernet cable, either over a network or by direct patch to a single machine.
  • The error happens regardless of which application is printing.
  • I’ve seen the error on Intel and PPC Macs, running Mac OS 10.5.3 through 10.5.5.
  • Printer firmware is up to date.
  • Internal printer diagnostics report no problems with the print heads.
  • The printers seem to be working correctly in every other way. Prints look great.

HP’s support has been very good throughout this. My only gripe is that they probably should have sent replacement print heads alongside the replacement printer. The included instructions had me transfer the heads from the old printer to the new one. Since the print heads are, at very least, being reported as a problem, it would be nice if I could test those too. HP did include a full set of ink cartridges, which was generous.

My followup call to HP got me nowhere, which was what I expected. But hopefully that will get the issue promoted up to their engineering bug tracker.

Other references to this problem:

postmortem: We eventually gave up on the printer. Software bugs ended up being a small issue compared to internal ink spray, clogs, streaks and general malfeasance. It was replaced with an Epson 3800 which has been flawless for the past 6 months. I think I heard our ten year old HP 8000 LaserJet laughing as the still-too-new inkjet was escorted from the building.


Switching to Git

I resisted Git for a long time. It seemed a cultish thing with devout vocal followers and frequent mentions on Digg. I figured it would probably be a passing fad. I was wrong.

I drank the Kool-Aid and damn, it was tasty.

The first important thing to realize, especially when starting out and considering switching, is that Git works with existing Subversion repositories. That means the transition can be as simple as learning a few new commands, your repositories and servers don’t need to changing. Other team members don’t need to switch. If I had any other team members, this would be huge.

Of course, once you start using Git and see its potential, you’ll probably switch everything, convert your repositories and feel superior whenever you have to work with a Subversion hosted project.

Ultimately, Git is a revision control system and is fundamentally about preserving and protecting your working history. So feel free to experiment, it’s really hard to mess up.

It took me an afternoon to grasp the basic concepts of Git, or at least enough to use it in dumb-SVN mode. After about a week, I started to feel fairly comfortable.

I read a small mountain of weblog posts, documentation and the like, here are the ones I found most valuable:

And definitely watch Linus Torvalds’ Google talk about Git. It won’t tell you how to use Git, but he’s funny and the talk worth seeing.

Getting Git

While Git itself is easy to compile from source, getting the documentation manpages built on Mac OS X Leopard is a pain in the butt. I futzed around with it a little, but gave up halfway through installing a seemingly endless line of dependencies. The Mac binary installer works perfectly well and is kept up to date. I’d rather spend my time using Git than installing it.

Using Git

I was blown away by some of the stuff Git can do.

In the Google talk Linus pointed out how all SCM packages could do branching and branching wasn’t a problem. Merging was. Merging branches with Git is leprechauns and unicorns. It’s almost too easy. After a few days I found myself branching all over the place, constantly creating new branches to test any idea I was having. Folding those branches back in was almost always quick and painless.

Interactive line-by-line commits mean it’s possible to commit single lines from a file instead of the whole thing. This is great if you happen to go off on a bender and change a zillion different things between commits.

Cherry-picking is also great, and saved my butt when I created a pretzel of branch history. Using git-cherry-pick I was able to straighten out my history completely within Git using Git’s tools with no loss of work.

Conclusion

I started writing this post at the end of May, it’s now early July and I’ve been using Git for a few months with no regrets. The only time I hold my breath is when I’m pushing changes back to SVN, though it hasn’t glitched on me since early June. The speed and flexibility of Git are a constant pleasure to work with. The pain of merging branches, which used to take entire afternoons with SVN, has almost become an afterthought.


Really last minute WWDC predictions

Short this year, but I wanted to get something up.

  • New iPhone demo
  • iPhone not immediately available
  • 10.6 demo. No, this isn’t 10.5 SP1 (really!)
  • No new MacBook Pro, much as I want one
  • A cleaner architectural re-alignment of OS X from a developer perspective
  • Twitter will melt
  • AAPL will be up at the end of the day
  • I don’t see how they can launch the store until next week. Half the people here would be immediately flooded with support and administrative requests. There will be pre-launch resources available, but the store won’t launch right away.

    10.5 is great, but there are a lot of rough edges. The rumors about 10.6 being previewed are probably true, but I don’t think this will be a $129 upgrade. This will essentially be Service Pack 1. Apple isn’t Adobe, they won’t charge money to fix things that are broken.

    Twitter is going to add such a bizarre additional layer to this.

    And we’re walking in… or at least closer.


Home movies as iTunes TV Shows

Update: At some point, probably with iTunes 8 though I didn’t notice at the time, iTunes added support for batch changing video format, making the script featured in this post obsolete… as it should be.

itunes_multiple_info

Original post follows.

We usually keep our home movies in iPhoto, but recently I’ve started moving some select clips into iTunes. Unfortunately, the list of Movies quickly becomes unmanageable. These kinds of videos are much easier to work with when grouped as TV shows, but unfortunately iTunes won’t batch convert Video Kind.

So I wrote a script. In addition to defining selected movies as a show, it also tags their season with the current year and sets the Show Title. Here’s the script: (Open in Script Editor)

set showTitle to display dialog “Enter TV Show Title” default answer “Family Videos” buttons {“Cancel”, “Ok”} default button 2

set theYear to year of (current date) as integer

tell application “iTunes”

copy selection to tracklist

repeat with theTrack in tracklist

set show of theTrack to text returned of showTitle

set season number of theTrack to theYear

set video kind of theTrack to TV show

end repeat

end tell

 

To use that, just select some movies in iTunes and run the script. Whatever’s selected will be tagged and grouped under the title you entered.

Now our home movies are all grouped together and easily synced to iPhones or other iTunes fed products like iPods and Apple TVs. To view videos on any of those devices, the movies will need to be converted to iPod compatible format. QuickTime can do it, but iSquint/VisualHub can do it much faster.

This could have been done with AtomicParsley, but AppleScript is easier and pre-installed on every Mac.

What would be really great is if iTunes and iPhoto could talk to one another and pull video content out. iPhoto has supported movies for years now, why can’t they talk to each other? (because neither was designed for handling video formats?)

There’s plenty of room to improve this, if you do please post a link in the comments.



Next Page »