Mac modifier keys

Posting this here for my own use:

This is known as the “Command” key, as in “press Command-q to quit.” This can be used to access most major menu items by pressing the key combination listed next to those items in the menu.
There are several standard commands which are consistent across nearly all Mac applications, such as ⌘Q (Quit), ⌘W (Close), ⌘C (Copy), ⌘V (Paste), ⌘X (Cut), ⌘O (Open), ⌘A (Select All), ⌘N (New), and ⌘-? for Help. ⌘-Tab quickly switches between applications. Learning these shortcuts can save you a lot of time.
Command-clicking can also be used to select multiple items at once.

There aren’t enough letters to match every menu item, so shift is generally used in combination with ⌘ for less-commonly accessed menu items.
Shift-clicking can also be used to select a range of items.

This is known as the “Option” key. This is used in combination with ⌘ and ⇧ for even lower-priority menu items, or for variations on standard items. (For instance ⌘⌥W will close all of an application’s windows, instead of just one.) If you pull down a menu and then press option, the menu items will change to their variant options in real time.
In the menus, option is represented by “⌥”, presumably because there weren’t any other symbols left. (The key has “alt” printed on it for compatibility with Windows applications.)
When ⌥ is used as a modifier without ⌘, it accesses alternate characters. For instance, ⌥-2 gives you ™, and pressing ⌥ in conjunction with vowels lets you place accents over international characters.
Option-dragging items will copy them instead of moving them.
You can also use option with the arrow & delete keys to work with entire words at a time.

The control key exists primarily for compatibility with Windows and Unix applications. You won’t generally use it in Mac applications. If an application does include a control-key shortcut, it will be abbreviated as “^”.
Control-clicking is equivalent to a right-click.

The function key is unique to notebook computers, and exists solely to access secondary functions on the keyboard. Use this to access Home, End, Page Up, Page Down, the F1-F7 keys, and the number keypad.


Links: 11-27-2006

Links: 11-16-2006

Using Lucene and MoreLikeThis to show Related Content

If you read this blog, you probably paid a smidgen of attention to the Web 2.0 Conference held last week in San Francisco. Sphere was one of the companies that presented and they launched a product called the “Sphere It Contextual Widget for blogs“, which is JavaScript widget you can add to your blog or content focused site that displays contextually similar blogs and blog posts for the reader. I’ve always wanted to try to do something similar (no pun intended) using Lucene, so I spent a couple hours this weekend banging around on it.

The first step was to get my WordPress content (which is stored in MySQL) into Lucene. A couple lines of code later I had a Lucene index full of all 857 (as of 11/14/2006) posts including the blog post ID, subject, body, date and permalink. Next, I checked out and compiled the Lucene similarity contrib, whose most important asset is the MoreLikeThis class (written in part by co-worker Bruce Ritchie). You provide an instance of MoreLikeThis a document to parse, an index to search and the fields in the index you want to compare against the given document and then execute a Lucene search just like you normally would:

Reader reader = ...;
IndexReader index =;
IndexSearcher searcher = new IndexSearcher(index);
MoreLikeThis mlt = new MoreLikeThis(index);
mlt.setFieldNames(new String[] {"subject", "body"});
Query query =;
Hits hits =;

I’ll skip all the glue and say that I wired all this up into a servlet that spits out JSON:

Map entries = getRelatedEntries(postID, body);
JSONObject json = JSONObject.fromObject( entries );
response.getWriter().write("Related = {}; Related.posts = " + json.toString());

and then used client side JavaScript and some PHP to put it all together:

<h5>Related Content</h5>
<script type="text/javascript"
  src="<?php the_ID(); ?>">
<script type="text/javascript">
for (post in Related.posts) {
document.write('<li><a href="' + Related.posts[post] + '">' + post + '</a></li>');

I’ve been cruising around the blog and so far, I think that MoreLikeThis works really well. For the most part, the posts that I would expect to be related, are related. There are a couple posts which seem to pop to the top of the ‘related content’ feed that I’ll have to fix and I would like to boost the terms in the subject of the original document, but other than that, I’m happy with it.

Back to sphere, and specifically to Brady’s post about it on the Radar blog:

Top-Left Corner: Recent, similar blog posts from other blogs.
Bottom-Left Corner: Recommended blogs that are selected by the site-owner. This is very handy for blog networks.
Top-Right Corner: Similar posts from that blog
Bottom-Right Corner: Ad, currently served by FM Pub.

Given a week, I’m guessing that you could use the Google API to do the top-left corner, hardcode the content in the bottom left, use MoreLikeThis in the top right and the bottom right you’d want to do yourself anyway. So if you were a publisher looking for more page views, why would you even consider the Sphere widget?

ROME, custom modules, publishdate and RSS

At work, I’ve taken on the work of migrating our RSS feeds currently being produced using JSP to ROME. Since we’ve added a few custom elements to the feeds available in Jive Forums (things like message and thread counts), I’m taking advantage of the feature in ROME that gives you the ability to programtically define namespaces in your RSS 2.0, Atom 0.3 and Atom 1.0 feeds (examples: the iTunes module and the OpenSearch module). Anyway, the code I wrote to add an item to the list of available items in a feed looked something like this:

entry = new SyndEntryImpl();
entry.setLink("" + 
JiveForumsModule module = new JiveForumsModuleImpl();
List modules = new ArrayList();

This code works, but if you view the feed, you don’t get a publish date on the item. I dug into the ROME source code a bit and found that the publish date is stored as part of the Dublin Core module, which I came to find out is a ‘special’ module that always exists on a SyndEntryImpl object. Take a look at the implementation of the getModules() method on the SyndEntryImpl class:

public List getModules() {
  if  (_modules==null) {
    _modules=new ArrayList();
  if (ModuleUtils.getModule(_modules,DCModule.URI)==null) {
    _modules.add(new DCModuleImpl());
  return _modules;

See how the method automatically injects a DCModuleImpl into the _modules property if the DCModule doesn’t exist? Long story short, the code I wrote blew away the _modules property on the SyndEntryImpl instance which contained a single DCModule which itself contained the publishedDate date instance. So by the time the feed was produced, the publish date I set on each SyndEntry was long gone. I should have written my code like this:

JiveForumsModule module = new JiveForumsModuleImpl();

Better yet, the ROME team could have done two things:

  1. Added documentation to the setModules(List modules) method that pointed out that any information in the existing DCModule instance will be lost if the provided list doesn’t contain the existing DCModule instance.
  2. Added a method to the SyndEntry interface called addModule(Module module).

Open source: I’m lovin it.

Links: 11-4-2006

Guys Weekend

I flew down to Los Angeles last weekend to be with my dad and my brother as part of our first annual guys weekend. My brother picked me up at LAX on Friday night and we drove to Mojave to meet my dad who drove down from Mammoth. Saturday morning we got up and had a leisurely breakfast and then drove 17 miles to the north entrance of Edwards Air Force Base for the 2006 Open House (I was a plane nerd when I was a kid). Unfortunately, I didn’t have a camera with me (Flickr has some great pictures if you’re interested) but I learned all kinds of interesting things on this visit: