<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Brett Terpstratagging page  - Brett Terpstra</title>
	<atom:link href="http://brettterpstra.com/tag/tagging/feed/" rel="self" type="application/rss+xml" />
	<link>http://brettterpstra.com</link>
	<description>Elegant solutions to complex problems.</description>
	<lastBuildDate>Tue, 22 May 2012 02:49:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Some suggestions for better tagging</title>
		<link>http://brettterpstra.com/some-suggestions-for-better-tagging/</link>
		<comments>http://brettterpstra.com/some-suggestions-for-better-tagging/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 23:24:30 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Write]]></category>
		<category><![CDATA[openmeta]]></category>
		<category><![CDATA[spotlight]]></category>
		<category><![CDATA[tagging]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=3379</guid>
		<description><![CDATA[<p>Since publishing my first article on tagging and appearing on MacPowerUsers, I’ve been asked many times for more specifics on my tagging system. I’ll start by telling you that I don’t have all of the answers; what I’m sharing here is what I’ve learned after a few years of constant tagging. On tagging OpenMeta is the most useful tool in&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/some-suggestions-for-better-tagging/">Some suggestions for better tagging</a></p>]]></description>
			<content:encoded><![CDATA[<p><img style=' float: right; padding: 4px; margin: 0 0 2px 7px;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2011/12/documentfolders.jpg?9d7bd4" alt="Image of documents in folders" title="Folders" width="250" height="248" class="alignright size-full wp-image-3385" />Since publishing my first <a href="http://brettterpstra.com/on-sorting-tagging-and-other-nerdery/">article on tagging</a> and <a href="http://macpowerusers.com/2011/03/mpu-045-finding-files-and-tagging/">appearing on MacPowerUsers</a>, I’ve been asked many times for more specifics on my tagging system. I’ll start by telling you that I don’t have all of the answers; what I’m sharing here is what I’ve learned after a few years of constant tagging.</p>

<h3>On tagging</h3>

<p><a href="http://code.google.com/p/openmeta/">OpenMeta</a> is the most useful tool in my tagging toolbox. It allows me to attach tags to anything with a filesystem representation: websites, documents, photos, source code, emails and more. Before OpenMeta we had to make do with whatever fields Spotlight would search, which was Finder comments on files, and really no options on emails and other items accessed outside of Finder.</p>

<p>Now that we have OpenMeta<sup id="fnref:openmeta"><a href="#fn:openmeta" rel="footnote">1</a></sup> and a <a href="http://code.google.com/p/openmeta/wiki/OpenMetaApplications">plethora of tools</a> (I highly recommend <a href="http://www.caseapps.com/tags/">Tags.app</a>) to work with, tagging is a real option. We just have to figure out the best way to make use of it.</p>

<h3>Things I’ve learned</h3>

<p>The goal of tagging is to associate files into groups that wouldn’t be feasible using a folder hierarchy. As I’ve mentioned before, I still use a shallow hierarchy, especially for grouping project files together. The idea of “one big pile” is as frightening to me as it is to most people. I use tags to create additional groups that might not otherwise be possible, bringing together files and other objects that might be related in ways that a folder reflects.</p>

<p>The primary problem you run into is that tag collections get out of control, and navigating them isn’t any faster than drilling through folders and mailboxes. This happens because multiple forms of a tag are used, or long after the object is tagged the original associations are forgotten. I’ve learned this the hard way, and on multiple occasions.</p>

<p>There are two basic approaches to tagging:</p>

<ol>
<li>Tag with anything and everything you could possibly associate with the object (file, email, photo, etc.). It’s a free-association tag-for-all that results in a huge collection of tags. This is navigable, but often results in messy tagging.</li>
<li>Tag sparingly, only using tags that will be easy to associate other objects with. Anything that is searchable in text or other metadata is left out of the tags. This is the method I’ve come to use.</li>
</ol>

<p>What I’ve learned is to do follow three obvious-sounding rules: tag intuitively, intelligently, and consistently.</p>

<p><span id="more-3379"></span></p>

<h3>Intuitively</h3>

<p><strong>Drill down</strong></p>

<p>I typically limit myself to three levels of tags. Top-level tags encompass an overall topic or broad scope that the object falls into. For example, if it’s a website, I tag it with the primary keyword that led me to the page, or the subject I was interested in when I followed the link. If it’s a project you’re working on, a client’s name is probably the right choice for a top-level tag. Tags such as “email,” “communication” or “research” aren’t top-level tags. If used at all, those are third-tier.</p>

<p>Second-tier tags divide the group into subsections. If your top-level tag is a client name, then second-tier tags would include a project name or other unique identifier that can be shared across all related files. If you consider your top-level tag specific enough for narrowing a project down in a future search, just skip to third-tier tags.</p>

<p>Third-tier tags are where you begin to cross-pollinate the tag groups. These tags are going to be common tags across multiple top-level groups. Tags like “research,” “approved,” “communication,” etc. can make sense here. This comes down to personal style. The only real rule is that they have to be tags you’ll consistently use elsewhere within other scopes. They’re what make this different from just using a folder hierarchy.</p>

<p>This pattern allows you to view your tag groups in a drill down fashion. If you tag with two or three levels, it increases the ease of browsing in various situations. If you were always going to look for a file as CSS3, you should just use a folder. It’s nice to be able to browse for all your web design articles, but maybe you’re just interested in the CSS articles at the moment. A search for bookmarks tagged “tutorial” and “CSS3” will quickly produce all of the relevant articles you’ve found in your web browsing.</p>

<p>Plus, you can cross groups: an article that covers html, javascript and CSS would get tags for all three, assuming I would be interested in all subjects in the future. If I dealt <em>only</em> in CSS, I wouldn’t bother tagging with the other topics, it would just pollute my tag collection.</p>

<p><strong>Choose tags that will be useful next year</strong></p>

<p>“What will I search for when I’ve forgotten this item exists?” It’s not always an easy question to answer. The basic rule is to take what first comes to mind and ask yourself that question. Is the first association you make related to current circumstances or events? You might not have that association in a year. You want to use tags that come to mind easily, but double-check yourself to make sure it will be as front-of-mind when the time comes to search.</p>

<p>For example, if it’s a website, tag it with the primary keyword that led you to the page, or the subject that you were interested in when you followed the link. If it’s a project you’re working on, a client’s name and the scope or project name are probably the right choices for top-level tags.</p>

<p>There are a lot of edge cases. You get better at it after you’ve had to deal with your own tags for a few years.</p>

<h3>Intelligently</h3>

<p>These are common sense rules that make tag collections work. You probably know them already (or have figured them out if you’ve been tagging for a while).</p>

<ol>
<li><p>Don’t tag with data already available</p>

<p>Unless your system has no other means of searching metadata, you can always add things like dates, filetypes and even content to your search to find specific files within a tag group.</p></li>
<li><p>Use lowercase tags. Always</p>

<p>It gets messy if you’re inconsistent, and autocomplete will almost always substitute the first capital letter it comes across in a completion, resulting in your previously unused tag now being capitalized.</p></li>
<li><p>Don’t use “flagged” or other time sensitive tags</p>

<p>This one needs some explanation. Unless you are religious about removing “tickler” tags as you go, find another way to denote importance of the tagged element. Finder labels work well for files, and you can keep a “Current” folder with things that need to be attended to. Once you’ve handled whatever needs to be handled, you file it (or send it to a script that will).</p>

<p>I know this from experience. I tend to be pretty good at reviewing my systems, but the “flagged” and “important” tags got out of hand quickly. Pretty soon I was looking back at flagged files, emails, photos and bookmarks and I really had no idea why they were important anymore.</p>

<p>In a best-case scenario, you’re using a project/task management solution that allows links. If I need to reply/follow-up on an email later, I drag it into my task manager and create a new task. That gets the flag, the due date, and any notes I need to remember why. I could tag/flag the email as well, but then I’d have to untag it later. This way I just check off the task. <em>Side benefit: assuming you don’t delete completed tasks, you can find it later and follow the link as an easy bookmark.</em></p></li>
</ol>

<h3>Consistently</h3>

<p>If a tag is used only once, you’re wasting your time. You could have found that file, page, calendar entry, etc. with Spotlight. You didn’t need a tag to do that.</p>

<p>Keep a list of common tags if you need to, at least until they become second-nature. Most of the tagging applications will show you common/recently-used tags when you’re tagging. The best thing in the world can be autocomplete, assuming your tag collection isn’t already a polluted mess. Autocomplete in tag dialogs means you don’t have to struggle to remember casing, plural forms, etc., just go with what you did before.</p>

<p>I generally try to avoid capital letters, hyphenation and plural forms. I’ll use multi-word tags frequently, but without punctuation or intercaps.</p>

<h3>Exceptions</h3>

<p>There are some obvious exceptions to these rules in my system. For example, I keep a list of things I want using a “tobuy” tag. I have to manually untag these things as I buy them or decide I don’t want them anymore. The tag works really well with Smart Folders in Finder, though, and I don’t have trouble keeping up with it. It’s not an area that changes rapidly; just a folder I can browse when I have some spending money and a shopping urge. On these occasions I just untag “tobuy” items as I go through them. It never gets out of hand and it never takes long to update. Unlike the “important” tag I used to use in all of my projects, “tobuy” is basically a top-level tag that I always search for across all topics and groups.</p>

<p>I also sometimes use questionable tags for scripting purposes. I prefer client→project folders to their redundant tag counterparts, mostly just because I’m going to separate those anyway for the sake of filing sanity. I’ll use client/project tags on files on my Desktop, though, and my scripts will automatically sort those tagged files based on their tags and subtags. It’s a bit of a complex system, but it lets me use my Desktop as a general bucket for everything I’m working on, and have the various elements from multiple projects all neatly filed at the end of the day. The filing tags can be removed by the script after they’ve found their home.</p>

<p>There are plenty more exceptions. I don’t think any two people’s tagging systems will be identical. It’s the beauty of tagging: you can build a system that works for you. It doesn’t have to be rigid, but some general, self-imposed rules can definitely make it a more useful process.</p>

<div class="footnotes">
<hr />
<ol>

<li id="fn:openmeta">
<p>Warning: there is no guarantee that we will always have OpenMeta. OpenMeta uses extended attributes in the UNIX subsystem and it’s not impossible that Apple would pull the plug on OpenMeta’s ability to maintain tags in these xattr’s. However, the current OpenMeta implementation stores tags in two different attributes and keeps a redundant backup of all tags/file associations. It’s a safe bet for now. <a href="#fnref:openmeta" rev="footnote">↩</a></p>
</li>

</ol>
</div>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/on-sorting-tagging-and-other-nerdery/' rel='bookmark' title='On sorting, tagging and other nerdery'>On sorting, tagging and other nerdery</a></li>
<li><a href='http://brettterpstra.com/autotag2-smarter-tagging-for-textmate-and-wordpress/' rel='bookmark' title='AutoTag2: smarter tagging for TextMate and WordPress'>AutoTag2: smarter tagging for TextMate and WordPress</a></li>
<li><a href='http://brettterpstra.com/a-bash-function-for-markdown-bloggers/' rel='bookmark' title='A Bash function for Markdown bloggers'>A Bash function for Markdown bloggers</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/some-suggestions-for-better-tagging/">Some suggestions for better tagging</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/some-suggestions-for-better-tagging/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Forget about it. Or not.</title>
		<link>http://brettterpstra.com/forget-about-it-or-not/</link>
		<comments>http://brettterpstra.com/forget-about-it-or-not/#comments</comments>
		<pubDate>Sun, 02 Oct 2011 23:07:31 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[notes]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[tagging]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=2888</guid>
		<description><![CDATA[<p>I forget a lot of things. I forget how I did something, or where I found an answer, or where I put my glasses. I use technology to help with that to some extent, and Notational Velocity/nvALT are excellent at helping me find previous notes, assuming I bothered to take them. I keep a log in VoodooPad, especially when I’m&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/forget-about-it-or-not/">Forget about it. Or not.</a></p>]]></description>
			<content:encoded><![CDATA[<p><img style=' display: block; margin-right: auto; margin-left: auto;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2011/10/Iforgetchalkboard.jpeg?9d7bd4" alt="Blank chalkboard image. Have I ever mentioned how much I dig the Acorn image editor from Flying Meat?" title="I forget" width="634" height="123" class="aligncenter size-full wp-image-2890" /></p>

<p>I forget a lot of things. I forget how I did something, or where I found an answer, or where I put my glasses. I use technology to help with that to some extent, and Notational Velocity/nvALT are excellent at helping me find previous notes, assuming I bothered to take them.</p>

<p>I keep a log in <a href="http://flyingmeat.com/voodoopad/">VoodooPad</a>, especially when I’m up late enough at my computer that I might not remember what I was working on in the morning. That’s handy, the search is excellent, and gathering tagged entries together on one page automatically is sweet. After a couple of years of doing it religiously, though, I’ve found that I rarely reference anything beyond the previous day or two. I rarely go back because the things I log aren’t “knowledge”, just activities. My logging system lacks the details I need to remember exactly <em>how</em> I did what I did. That’s my own fault, of course, but I needed a system that would build an environment-agnostic knowledgebase for remembering all the things I tend to forget.</p>

<p>Thus, I’ve been playing with an idea. I’m building a collection of plain-text notes (primarily using nvALT with notes saved to a Dropbox folder) where the title of the note is the question I think I would ask myself long after I’ve forgotten the answer. The content of the note is the answer in its briefest form, including commands, filenames, urls and whatever is necessary to get me back on the right track.</p>

<p><span id="more-2888"></span></p>

<p>I can query these notes quickly from the command line (<code>qq where glasses</code> or <code>qq best h.264 settings</code>), as well as from LaunchBar and Alfred. Adding new notes can be done just as easily from the same sources. The text files are stored among all of my nvALT notes (with a special prefix to easily separate them), so it automatically benefits from Notational Velocity-style searching and editing.</p>

<p>One of the reasons I prefer to store my nvALT notes as plain text files is that I have access to them from Spotlight and <code>mdfind</code> (<a href="http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/mdfind.1.html">man page</a>). Spotlight allows me to query a little more intricately, separating tags from titles and titles from content in a way that nvALT currently can’t. <code>mdfind</code> is the crux of this system. You can store all you want in plain text and feel great about it, but the ease of querying any information system is the measure of its worth.</p>

<p>I like <a href="http://brettterpstra.com/tag/tagging/">tagging</a>. I’ve found that tagging isn’t the solution for my forgetfulness, though. It’s been extremely helpful in tracking projects across multiple folders, but not so much in dealing with aged notes. I’m as likely to forget a tag I associated as I am anything else. Extra, more verbose text seems to be the trick. Instead of piling on a bunch of tags, I set my scripts up to search–but not output–anything inside of a @(extra text tag). Then I can add extra verbosity and keywords that I think might help the search later… without fouling up my tag database.</p>

<p>While there’s definite GTD-style comfort in knowing I have my discoveries and important notes in a portable, syncable system, the process of thinking through the syntax of the question/filename is actually helping me remember things better to begin with. It’s a conscious effort to connect neurons in a way that keeps the information more readily accessible to my feeble memory. I’ve only been doing it for a month, though, so I’m curious to see how the knowledgebase looks and functions in a year.</p>

<p>I’ve put the whole system and installation/usage/best practices <a href="http://ttscoff.github.com/QuickQuestion/">up on GitHub</a>. There’s a command line tool (bash), a pair of LaunchBar Actions and two standalone Alfred extensions for adding and querying the notes. As I use it more, I’ll probably come up with more ways to interface with it. Right now I’m thinking about an AppleScript/Mail Rule-based system for adding and querying notes via a GMail alias. More to come, pending determination that the new method is worth the fiddling time in the end. I do love having universal access to any bucket I use, though…</p>

<p>If you’ve ever forgotten where you put something important or solved a problem and later forgotten the solution, check out the <a href="http://ttscoff.github.com/QuickQuestion/">QuickQuestion GitHub page</a>. The Readme and up-to-date files are also available as a direct download below.</p>

<div class="download_desc"><p class="download-icon"><a href="http://brettterpstra.com/downloads/quickquestion1.1.zip?9d7bd4" title="Download QuickQuestion (324)"><img src="http://cdn2.brettterpstra.com/wp-content/uploads/downloads/thumbnails/2011/10/qqicon.png?9d7bd4" alt="download image for QuickQuestion" width="64" /></a><br /><a href="http://brettterpstra.com/downloads/quickquestion1.1.zip?9d7bd4" title="Download QuickQuestion (324)" class="download-button">Download</a></p><p class="desc"><a href="http://brettterpstra.com/downloads/quickquestion1.1.zip?9d7bd4" title="Download QuickQuestion (324)">QuickQuestion</a> — A set of scripts for building and querying a plain-text knowledgebase on OS X. Includes CLI, LaunchBar actions and Alfred extensions. Works great with Notational Velocity/nvALT, but does just fine without. <a href="https://github.com/ttscoff/QuickQuestion">More Info</a></p></div>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/quick-tip-running-nvalt-after-a-notational-velocity-update/' rel='bookmark' title='Quick tip: running nvALT after a Notational Velocity update'>Quick tip: running nvALT after a Notational Velocity update</a></li>
<li><a href='http://brettterpstra.com/taking-the-markdown-to-evernote-service-further/' rel='bookmark' title='Taking the Markdown to Evernote service further'>Taking the Markdown to Evernote service further</a></li>
<li><a href='http://brettterpstra.com/nvalt-2-2-public-beta/' rel='bookmark' title='nvALT 2.2 public beta'>nvALT 2.2 public beta</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/forget-about-it-or-not/">Forget about it. Or not.</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/forget-about-it-or-not/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>AutoTag2: smarter tagging for TextMate and WordPress</title>
		<link>http://brettterpstra.com/autotag2-smarter-tagging-for-textmate-and-wordpress/</link>
		<comments>http://brettterpstra.com/autotag2-smarter-tagging-for-textmate-and-wordpress/#comments</comments>
		<pubDate>Sun, 03 Apr 2011 20:11:53 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[tagging]]></category>
		<category><![CDATA[textmate]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=2154</guid>
		<description><![CDATA[<p>I was tooling around the Vim website looking at blogging plugins this morning. I noticed that one of them, Vimpress, had linked to an old project of mine that allowed you to work with Ultimate Tag Warrior tags through XML-RPC. Since the inclusion of tagging support in WordPress, Ultimate Tag Warrior has been defunct, and so have the UTW-RPC plugin&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/autotag2-smarter-tagging-for-textmate-and-wordpress/">AutoTag2: smarter tagging for TextMate and WordPress</a></p>]]></description>
			<content:encoded><![CDATA[<p><img style=' float: right; padding: 4px; margin: 0 0 2px 7px;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2011/04/autotag_add_tags_panel.jpg?9d7bd4" alt="Autotag Add Tags panel" height="469" width="349" class="alignright">I was tooling around the <a href="http://www.vim.org">Vim website</a> looking at blogging plugins this morning. I noticed that one of them, <a href="http://www.vim.org/scripts/script.php?script_id=1953">Vimpress</a>, had linked to an old <a href="http://blog.circlesixdesign.com/download/utw-rpc-autotag/">project of mine</a> that allowed you to work with Ultimate Tag Warrior tags through <a href="http://en.wikipedia.org/wiki/XML-RPC">XML-RPC</a>. Since the inclusion of tagging support in WordPress, Ultimate Tag Warrior has been defunct, and so have the UTW-RPC plugin and associated AutoTag TextMate bundle.</p>

<p>Thinking about it for a minute, I realized I really did miss the functionality that AutoTag had given me. While I’ve toyed around with blogging from Vim, I still primarily use TextMate, not least because of the <a href="http://bundle.weblogzinc.com/docs/index.php">Blogsmith Blogging Bundle</a>. Until that kind of functionality is ported to Vim, I’m happy right here. Thus, I spent my Sunday afternoon reviving the AutoTag bundle.</p>

<p>If you use <a href="http://blog.macromates.com/2006/blogging-from-textmate/">TextMate to blog on a WordPress site</a>, you’ll want to see this.</p>

<p><span id="more-2154"></span></p>

<p>There are two parts to this: a WordPress plugin that adds an XML-RPC call for getting all of the tags in use on the blog, and a small TextMate bundle for making good use of it. The TextMate bundle cribs off of my previous AutoTag project, and borrows most of the remote functionality from the original TextMate blogging bundle. Why reinvent the wheel? I’m bundling both together in the download, so if you want to use the WordPress plugin to port the functionality elsewhere (say, Vim?), you can just pull out the parts you need.</p>

<p>[<a href="#download">Skip to download</a>]</p>

<h2>AutoTagging in TextMate</h2>

<p>What the bundle does (short version) is find the most appropriate tags for your content based on <em>tags you’ve already used</em> before. This helps you easily keep your tag collection trim and <em>useful</em>. No disparate tags because of inconsistent capitalization, plurals or conjugation. Things that are related stay related. This can be especially difficult blogging from TextMate because you can’t quickly see “all tags” the way you can from the WordPress editor. This solves the problem.</p>

<h3>Install the WordPress plugin</h3>

<p>Standard install, like any other (manually-installed) plugin:</p>

<ul>
<li>Upload the gettags-rpc folder from the zip download to your <code>wp-content/plugins</code> folder on your server.</li>
<li>Open your admin page and go to the Plugins panel.</li>
<li>Activate the GetTags-RPC plugin in the plugin list.</li>
</ul>

<p>If the plugin activates without error, you should be ready to go. It’s a very simple plugin without a lot of error checking, so let me know if you have any trouble with it.</p>

<h3>Install the AutoTag bundle</h3>

<p>To install AutoTag in TextMate, double click on the bundle in the download zip file. It should open TextMate, pop up the Bundle Editor and show you the installed bundle and its commands. Done.</p>

<p>Assuming you have AutoTag installed in TextMate and the GetTags-RPC plugin installed in WordPress, you’re ready to go. Well, you’ll need to have your blog set up (Bundles &gt; Blogging &gt; Setup Blogs) in TextMate, but we’ll assume you’ve done that by now.</p>

<h3>Using the commands</h3>

<p><img style=' float: right; padding: 4px; margin: 0 0 2px 7px;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2011/04/autotag_tab_trigger.jpg?9d7bd4" alt="AutoTag Tab Trigger" height="166" width="287" class="alignright shadow">The AutoTag commands can be triggered in two ways. First, you can just put your cursor one space after the colon in the “Keywords:” line of the template headers. If you don’t have that line in your template, you can just type “Keywords: ” on a line before the end of the headers, or add it permanently by editing the template in the Bundle Editor. Hit tab from there and you’ll get a menu of the three commands in the bundle. You can trigger that from the same point even if you already have tags on the line; it will add appropriate commas automatically. Second, you can use Control-Option-T to get the same menu at any point in the file, although I’m not sure why you’d call it from anywhere <em>other</em> than the “Keywords” line.</p>

<h4>Commands</h4>

<p><strong>AutoTag:</strong> This is the primary command, or at least my favorite in the bundle. It’s only good when you run it <em>after</em> you write your post; it doesn’t have anything to work with on a blank template. Finish your post (or open an existing one) and trigger the command. It will grab all existing tags on your blog and compare them to your text, resulting in a dialog with a list of the best matches ranked by relevance. If you’re curious, here’s what it does when processing:</p>

<ul>
<li>Strips out all punctuation from the content of your post and creates an array of words</li>
<li>Uses the Porter Stemming algorithm to get the stem of each word. This makes plurals, adjective, adverb and verb forms all represent the same word.</li>
<li>Compares the list of stemmed words to the stems of each tag returned by your blog, keeping matches.</li>
<li>Measures the frequency of each match in the content and sorts the list accordingly.</li>
</ul>

<p><strong>Common Words:</strong> This command ignores the tags on your blog and just gives you the most common words from your post for selection as tags. It’s a good way to figure out what new tags might be worth adding. Again, it’s not very useful if you don’t have your content written yet.</p>

<p><strong>All Tags:</strong> If you’re not finding the AutoTag results satisfactory on a given post, or you want to tag before you have any content, this command will simply return your entire list of available tags. You can use it to check what form or casing you used on an existing tag, and it can be run at any time.</p>

<p>That’s it. If you use WordPress and TextMate together, I know you’re going to love this. Let me know how it goes! By the way, I’ll probably (eventually) build similar functionality right into the WordPress editor, and I’d love to see this ported to Vim, too. Any Vim plugin writers want a challenge?</p>

<h2>Download</h2>

<div class="download_desc"><p class="download-icon"><a href="http://brettterpstra.com/downloads/AutoTag2_1.0.1.zip?9d7bd4" title="Download AutoTag2 and GetTags-RPC (310)"><img src="http://brettterpstra.com/wp-content/plugins/download-monitor/page-addon/thumbnail.gif?9d7bd4" alt="download image for AutoTag2 and GetTags-RPC" width="64" /></a><br /><a href="http://brettterpstra.com/downloads/AutoTag2_1.0.1.zip?9d7bd4" title="Download AutoTag2 and GetTags-RPC (310)" class="download-button">Download</a></p><p class="desc"><a href="http://brettterpstra.com/downloads/AutoTag2_1.0.1.zip?9d7bd4" title="Download AutoTag2 and GetTags-RPC (310)">AutoTag2 and GetTags-RPC</a> — A combination WordPress plugin and TextMate bundle to provide additional tag functionality when blogging from TextMate to WordPress. <a href="http://brettterpstra.com/?p=2154">More Info</a></p></div>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/markdown-quicktags-wordpress-plugin/' rel='bookmark' title='Markdown QuickTags: WordPress plugin for Markdown lovers'>Markdown QuickTags: WordPress plugin for Markdown lovers</a></li>
<li><a href='http://brettterpstra.com/textmate-as-writeroom-for-free/' rel='bookmark' title='TextMate as WriteRoom, for free'>TextMate as WriteRoom, for free</a></li>
<li><a href='http://brettterpstra.com/getting-back-into-real-textmate-blogging/' rel='bookmark' title='Getting back into real TextMate blogging'>Getting back into real TextMate blogging</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/autotag2-smarter-tagging-for-textmate-and-wordpress/">AutoTag2: smarter tagging for TextMate and WordPress</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/autotag2-smarter-tagging-for-textmate-and-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mirror your Pinboard bookmarks with OpenMeta tags</title>
		<link>http://brettterpstra.com/mirror-your-pinboard-bookmarks-with-openmeta-tags/</link>
		<comments>http://brettterpstra.com/mirror-your-pinboard-bookmarks-with-openmeta-tags/#comments</comments>
		<pubDate>Sat, 02 Apr 2011 19:22:41 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[openmeta]]></category>
		<category><![CDATA[pinboard]]></category>
		<category><![CDATA[spotlight]]></category>
		<category><![CDATA[tagging]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=2146</guid>
		<description><![CDATA[<p>Update [April 3rd, 2011]: The current version, 1.0.4 at the moment, has bugfixes for running without Tags.app installed, more error handling and a new setting for locations where the date format is dd-mm-yyy. If you had a previous version and run into trouble, please replace the script with the latest and delete your ~/getpinboard.yaml file to regenerate a new one&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/mirror-your-pinboard-bookmarks-with-openmeta-tags/">Mirror your Pinboard bookmarks with OpenMeta tags</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong>Update [April 3rd, 2011]:</strong> The current version, 1.0.4 at the moment, has bugfixes for running without Tags.app installed, more error handling and a new setting for locations where the date format is <code>dd-mm-yyy</code>. If you had a previous version and run into trouble, please replace the script with the <a href="#download">latest</a> and delete your <code>~/getpinboard.yaml</code> file to regenerate a new one with the additional localization setting.</p>

<p>The download is at the end of this post, but I highly suggest reading at least the setup section before you get all crazy with it.</p>

<p><img style=' float: right; padding: 4px; margin: 0 0 2px 7px;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2011/04/pinboardbookmark.jpg?9d7bd4" alt="" title="pinboardbookmark" width="300" height="220" class="alignright size-full wp-image-2147" />I wrote a script a while back that would watch for changes in my Delicious bookmarks and mirror new ones to .webloc files on my drive, applying <a href="http://code.google.com/p/openmeta/">OpenMeta</a> tags so that they were locally searchable with Spotlight and other <a href="http://code.google.com/p/openmeta/wiki/OpenMetaApplications">OpenMeta applications</a>. I stopped using Delicious, though, and started using <a href="http://pinboard.in/">Pinboard</a>, which I mentioned recently <a href="http://brettterpstra.com/i-adore-pinboard/">that I adore</a>. In the process of revamping the script it became a little more “involved” than the original.</p>

<p>This script is for people who want to take advantage of Pinboard–with its full text search, easy privacy settings, accessible API, etc.–yet still want to be able to search their bookmarks in local Spotlight (and similar) searches. While it has the option to save bookmarks with a certain tag as searchable PDF files, it doesn’t attempt to replicate the full spectrum of Pinboard features. It’s just a way to make your remote bookmarks locally searchable, available system-wide and OpenMeta compatible.</p>

<p>I toyed around for a long time with using safaribookmark files instead of webloc files. They let you store a larger preview image, and you can include full text from websites within the XML of the file. Lots of possibilities there. For many reasons, I decided to stick with these little webloc files. If I want fancier images and web text, I’ll use <a href="http://www.celmaro.com/webbla/">Webbla</a>, and if I want comprehensive full text search I’ll use <a href="http://www.stclairsoft.com/HistoryHound/">HistoryHound</a>, both excellent programs in their own right. I want OpenMeta and simplicity, though. If I know I’m looking for a bookmark from Pinboard, I can just go to Delibar and do some searching. The goal is to be able to include my web discoveries in larger searches on my Mac.</p>

<p><span id="more-2146"></span></p>

<h3>Setup and Features</h3>

<p>First, put the script (download below) somewhere you can leave it, preferably somewhere in your system path. That’s not a huge deal, though, because you’ll be supplying an absolute path in most automation cases anyway. Once you have it situated, open Terminal and run <code>chmod a+x /path/to/your/script.rb</code>. Now you can run the script from the command line to configure and test.</p>

<p>When you run the script the first time (do it from the command line with <code>/path/to/script/getpinboard.rb</code>), it puts a configuration file at <code>~/getpinboard.yaml</code>. It will let you know exactly where it is, and will automatically open it in your text editor. You <em>must</em> edit the configuration settings before you’re ready to run it again. The configuration has options for all of the main features of the script, so these instructions are also going to be the tour. You can edit any of these options at any time. Note that the next time you run the script it will pull in up to 500 of your bookmarks, starting with the oldest. If you decide you didn’t like a setting, you may want to trash those files and the database and start over. Try not to let that happen.</p>

<h4>Configuration options</h4>

<dl>
<dt>user and password (string)</dt>
<dd>Set these to your Pinboard credentials</dd>

<dt>dateformat (string)</dt>
<dd>Leave this as ‘US’ if your local date format is <code>mm-dd-yyyy</code>. Set it to ‘UK’ if your date format is <code>dd-mm-yyyy</code>.</dd>

<dt>target (absolute path)</dt>
<dd>This is where the webloc files will be collected. It works great with a Dropbox folder, but put it anywhere you like. On my system, I have my <code>~/Library/Caches/Metadata/Tags/Bookmark</code> folder (where Tags.app stores its tagged bookmarks) symlinked to <code>~/Dropbox/Sync/Bookmark</code>. That Dropbox folder is my target for the script, so I’m saving my Pinboard bookmarks to my Tags folder and still syncing them (and their OpenMeta tags) to my other computers. Further Tags integration will be covered at the end of the options.</dd>

<dd>If a folder specified in the config is missing, the script will attempt to create it.</dd>

<dt>db_location (absolute path)</dt>
<dd>This is the location of the bookmarks database. The filename will be <code>bookmarks.stash</code>, and it’s perfectly fine for it to exist in the same folder as you set for your TARGET.</dd>

<dt>pdf_location (absolute path)</dt>
<dd>If the PDF_TAG below isn’t set to false, this is where PDFs of bookmarks with that tag will be created. This requires the latest version of <a href="http://derailer.org/paparazzi/">Paparazzi!</a> (which does run fine on Snow Leopard).</dd>

<dt>tag_method (integer 0–2)</dt>
<dd>This determines how the OpenMeta tags will be applied. Use 0 to disable, 1 for <a href="http://www.caseapps.com/tags/">Tags.app</a> or 2 for the <a href="http://code.google.com/p/openmeta/downloads/list">OpenMeta CLI utility</a>.</dd>

<dt>always_tag (string)</dt>
<dd>I like to mark my tags which come from bookmark services for top-level grouping. This setting defaults to “pinboard”, but you can change it to anything (or leave it blank).</dd>

<dt>update_tags_db (boolean)</dt>
<dd>If you’re using Tags.app, you know you can tag a web page with it and it will remember the tags next time you visit that address. That doesn’t work with external tools, though, because Tags keeps a separate database for those links. Setting this to true will let the script update the Tags database and keep everything in sync.</dd>

<dt>create_thumbs (boolean)</dt>
<dd>If set to true, this feature will add custom icons to your webloc files using a screengrab of the website and the website’s favicon. It looks great in icon and CoverFlow views.</dd>

<dd>This is another external requirement. To get thumbnails, you must have <a href="http://hasseg.org/setWeblocThumb/">setWeblocThumb</a>, a free utility for doing just that. The utility must be located at <code>/usr/local/bin/setWeblocThumb</code>.</dd>

<dd>Note that creating thumbs takes a typical 4-8k webloc file and makes it around 160k average. My bookmarks folder has nearly 200MB of bookmarks in it, tagged and thumbnailed. That’s ok with me, but if you want to keep it small and agile, skip the thumbs.</dd>

<dt>pdf_tag (string)</dt>
<dd>The string defined here will determine which bookmarks, if any, are also saved as searchable PDF files. Just use it as a tag and Paparazzi! will download the url in the background to the location you set above.</dd>

<dt>debug (boolean)</dt>
<dd>Leave this off (false), unless you need a little more info about what’s going on. It will use Growl and STDOUT to display progress if enabled.</dd>

<dt>gzip_db (boolean)</dt>
<dd>I can’t imagine the database file that this generates being large enough to worry about size, but this option will cut the disk space it requires significantly. I leave it off, but it’s your choice.</dd>
</dl>

<h3>Optional additions</h3>

<p>As mentioned above, if you want to create thumbnails for your webloc files from screenshots of the web page, you’ll need <a href="http://hasseg.org/setWeblocThumb/">setWeblocThumb</a>, a free utility for doing just that. Its functionality is included in the script, just install the utility and make sure thumbnailing is enabled in the config. The script expects the utility to be located at <code>/usr/local/bin/setWeblocThumb</code>.</p>

<p>If you want the option to save bookmarks with a certain tag as fully-searchable PDF files, you’ll need the latest (I use the term loosely) version of <a href="http://derailer.org/paparazzi/">Paparazzi!</a>.</p>

<p>You’ll also probably want <a href="http://growl.info/">Growl</a> installed. I can’t recall if the command line utility <code>growlnotify</code> is set up by default, but that’s what the script uses to send notifications. It will live if you don’t have it, but it generally won’t try to communicate by any other channels when debugging is turned off.</p>

<h2>Running the script</h2>

<p>There are a couple of options for automating the script. You can have it run at regular intervals; it stores its last update time and compares it with the Pinboard server before it bothers downloading anything. Once you’re up-to-date on your sync, you could run it every 15–30 minutes without any trouble. The easiest way to do that is with <code>launchd</code>, and the easiest way to do <em>that</em> is with Lingon. If you don’t already have it, grab it <a href="http://itunes.apple.com/us/app/lingon/id411211026?mt=12">from the Mac App Store</a>. It’s worth the five bucks. Use the wizard to set up a schedule and run the script.</p>

<p>What <em>I</em> do is set up <a href="http://www.noodlesoft.com/hazel.php">Hazel</a> to watch the database file for <a href="http://www.delibarapp.com/">Delibar</a>. Delibar is my favorite app for bookmarking and searching my online bookmarks. It works wonderfully with Pinboard, and I can’t recommend it highly enough. I can hit a key when I’m on a website in any browser and be able to quickly comment, tag and save the page (either privately or publicly) using the same Cocoa interface every time. Anyway, Delibar keeps its database in <code>~/Library/Application Support/Delibar</code> and the file is named <code>DelibarDB.xml</code>. I simply watch for changes since the last match, and then run the script when one is found. I’m sure you could accomplish something similar with Webbla, or even one of the browser plugins if it modified a local store at all when you add the bookmark.</p>

<p>You could resort to <code>cron</code>, or run it manually once in a while, I suppose. It’s far handier to have it out of mind, though, and just have your bookmarks show up in OpenMeta and Spotlight searches within minutes of bookmarking them.</p>

<h2>Tips</h2>

<ol>
<li>If you imported a ton of bookmarks from Delicious and haven’t spent a lot of time “weeding” them, you’ve probably got a lot of dead links that you’d be better off <em>not</em> downloading. Here’s a great solution: <a href="https://github.com/jparise/stale">stale.py</a>. It’s a Python script that you run locally, and it will traverse your entire collection of links and test them for error responses. You can run it in test mode first, and then turn on the delete mode to get rid of the dead ones. Instructions are at the <a href="https://github.com/jparise/stale">bottom of the GitHub page</a>.</li>
<li>Use descriptions <em>and</em> tags on things you want to make sure you can find. Clip some text out of the web page or write yourself a note in the description field. These notes are transferred by the script to your Spotlight Comments for the webloc file, making them instantly searchable, in addition to the convenience of tag search.</li>
<li>Don’t be shy about saving PDFs. If a page is a tutorial that you know you’ll need to reference, just go for it. They don’t take up much space, they can be annotated easily (seriously, have you tried <a href="http://skim-app.sourceforge.net/">Skim</a>?), and they allow for full text search locally.</li>
<li>Use <a href="http://www.choosyosx.com/">Choosy</a>. With a local store of Spotlight-searchable bookmarks synced with Dropbox, and Choosy to determine what browser you open them in, you have cross-browser, cross-machine support for your entire bookmark collection.</li>
<li>The timestamp of the last check is stored in your user’s preference files using the <code>defaults</code> command. For the purposes of debugging, it’s sometimes useful to set that back a bit and force it to update. Just use <code>getpinboard.rb -r</code> to set it back 24 hours, or use a number after the –r to specify a number of days to revert.</li>
</ol>

<h2>Notes</h2>

<p>The script is a one-way sync. All of the pieces are there to start working on a system that would update Pinboard with local deletions and insertions, but I just don’t have a need for it. At that point, I might as well make a dedicated application with an SQLite database to do all of this, and that gets way outside the scope of what I started here. Anyway, the only reason I’m not using Webbla for more of this is that it’s sandboxed from the rest of the system, and this script can work in tandem with Webbla to fix that.</p>

<p>Also, the local database created by this script is essentially a text dump, and it can be easily read into a Ruby script and manipulated. It serves as a good backup of all of your Pinboard info, and has some other possibilities as well. Here’s a quick <a href="https://gist.github.com/899757">demo script</a> for outputting an HTML file, and a little tweaking could make it output a format that Safari, Firefox and Chrome can read to import bookmarks. All of the keys and values are there, so you can sift and sort any way you want. Lots of fun to be had, for the adventurous (or easily distracted).</p>

<h2>Uninstalling</h2>

<p>If you need to uninstall the script, remove it from whatever you’re using to schedule its activity, delete the script and locate two files:</p>

<ul>
<li><code>~/getpinboard.yaml</code> (in your User’s home folder)</li>
<li><code>~/Library/Preferences/com.brettterpstra.PinboardTagger.plist</code> (in your User’s Library/Preferences folder)</li>
</ul>

<p>Hope the script comes in useful for somebody, feel free to let me know if you have any trouble with it.</p>

<h2>Download</h2>

<p>There is a <a href="https://github.com/ttscoff/Pinboard-to-OpenMeta">repo on GitHub</a>, feel free to fork and send pull requests.</p>

<div class="download_desc"><p class="download-icon"><a href="http://brettterpstra.com/downloads/GetPinboard1.0.4" title="Download Pinboard mirror with OpenMeta tagging (471)"><img src="http://cdn2.brettterpstra.com/wp-content/uploads/downloads/thumbnails/2011/04/pinboardlogo.png?9d7bd4" alt="download image for Pinboard mirror with OpenMeta tagging" width="64" /></a><br /><a href="http://brettterpstra.com/downloads/GetPinboard1.0.4" title="Download Pinboard mirror with OpenMeta tagging (471)" class="download-button">Download</a></p><p class="desc"><a href="http://brettterpstra.com/downloads/GetPinboard1.0.4" title="Download Pinboard mirror with OpenMeta tagging (471)">Pinboard mirror with OpenMeta tagging</a> — A Ruby script to mirror your Pinboard tags as local webloc files, complete with Spotlight Comments and OpenMeta tags. <a href="http://brettterpstra.com/?p=2146">More Info</a></p></div>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/delicious-bookmarks-and-openmeta-tags/' rel='bookmark' title='Delicious bookmarks and OpenMeta tags'>Delicious bookmarks and OpenMeta tags</a></li>
<li><a href='http://brettterpstra.com/delicious-spotlight-and-openmeta-tags-revisited/' rel='bookmark' title='Delicious, Spotlight and OpenMeta tags, revisited'>Delicious, Spotlight and OpenMeta tags, revisited</a></li>
<li><a href='http://brettterpstra.com/pinboard-links-with-instapaper-text/' rel='bookmark' title='Bookmarklet: Read Pinboard links with Instapaper Text'>Bookmarklet: Read Pinboard links with Instapaper Text</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/mirror-your-pinboard-bookmarks-with-openmeta-tags/">Mirror your Pinboard bookmarks with OpenMeta tags</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/mirror-your-pinboard-bookmarks-with-openmeta-tags/feed/</wfw:commentRss>
		<slash:comments>41</slash:comments>
		</item>
		<item>
		<title>On sorting, tagging and other nerdery</title>
		<link>http://brettterpstra.com/on-sorting-tagging-and-other-nerdery/</link>
		<comments>http://brettterpstra.com/on-sorting-tagging-and-other-nerdery/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 12:36:10 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Write]]></category>
		<category><![CDATA[openmeta]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[tagging]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=1996</guid>
		<description><![CDATA[<p>Nerd post alert. As if you were expecting anything else. Since posting my latest desktop, I’ve received a few questions about how I keep my Mac’s Desktop icons under control. I thought I’d answer that question before I got around to posting my whole GeekTool setup. Beyond hiding disk icons and making the icons smaller in Finder’s Desktop view settings,&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/on-sorting-tagging-and-other-nerdery/">On sorting, tagging and other nerdery</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong>Nerd post alert.</strong> As if you were expecting anything else.</p>

<p><img style=' float: right; padding: 4px; margin: 0 0 2px 7px;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2011/02/file_stack_image.jpg?9d7bd4" width="283" height="424" class="alignright" />Since <a href="http://brettterpstra.com/my-desktop-february-2011/">posting my latest desktop</a>, I’ve received a few questions about how I keep my Mac’s Desktop icons under control. I thought I’d answer that question before I got around to posting my whole GeekTool setup. Beyond hiding disk icons and making the icons smaller in Finder’s Desktop view settings, I have a “system.” My filing system is simple to use, but a little complicated to explain (and set up), so it gets a whole post to itself. I doubt many will follow directly in my footsteps, but you asked…</p>

<p><span id="more-1996"></span></p>

<h2>Like any so-called system…</h2>

<p>The basic idea is that my Desktop is an inbox. During the day, I save just about everything I work on to my Desktop. Like any system I’ve ever used, the secret is actually doing the “reviews”. At the end of each day I do a scan and file what obviously has a place (I have some neat tricks for speeding that part up, but I’ll get there in a bit). Things that represent new projects or that don’t fit into an existing folder/tag setup take further action; if there are enough related items to represent a project or topic, they get collected into a new Desktop folder which is descriptively named. The new folders will generally stay on the Desktop until the weekend, when I do a Weekly Review. If a file is singular and has no context, it stays on the Desktop and waits for company. If a file sits alone for a few days, it usually ends up being tossed into a “pile” of similar filetypes. Let Spotlight sort ‘em out.</p>

<p>In the Weekly Review, I go through the new folders on the Desktop and determine what type of information they represent. Is it a project? A client? Reference material? I have a folder hierarchy based on these types, the top levels being Work, Code, Reference and File Cabinet. Each breaks down a couple more levels. If a Desktop folder can be filed into one of these categories, it’s moved there. Not before it’s tagged, though.</p>

<h2>Tags, tags, tags</h2>

<p>I use <a href="http://code.google.com/p/openmeta/">OpenMeta</a> tags to sort and search all of my data. I primarily use <a href="http://www.caseapps.com/tags/">Tags</a> from Case Apps, <a href="http://www.stclairsoft.com/DefaultFolderX/">Default Folder X</a> and Spotlight, but make frequent use of <a href="http://www.houdah.com/houdahSpot/">HoudahSpot</a> and the command line openmeta utility as well (among many other <a href="http://code.google.com/p/openmeta/wiki/OpenMetaApplications">OpenMeta-compatible apps</a>). I don’t stake the life of my data on the continued availability or stability of the OpenMeta system, but in combination with a consistent, shallow folder hierarchy, I know where things are, even without the convenience of tags. Tags make it easy to group files and work with those groups, but there’s more than enough metadata in the filesystem to make any information easy to locate with Spotlight or other <a href="http://en.wikipedia.org/wiki/Mdfind-related">mdfind</a> tools.</p>

<p>The beauty of tagging, as you may know, is that you can easily assign multiple categorizations and topics to each item, rather than just having them exist at one location which defines it as a type or part of a static collection. I still use the shallow hierarchy of folders that drill down to individual projects and topics, so it’s not a “one pile” deal. I couldn’t function like that; it’s difficult to weed, and if metadata is lost, so is the file, essentially. I use folders to maintain filesystem sanity. I use tags and other metadata to maintain <em>my</em> sanity.</p>

<p>I also use tags on iCal events, emails, web sites and other elements of my system. They’re easy to filter in searches and allow me to make a project “folder” that contains more types of data than Finder would normally make convenient.</p>

<p>Tags, to me, are like mind maps, in that they work the way my brain does. Each tag creates a “nodal connection” to other items sharing the tag, and neural networks are formed by related tags. Things aren’t always directly connected, but the nodes make it possible to track things down after you’ve forgotten about them. They’re useful in the short term for gathering projects together and categorizing, but even more useful after you’ve forgotten you ever had a file and then suddenly need it.</p>

<h2>What’s in a (tag) name?</h2>

<p>The secret, which I’ve learned from a few years of doing this, is to tag intelligently, sparingly and consistently. Being liberal with tags like “important” or “flagged” just means more upkeep and reviews that have to be done to keep the tags relevant. While tags like “neat” or “supercool” seem silly to me, I use one “inspiration” tag on anything that I’m saving just because it’s, well, inspirational. I have a Smart Folder in Finder that pulls up everything with that tag, and then I can filter the files based on date, type, etc. If I add additional tags, they are pretty general, such as “color,” “webdesign,” or “productivity.” These are big buckets I can dive into when I need an idea, or a kick in the pants. The tags on project and research files tend to be more specific, and I can drill down to precise sets of files by typing a few words in Tags or HoudahSpot.</p>

<p>To keep the cruft down, I use tags which aren’t already defined by other metadata like the creation or modified date, the filetype, the filename, etc. I do tag files with the name of their parent project or topic, even though it’s often redundant to the folder hierarchy. This allows me to tie projects together across multiple folders, disks or even servers. Sometimes a file is more strongly tied to a topic than it is to an individual project. Say it’s a general reference item or a stock photo that I gathered while working on a specific project, but that I know I’ll need again. I put it into a reference folder or photo collection, and tag it with the related project. It’s easy to view it in the context of the project with a tag search, but part of a larger collection of similar items at the same time.</p>

<p>When in doubt, I usually choose tags based on the first thought that pops into my head. Chances are, when I’m looking for it again in a year, I’ll have the same thought. It doesn’t always work, but I’ve had a pretty good success rate over the last couple of years. As often as possible I try to reuse tags; a tag that reveals one or two files is a useless tag. My “Yearly Review” includes weeding out tags that have very few associated files, or that could be merged into more common tags.</p>

<h2>Is this future-proof?</h2>

<p>I know I started by saying I don’t depend solely on tags, and then went on to describe a system that sounds pretty tag-heavy. Given the somewhat unorthodox nature of OpenMeta tags, and Apple’s power to pull the rug out from under them at any time, it kind of seems like a disaster waiting to happen, right? The fact of the matter is that OpenMeta tags are well preserved by design, backed up<sup id="fnref:fn1"><a href="#fn:fn1" rel="footnote">1</a></sup>, and can be re-associated with their files through various means, should the system ever fail. It’s really pretty solid.</p>

<p>The tags don’t translate to iOS, though, so that’s taken some extra thought in some cases. The tags I use in Simplenote/Notational Velocity, for example, are inline in the file as a special character followed by the tag name. I can set up Spotlight searches to search for a keyword with and without that prefix, so it doesn’t really add complexity to the system. Searching in Simplenote on my iPhone/iPad is then much easier. Spotlight and apps like Simplenote also search text content and filenames, and iOS apps don’t “talk” to each other very well anyway, so it’s not a huge deal at this point.</p>

<h2>The cool part</h2>

<p>Tagging files with a project name has an added benefit for me. I’ve built a system using some Ruby scripts, the CLI tool for OpenMeta, the mdfind command, <a href="http://www.aptonic.com/">Dropzone</a>, <a href="http://www.noodlesoft.com/hazel.php">Hazel</a> and Tags.app. This is the truly “complicated” part. The system took a while to set up, and there was some tweaking early on, but it’s solid now and I rarely have to think about it. It just works.</p>

<p>When I file those Desktop folders each week, I add a special supertag to define them as “targets.” They get a unique project name or combination of names, and the target tag. Then they’re filed in parent folders which are also targets with unique names. The second level of target can have one more child level of targets to separate sub-projects or file types. These tag names do not have to be unique system-wide, only within their parent target tag. Within any of those folders, the files are tagged and finding them rarely actually requires going into the folders.</p>

<p>Now, during the daily review, I just use Tags.app to quickly tag files on the Desktop with whatever is appropriate, plus the name of the project or topic they’re associated with, and any subfolders I want them to reach. Then I can let Hazel pick them up, or drag them straight to my Filer destination in Dropzone. Both run a script which gathers all of the target folders on the system and starts drilling down to find the best matching tag or series of tags. Then, it moves the tagged file into the best-match folder, logs the action to a text file, and gives me a quick Growl notification letting me know what it decided.</p>

<p>That’s the system. I’m sure I left some questions unanswered, so feel free to ask again in the comments. As I said in the beginning, I don’t know if this kind of setup makes sense to other Mac users, but it’s served me well for years. I don’t lose files, I keep my filesystem tidy, and I stay relatively sane.</p>

<p>Here’s a mind map of the elements that went into this article. It seemed to make a nice summary of my long-winded diatribe.</p>

<iframe width="600" height="400" frameborder="0" src="http://www.mindmeister.com/maps/public_map_shell/83325908/tagging?width=600&#038;height=400&#038;zoom=0&#038;no_share=1" scrolling="no" style="overflow:hidden"></iframe>

<div class="footnotes">
<hr />
<ol>

<li id="fn:fn1">
<p>The Mac App Store has an issue with the backups, actually, because OpenMeta-compatible apps all back tags up to a universal cache folder. MAS doesn’t allow an app to write anything outside of its own Application Support folder. I like that in general, but I think there needs to be a concession in cases where synchronicity between multiple apps is of essence. <a href="#fnref:fn1" rev="footnote">↩</a></p>
</li>

</ol>
</div>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/some-suggestions-for-better-tagging/' rel='bookmark' title='Some suggestions for better tagging'>Some suggestions for better tagging</a></li>
<li><a href='http://brettterpstra.com/autotag2-smarter-tagging-for-textmate-and-wordpress/' rel='bookmark' title='AutoTag2: smarter tagging for TextMate and WordPress'>AutoTag2: smarter tagging for TextMate and WordPress</a></li>
<li><a href='http://brettterpstra.com/a-bash-function-for-markdown-bloggers/' rel='bookmark' title='A Bash function for Markdown bloggers'>A Bash function for Markdown bloggers</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/on-sorting-tagging-and-other-nerdery/">On sorting, tagging and other nerdery</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/on-sorting-tagging-and-other-nerdery/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Delicious, Spotlight and OpenMeta tags, revisited</title>
		<link>http://brettterpstra.com/delicious-spotlight-and-openmeta-tags-revisited/</link>
		<comments>http://brettterpstra.com/delicious-spotlight-and-openmeta-tags-revisited/#comments</comments>
		<pubDate>Tue, 25 May 2010 07:56:12 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[bookmarking]]></category>
		<category><![CDATA[delicious]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[openmeta]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[spotlight]]></category>
		<category><![CDATA[tagging]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=448</guid>
		<description><![CDATA[<p>I’ve taken a little time to improve the script I’d posted previously. It saves bookmarks you add to Delicious as webloc (Safari bookmark) files on your local hard drive, optionally with thumbnails and OpenMeta tags. Why would you want to do this? First, it adds Spotlight search abilities to your Delicious bookmarks, and, if you use OpenMeta tags, it integrates&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/delicious-spotlight-and-openmeta-tags-revisited/">Delicious, Spotlight and OpenMeta tags, revisited</a></p>]]></description>
			<content:encoded><![CDATA[<p>I’ve taken a little time to improve the script I’d <a href="http://brettterpstra.com/2010/05/11/delicious-bookmarks-and-openmeta-tags/">posted previously</a>. It saves bookmarks you add to <a href="http://delicious.com/">Delicious</a> as webloc (Safari bookmark) files on your local hard drive, optionally with thumbnails and <a href="http://code.google.com/p/openmeta/">OpenMeta tags</a>.</p>

<h3>Why would you want to do this?</h3>

<p><a rel="lightbox" href="http://cdn2.brettterpstra.com/wp-content/uploads/2010/05/tagsearchdelicious_lg.jpg?9d7bd4" title="Searching in Tags for CSS3 bookmarks from Delicious"><img style=' float: left; padding: 4px; margin: 0 7px 2px 0;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2010/05/tagsearchdelicious_lg-150x150.jpg?9d7bd4" alt="" title="tagsearchdelicious_lg" width="150" height="150" class="alignleft size-thumbnail wp-image-457" /></a>First, it adds Spotlight search abilities to your Delicious bookmarks, and, if you use OpenMeta tags, it integrates a tag-based search into any OpenMeta application. The second half of that is, in my case, I bookmark in different ways for different purposes, and it’s nice to have everything integrate into a full search in the end. For me, that search is primarily tag-based, thus the OpenMeta tagging. When I want to share a link, I use Delicious (<a href="http://www.delibarapp.com/">via Delibar</a>), and when I just want to save it for my own reference, I use OpenMeta (<a href="http://www.gravityapps.com/tags/index.html">via Tags.app</a>). This script is part of a system which blends the two, removing the need for redundant tagging and bringing my Spotlight searches together.</p>

<p>Read on for the new script, and installation instructions.</p>

<p><span id="more-448"></span>
At the top of the script, you’ll find a section that looks like this:</p>

<div>
<pre><code>
-- CONFIG
-- delicious username
property _user : "username"
-- delicious password
property _pass : "password"
-- POSIX path to *existing* folder, manually create the folder if needed or point to one that does exist
property targetFolder : "/Users/OSXUSERNAME/Library/Caches/Metadata/Delicious"
-- use Tags.app to apply OpenMeta tags based on Delicious tags
property useTagsApp : true
-- add thumbnails using http://hasseg.org/setWeblocThumb/
property useWebLocThumb : true
-- END CONFIG
</code></pre>
</div>

<p>You’ll need to set these properties to your own information, but after that the script should take care of itself. Username and password are your login info for Delicious.com. Obviously, it won’t work without those. The targetFolder property should be set to a folder that already exists or that you just created for the purpose. The script will <strong><em>not</em></strong> create a folder that doesn’t exist. I recommend creating one in <code>~/Library/Caches/Metadata/Delicious</code>, and just substituting your user name in the targetFolder config.</p>

<p>The last two configuration options determine whether posts are tagged with Tags.app and/or thumbnailed with setWeblocThumb. I recommend doing both, but if you have other purposes for the script, feel free to set these to false. In order to use either option, you’ll need to have the appropriate application installed. <a href="http://www.gravityapps.com/tags/index.html">Tags</a> is a $29US application that makes tagging everything from URL’s to iPhoto pictures, as well as files and folders, a breeze. Worth every penny, in my opinion. <a href="http://hasseg.org/setWeblocThumb/">setWeblocThumb</a> is a free utility that captures thumbnail images of the bookmarked page and applies it to the webloc file. It makes for very nice presentation of search results and bookmark folders.</p>

<p>The last thing you’ll probably want to alter is the first line <em>after</em> the end of the config. It sets the ‘date from’ parameter default to 1 hour prior, in Central Standard Time. If you’re not stuck in the middle of the country, you’ll want to edit the –v+4H part to a + or — number more indicative of your own GMT offset. It’s not a huge deal, this current script will grab everything after this date on the first run, but will record the date of the last bookmark it finds and use that for the next run, and so on. If you want to get <strong><em>all</em></strong> of your Delicious bookmarks on the first run, set this to something long, long ago.</p>

<p>I’ve smartened the script up a bit from the previous version, and solved some of the errors that caused the bookmark save to fail on certain filenames. It also checks for existing bookmarks before writing new ones to disk, avoiding duplicates.</p>

<p>As with the last script, you can use Lingon to set up an hourly run for the script in launchd, or even just set it as an alarm in iCal and use that to schedule it, but I’ve found a better solution. I use Delibar for bookmarking, and it writes out to an xml file in <code>~/Library/Application Support/Delibar</code>. I used Lingon to set up a launchd process that watches for changes in that file and runs the script. Seems to work really well, at least so far. However you choose to run it, it will keep storing the latest date at the time of retrieval, so you can even just run it once a day (or week, or month) and it will find just the newest bookmarks.</p>

<p>Without further ado, here’s the script in its entirety, commented for readability:</p>

<p><strong><em>Updated:</em></strong> Thanks to Matteo from Shiny Frog for tipping me off to the fact that the API rate limiting I was running into was due to the lack of a user agent. This has been added to the curl call in the script, testing will be much smoother now!</p>

<div>
<pre><code>
#!/usr/bin/osascript
-- CONFIG
-- delicious username
property _user : "username"
-- delicious password
property _pass : "password"
-- POSIX path to *existing* folder, manually create the folder if needed or point to one that does exist
property targetFolder : "/Users/OSXUSERNAME/Library/Caches/Metadata/Delicious"
-- use Tags.app to apply OpenMeta tags based on Delicious tags
property useTagsApp : true
-- add thumbnails using http://hasseg.org/setWeblocThumb/
property useWebLocThumb : true
-- END CONFIG

set _date to do shell script "date -v+4H '+%Y-%m-%dT%H:%M:%SZ'"
-- returns a date 1 hour ago (CST) in the format required by the twitter API.
-- you can adjust the date based on your time zone and the frequency that you run
-- the script by editing the -v+4H part of the date command (e.g. -v-1H for GMT - 1 hour)
-- Note that the Delicious dates run on GMT, so you have to account for your time offset
-- For me (CST), this means -v+4H if I want to go back one hour
try
    set _fromdt to do shell script "defaults read com.brettterpstra.getdelicious fromdt"
    -- if the last update time is stored in defaults, use it
on error
    set _fromdt to _date
    -- otherwise, use the date we just set
end try

set bookmarks to do shell script "curl -A \"OpenMetaTagger/1.1\" https://" &amp; _user &amp; ":" &amp; _pass &amp; "@api.del.icio.us/v1/posts/all?fromdt=" &amp; _fromdt

-- gets the bookmarks starting with the date specified in _date
set _folder to POSIX file targetFolder as alias
-- turns the POSIX path in CONFIG into an AppleScript alias
set _output to ""

tell application "System Events"
    set xmlDocument to make new XML data with data bookmarks
    -- set xmlDocument to contents of XML file "Users:ttscoff:Desktop:deliciousbookmarks.xml"
    -- create the XML object
    set {astid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, " "}
    -- store the current delimiter and set the new one to a space for breaking up the tags
    repeat with _post in XML elements of XML element 1 of xmlDocument
        set _url to value of XML attribute "href" of _post as string
        set _tags to text items of (value of XML attribute "tag" of _post as string)
        set end of _tags to "delicious"
        set _name to value of XML attribute "description" of _post as string
        set _title to do shell script "echo \"" &amp; _name &amp; "\"" &amp; "|tr -cs /[^A-Za-z]/ ' '"
        -- strips some bad characters from the page title, solves some errors
        set _date to value of XML attribute "time" of _post as string
        try
            tell application "Finder"
                set AppleScript's text item delimiters to ""
                if not exists alias ((_folder &amp; _title as string) &amp; ".webloc") then
                    set webloc to make new internet location file at _folder to _url with properties {name:_title}
                    -- makes a .webloc file in our target folder
                    set _output to _output &amp; "Grabbed " &amp; _title
                    set AppleScript's text item delimiters to " "
                    if useTagsApp then
                        tell application "Tags" to apply tags _tags to files {POSIX path of (webloc as string)}
                        -- adds OpenMeta tags to our newly created file
                        set _output to _output &amp; " and tagged with " &amp; _tags as string
                    end if
                    if useWebLocThumb then
                        do shell script "/usr/local/bin/setWeblocThumb " &amp; quoted form of (POSIX path of (webloc as string))
                        -- use setWeblocThumb to add a thumbnail to our webloc file
                        -- http://hasseg.org/setWeblocThumb/
                        set _output to _output &amp; ", applied thumbnail"
                    end if
                    set _output to _output &amp; "." &amp; return
                end if
            end tell
        on error myError
            set _output to _output &amp; "Error " &amp; myError &amp; return
        end try
        set {_url,_title,_tags,_name,_time} to {null,null,null,null,null}
    end repeat
    set AppleScript's text item delimiters to astid
    -- restore the delimiters
end tell
do shell script "defaults write com.brettterpstra.getdelicious fromdt " &amp; _date
-- store the date of the last bookmark in system defaults
return _output
</code></pre>
</div>

<p><a href="applescript://com.apple.scripteditor?action=new&amp;script=%23%21%2Fusr%2Fbin%2Fosascript%0A%2D%2D%20CONFIG%0A%2D%2D%20delicious%20username%0Aproperty%20_user%20%3A%20%22username%22%20%0A%2D%2D%20delicious%20password%0Aproperty%20_pass%20%3A%20%22password%22%20%0A%2D%2D%20POSIX%20path%20to%20%2Aexisting%2A%20folder%2C%20manually%20create%20the%20folder%20if%20needed%20or%20point%20to%20one%20that%20does%20exist%0Aproperty%20targetFolder%20%3A%20%22%2FUsers%2FOSXUSERNAME%2FLibrary%2FCaches%2FMetadata%2FDelicious%22%20%0A%2D%2D%20use%20Tags%2Eapp%20to%20apply%20OpenMeta%20tags%20based%20on%20Delicious%20tags%0Aproperty%20useTagsApp%20%3A%20true%20%0A%2D%2D%20add%20thumbnails%20using%20http%3A%2F%2Fhasseg%2Eorg%2FsetWeblocThumb%2F%0Aproperty%20useWebLocThumb%20%3A%20true%20%0A%2D%2D%20END%20CONFIG%0A%0Aset%20_date%20to%20do%20shell%20script%20%22date%20%2Dv%2B4H%20%27%2B%25Y%2D%25m%2D%25dT%25H%3A%25M%3A%25SZ%27%22%0A%2D%2D%20returns%20a%20date%201%20hour%20ago%20%28CST%29%20in%20the%20format%20required%20by%20the%20twitter%20API%2E%0A%2D%2D%20you%20can%20adjust%20the%20date%20based%20on%20your%20time%20zone%20and%20the%20frequency%20that%20you%20run%0A%2D%2D%20the%20script%20by%20editing%20the%20%2Dv%2B4H%20part%20of%20the%20date%20command%20%28e%2Eg%2E%20%2Dv%2D1H%20for%20GMT%20%2D%201%20hour%29%0A%2D%2D%20Note%20that%20the%20Delicious%20dates%20run%20on%20GMT%2C%20so%20you%20have%20to%20account%20for%20your%20time%20offset%0A%2D%2D%20For%20me%20%28CST%29%2C%20this%20means%20%2Dv%2B4H%20if%20I%20want%20to%20go%20back%20one%20hour%0Atry%0A%09set%20_fromdt%20to%20do%20shell%20script%20%22defaults%20read%20com%2Ebrettterpstra%2Egetdelicious%20fromdt%22%0A%09%2D%2D%20if%20the%20last%20update%20time%20is%20stored%20in%20defaults%2C%20use%20it%0Aon%20error%0A%09set%20_fromdt%20to%20_date%0A%09%2D%2D%20otherwise%2C%20use%20the%20date%20we%20just%20set%0Aend%20try%0A%0Aset%20bookmarks%20to%20do%20shell%20script%20%22curl%20https%3A%2F%2F%22%20%26%20_user%20%26%20%22%3A%22%20%26%20_pass%20%26%20%22%40api%2Edel%2Eicio%2Eus%2Fv1%2Fposts%2Fall%3Ffromdt%3D%22%20%26%20_fromdt%0A%0A%2D%2D%20gets%20the%20bookmarks%20starting%20with%20the%20date%20specified%20in%20_date%0Aset%20_folder%20to%20POSIX%20file%20targetFolder%20as%20alias%0A%2D%2D%20turns%20the%20POSIX%20path%20in%20CONFIG%20into%20an%20AppleScript%20alias%0Aset%20_output%20to%20%22%22%0A%0Atell%20application%20%22System%20Events%22%0A%09set%20xmlDocument%20to%20make%20new%20XML%20data%20with%20data%20bookmarks%0A%09%2D%2D%20set%20xmlDocument%20to%20contents%20of%20XML%20file%20%22Users%3Attscoff%3ADesktop%3Adeliciousbookmarks%2Exml%22%0A%09%2D%2D%20create%20the%20XML%20object%0A%20%20%20%20set%20%7Bastid%2C%20AppleScript%27s%20text%20item%20delimiters%7D%20to%20%7BAppleScript%27s%20text%20item%20delimiters%2C%20%22%20%22%7D%0A%20%20%20%20%2D%2D%20store%20the%20current%20delimiter%20and%20set%20the%20new%20one%20to%20a%20space%20for%20breaking%20up%20the%20tags%0A%09repeat%20with%20_post%20in%20XML%20elements%20of%20XML%20element%201%20of%20xmlDocument%0A%09%09set%20_url%20to%20value%20of%20XML%20attribute%20%22href%22%20of%20_post%20as%20string%0A%09%09set%20_tags%20to%20text%20items%20of%20%28value%20of%20XML%20attribute%20%22tag%22%20of%20_post%20as%20string%29%0A%09%09set%20end%20of%20_tags%20to%20%22delicious%22%0A%09%09set%20_name%20to%20value%20of%20XML%20attribute%20%22description%22%20of%20_post%20as%20string%0A%09%09set%20_title%20to%20do%20shell%20script%20%22echo%20%5C%22%22%20%26%20_name%20%26%20%22%5C%22%22%20%26%20%22%7Ctr%20%2Dcs%20%2F%5B%5EA%2DZa%2Dz%5D%2F%20%27%20%27%22%0A%09%09%2D%2D%20strips%20some%20bad%20characters%20from%20the%20page%20title%2C%20solves%20some%20errors%0A%09%09set%20_date%20to%20value%20of%20XML%20attribute%20%22time%22%20of%20_post%20as%20string%0A%09%09try%0A%09%09%09tell%20application%20%22Finder%22%0A%09%09%09%09set%20AppleScript%27s%20text%20item%20delimiters%20to%20%22%22%0A%09%09%09%09if%20not%20exists%20alias%20%28%28_folder%20%26%20_title%20as%20string%29%20%26%20%22%2Ewebloc%22%29%20then%0A%09%09%09%09%09set%20webloc%20to%20make%20new%20internet%20location%20file%20at%20_folder%20to%20_url%20with%20properties%20%7Bname%3A_title%7D%0A%09%09%09%09%09%2D%2D%20makes%20a%20%2Ewebloc%20file%20in%20our%20target%20folder%0A%09%09%09%09%09set%20_output%20to%20_output%20%26%20%22Grabbed%20%22%20%26%20_title%0A%09%09%09%09%09set%20AppleScript%27s%20text%20item%20delimiters%20to%20%22%20%22%0A%09%09%09%09%09if%20useTagsApp%20then%0A%09%09%09%09%09%09tell%20application%20%22Tags%22%20to%20apply%20tags%20_tags%20to%20files%20%7BPOSIX%20path%20of%20%28webloc%20as%20string%29%7D%0A%09%09%09%09%09%09%2D%2D%20adds%20OpenMeta%20tags%20to%20our%20newly%20created%20file%0A%09%09%09%09%09%09set%20_output%20to%20_output%20%26%20%22%20and%20tagged%20with%20%22%20%26%20_tags%20as%20string%0A%09%09%09%09%09end%20if%0A%09%09%09%09%09if%20useWebLocThumb%20then%20%0A%09%09%09%09%09%09do%20shell%20script%20%22%2Fusr%2Flocal%2Fbin%2FsetWeblocThumb%20%22%20%26%20quoted%20form%20of%20%28POSIX%20path%20of%20%28webloc%20as%20string%29%29%0A%09%09%09%09%09%09%2D%2D%20use%20setWeblocThumb%20to%20add%20a%20thumbnail%20to%20our%20webloc%20file%0A%09%09%09%09%09%09%2D%2D%20http%3A%2F%2Fhasseg%2Eorg%2FsetWeblocThumb%2F%0A%09%09%09%09%09%09set%20_output%20to%20_output%20%26%20%22%2C%20applied%20thumbnail%22%0A%09%09%09%09%09end%20if%0A%09%09%09%09%09set%20_output%20to%20_output%20%26%20%22%2E%22%20%26%20return%0A%09%09%09%09end%20if%0A%09%09%09end%20tell%0A%09%09on%20error%20myError%0A%09%09%09set%20_output%20to%20_output%20%26%20%22Error%20%22%20%26%20myError%20%26%20return%0A%09%09end%20try%0A%09%09set%20%7B_url%2C_title%2C_tags%2C_name%2C_time%7D%20to%20%7Bnull%2Cnull%2Cnull%2Cnull%2Cnull%7D%0A%09end%20repeat%0A%09set%20AppleScript%27s%20text%20item%20delimiters%20to%20astid%0A%09%2D%2D%20restore%20the%20delimiters%0Aend%20tell%0Ado%20shell%20script%20%22defaults%20write%20com%2Ebrettterpstra%2Egetdelicious%20fromdt%20%22%20%26%20_date%0A%2D%2D%20store%20the%20date%20of%20the%20last%20bookmark%20in%20system%20defaults%0Areturn%20_output">Open this script in your Script Editor</a></p>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/delicious-bookmarks-and-openmeta-tags/' rel='bookmark' title='Delicious bookmarks and OpenMeta tags'>Delicious bookmarks and OpenMeta tags</a></li>
<li><a href='http://brettterpstra.com/mirror-your-pinboard-bookmarks-with-openmeta-tags/' rel='bookmark' title='Mirror your Pinboard bookmarks with OpenMeta tags'>Mirror your Pinboard bookmarks with OpenMeta tags</a></li>
<li><a href='http://brettterpstra.com/save-safari-tabs-to-instapaper/' rel='bookmark' title='Save Safari tabs to Instapaper'>Save Safari tabs to Instapaper</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/delicious-spotlight-and-openmeta-tags-revisited/">Delicious, Spotlight and OpenMeta tags, revisited</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/delicious-spotlight-and-openmeta-tags-revisited/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Delicious bookmarks and OpenMeta tags</title>
		<link>http://brettterpstra.com/delicious-bookmarks-and-openmeta-tags/</link>
		<comments>http://brettterpstra.com/delicious-bookmarks-and-openmeta-tags/#comments</comments>
		<pubDate>Tue, 11 May 2010 11:56:50 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[bookmarking]]></category>
		<category><![CDATA[delicious]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[openmeta]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[tagging]]></category>
		<category><![CDATA[utilities]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=421</guid>
		<description><![CDATA[<p>There are quite a few things I love when it comes to my Mac. I love Spotlight. I love OpenMeta tagging. I love Evernote. I love being able to collect information from any source, and find anything I’ve saved, anywhere, no matter what program I used to create it. I especially love programs that allow me to accomplish that. Unfortunately,&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/delicious-bookmarks-and-openmeta-tags/">Delicious bookmarks and OpenMeta tags</a></p>]]></description>
			<content:encoded><![CDATA[<p>There are quite a few things I love when it comes to my Mac. I love <a href="http://www.apple.com/macosx/what-is-macosx/spotlight.html">Spotlight</a>. I love <a href="http://code.google.com/p/openmeta/">OpenMeta</a> tagging. I <a href="http://brettterpstra.com/tag/evernote/">love Evernote</a>. I love being able to collect information from any source, and find anything I’ve saved, anywhere, no matter what program I used to create it. I especially love programs that allow me to accomplish that.</p>

<p>Unfortunately, one of my favorite apps right now, <a href="http://www.delibarapp.com/">Delibar</a>, doesn’t integrate with Spotlight or OpenMeta, despite the fact that it would be relatively easy to do. Delibar is an excellent (and sexy) menubar application for creating and searching <a href="http://delicious.com/">Delicious</a> (and <a href="http://pinboard.in/">Pinboard</a>) bookmarks. A similar app, <a href="http://codesorcery.net/pukka">Pukka</a>, pulls off the Spotlight part, but I still wanted OpenMeta tags that matched my Delicious tags for local searching.</p>

<p>I also use <a href="http://www.gravityapps.com/tags/index.html">Tags.app</a> for most of my tagging. OpenMeta tags allow you to group and classify files with simple tags, and provide a Spotlight-compatible way to search more intelligently. When you tag a website with Tags, it creates a <a href="http://www.downloadatoz.com/file-extensions/webloc-file-extension.html">webloc</a> file in your metadata cache and applies the OpenMeta tags to it. I figured a similar approach would be feasible using AppleScript, and it seems to be working out great. Read on to see the script I’m using, and be sure to let me know if you improve on it!</p>

<p><span id="more-421"></span>
What I’m doing is using curl with the <a href="http://delicious.com/help/api#posts_all">Delicious API</a>, and downloading everything that’s been bookmarked within the last hour. I’m running it with <a href="http://en.wikipedia.org/wiki/Launchd">launchd</a> every hour, so I don’t want to grab more than that every time it runs. It parses out the title, tags and url for the bookmark, saves it to a .webloc file, and tags it using Tags.app’s AppleScript commands. If you’re not running Tags, it could be modified pretty easily to work with the <code>openmeta</code> command line application.</p>

<p>I’m leaving the target folder up to the user, so when you define it in the CONFIG section, make sure it’s pointing to an existing folder. The only other config properties are your Delicious username and password (sent securely). As noted in the comments in the script, you can adjust the time/date it retrieves from in the first line after the CONFIG section.</p>

<p>The script is pretty well commented, so I won’t rewrite the whole thing here. Take a look, and then I’ll show you how I installed it.</p>

<div markdown=0>
<pre><code>
-- CONFIG
property _user : &quot;username&quot; -- delicious username
property _pass : &quot;password&quot; -- delicious password
property targetFolder : &quot;/Users/ttscoff/Library/Caches/Metadata/Delicious&quot; -- POSIX path to existing folder
-- END CONFIG

set _date to do shell script &quot;date -v-1d &#x27;+%Y-%m-%dT%H:%M:%SZ&#x27;&quot;
-- returns a date 1 day ago in the format required by the twitter API.
-- you can adjust the date based on the frequency that you run the script
-- by editing the -v-1d part of the date command (-v-1H for 1 hour)
-- Note that the Delicious dates run on GMT, so you have to account for your time offset
-- For me, this means -v+4H if I want to go back one hour

set bookmarks to do shell script &quot;curl https://&quot; &amp; _user &amp; &quot;:&quot; &amp; _pass &amp; &quot;@api.del.icio.us/v1/posts/all?fromdt=&quot; &amp; _date
-- gets the bookmarks starting with the date specified in _date

set _folder to POSIX file targetFolder as alias
-- turns the POSIX path in CONFIG into an AppleScript alias

tell application &quot;System Events&quot;
    set xmlDocument to make new XML data with data bookmarks
    -- create the XML object
    set {astid, AppleScript&#x27;s text item delimiters} to {AppleScript&#x27;s text item delimiters, &quot; &quot;}
    -- store the current delimiter and set the new one to a space for breaking up the tags
    repeat with _post in XML elements of XML element 1 of xmlDocument
        set _url to value of XML attribute &quot;href&quot; of _post as string
        set _tags to text items of (value of XML attribute &quot;tag&quot; of _post as string)
        set end of _tags to &quot;delicious&quot;
        set _title to value of XML attribute &quot;description&quot; of _post as string
        try -- it fails on some files, the try block lets us keep moving if we hit a problem
            tell application &quot;Finder&quot; to set webloc to make new internet location file to _url at _folder with properties {name:_title}
            -- makes a .webloc file in our target folder
            tell application &quot;Tags&quot; to apply tags _tags to files {POSIX path of (webloc as string)}
            -- adds OpenMeta tags to our newly created file
        end try
    end repeat
    set AppleScript&#x27;s text item delimiters to astid
    -- restore the delimiters
end tell
</code></pre>
</div>

<p><a href="applescript://com.apple.scripteditor?action=new&#038;script=%2D%2D%20CONFIG%0Aproperty%20_user%20%3A%20%22username%22%20%2D%2D%20delicious%20username%0Aproperty%20_pass%20%3A%20%22password%22%20%2D%2D%20delicious%20password%0Aproperty%20targetFolder%20%3A%20%22%2FUsers%2Fttscoff%2FLibrary%2FCaches%2FMetadata%2FDelicious%22%20%2D%2D%20POSIX%20path%20to%20existing%20folder%0A%2D%2D%20END%20CONFIG%0A%0Aset%20_date%20to%20do%20shell%20script%20%22date%20%2Dv%2D1d%20%27%2B%25Y%2D%25m%2D%25dT%25H%3A%25M%3A%25SZ%27%22%0A%2D%2D%20returns%20a%20date%201%20day%20ago%20in%20the%20format%20required%20by%20the%20twitter%20API%2E%0A%2D%2D%20you%20can%20adjust%20the%20date%20based%20on%20the%20frequency%20that%20you%20run%20the%20script%0A%2D%2D%20by%20editing%20the%20%2Dv%2D1d%20part%20of%20the%20date%20command%20%28%2Dv%2D1H%20for%201%20hour%29%0A%0Aset%20bookmarks%20to%20do%20shell%20script%20%22curl%20https%3A%2F%2F%22%20%26%20_user%20%26%20%22%3A%22%20%26%20_pass%20%26%20%22%40api%2Edel%2Eicio%2Eus%2Fv1%2Fposts%2Fall%3Ffromdt%3D%22%20%26%20_date%0A%2D%2D%20gets%20the%20bookmarks%20starting%20with%20the%20date%20specified%20in%20_date%0A%0Aset%20_folder%20to%20POSIX%20file%20targetFolder%20as%20alias%0A%2D%2D%20turns%20the%20POSIX%20path%20in%20CONFIG%20into%20an%20AppleScript%20alias%0A%0Atell%20application%20%22System%20Events%22%0A%09set%20xmlDocument%20to%20make%20new%20XML%20data%20with%20data%20bookmarks%0A%09%2D%2D%20create%20the%20XML%20object%0A%09set%20%7Bastid%2C%20AppleScript%27s%20text%20item%20delimiters%7D%20to%20%7BAppleScript%27s%20text%20item%20delimiters%2C%20%22%20%22%7D%0A%09%2D%2D%20store%20the%20current%20delimiter%20and%20set%20the%20new%20one%20to%20a%20space%20for%20breaking%20up%20the%20tags%0A%09repeat%20with%20_post%20in%20XML%20elements%20of%20XML%20element%201%20of%20xmlDocument%0A%09%09set%20_url%20to%20value%20of%20XML%20attribute%20%22href%22%20of%20_post%20as%20string%0A%09%09set%20_tags%20to%20text%20items%20of%20%28value%20of%20XML%20attribute%20%22tag%22%20of%20_post%20as%20string%29%0A%09%09set%20end%20of%20_tags%20to%20%22delicious%22%0A%09%09set%20_title%20to%20value%20of%20XML%20attribute%20%22description%22%20of%20_post%20as%20string%0A%09%09try%20%2D%2D%20it%20fails%20on%20some%20files%2C%20the%20try%20block%20lets%20us%20keep%20moving%20if%20we%20hit%20a%20problem%0A%09%09%09tell%20application%20%22Finder%22%20to%20set%20webloc%20to%20make%20new%20internet%20location%20file%20to%20_url%20at%20_folder%20with%20properties%20%7Bname%3A_title%7D%0A%09%09%09%2D%2D%20makes%20a%20%2Ewebloc%20file%20in%20our%20target%20folder%0A%09%09%09tell%20application%20%22Tags%22%20to%20apply%20tags%20_tags%20to%20files%20%7BPOSIX%20path%20of%20%28webloc%20as%20string%29%7D%0A%09%09%09%2D%2D%20adds%20OpenMeta%20tags%20to%20our%20newly%20created%20file%0A%09%09end%20try%0A%09end%20repeat%0A%09set%20AppleScript%27s%20text%20item%20delimiters%20to%20astid%0A%09%2D%2D%20restore%20the%20delimiters%0Aend%20tell">Open this script in your Script Editor</a></p>

<h3>Installing</h3>

<p>The first thing I did was make a version of the script that excluded the date parameter (fromdt) in the curl call in order to download my entire history and process it so I was up-to-date. This took a while, but didn’t seem to cause any problems. The Delicious API is pretty quick to throttle you, so download the whole bunch in one API call or you’ll be in trouble.</p>

<p>After editing the config options, I saved the file as an <del datetime="2010-05-11T14:25:06+00:00">Application Bundle</del> <ins datetime="2010-05-11T14:25:06+00:00">(see addendum below)</ins> in my own apps directory (~/Applications). It doesn’t matter where you put it (or what you name it), as long as you know the path to get there. Then I set up a launchd plist to run it every 3600 seconds (hour). I highly recommend <a href="http://sourceforge.net/projects/lingon/">Lingon</a>  for editing all things launchd. It will make sense when you get there.</p>

<h3>Addendum</h3>

<p>In reference to the install procedure above, I’ve actually had more luck saving it as a text file to a scripts folder and running it with osascript through launchd. Here’s my launchd plist, which you can edit and load through the “Expert” section of Lingon’s editor.</p>

<p>Also, as I just added into the code comments above, I didn’t originally account for the fact that Delicious dates are in GMT, and my offset is –5 right now, so I have to use –v+4H to get 1 hour back, not –v-1H.</p>

<div markdown=0>
<pre><code>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;
&lt;plist version=&quot;1.0&quot;&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;org.brettterpstra.GetDelicious&lt;/string&gt;
    &lt;key&gt;Nice&lt;/key&gt;
    &lt;integer&gt;8&lt;/integer&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;/usr/bin/osascript&lt;/string&gt;
        &lt;string&gt;/Users/ttscoff/scripts/getdelicious&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;RunAtLoad&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;StartInterval&lt;/key&gt;
    &lt;integer&gt;3600&lt;/integer&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</code></pre>
</div>

<p>Areas for improvement:</p>

<ul>
<li>Currently errors out on some bookmarks for unknown reasons</li>
<li>Could have a first-run setting to automatically download and tag ALL bookmarks</li>
<li>Could set the created date of the webloc file based on the date of the bookmark from Delicious</li>
<li>Could provide more feedback or logging</li>
</ul>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/delicious-spotlight-and-openmeta-tags-revisited/' rel='bookmark' title='Delicious, Spotlight and OpenMeta tags, revisited'>Delicious, Spotlight and OpenMeta tags, revisited</a></li>
<li><a href='http://brettterpstra.com/mirror-your-pinboard-bookmarks-with-openmeta-tags/' rel='bookmark' title='Mirror your Pinboard bookmarks with OpenMeta tags'>Mirror your Pinboard bookmarks with OpenMeta tags</a></li>
<li><a href='http://brettterpstra.com/natural-language-date-service-update/' rel='bookmark' title='Natural Language Date Service update'>Natural Language Date Service update</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/delicious-bookmarks-and-openmeta-tags/">Delicious bookmarks and OpenMeta tags</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/delicious-bookmarks-and-openmeta-tags/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: enhanced
Database Caching 19/102 queries in 0.228 seconds using xcache
Object Caching 2389/2501 objects using xcache
Content Delivery Network via cdn2.brettterpstra.com

Served from: brettterpstra.com @ 2012-05-23 04:35:58 -->
