Jump To PayPal Transaction

April 16th, 2010

I complained on Twitter about PayPal’s unfortunate transaction search utility, which doesn’t recognize the transaction ID itself as a search term.

Georg C. Brückmann chimed in with a semi-solution, which is a URL template you can use to jump directly to a PayPal transaction by ID. Take the root PayPal URL for your country, and add “vst/id=” followed by the PayPal transaction ID. In the United States, this leads to a URL like: https://www.paypal.com/vst/id=1234.

It’s sad to say that remembering a static PayPal URL and pasting in the transaction ID in the magic location is indeed easier than navigating PayPal’s slow and awkward transaction history UI. But it could be even easier with a little automation.

Jump To PayPal Transaction ID is a simple AppleScript that prompts you for a transaction ID, constructs the desired URL, and opens it in your default browser. If you don’t live in the United States, open the script in AppleScript Editor and alter the template URL contained within it.

I put this in my Safari-specific scripts folder:

[Home] | Library | Scripts | Applications | Safari

So it’s available from FastScripts whenever I’m in Safari. Problem solved.

The Oldest Trick In The Book

April 16th, 2010

Brent Simmons reveals one of the biggest secrets for making friends and influencing people. Yes, it’s the oldest trick in the book: be nice.

Be gracious. Be thoughtful of other peoples’ interests. Don’t be a whiner. Be generous. Be inclusive. Pay it forward… you get the picture.

Have you ever noticed this phenomenon of the internet? As the ultimate reference archive, it reveals the most arcane and lesser-known facts of science, art, and trivia. It teaches us about the world. But as the ultimate social connector, it teaches us about people, how we do or don’t, and how we should or shouldn’t get along with each other.

I experienced this the other day when I was tweeting enthusiastically about Tweetie for the Mac and how I might be interested in taking the product over if it doesn’t fit into Twitter’s plans for the app. In the excitement, I not only violated one of the social rules of politeness by filling my followers’ Twitter screens to the brim, but I made the mistake of taking a stab at a company called Brizzly.

See, my friends Buzz and Neven built a wonderful iPhone Twitter app called Birdfeed. A few months ago, Brizzly acquired Birdfeed from my friends, and revamped the user interface a bit to match their style. I’m not a fan of these revisions, and I have stuck with the original Birdfeed app on my phone. But I used this distaste for the UI changes to fuel a less constructive tweet that I would characterize as a “low blow” against Brizzly. I have since deleted the original tweet, but it prompted a response from Brizzly’s CEO:

@phopkins He may be hella cool but does he realize that smacking Brizzly isn’t going to get him anywhere?

I immediately had one of those wake-up-call feelings where you realize that what was just mindless banter at “somebody else’s” expense was actually at the expense of somebody very particular. Yes, I reminded myself, there are actually people on the internet:

I should know this by now: there are people behind products. Ashamed of my tasteless treatment of Brizzly, and by extension, @shellen.

Some people who don’t know me very well assume that because my Twitter name, @danielpunkass, is a bit crass, that I must be a provocative and thoughtless person. They are surprised to meet me in person and find out that I’m actually pretty nice.

What my Twitter name represents to me is my willingness to be the cheeky one. To defy the standards and be a bit of a jerk when it’s called for, but only when it’s called for. Sometimes, the most unexpected, uncalled for, provocative, defiant move you can make is to be nicer than people expected you to be.

A Stroke Of Luck

April 9th, 2010

One of my customers reported a really subtle bug having to do with a keyboard shortcut for a command. I’m going to change some facts to protect the innocent, but imagine I got a report:

“Every time I press cmd-N to create a new document and start typing, instead of accepting the text, it just beeps at me.”

This seems impossible to me. Creating a new document and typing into it is fundamental to my product. Surely if it was broken I would know from my own daily testing of the application. I try diligently to reproduce it, but of course, I can’t. Create a new document. Start typing. Everything works, everybody’s happy. Except the person who reported the bug.

At some point in my tinkering I stumble upon the bug. Beep. I can’t type. There it is! What a drag. This application sucks!

Now that I’ve seen and heard the bug with my own eyes, I’m more committed than ever to fixing it. But how on earth did I do it? I try several more times and am unable to reproduce the problem.

I have only spotted the issue once in my dozens of trials, yet the customer claims it affects him every single time. What explains this? Maybe it simply doesn’t happen as often on my Mac as it does on his. My thoughts turn to the brute force of AppleScript. If this happens only once in a blue moon on my Mac, surely I can reproduce it by running a script that iterates the test conditions hundreds or thousands of times. I open AppleScript Editor and enter the following:

tell application "System Events"
	repeat 100 times
		keystroke "n" using command down
		keystroke "Testing typing"
	end repeat
end tell

Nothing! Even after running it 1000 times, nothing. How can this be? How could something so common for the customer, something that I saw myself once, be so difficult to reproduce on my Mac?

After playing around a bit more, I started to reproduce it more readily. What was happening? I couldn’t figure it out, but something “felt” a little different when I reproduced it. I thought carefully about the parameters of the bug, as exemplified (I thought) by my script:

  1. The command key is pressed.
  2. The N key is pressed.
  3. The N key is released.
  4. The command key is released.
  5. Typing into the new document is attempted.

I looked again at the script. Perhaps this “keystroke” command is not literal enough. For all I know it’s circumventing the normal key events that get generated when you type on the keyboard. On a lark, I modified the script to be more explicit:

tell application "System Events"
	repeat 100 times
		key down {command}
		key down  "n"
		key up "n"
		key up {command}
		key down "x"
		key up "x"
	end repeat
end tell

Here we have a more literal match with my analysis of what happens. Hold down the command key, press the N key, release, then type something. In this case I just type an x character because I figure any typing is enough to trigger the bug.

I ran this 100 times as well and no luck. The bug is simply not reproducible through scripting. I guess I’ll have to figure out what conditions are making it more likely for the customer to run into the bug. Maybe he has some 3rd party software that is interfering. Or … wait a minute.

tell application "System Events"
	repeat 100 times
		key down {command}
		key down  "n"
		key up {command}
		key up "n"
		key down "x"
		key up "x"
	end repeat
end tell

I ran the modified script and the bug immediately exhibited itself. So what changed? Look carefully and you’ll see that my previous script assumed that when a keyboard shortcut is pressed, there is a sort of nested symmetry to the order of pressing and releasing the keys. When I press keyboard shortcuts, I hold the modifier keys down throughout the stroke, and release only after the letter key has been released. But this customer has muscle memory that inclines him to instead release the keys in the order they were pressed. When he releases the N key, the command key has “long” since been released.

This subtle difference turns out to trigger a bug in my event monitoring code that, to make a long story short, robs first responder status from the default view in the document. So when he creates a new document, there is no first responder, and his typing just causes a bunch of beeps. When I create a new document, there’s always a first responder, so I don’t see the bug.

As difficult as this bug was to track down, it would have been near impossible without the theory testing, disproving, and ultimately proving tool of using AppleScript and System Events to zero on in the behavior. Sometimes when the steps a customer provides to reproduce a bug seem exactly the same as what you’re doing, you’re just not trying hard enough to find the difference.

When I Joined Apple

April 2nd, 2010

When I joined Apple in May, 1996, the company was filled with geniuses who were trying to invent the future. Despite that brilliance, Apple was failing. I came on board because I was young, had just started using a Macintosh, and I knew something great was happening. I was eager to find out what it was and, if possible, to help it grow.

I was lucky to join one of the most cavalier and competent teams in the company: the Mac OS system integration team. In a nutshell, we were in charge of the Mac OS System File, “System Enabler,” and other crucial bits that made your Mac a Mac. Whoo-hoo! Power! We made or broke your Mac experience, hopefully making more than breaking. I took my new job seriously and stepped carefully with every change. It felt great, and I cherished every contribution I made.

Later, I moved to the Mac OS X team and did similar work on the infrastructure of Mac OS X. In particular, with how it deals with older applications that rely on the “Carbon” framework. After years of using a custom Mac-only environment called MPW, I was using standard UNIX tools and building UNIX libraries. This felt awesome! I had grown up using an Amiga, then switched to Sun OS, where I spent a lot of time getting familiar with UNIX. There I was, and Apple decides to put the best UI in the world on top of Unix. I was in heaven.

While I was at Apple I saw a lot of failure. I saw the Newton fail. I saw Pippin fail. I saw PowerTalk fail. I saw Cyberdog fail. I saw Apple desperate to sell even a few hundred thousand Macs in a quarter. I saw the press lambast us and declare us dead. “Beleaguered” became an unfortunately common word in our office life.

But I kept looking around me, and I saw nothing but signs of success. I marveled at QuickTime, speech recognition, networking technologies like ZeroConf (Bonjour), and other things that have never seen the light of day. This company is awesome! I want to work here! They’re going to change the world!

Of course, they already had changed the world with the Apple II and the Macintosh, but as a young 20 year old, I was anticipating future growth. It was a bad time for Apple: competitors and the press were declaring our obsolescence. Michael Dell said we should give the money back to the shareholders and close the company. We persisted on a wing and a prayer, driven by Steve Jobs’s admonition that we could beat Dell. I believed in that mission, and I believe in it still.

In 2005, I wrote boldly about the end of Dell, and I have to confess I was a little over-ambitious. I could see a path where Apple would take Dell down faster than they have. I was wrong. Dell is still a strong  company. But that will change soon.

I joined Apple because they were threatening to change the world. I stayed on at Apple because they were changing the world. And I remain loyal to that company because, in spite of my absence, they have changed the world. In more ways than I can imagine, they’re inventing the future. And I’m along for the ride.

Dell is not changing the world, Microsoft is not changing the world. Hewlett-Packard is not changing the world.

Apple is changing the world, and damn it feels good to be part-Apple today.