Share how you use BibDesk

If you use BibDesk, I want to hear how you use it - what features you use most, and how you have it set up.

I've added a page to the BibDesk wiki to share User Screenshots - add a section there about what you do with BibDesk, and share your experiences. I added my own thoughts already, to get things started.

(Note, image uploading on the wiki is broken right now, I'll fix it as soon as I can and update this post. Please add text anyway!)

Linking the OS X Clipboard and XTerm's selection

If you only use X11 for XTerm, it might seem like the handling of the clipboard in Apple's X11.app is broken. You can select text and paste it with a click of the middle mouse button (opt-click on my Powerbook), and that works when pasting into other X apps, but it doesn't change the Mac clipboard at all.

Why not? Is X11.app just ignoring the X clipboard?

No - X11.app does synchronize the two clipboards. The problem is that the selection pasting in XTerm is using a completely different buffer. There's a full and clear explanation, with some interesting details about (X)Emacs' behavior, at jwz.org.

If, like me, you only use X11 for Emacs and XTerm, you might want to link the selection in XTerm to the X clipboard, so X11.app will then sync that with the system clipboard and you can select in XTerm and paste with Cmd-V in say, Mail.app.

I'll tell you how in a sec, but first the caveat - I said if you only use X11 for Emacs and XTerm because what we're going to do is make setting the XTerm selection always overwrite the clipboard contents. If you use X apps that use the X clipboard, sometimes you don't want that. So beware. If you use Emacs, it just pushes onto the kill ring, so you're good.

OK, now that that's over, add these lines to your ~/.Xdefaults:

XTerm*VT100.Translations: #override\
<BtnUp>: select-end(CLIPBOARD,PRIMARY)\n\
<Btn2Down>: insert-selection(PRIMARY)\n\

Note that the backslashes at the end of the lines are important.

Update: The first version of this post didn't include the Btn2Down action. Without that, the original paste behavior goes away - the man page doesn't really explain the "#override" keyword, so I'm not sure why.

"New Assembly?" - native apps in Python and Ruby?

A couple days ago, Daniel Jalkut wrote a quick note wondering if the future is writing native desktop apps in languages like Python or Ruby, dropping down into C/Obj-C only for performance reasons. It's been an interesting thread since then, in comments and other posts. Notably, today Bill Bumgarner responded with a long and informative ramble about how the dynamic language future is already here.

Specifically, he notes that the Python-ObjC bridge has been working for quite some time, and is even in use by a few commercial apps.

As official support for this kind of development grows, I bet we'll find more apps written with mostly Python (or Ruby) and a few ObjC/C/C++ bundles or frameworks. I really don't think this will be a performance problem - from what I can tell, performance problems in desktop apps are more often algorithm problems or I/O problems - overheads of small constant factors due to using an interpreted language are in the wash.

I've probably written as much Python (not using the bridge) as Objective-C, and my experience is that I feel like I'm solving the problem faster with Python. I particularly like the more compact syntax for common data structures like lists, dictionaries and tuples - I've written and modified a couple of very small Cocoa apps using PyObjC (including Python plugins for VoodooPad), and it feels like I'm getting away with something when I pass inline lists + dictionaries to AppKit...

In case you're wondering about what Py-Cocoa code looks like, there are a lot of great examples on the PyObjC project site. Looking at it now, it's like I'm reading Cocoa email-pseudocode, and I like that.

Mac programming collaborative bookmarks?

I usually like the link selection I get from the Joel Reddit, which usually has good software-related essays at the top. It seems to avoid links to uninformed rants about consumer electronics or industry politics, for which I have no use.

I'd like a social links site for software professionals on the Mac - does one exist?

Or am I missing the point of these sites, and there's a feature in each of them to get only the links I want?

I'm curious - how do you get your mac-related links?

Update: From the comments and some emails, I heard three main ways. A few people just rely on the feeds they check regularly, trusting that if something's interesting enough, eventually someone they read will post about it. This was basically my strategy.

A few other people plugged Scott Stevenson's Cocoablogs.com, which I remember seeing a while back but overlooked when I wrote this post. He's doing a good job of collecting interesting links and highlighting blogs you might want to check out - keep an eye on that site. To paraphrase Scott, he wants cocoablogs to be the 'anti-digg', a site where you can guarantee someone actually read the article before they recommend it to you. I'd say that's a good idea - I don't have patience for mob voting.

Finally, another suggestion was to follow the 'cocoa' tag on del.icio.us, something else I should have thought of - this is nice and social like digg and reddit, but it seems less likely that someone will tag an article they haven't read, so I think it's a stronger vote.

Thanks, everyone, for the suggestions!

Quick n' Dirty OmniOutliner to MediaWiki Applescript

The other day, I had a big outline on a wiki that I wanted to edit in OmniOutliner so I could hide and move things around with a real outliner, then export it back out to the wiki.

I managed to get it into OO with copy and paste and a lot of RSI-inducing tabbing, but the text export options can't be massaged to export MediaWiki-style (eg, '#' for level one, '##' for level two).

So I wrote a quick Applescript to get the data out and get me back on my way. I thought I'd post it in case it would be useful to anyone else:

tell front document of application "OmniOutliner Professional"

    set expText to ""

    repeat with aRow in rows
        set rowText to ""
        -- start from 2 to treat top levels as headers
        repeat with i from 2 to level of aRow
            set rowText to rowText & "#"
        end repeat
        set rowText to rowText & " " & topic of aRow
        set expText to expText & return & rowText
    end repeat

    set the clipboard to expText

    display dialog "The exported text is in the clipboard."
end tell

Update: see the comments for a version for TWiki. Thanks, Peter!

Take Control of OS X Backups

The excellent "Take Control" series of Mac ebooks has updated "Take Control of OS X Backups" to version 2.0.

I have gotten a lot of use out of their other books. "Take Control of Your Airport Network" saved me a lot of frustration setting up a network for my roommates, and "Take Control of Spam with Apple Mail" is what led me to buy SpamSieve, so the book deserves part of the credit for solving my spam problem.

So, when I saw that they had a book about backups, I jumped at the chance to get some more good practical advice. Since I already have a copy of Retrospect sitting around gathering dust, I was happy to see a great section dedicated to setting up a recommended backup plan using Retrospect. That section was helpful enough to get me back on track with regular full duplicate backups as well as the incremental backups of selected files I was already doing. That alone was well worth the cost of the book.

BibDesk and the hCite Microformat

This is about building an iTunes store-style interface to the web's bibliographic information.

I've been pushing along the hCite Microformat process, which will set a standard for HTML publishers to add simple semantic markup to their pages that programs like BibDesk can read as citation metadata.

In stark contrast to great but complex things like Z39.50, if you can publish a web page, you can serve citation metadata. No need to have servers to support complicated queries, let google do the hard work.

The progress on the standard has been slow, and so far there is only one beta implementation to help focus the talks - Brian Suda's X2C XSL stylesheet.

In the spirit of building momentum, I've added support for parsing hCite to a private build of BibDesk. For now, we're just discussing how to merge it, but soon the feature will show up in nightly builds, and anyone can start testing and getting experience with the emerging standard. I'll update when it's available, but until then, here's a rough screenshot:

Update: this feature is now in the latest nightly builds, but it's hidden because hCite isn't final. To see the web group, type defaults write edu.ucsd.cs.mmccrack.bibdesk BDSKShouldShowWebGroup true (all one line) at the command line before running a recent nightly.