Archive for February, 2010
This restaurant scares me
Sunday, February 21st, 2010American Gothic
Sunday, February 21st, 2010
Is the Volvo C30 this decade’s AMC Gremlin?
Wednesday, February 17th, 2010EPA should not list combined ratings for upcoming electric vehicles
Monday, February 15th, 2010This next paragraph is going to sound like a grade-school mathematics word problem, but bear with me. The Chevy Volt has an electric motor and a battery. When the battery is depleted, a gas generator kicks in to power the electric motor and extend the range. Chevy says their battery will power 40-miles of driving. So a person who drives less than 40-miles a day might only use gas on rare occasions. So for that person, a displayed rating of 40-miles-per-charge would be the most useful rating. For a person who regularly takes a 400 mile drive from Los Angeles to San Francisco, 90% of their drive would be powered by the generator. For them, the number they’d need to see would be how may miles-per-gallon they’d get. The EPA’s current label design would fail to communicate anything of use to either the people in these examples.
Instead, they’re doing some kind of weird combined rating that relates to kilowatt-hours used per 100 miles of travel. This awards the Chevy Volt a rating of 236 mpg. Sounds impressive, but that’s not a number that relates to one’s experience of using the car. I typically drive less than 100 miles a week. If I were in the market for an electric vehicle, I’d use zero gallons of gas most weeks. ∞ mpg?
Here’s the EPA draft label, for the BMW Mini-E. That car can travel 156 miles on a single charge. It’d be much more useful if that range were just printed on the label, rather than “33kW-hr/100 miles (equivalent to 102 MPG)”.
EPA, if you’re listening, please label electric cars as follows. Show the distance the car can go on a single battery charge. If the vehicle switches to another fuel when the battery is depleted, then separately show the distance it can go on that fuel along with the size of that fuel tank. Nice and simple. 2 big numbers (distance ranges), one small number (size of secondary fuel tank). The car manufacturers wouldn’t be able to tout awesomely high miles-per-gallon ratings, but it’d be a more honest and intelligible way to rate methods of propulsion that use fuel not measured by the gallon.
iTunes sharing over the internet using Back to my Mac and ssh port forwarding
Monday, February 8th, 2010I was at work the other week, doing a repetitive task of the sort that provides an opportunity to listen to music. I’d recently purchased an album and had stored it in the iTunes library on my home computer, but had not yet loaded the new songs onto my iPhone. There had to be a way to make iTunes at home share its music to my work computer so that I could listen to the new music. A few internet searches turned up some interesting information as well as a solution.
The crippled feature to be healed and exploited
Apple’s iTunes software has the ability to share selected playlists or entire libraries of music to other computers on a local network running iTunes. This means that if you have a large collection of music on your desktop computer, you can browse and listen to music from its library from a different room, streamed to your laptop. Or if you work in an office, and your coworkers have iTunes running on their machines and set to share, their shared libraries will automatically appear in the left column of iTunes running on your machine and you can play from them. It all works very seamlessly, on a local network. Possibly due to agreements made between apple and the recording industry, the sharing feature only works between computers on a local network, not between computers on the internet at large.How iTunes sharing works
When a user tells iTunes to enable sharing in that application’s preferences, iTunes advertises that service on port 3689 of the local network using “Bonjour“, the name for Apple’s implementation of the Zeroconf standard. Bonjour is used by iTunes, iPhoto, and other applications to advertise and to find servers on a local network, such as within a home or office.If a copy of iTunes is running on any other computers that are on the local network, those instances of iTunes will notice the advertisement of an iTunes share on the network, and will display the name of that iTunes share in the left column of the window. The user can then click that shared Library and play songs from it on their computer. The playlists and songs stream over the network from the sharer to the sharee. Unfortunately in my case, iTunes running on my laptop at work couldn’t see the iTunes share served from my computer at home, because my home computer is miles away and not connected to the same local network as my laptop.
Bringing the remote network closer
The following link pointed the way to a solution:1I recognized a familiar Unix trick in their tip: Port forwarding over a secure shell connection. Of course! If one could make a secure shell connection (abbreviated in the command “ssh”) to a remote computer, one could then do what’s called “port forwarding”, and forward all communications on a port on the remote machine to a port on the local machine. This would transport both the advertisement of the iTunes share and the actual sharing itself from the remote network to the local network. I’d never actually executed port forwarding over ssh before, but I’d heard of it, and between their example and the man page for the ’ssh’ command, it all became clear. The tip first requires that one knows the IP address of the remote computer, and then shows the command to connect to the remote machine, grab any communications on port 3689 (the port used by iTunes sharing), transport it encrypted to the local machine, and repeat it on port 36890 of the local machine. The command looks like this (hover your mouse over any portion of the command to see an explanation of that portion):
$ ssh -fNL *:36890:127.0.0.1:3689 USER@REMOTE-HOST
After that command successfully concludes, the iTunes share on the remote computer will be accessible to computers on the local network, except they won’t be able to see that it’s there. The second command in their document uses OS X’s built-in “dns-sd” command to advertise that there is an iTunes share on port 36890 of the local computer. It is this advertisement that will make the iTunes share appear in the sidebars of any copy of iTunes running on the network:
$ dns-sd -R "Remote iTunes" _daap._tcp local 36890 &
I was confident that this would all work, but for one snag. Like most people, my home computer only has an address on its local network, it doesn’t have its own internet address. The computer is connected to a router. The router has an IP address on the internet and an IP address on the local network and uses what’s called “Network Address Translation” to distribute connections from the outside internet to all the computers on the local network. If I tried to connect to the IP address of my home connection, I’d be connecting to the router, not my home computer with its trove of music. Luckily a solution was within reach.
Locating the remote computer using Back to My Mac
I recently purchased a “MobileMe” subscription, which includes a service called “Back to my Mac“. I’ll let Apple’s marketing folk, who’ve obviously seen Buckaroo Banzai, explain “Back to My Mac” for me:Wherever you go, there’s your Mac.
Back to My Mac puts any Mac OS X Leopard- or Snow Leopard-based Mac you use within easy reach. MobileMe finds your remote Mac computers over the Internet and displays them in the Finder on the Mac you’re using. So you can connect from anywhere with just a click. Edit and save documents, open applications, and move folders. With Back to My Mac Screen Sharing, you can control your remote Mac as though you’re sitting in front of it.
I have been using the Back to My Mac service to copy files to and from my remote computer from work, and to occasionally take control of my home computer’s screen from work. The service must be punching through the router using port-forwarding and registering a temporary domain name for my home computer which can be accessed from the outside internet. I figured that if I could find out this domain name, it would be worth a try to use it to connect from work to the home computer and set up ssh port forwarding of the iTunes share. A search turned up this article:
10.5: How to use ssh using ‘Back to My Mac’
The writer of that article explains exactly how to determine the Back to My Mac domain name at which one can find their remote computer. When I tried the first method described, it did not work. As it turns out, that method works for short computer names, but my home computer’s name is long, and Back to My Mac truncates it and adds a few random (?) numbers when assigning the domain name. The second method they mention does work. I can easily determine the name assigned to my remote machine by choosing “Shell > New Remote Connection…” in the Terminal application’s menubar. In the “New Remote Connection” window that appears, I choose ’ssh’ in the service column and my remote computer’s name in the ‘Server’ column. There, in the field at the bottom of the New Remote Connection window will appear the command for making a ssh connection to my home computer. It’s not the same ssh connection command that will be used to do port forwarding, but the last portion of it does show me the exact domain name that will resolve to my home computer.
Victory
Whenever I feel the mood, I can now run the following two commands and then sit at work listening to streaming music stored on my home computer:$ ssh -fNL :36890:127.0.0.1:3689 myComputerName.myMobileMeID.members.mac.com.
$ dns-sd -R "Zach's Remote iTunes FTW" _daap._tcp local 36890 &
Thanks Y’all
Thank yous are due to the writers of:- http://www.macosxhints.com/article.php?story=20080428132615192
- http://atomized.org/2008/10/remote-itunes-sharing/
- All the solutions written below involve the use of the Terminal application and the command-line. If you’ve never played with such, give it a shot. Stop kvetching and open /Applications/Utilities/Terminal. You paid for a Unix operating system when you bought your Mac, you might as well try exploring some of its inner awesomeness. [↩]
FCP howto: Use Batch Export to create a directory of still frames from a bin of clips
Wednesday, February 3rd, 2010If you’ve got a bunch of clips in a Final Cut Pro Browser window, and you’d like to quickly generate a still frame for each clip, you can use the “Still Image” feature of FCP’s ancient “Batch Export” feature to automate much of the process. Here’s how:
The result will be a folder full-resolution PNG images, each named after its parent clip, deposited in the chosen destination folder.
I often end up processing directories full of such uncompressed images further using the excellent command-line Imagemagick utilities using the tcsh shell’s1 “foreach” command to iterate through all the images.2 It generally goes a little something like this:
$ tcsh3
% cd directory_of_images4
% foreach foo (*.png)5
foreach? convert -geometry 330x800 "$foo" "$foo:r.jpg"6
foreach? rm "$foo"7
foreach? end8
The result of this command is a set of JPEG-compressed images, one per clip selected in step 2, each resized proportionally to fit within a 330×800 rectangle.
- This is also easy to do with OS X’s default bash shell, but I’m more fluent in tcsh. [↩]
- You may prefer GraphicConverter, Photoshop, or MS Paint. Imagemagick combined with the command line is mad fast for both image transformations and automatically renaming files. [↩]
- Switching to the tcsh for this because I have yet to internalize Bash's foreach syntax. [↩]
- If you're unfamiliar with command lines and shells, please note that the "%" character here represents the tcsh command-prompt, the "$" in the previous line represents the typical Bash command-prompt. Don't type these characters in your commands, they're just here for show. [↩]
- "foo" is a placeholder of my choosing. There's nothing special about the string "foo". You can replace it with anything you like, such as "image", "placeholder", or "your_mom". Just make sure to use the same string in place of all the "$foo" commands below. [↩]
- Each time tcsh iterates through your commands, it will replace the string "$foo" with the filename of an image from the set chosen by "*.png", which is every file in the directory ending in ".png". Adding a ":r" to "$foo" indicates that tcsh should expand the filename but leave off the period and filename extension –in this case "$foo:r.jpg" removes ".png" from the file and adds ".jpg" in its place. The quotes around "$foo" are optional if your filenames do not contain spaces or special characters. [↩]
- Removing the original png file because all I ever wanted were the tiny JPEGs. [↩]
- One more note from Captain Obvious: If you try to copy and paste any of these commands, be sure not to copy and paste the superscript numbers that lead to these footnotes. [↩]

















