Mint opens up its data#

Instead of knowing how many dollar signs a guide gives a restaurant, you'll see what the average amount spent at that restaurant is. Just go to data.mint.com to compare one city with another, look at how popular merchants are performing, and more. You can see spending data by average purchase price or popularity (the number of transactions per month). Start with a category or a specific business for more than 300 U.S. cities.

Utterly fascinating.

Instantwatcher iOS app#

I've been using this app for a couple of months and love it. At the end of every day I open it up and scroll through all of the movies Netflix added to its streaming service that day, and queue up the ones I'd like to watch. (One thing you'll realize immediately is that Netflix adds (a lot) more movies to its library each day than the website would have you believe; apparently Netflix exposes all of this data through its API, but not its own website.)

ColorWare's Grip for iPad#

This is the sort of thing I normally would dismiss immediately, but after giving it some thought I realized that it could be pretty damn useful for certain tasks (e.g., where one has to walk from room to room in a large hospital and record various data). That said, the Grip has two significant drawbacks: 1) the handle is usable only when holding the iPad in portrait mode (who doesn't use landscape mode 99% of the time?); and 2) it's $300 (yes, really).

Divvy#

[I]t's as simple as a single click and drag in the Divvy interface and your window will be resized and moved to a relative portion of the screen.

An indispensable utility, and one that probably obviates my need for Cinch. (I think I may write more about Divvy in a separate piece.)

When it drops#

[H]elps you keep track of each week's newest releases. We were tired of digging through a handful of sites wondering if anything cool was coming out this week. Spend 60 seconds on whenitdrops.com instead of scouring sites that bury information in a maze of clicks.

So well done.

WiFi Camera#

The WiFi Camera "takes ‘pictures' of spaces illuminated by WiFi in much the same way that a traditional camera takes pictures of spaces illuminated by visible light."

Restart Flash without quitting Safari or Chrome (using AppleScript and LaunchBar)

October 10, 2010

A few weeks ago I linked to a Macworld article that described how to restart Safari's Flash plugin without quitting the browser, and said the following:

You guys aren't already doing this? I actually take it a step further and use a LaunchBar action (that I named "kf") to kill the plugin with just a few keystrokes (i.e., I saved do shell script "killall -9 WebKitPluginHost" to kf.scpt in LaunchBar's Actions folder).

I normally would refer to my Use LaunchBar to execute, in the "background," commands via a shell piece, and tell you to alias killall -9 WebKitPluginHost to "kf," but do shell script uses the Bourne shell, which doesn't recognize aliases. Actually, you maybe could use my linked-to solution together with TextExpander (i.e., have "kf" expand to "killall -9 WebKitPluginHost").

Since making those comments I've grown the idea a bit and now my "kf" LaunchBar action checks to see which browser -- Safari or Chrome -- is having trouble with Flash, and kills the appropriate plugin. (In either case, the plugin is restarted automatically whenever you (re)load a page with Flash.)

Here's my updated AppleScript:

tell application "System Events" to set webBrowser to name of first process 
    where frontmost is true
if webBrowser is "Safari" then
    do shell script "killall -9 WebKitPluginHost"
else if webBrowser is "Google Chrome" then
    do shell script "ps ux | grep -E '[F]lash Player Plugin 
    for Chrome' | awk '{ print $2; }' | xargs kill"
end if

Because it's very likely you'll invoke the script while cursing at your unresponsive browser, the script simply checks to see which is the frontmost app, and if the frontmost app is either browser, then it kills that browser's Flash plugin. If neither browser is the frontmost app, then the script effectively does nothing. (No, I don't usually run both browsers at once, but by coding it this way I have to remember just one command — "kf" — irrespective of which browser I'm currently using.)

I had every intention of killing Chrome's Flash plugin the same way I do Safari's, but I just couldn't figure out a way to use "Shockwave Flash (Chrome Plug-In Host)" (i.e., its Process Name as reported by Activity Monitor), which is why I had to resort to the slightly(!) less elegant commands you see above.

As ever, if you've any questions or tips on how to make this faster, smaller, etc., please let me know.

Blogging with TextMate and Chromium/Chrome

September 28, 2010

Early this year I wrote a long piece titled Blogging with TextMate, and using AppleScript and JavaScript to ease the pain, which described a way to kind of automate the generation of linkblog-type posts using TextMate. That post was written with Safari/WebKit in mind, and this post provides a similar solution for Chromium/Chrome. (For the specifics of how to actually run all of this stuff using FastScripts, etc., please see the previous post; the only difference between the Safari and Chrome methods is the below AppleScript.)

Let's start with the final code, and then I'll explain how I got there.

tell application "System Events"
    set prevClip to (the clipboard as text)
end tell

tell application "Chromium"
    copy selection of (active tab) of window 1
    set pageURI to (get URL of (active tab) of window 1)
    set pageTitle to (get title of (active tab) of window 1)
end tell

tell application "System Events"
    set selectedText to (the clipboard as text)
end tell

property LF : ASCII character 10 -- Unix  \n

tell application "TextMate"
    activate
    open "/path/to/file" & (random number from 1 to 1000000) & ".txt"
    set post to "Title: " & pageTitle & LF
    set post to post & "Slug: " & LF
    set post to post & "Pings: Off" & LF
    set post to post & "Comments: Off" & LF
    set post to post & "Category: posts" & LF & LF
    set post to post & "[" & pageTitle & "]"
    set post to post & "(" & pageURI & ")." & LF & LF
    if prevClip is not equal to selectedText then
        set post to post & "> " & selectedText & LF & LF
    end if
    insert post
end tell

(Obviously if you're using Chrome, you'll want to replace "Chromium" in the above script with "Google Chrome.")

First of all, I had a hell of a time figuring out how to reference the active tab (i.e., the one to which you're trying to link; see the longer post referenced above). Turns out that Chromium's active tab property can't be used without identifying what window it's in (even though, obviously, only a single tab can be active at any given time), and window IDs are based on overlay order, not the order in which they were created. It took me a while to figure all of this out, but once I did the rest was fairly simple. Unfortunately, it took me even longer to determine how to get selected text from Chromium into TextMate via AppleScript.

For the Safari solution I used a combination of do JavaScript and AppleScript objects/commands provided by Safari. Turns out that Chromium now has a class similar to do JavaScript called execute, but I couldn't get it working to save my life, and part of me is convinced that it actually isn't fully functional just yet. (I can't tell you for sure because there's next to nothing on the web about using AppleScript with Chromium/Chrome.) Thus, I had to find another solution.

I noticed that Chromium had a copy selection class and started working through it. After some trial and error I realized that copy selection didn't return anything (unlike getSelection() via Safari's do JavaScript) — it just copied the selection (in this particular case, from the current tab) and placed it on the system clipboard.

At this point I knew I could use AppleScript to pull the selected text from the clipboard and into TextMate. Great! But, what about when I don't want to quote any part of the article and thus don't select any text? Because copy selection always grabs the last thing placed on the clipboard (no matter its origin), you'll end up getting whatever was last put there even if you aren't selecting text when it's invoked (and obviously will have to spend some time deleting this irrelevant content from your draft post). Given that copy selection doesn't return anything, there's no simple way to check whether anything actually was copied, and thus no way to determine if the text currently on the system clipboard should be incorporated into your post.

To get around this I grab the text on the system clipboard before and after running copy selection, and then compare the two strings. If they aren't equal, then some text definitely was selected and so the clipboard content is added to the post. If they are equal, then no text was selected and the clipboard content is ignored.

"Back to the Future" returns to AMC Screens for 25th anniversary#

To help celebrate this classic film's anniversary, AMC Theatres is bringing back the film for two special screenings on Saturday October 23rd at 12:30PM and Monday October 25th at 7:00PM on 158 screens in over 40 cities!

Oh. Hell. Yes. That was one of the easiest purchases I've ever made. Can't wait!

Where does our alphabet come from?#

We will begin where civilization began, meander through the Middle Ages, race through the Renaissance, and in doing so discover where our alphabet originated, how and why it evolved, and why, for example, an A looks, well, like an A.

An alien's eye view of the solar system#

[NASA astronomers] have determined what our solar system would look like to an alien astronomer. The simulations track the interactions of 75,000 dust grains in the Kuiper Belt, which is an icy region out beyond Neptune where millions of small bodies (including Pluto) orbit the sun.

Dictaphone Parcel#

[A]n animation based on a sound recorded with a dictaphone traveling secretly inside a parcel. As the hidden recorder travels through the global mail system, from London to Helsinki, it captures the unexpected. We hear a mixture of abstract sounds, various types of transport and even discussions between the mail workers. The animation visualizes this journey by creating an imaginary documentary.