Category Archive: “Macintosh”

Reading on the Big Screen

Big displays are worthwhile because they improve the ratio of visible content to “computer stuff”.

Here is a story from Issue 114 of Hub Magazine viewed in Tofu, a little app that displays text in a side-scrolling columnar format suitable for comfortable reading. The story is The Unpopular Opinion of Reverend Tobias Thackery, by Adam Christopher. Yes, we are all dog-men.

Two pages of a document can be displayed side-by-side at life size (in other words, the image of the typical page is eleven inches tall, just as it would be if printed). This is especially useful when reading documents whose layout would require scrolling back and forth to follow the flow of text on a smaller screen.

What am I reading? The paper which introduced the collective animal behavior model presented by Iain Couzin at a recent EvoS seminar:

Couzin, I. D., Krause, J., James, R., Ruxton, G. D., & Franks, N. R. (2002). Collective Memory and Spatial Sorting in Animal Groups. Journal of Theoretical Biology, 218(1), 1-11. (PDF)

I’d like to write my own implementation of the model (or some representative subset) in Processing. I spawn a lot of eventually-neglected side projects, of course, but right now this subject has my attention.

Posted on Sunday, March 14th, 2010 in Macintosh. No Comments

Adobe: Not Professional Grade

I’m willing to bet the contents of this folder were supposed to go in the /Adobe/Acrobat subfolder of Application Support, not in a new folder named “Application Support/Adobe/Acrobat”. As others have observed, it’s weird that the producers of such popular creative software have become so sloppy. I had CS4, but I don’t miss it.

Posted on Sunday, March 14th, 2010 in Macintosh. No Comments

Add Curved Drop Shadow plugin for Acorn

This is a variation on the Curved Drop Shadow without Border plugin for Acorn I posted a few days ago (which is itself a derivative of the original Create New Image with Curved Drop Shadow plugin). It adds the drop shadow to the current image instead of spawning a new document. The drop shadow is added to the active layer.

Download AddCurvedDropShadow.py (2.3 KB) and install it in ~/Application Support/Acorn/Plug-Ins.

Posted on Sunday, March 14th, 2010 in Macintosh. Tags: , . No Comments

Search with Google Scholar Service

Download this service (53 KB; might require Snow Leopard), unzip it, and install it in ~/Library/Services. Then select some text, right-click the selection, and choose “Search with Google Scholar” to find related articles. If the text you selected is the title of a paper, chances are the first result will include exactly what you want: a PDF copy of the paper, or at least an abstract.

This service is shamelessly derived from the “Show Address in Google Maps” service that ships with Mac OS X 10.6.

Posted on Friday, March 12th, 2010 in Macintosh. Tags: . 2 Comments

Curved Drop Shadow without Border (A Modified Plug-in for Acorn)

This is a very slightly modified version of the “New Image with Curved Drop Shadow” plug-in that ships with Acorn. The original plug-in adds a narrow white border with a gray frame to the image in addition to the curved drop shadow. I removed the code that adds the border, so all this version does is add the subtle shadow (illustrated in the screenshot below).

Download New Image with Curved Drop Shadow without Border.jstalk (1.5 KB; unzip and install in ~/Library/Application Support/Acorn/Plug-Ins; restart Acorn). I’m not sure what license terms apply to this plug-in, but the JSTalk plug-in and the original Python filter were written by Gus, inspired by the screenshots in an article by Sebastiaan.

Posted on Saturday, March 6th, 2010 in Macintosh. Tags: , . No Comments

Keep Working with Full Screen Movies on a Second Monitor

Do you have a big external monitor for your Mac laptop? If so, you might want to watch a DVD or a video file on it while you continue to work on your main monitor. With the click of a checkbox, you can keep the video playing full screen while you use other applications.

In the DVD Player application preferences, check “Remain in full screen when DVD Player is inactive”:

In the QuickTime Player 7 application preferences, click “Remain in full screen when player is inactive”:

It’s a little tricker to set up the same configuration in iTunes, but you can play many iTunes videos (including television shows and movies purchased from the iTunes store – but not rentals) in QuickTime Player. Right-click a movie in iTunes and select “Show in Finder” to locate the file.

Posted on Saturday, March 6th, 2010 in Macintosh. Tags: , . No Comments

XML Parsing in AppleScript

I recently wrote a script that posts bookmarks from Yojimbo to Pinboard. Now that I have a nice system for posting links, I find that I’d like even more integration. For instance, I’d like to be able to keep Yojimbo in sync by downloading any links I post to Pinboard via other interfaces.

The Pinboard/Delicious API provides a variety of methods for retrieving link information, but there isn’t a straightforward way to parse the results in AppleScript. In my posting script, I just search the response for code="done". This is sufficient to tell if the add method succeeded, but methods that return more detailed information need more rigorous handling.

Incidentally, AppleScript supports direct interaction with SOAP or XML-RPC web services; see the documentation here. However, the Pinboard API uses a different architecture, REST (sort of).

Essentially, a query is represented as a URL, with parameters, and the XML results are returned by the server like the content of any other web page. (I use do shell script and curl to make the request and get the raw results; I don’t know if there is a better AppleScript idiom for general HTTP transactions. URL Access Scripting is dusty and requires writing temporary files.) The task is to extract the relevant bookmark information from the response.

As it turns out, the System Events scripting dictionary includes an XML suite, pictured above. Some experiments based on the examples given in this discussion at MacScripter confirm that it can be used to parse data returned by the Pinboard API. So, all the pieces necessary to implement a more sophisticated AppleScript bookmark syncing system are available.

Posted on Saturday, February 20th, 2010 in Development, Macintosh. Tags: , . No Comments

Safari, NetNewsWire, Yojimbo, and Pinboard

Bookmark Page in Yojimbo

This is a script for Safari. It’s a variation on my Bookmark in Yojimbo script. The original “Bookmark & Edit” option has been replaced with “Bookmark & Post to Pinboard”. I rarely want to edit a bookmark or its properties, but soon I might start sharing some links on Pinboard.

Bookmark News in Yojimbo

This is a script for NetNewsWire, a free feed reader for Mac OS X. It works just like the above script for Safari. It saves a bookmark to the current news item, and provides an option to spread the news by posting the bookmark to Pinboard. This is what I’m going to do instead of sharing items in Google Reader.

Post Bookmark to Pinboard

This is a script for Yojimbo, the program I use to save bookmarks and other bits of information. It posts the selected bookmark items to Pinboard. This script is invoked [and thus required] by the “Bookmark & Post to Pinboard” option in both scripts listed above.

Before posting a bookmark, the script prompts you to enter a description. The initial value of the description is based on the Yojimbo item comments. If you click “Post”, the bookmark will be posted with the given description but the Yojimbo item comments will not be changed; “Post & Update Comments” will change the item comments to match the entered description.

To help you keep track of what you’ve shared, items posted to Pinboard are added to a “Pinboard” collection, which will be created if it doesn’t already exist. As an example, here’s what my collection looks like at the moment:

And here’s how it looks on Pinboard:

Limitations

These scripts don’t deal with tags, labels, stars, or other features offered by Yojimbo or Pinboard. These scripts aren’t likely to be very useful if you’re not me. I don’t know exactly what happens if you post the same bookmark to Pinboard twice; I think it’s updated automatically.

There are bugs.

Download

Download all three scripts here (24 KB)

Configuration

Some assembly is required. I recommend installing the scripts in the following locations (create the directories if they don’t already exist). Run them with FastScripts or the regular script menu.

~/Library/Scripts/Applications/Safari/Bookmark Page in Yojimbo.scpt
~/Library/Scripts/Applications/NetNewsWire/Bookmark News in Yojimbo.scpt
~/Library/Scripts/Applications/Yojimbo/Post Bookmark to Pinboard.scpt

Edit the _pinboard_script_path property at the top of both “Bookmark in Yojimbo” scripts to identify the full path to your copy of the Pinboard script. In my case, this reads:

property _pinboard_script_path : "/Users/anoved/Library/Scripts/Applications/Yojimbo/Post Bookmark to Pinboard.scpt"

Lastly, edit the _API_username and _API_password properties at the top of the Pinboard script to reflect your Pinboard login information. Since the Pinboard API is essentially a clone of the Delicious API, it should be straightforward to modify this script to work with Delicious – but unfortunately I haven’t quite got it working. Don’t hold your breath for an update, but please do share any fixes or improvements.

Acknowledgements

The code to post to Pinboard is derived from this NetNewsWire to Delicious script by Larry and Andrew. My sketchy URL encoding code is lifted from this example at Mac OS X Automation.

Posted on Monday, February 15th, 2010 in Macintosh. Tags: , , , , . 1 Comment

Kitgen Build System for Tcl/Tk

In the past I have written a variety of posts about Starkits and Starpacks. Briefly, Starkits provide a way to package complex Tcl/Tk programs in a single file, and Starpacks allow those packages to be combined with self-contained interpreters to deliver stand-alone applications. However, the Tclkit interpreters I originally used for this purpose have not generally been maintained, at least for Mac OS X (Pat Thoyts has done a good job providing current Windows and Linux versions).

Of course, there are various ways to build your own Tclkit equivalent, but I usually found the process slightly too tedious to sustain my interest (although I did succeed with Pat’s version of kitgen shortly before discovering the method described below).

As it turns out, self-contained Tcl/Tk installations functionally equivalent to Tclkits can quite easily be created with the kitgen build system. This comprises a single Tcl script (kbs.tcl) that automates the process of downloading, compiling, and assembling the elements of a “kbskit”. The script is robust – it worked successfully on the first try, without any knowledge of what options to use beyond those given in the Quick Start examples.

If you simply run a fresh copy of kbs.tcl, it will retrieve the Tcl/Tk sources.

Build a Metakit-based kbskit (like Tclkit) with:

./kbs.tcl -r -mk install kbskit8.5

Build a Vlerq-based kbskit (like Tclkit Lite) with:

./kbs.tcl -r -vq install kbskit8.5

In either case, three executables will actually be built:

  1. A Tcl-only executable, denoted by -cli suffix
  2. An executable that loads Tk from an external library if needed, denoted by -dyn suffix
  3. An all-in-one Tcl/Tk executable, denoted by -gui

On Mac OS X, these executables are found in the buildDarwin subdirectory relative to kbs.tcl. The subdirectory name will presumably differ on other operating systems.

Happily, the kbskits created with the kitgen build system can be used with Starpacker. Check the “Other” box and select the kbskit you prefer to use as the executable in your Starpack:

You can bundle other packages into your kbskits using the -mk-bi or -vq-bi options (-bi stands for “Batteries Included”). This will ensure that those packages (typically useful extensions) are always available to code being run by that kit. Of course, a different approach, with different advantages and disadvantages, is to bundle packages in your application Starkit, which can be executed with different kits.

Additional topics to explore include building the --enable-aqua option and the best method to update both kbs.tcl and the source code it retrieves.

Posted on Sunday, January 10th, 2010 in Development, Macintosh. Tags: . No Comments

Window Cinch

Cinch is a neat little window management utility that provides a useful supplement to the standard (and not so standard) Mac OS X window zooming behavior:

Cinching to the left or right edges of the screen will resize the window to fill exactly half the screen, allowing you to easily compare two windows side-by-side (splitscreen). Cinching to the top edge of the screen will resize the window to fill the entire screen (fullscreen). Dragging a window away from its cinched position will restore the window to its original size.

Via Daring Fireball, with credit to Windows 7 Snap.

Posted on Wednesday, January 6th, 2010 in Macintosh. No Comments