Hold On A Minute

September 9th, 2010

One of the big new features in MarsEdit 3 is a revamped media manager that allows you to easily browse local libraries from iPhoto, Aperture, etc.

Media Manager.png

This functionality is based largely on the great work of the iMedia project, which was spearheaded by Karelia to replicate Apple’s own ubiquitous media browsing interface, some variant of which is available in Pages, iWeb, Mail, etc.

iMedia has been around for a while, but in the past year or more it has been undergoing a significant overhaul as its primary developers gear up to release the official 2.0 milestone. I have been involved in the 2.0 project for a long time now as an “early adopter,” using MarsEdit as a testing ground during the beta phase, and taking (mostly!) only the refined and polished aspects of the product for the final MarsEdit 3.0 release.

We are still ironing out some of the kinks, especially in parts of the project that were not tested in MarsEdit. One of the cool new features is support for the Flickr photo-sharing service. Like MarsEdit’s own Flickr-browser, it shows thumbnails of images on Flickr, and lets you treat them more-or-less like ordinary image files that you’d find on your computer.

iMedia Flickr Support

Things get a little bit complicated when a user selects and drags one of these Flickr image thumbnails to another app, such as the Finder, or Photoshop. Since the image lives in the internet, and not on the local hard disk, it is not something that can be popped over to the application in an instant. Instead, a progress dialog comes up while the image is downloaded to the disk, and then the local copy is passed to the receiving application.

iMedia Flickr Download Panel

I try to contribute back when possible in the form of bug fixes and architectural feedback. Some of the work I did for iMedia 2.0 involved updating its drag-and-drop functionality to take advantage of new features in Mac OS X 10.6. In the process, I became a sort of de facto expert on handling dragging, which is a shame, because we could sure use a real expert, instead!

The other day, an issue came up that relates to the dragging of Flickr files. If the download is taking a while, and the user tries to cancel, mouse clicks are apparently ignored and they are stuck with the progress dialog above. I agreed to look into the issue, but there was just one problem: my network is too fast! Whenever I try to drag a Flickr image to another app, it’s done within a couple seconds, and I don’t have time to play around with clicking the cancel button.

If only I could get a really slow connection to Flickr, then I could easily test this. In the old days of Mac OS 9 or earlier, I may have resorted to plugging in a slow modem to simulate the experience of the less bandwidth-fortunate. In Mac OS X however, I can take advantage of the advanced firewall software that comes bundled with the operating system, and which allows me to configure “traffic shaping” policies on the traffic coming in and out of my computer. I found a great hint from Macworld that got me on the right track.

My goal is to cause Flickr downloads to be artificially slow. In order to achieve this goal I need to find the specific web address that the downloads come from. To do this, I use the standard tcpdump terminal utility, which also comes bundled with Mac OS X:

sudo tcpdump -Atqp -s 0 -ien1

The only part you may want to change is the bit at the end that says “en1”. Depending on the network interface you’re using, you might want en0 or en2 instead. With this running in the terminal, I go back to iMedia and start downloading Flickr files. This lets me see what the addresses of those files look like, and I discover the pertinent host name is “farm5.static.flickr.com”. Using the information I gleaned from the Macworld article, I set up the following firewall traffic shaping rules:

sudo ipfw pipe 1 config bw 15KByte/s
sudo ipfw add 1 pipe 1 src-port 80 src-ip farm5.static.flickr.com

Translation?

  1. Create a pipe (you might prefer to call it a “tube”). A pipe is an artificial pass-through which can be configured to slow down, block, or otherwise alter the network traffic that goes through it.
  2. Configure the pipe to limit bandwidth to a crawling 15KByte/s.
  3. Configure all traffic coming from port 80 (the standard HTTP port), and originating from a specific hostname at Flickr, to pass through that pipe.

As soon as these commands are executed, the pipe is in place, and Flickr download speeds are brought to screeching halt. I can now debug the issue with the download dialog and the cancel button patiently and curiously, instead of racing to try clicking the button while I still have the chance.

When I’m done debugging, I definitely want to delete the pipe, so that download speeds go back to normal:

sudo ipfw delete 1

Mucking around with the built-in firewall on Mac OS X is not for the extremely faint-of-heart. This is why all the commands listed in this entry require “sudo” superuser privileges. Yes, you could seriously screw up your computer’s network connection if you do something wrong. But if you are the type of person whose work requires you to test and debug network related tasks, this traffic shaping functionality can be a real asset when it comes to mimicking the network environments of other people.

Addendum: I should have known I might be doing it the hard way, as usual. Clint Ecker reported on Twitter, and several folks in the comments below, that speedlimit, a Mac OS X preference pane, gets the job done in a much friendlier manner.

Fall Conferences

August 31st, 2010

After the announcement earlier this year that C4 was cancelled, I had a hard time getting too excited about conferences. My feelings about Apple’s WWDC are ambivalent: it’s an impressive production and a great opportunity to meet up with dozens or hundreds of colleagues, but it’s expensive and simply lacks the heart of smaller conferences. I go to WWDC every year with some amount of excitement, but mostly as a point of professional obligation. Attending smaller get-togethers like C4, on the other hand, is pure indulgence.

While I don’t think C4 can be replaced, there are other conferences of a similar scale that can help to fill the void. This Fall offers a full calendar of options for folks who are looking for an opportunity to socialize with peers and learn a few new tricks of the trade:

VTM iPhone Developer’s Conference: October 16-17, Philadelphia, PA.
Voices That Matter has been on a run with iPhone-targeted conferences, putting on a show every 6 months or so at different locations around the country. I spoke at the Boston event a year or so ago, and had a great time.

I am attending the Philadelphia event as a speaker alumni guest, and they have also passed along a discount code to share with you: PHBLOGS. If you use this code before September 10th, it combines with early bird pricing for a total savings of $300.

MacTech Conference: November 3-5, Los Angeles, CA.
For all you hardcore Mac and IT nerds who have had enough of the iPhone-only conferences, this is the place for you. This is the inaugural event and seems to have come at least in part as a reaction to Apple’s substantial omission of Mac and IT content from the WWDC event this year.

I’m speaking at this conference and although I won’t say exactly what my topic is, it just might set me up for a world class showdown with my illustrious friend Wil Shipley, who is also scheduled to appear.

360 iDev: November 7-10, Austin, TX.
Hot on the heels of MacTech, 360 iDev is another iPhone-oriented conference that has been skipping around the country. The Austin, TX location is a big draw for me, but I think with so much other activity and the speaking gig just prior in Los Angeles, I will have to sit this one out.

Apple Developer Tech Talks: November-December? Worldwide.
If you haven’t been lucky enough to live near enough and apply quickly enough for these stellar events, you’ve missed out. For the past several years Apple has sent some of its best communicators to put on what amounts to a micro-WWDC: a day of intensive sessions on the latest and greatest Apple technologies.

I attended last year’s New York event and wrote up the experience for TUAW. Assuming Apple puts this tour on again this year, and I’m eligible to attend, I’ll be scampering to sign up. You should, too!

What else is going on in the Apple-sphere this Fall? If I am overlooking something big, please share with us in the comments below. I’ll update the post later with a more “definitive” list of options to choose from.

Flexing His Power

August 10th, 2010

Brent Simmons makes the case for power of software as a more admirable quality than flexibility:

It may go against the grain a little bit, but I’ll say it: I’m incredibly excited for the future of Mac software. I don’t expect we’ll make software that looks and feels like iOS apps (we shouldn’t), but I do expect we’ll learn from iOS apps how power is the real goal, and that flexibility is just a tool to use exceedingly sparingly, only when it substantially increases power.

I like, no … I LOVE the idea of learning from iOS apps, in order to build superb Mac apps.

As many of you know, I don’t believe the Mac is dead, and it should go without saying I don’t believe iPhone or iPad is dead.

We’re on the brink of an Apple-dominated consumer-electronics era, and we’re in charge of making the software good.

Before Google

August 5th, 2010

On a whim today I tried to figure out what the oldest pages are on the internet that mention the names of Google’s founders, Sergey Brin and Larry Page. In particular, I wanted to find out what information Google’s founders left on the internet before they had the notion to index it all.

This pursuit was of course assisted by Google itself. It has a nifty advanced search feature where you can specify a date range for the results. Unfortunately the algorithm for assigning dates to pages seems really buggy, and you end up with a lot of false positives for the date range you specify. For example, Google was being talked about in 1973?

GoogleDates.png

I was able to find some interesting newsgroup postings from Sergey in 1994. On August 18, 1994, he sought advice about booking air travel from San Francisco to Baltimore. In 2010, this conversation would almost certainly not happen, as any number of powerful airfare search engines crunch the numbers and compare rates across carriers, dates, and airports.

But even more interesting to me is a math question posed in 1994 about the Karhunen-Loeve theorem:

Hi,

I ran across a reference to a Karhunen-Loeve transform in a paper I was reading and from the brief mention it seems that it is relevant to my research.  However, there is no pointer to where I could find more information.

Could someone let me know what a good reference for the Karhunen-Loeve transform would be?

thanx
–sergey

Today you just type “Karhunen-Loeve” into Google to get the answer.