Archive for May, 2008

Razor and CYA Idiocy

We got a Razor for Amy and me, so we can scoot with Julia. It’s fun, but apparently for robust kids, as the handlebars are too low for a grownup, but it’s rated up to 180 pounds. The handlebars bug me, though. They have a label which reads:

Caution: this moves when used. Exercise caution & common sense when riding.

Caution: this moves when used. Exercise caution & common sense when riding.

Okay, I understand that a liability lawyer made them put that label on the scooter. But anyone who needs to be told that a Razor scooter moves, is going to be unable to exercise common sense when riding.

Comments

Nicer Batch Encoding with HandBrake

A while ago I posted a script for driving HandBrakeCLI. But it was lame that I had two not-quite-identical versions of the script — one for iPhone output and another for Apple TV. At a guess, Brian Beardmore only needed one type. Now that we watch movies on the Apple TV and I watch on the iPhone, it was silly to have two different scripts. So I added simple argument processing.

hb.sh v1.0.3

If there first argument is iphone, then hb.sh optimizes for iPhone. If the argument is appletv or there are no arguments, hb.sh optimizes for Apple TV. It’s very easy to tweak or add your own types — just look for myArgs in the script and add or adjust as desired. I run this script on my Linux server, which has lots of disk space and is generally idle.


On my MacBook Pro, I have a couple aliases to facilitate things. I copy DVD folders to ~/tivo/tivo-inspector/input and run one of these. When done, the script opens up ~/tivo/tivo-inspector/. I move the DVD folders out of input and the processed .m4v video out of output; then I drop the .m4v files onto iTunes’ LIBRARY area (so it doesn’t stop whatever it’s currently playing) and check iPhone videos to sync to the iPhone (the Apple TV has plenty of space, so everything syncs to it). Note that these lines may be too wide to display properly in WordPress — just Copy and Paste, and you’ll get the full text.

alias hbatv="ssh -t inspectore time screen bin/hb.sh appletv; open ~/tivo/tivo-inspector"
alias hbip="ssh  -t inspectore time screen bin/hb.sh iphone;  open ~/tivo/tivo-inspector"

Note that inspectore is the name of my Linux server. This would work just as well with HandBrakeCLI on a Mac “server” — or even Windows, if you set it up to accept remote commands (CygWin, anyone?).


Reminder: You must adjust the inputSearchDir and outputDir paths for the running HandBrakeCLI.

pepper@inspector:~$ egrep tivo bin/hb.sh
inputSearchDir="$HOME/tivo-inspector/input"
outputDir="$HOME/tivo-inspector/output"

In the future version I’d like to support for arbitrary HandBrakeCLI arguments on the hb.sh command line, but I first have to see if HandBrakeCLI can handle gracefully conflicting arguments from built-ins and the command line.

Comments (1)

My favorite Mac OS X command: open

For years I’ve been hearing complaints about the Finder, chiefly from John Siracusa and John Gruber. They have mostly gone in one ear and out the other, because of a little secret I have.

See, back in the day of Mac OS X Public Beta (pre-1.0), the Finder was really bad. Dog slow (much worse than now), highly crash-prone, and very limited (compared to both the Mac OS 9 Finder and the Leopard Finder).

When I was still working at The Shooting Gallery, fixing Macs, learning UNIX, and trying to jettison hacked Windows servers (unsuccessfully), the Mac OS X Public Beta was a very big deal. Its Terminal application and command-line environment much more stable than the still-very-beta Finder, so, I used them as much as possible. Over the years, as I have read ongoing complaints about the Finder, I have continued to use Terminal and the command line, and been largely insulated from the Finder’s failings.

I would like to mention three Apple tricks for mixing the GUI and CLI worlds — not that there couldn’t be others I don’t know. One is that you can drag files into Terminal, and it will insert their paths. This is excellent, because instructions can say things like:

Now open your Applications Folder, and the Utilities folder there, and Terminal inside Utilities. Next type “chmod u+x ” (make sure to leave that space at the end), and drag the file you just downloaded into the Terminal window. Then press Return.

I don’t use path insertion often, though, because Tab completion is faster than switching to the Finder, digging up the file, and dragging. Ironically, when I read In the Beginning Was the Command Line, I thought it was absurd that Stephenson claimed typing could be faster than mousing. All those keys to hit! Alas, the CLIs I had used at the time did not have Tab completion, which does in fact make the keyboard faster than the mouse.

So anyway, back to the point of this post: the path from the command line back to the Mac OS X GUI: the open command. Apple has given this one simple command the ability to open files, folders, URLs (web pages, email addresses, etc.), applications (optionally passing them files), etc. This single command allows me to do 90% or more of my file system navigation in the command line (where ssh and friends live) instead of in the Finder.

We love it!

I actually use the bbedit command as frequently.

There’s a third bridge between the CLI and GUI spheres: executable scripts with the .command suffix are launchable as Mac applications, but run as CLI scripts. I like putting these in the Dock, although for my own use I mostly launch scripts directly from the command line. If you find yourself in need of argument processing, check out Fred Sanchez’s DropScript hack useful; it can add argument processing which is not available with the .command technique.

PS-If you want to run AppleScripts from the shell, look into the osascript command.

Comments (3)

Batch Encoding with HandBrake

I use Handbrake to rip DVDs for my iPhone and Apple TV (and previously for my Treo 650, at much lower quality). It’s excellent, but takes a long time, and slows down the whole system while compressing. My PowerBook G4 wasn’t powerful enough to do H.264 compression in reasonable time, so I got into the habit of ripping the DVDs on the Mac with Mac The Ripper, copying them to the server, converting on the server, and copying back down to the iPhone through iTunes on the laptop. Transferring a full DVD via gigabit Ethernet takes under 10 minutes, which is why we have 3 1/2 gigabit Ethernet switches (8-port, a pair of 5-ports, and the 3 ports built into the Time Capsule) in a 3 1/2 person (2 grown-ups, a 5-year-old, and the cat) home.

Since then I’ve upgraded the laptop and replaced the server, so they’re now both 2.4GHz Core Duos, but I still prefer to avoid the load on my personal machine — especially now that we have an Apple TV, which likes large high-quality video files. The MacBook Pro runs HandBrake.app (Mac GUI), while the server runs HandBrakeCLI (Linux).

HandBrakeCLI is designed to convert individual files and is awkward for converting whole DVDs. Fortunately I found MediaForkCLI-batch.sh, a wrapper which is good at converting all the real titles from one or more DVDs; it automatically ignores short titles such as previews, and titles that have already been transcoded. Unfortunately MediaForkCLI-batch.sh is languishing, and hasn’t been updated for HandBrake v0.92, but it was straightforward to update it to the new syntax.

In the process I made some changes and added an alternate version with different settings optimized for our Apple TV. On the Linux box (named inspector), the scripts are ~/bin/appletv.sh & ~/bin/iphone.sh. I put newly ripped files into ~/tivo-inspector/input/ on inspector, and these scripts rip whatever they find there, generating files in ~/tivo-inspector/output/.

On the MacBook Pro, I keep video files in ~/tivo, and ~/tivo/tivo-inspector is a symbolic link to tivo-inspector on inspector, the server — mounted via AFP. This makes it easy to move files back and forth.

For convenience, I have a couple aliases on the MacBook Pro which log into the Linux machine, start a screen session, and run the appropriate script. This means that if I disconnect the laptop, I can later ssh back into the server and use screen -DR to reconnect to my running conversion session. When the conversion is done, the aliases open the remote folder in the Finder. I move the files back up out of input & output, drop them onto iTunes, and then either Sync the Apple TV (which gets copies of my whole iTunes Library), or sync them to the iPhone.

The scripts are appletv.sh & iphone.sh.

If you use these scripts, you should carefully review the encoding settings. In particular, I encode Apple TV audio to AAC stereo, because our Apple TV is connected to a pair of stereo speakers with a subwoofer; they cannot handle Dolby Pro Logic, which is better for most TVs.

You will also have to update paths in the scripts — to the input and output directories, and to HandBrakeCLI itself — to make them work on your own system.


Here are the aliases in sh/bash format; change the equal signs to spaces for csh/tcsh:

alias appletv="ssh -t inspectore time screen bin/appletv.sh; open ~/tivo/tivo-inspector"
alias  iphone="ssh -t inspectore time screen bin/iphone.sh;  open ~/tivo/tivo-inspector"

Comments

Time Warner HD DVR Kicked to the Curb; Replaced by Apple TV

Our (cheap) 23″ LCD TV’s composite input gives lousy color. On the other hand, we’ve gotten loud buzzing noises a few times from its HDMI input, so we had our Time Warner (Scientific Atlanta) HD DVR connected to the composite inputs, and dealt with the lousy color and poor brightness. We also paid an additional $20.10/month for the second cable connection and DVR (Time Warner charges $9.95/month more for either HD or non-HD DVR than for a non-DVR cable box [HD or non-HD]). Now I wonder if the problem was with the DVR’s HDMI output all along. Oh, well — it no longer matters.

We do still pay $66.19/month for digital cable service upstairs. This lets Julia watch a couple kids’ shows a day, and Annette & Amy check the Weather Channel. Our (pre-paid) TiVo also records the shows we like, so we can watch upstairs, but we generally watch downstairs. Neither of us knows if we’ll watch more upstairs, or pay a few dollars a month to watch downstairs. It’s an experiment.

Since we watch most of our “TV” from (ripped) DVDs, and our Time Warner signal is very unreliable, and their service is lousy, I returned the DVR on Saturday. That $20.10/month should pay for a Netflix upgrade and/or several shows from the iTunes Store (no longer the “iTunes Music Store”, I noticed — I wondered how long that would take, but missed the actual switch).

Good candidates for iTunes ducats — (certain to total less the $241.20/year we’d been paying for the downstairs DVR):

  • $10: 16 consecutive episodes (4 weeks) of The Daily Show ($2/ea) — we watch it infrequently these days.
  • $20: a season of South Park.
  • $26: a Torchwood season.
  • Doctor Who isn’t available from iTunes, but we can watch it in VLC or upstairs, on cable.
  • free: Battlestar Galactica (on cable, upstairs)
  • free: The Sarah Jane Adventures (upstairs)
  • free: Robot Chicken (downloaded and watched on a laptop)

The TiVo S2 has a built-in web server, and I use tivodecode to extract MPEG video, but it won’t play in QuickTime Player. They do play in the redoubtable VLC, but it’s not quite as polished. This is not presently annoying enough to justify purchase of Toast, which can convert .TiVo files for QuickTime or iPhone, but I am not sure if DRM would be a problem; they don’t provide any detail.

We haven’t yet purchased anything through (or for) the Apple TV yet — perhaps this week we’ll try it.

Comments

Outlook Problems #6

Outlook’s default behavior is to sort new messages to the top of mailbox windows. I prefer new messages at the bottom, but have noticed that when I start reading mail, threads with new messages appear at the top. So I tried reading mail the way Outlook wants me to, but it still sorted newer messages within each thread (”Conversation”) to the bottom of the group, and deleting messages still moved down (to an earlier message in this arrangement). Since it doesn’t work right either way, I might as well do it the way I’m used to: newest at bottom (as of the time I first display or last Refresh the mailbox; the newest stuff still floats to the top, which I cannot prevent).

Sometimes when I delete messages, Outlook selects the next message down (which is correct, given that I view messages in ascending date order). Other times it selects the top message in the mailbox, which is only the right thing to do if it’s the last message in the mailbox. This inconsistent behavior may be connected to whether any off-screen messages are selected, but that shouldn’t matter. I shouldn’t have to wonder where the selection will go, or try not to select messages across more than one screenful at a time, or rush through selecting and deleting mail or collapsing threads, for fear of a new message coming in, removing my selection, and selecting, previewing, and (almost) marking one of those messages read, before I had a chance to delete, mark, or collapse it. This means that if client-side filters are active, the user must wait after launching Outlook, until it’s finished filing messages into the current mailbox, as new messages will constantly disrupt the selection until Outlook is finished running client-side filters. Even if Outlook has been running a while, it’s easy to select a few messages for processing, be interrupted by new mail, deal with whatever was previewed and start selecting again, be interrupted again, and have to deal with the second undesired selection/preview before attempting to return to manual selection for managing email. Amazingly frustrating, and a great way to “lose” unread mail.

With a multi-monitor setup, the best way to use Outlook is with the mailbox filling one display and the attached preview pane covering most of another display. Unfortunately, as I select different mailboxes, the preview turns off. Each mailbox has its own preview state, which is important because I generally only read messages (via preview) in my “fresh” search pseudo-mailbox. In other mailboxes, clicking a messages shouldn’t mark it read, so preview is a bad thing everywhere except in “fresh” (and often in “fresh”, as well!); unfortunately, viewing messages in their own windows is prohibitively slow. The very confusing thing is that sometimes Outlook spontaneously turns off the preview and shrinks the mailbox to its size excluding the preview. This leaves the mailbox covering one display but not extending onto the next; it looks maximized, but isn’t actually in the maximized state. When I switch back a mailbox with preview on (”fresh”), it reappears one character wide, rather than covering most of the secondary display as before. Very aggravating — I think the workaround will be that I must use one window for my “fresh” filter (with preview), and another for other mailboxes (no preview). Hopefully I can escape more bites from these two bugs.

In Outlook, it’s impossible to mark a message (un-)read from the message window, or even to determine directly what mailbox it’s in. I find myself searching across all mailboxes by title and refining by date (which I can see in the message window) to find out it message is, so I can mark it unread for later attention. It’s also impossible to open a message in a new window from the reading pane; the workaround is to Shift-Tab back into the mailbox window and then hit Enter to open a new message window from there.

I often want to delete a collapsed thread (”Conversation”). Outlook insists on expanding it first, which wastes time and often results in unread messages appearing and then being deleted — disconcerting, as it gives the impression I’m losing important (unread) mail. Worse, Outlook cannot mark a thread unread without expanding it, which moves the selection into the thread and marks that one or two messages read when deselected (unless the selection lasts a second or less, as I have set Outlook to mark messages read after a second, because I cannot eliminate the delay, and above one second it doesn’t automatically mark short messages which I read quickly as read; I have to go back and mark them read manually later). If I have just read a new message in threaded mode, and want to mark it unread, I have to either hit Control-Q to mark it read or move to another message and back (assuming I’ve had the current message previewed for at least a second), mark it unread (Control-U), then hit left-arrow to collapse the thread.

Worse is when I want to mark a whole thread unread (more common). Then I have to collapse the thread to implicitly select the whole thing (switching to and from the mouse slows me down, and I get too much mail to be inefficient in dealing with it); hit Control-U to mark the whole thread read (implicitly expanding it), then hit left-arrow within a second to collapse it again before Outlook decides I’ve read a message in preview.

When I delete a message, Outlook immediately selects (and previews, in “fresh”) another message. When I’m reading mail, this is generally what I want, so I can deal with the next message. When I’m trying to delete or file mail, it means Outlook automatically starts the process of dealing with another next message, and unless I’m very quick marks it pseudo-read (as soon as I deselect), so I must decide what to do about the new selection. This makes it harder to stop reading mail in the current mailbox, as every time I complete an action, Outlook picks the “next” message and engages me in dealing with it; stopping without losing unread status on a message I haven’t actually read yet requires contortions. When I know I’m about to stop, I tend to deal with a message or thread and then hit Control-up-arrow to jump to the top of the mailbox, which should be the first message I read (so already marked read), but is often a new message that’s come in recently; I then have to decide on and handle that before I can move on to another mailbox or activity.

Normally, when a thread (”Conversation”) is collapsed, Outlook deselects its messages. Sometimes (unpredictably) it still shows the preview for a hidden message, which breaks the Control-Q Control-U left-arrow dance, and I have to instead hit Control-Q Control-U left-arrow up-arrow to get a collapsed unread thread.

F5 (Refresh) doesn’t clear collapsed conversations; this is annoying. On the other hand, sometimes messages disappear immediately upon being marked read, which means I don’t even get a chance to mark them unread; they’re effectively just gone. I have no idea what triggers the second problem; fortunately it’s rare, as it tends to result in losing mail — often mail I was saving for later attention.

Control-Q marks individual messages read, but cannot be used on whole mailboxes (with the selection in the left-side mailbox column). There’s no good reason for this, as marking whole mailboxes read is a common function, and in the pop-up menu, it just doesn’t have the obvious keyboard shortcut.

Outlook cannot select multiple mailboxes at one time, which is ungood; on the other hand, it makes an effort to be helpful — when I select a mailbox, it kinda-sorta move the selection into the message list (which is pretty reliably what the user really wants, since you can’t do much with mailboxes except delete or move them). It’s all a bit confusing.

If I have a message which has been previewed for over a second, I know it’s effectively read (it will be marked as such as soon as I deselect it, unless I drag it into another mailbox first). It would be good if I could use Control-U to tell Outlook not to mark this message read as soon as it gets deselected, but instead I have to mark it read, then mark it unread, and then move away within a second — before the preview timer marks it mostly-read again.

Comments

People Suck: Flower Thief

1:39pm: 3 flowering plants On Friday Amy bought a bunch of flowers. On Saturday she planted them outside our apartment. On Sunday we went to J. J. Byrne Park (to be re-renamed back to “Washington Park” in the near future) with Julia and Lynne. We left at 1:39, and I took some pictures of Amy’s handiwork.
3:59pm: Theft -- 2 stolen When we returned at 3:59, we were shocked to see that someone had dug up and stolen two of the dahlias.
To the DISGUSTING HUMAN BEING who stole my PLANTED FLOWERS, get a life!!! To the disgusting human being who stole my planted flowers, get a life!!!

Comments (4)

Apple TV in the House

We got an Apple TV this week, and it’s excellent, although I tripped over some serious network problems (more Mac problems than Apple TV problems, actually).

Compared to our TiVo (upstairs) or our Time Warner Scientific Atlanta HD DVR, the Apple TV is surpringly advanced. The SA box keeps losing signal (probably TWC’s wiring at fault, but they keep not fixing it), and is much larger (and noisier) than the Apple TV; basically it’s a piece of junk, but it’s substantially cheaper than another TiVo. We’ll probably get rid of this DVR and our downstairs cable connection in favor of the Apple TV very soon.

Comparing the Apple TV to the TiVo is more interesting, not least because people have been comparing the two companies for years, and keep demanding that Apple build a TiVo killer (both before and after the Apple TV release). Given how badly cable companies stink, it’s hard to believe Apple should embroil themselves in this mess, but they seem to be doing okay with the iPhone, and phone companies aren’t much better than cable companies. People also want Apple TVs to play DVDs, which is an obvious feature, but would be less profitable for Apple than iTunes Store rentals and purchases. But back to the comparisons.

The SA DVR has exactly one advantage over the TiVo (aside from price): its “Ouija board” — when you need to “type” with a very limited keyboard, the TiVo makes it possible but not easy. The SA box improves the experience dimming (and skipping over) invalid letters (which would spell words that don’t match the list of available shows). The Apple TV, interestingly, has an unimpressive on-screen keyboard and a very limited remote (it’s the same one Macs ship with, meaning 6 buttons: 4 directions, play/pause, and menu/back). But it’s easier to use, because the Apple TV doesn’t lag behind user input as much (it doesn’t have to match input against all possible titles, remember), and tactile response is very good; I only made one typo when entering usernames of several friends, and it was easy to correct, even though Delete is an onscreen selection (no Clear key, as on the TiVo remote).

This brings us to another interesting comparison: the SA box has Internet connectivity (I think it’s channel 996 that shows the current IP), but doesn’t use it for anything except the electronic program guide and purchasing pay-per-view (which we don’t do). The TiVo adds TiVo-to-TiVo transfers of shows (we only have one, so haven’t tried it), scheduling via http://www.tivo.com/tco/, an unsupported web server which allows downloading encrypted/watermarked television shows, and the ability to run applications from a server (either at home or across the Internet). Applications allow you to play music or slide shows from a Mac or Windows PC, or slide shows (from your Picasa or Yahoo Pictures account — but not Flickr, even though Yahoo owns Flickr!). Unfortunately, you cannot combine these applications, so it’s impossible to listen to music while watching a slide show on the TiVo. TiVo has apparently dropped support for third-party development.

The Apple TV, on the other hand, does this all much better. Out of the box, it comes with a set of high-quality flower photos, which run as a slide show when idle. Music can be a) played from the Apple TV’s hard drive, b) streamed from iTunes on a Mac or PC (controlled from the Apple TV), or c) streamed from within iTunes in AirTunes+ mode — iTunes sends audio and ID3-style metadata including cover art over the network to the Apple TV. In any of these modes, track information is displayed onscreen, and if the Apple TV is left idle, the it starts showing a slide show (ours is photos of Julia, of course); this doesn’t interfere with music playback at all.

Compared to TiVo’s lousy support for Yahoo Photos (!?!) and Picasa (they want you to create your own account and log into it before downloading any photos), the Apple TV supports Flickr and .Mac photos, as well as the owner’s own via iTunes, of course. There is a clear hierarchy of user experience here: no support on SA/TWC; poor slide shows or mediocre media streaming on TiVo; high-quality music and photos on the Apple TV, pre-loaded with nice photos for a superior out-of-box experience.

One of the few things I regret about the Apple TV is that I bought it from Apple; I didn’t get an educational or corporate discount, so I could have gotten it faster for $15 less from Amazon (via Prime), but when I tried to cancel the order at store.apple.com it had already gone through (less than 5 minutes after pressing Submit). This should be the worst problem I have with the new gadget!

Unfortunately, it wasn’t. The Apple TV would not synchronize content from iTunes; I was able to play music through it (AirTunes), but it mostly refused to show up in iTunes’ DEVICES list. I got a warning about port 3689 possibly being blocked by a firewall, which I initially ignored, knowing I had specifically allowed iTunes to connect through Leopard’s “socket firewall”.

The Apple TV AppleTV is not responding. Check that any firewall software running on this computer has been set to allow communication on port 3689.

pepper@prowler:~$ grep 3689 /etc/services 
daap            3689/udp    # Digital Audio Access Protocol
daap            3689/tcp    # Digital Audio Access Protocol

The second time I got this message, with iTunes’ Preferences claiming the Apple TV was synching even while it wasn’t fully accessible, I did some searching, and found out that indeed several people needed to open up the socket firewall before Apple TV synching would work. I did this, and lo and behold, our Apple TV now has the proper 12gb of video, 51gb of audio, and 3gb of photos it should. It’s bad that iTunes wasn’t properly whitelisted in the firewall, but it’s much worse that people need to turn off a security feature to make the Apple TV work. Fortunately, after I switched the firewall back to “Set access for specific services and applications” (where it should be), the Apple TV continued to appear and synch properly; bug filed with Apple.

That brings up another bug: we have a Gigabit Ethernet network (3.5 switches — 8-port, a couple 5-port, and the 3-port built into our Time Capsule) and an 802.11n network, but unfortunately the wireless doesn’t work right. At 5GHz, I keep losing my connection; at 2.4GHz it stays up everywhere except the guest room (which has no Ethernet), but speeds throughout the apartment are poor and connectivity is less reliable than our 802.11g Airport Extreme network. Since I haven’t fixed this yet, I much prefer to do large transfers over the wired network.

The Apple TV connects to a running copy of iTunes to download content; in my case, most of the connections (once I got past the firewall issue) were to the AirPort IP address, which prevented them from making progress on the 65gb transfer. I had to disable AirPort to force the Apple TV over to the Ethernet connection, which was much faster; after it was done I re-enabled AirPort, but that’s another bug (also reported, and yes, I do have System Preferences set to prefer Ethernet to AirPort).

Comments (3)