Another way to block the Digg Bar

A lot of developers don’t like having their sites loaded into a frame with Digg’s new DiggBar, inspiring several scripts to get rid of the bar. John Gruber came up with a short PHP script that prevents the page from loading with a nasty message if it detects that it’s being loaded in DiggBar’s frame. Gruber’s script inspired Phil Nelson’s WordPress plugin, which adds that script to any WordPress site.

I decided on a different route, using JavaScript instead of PHP and reloading the page outside the frame instead of displaying a message. The result is my Undigg WordPress plugin, which you can download here.

My plugin simply adds the following bit of JavaScript code to the page:

<script type="text/javascript">if ((top !== self) && ((document.referrer+"").substring(7,11) == "digg")) top.location.href = self.location.href;</script>

This is very similar to a standard frame killer, except it only affects the Digg bar while letting other frames load your page.

To install it, unzip the archive, drop ‘undigg.php’ in /wp-content/plugins, and enable it in the plugins screen.

Useful XCode tricks

XCode provides several ways to make your work easier by cutting down on repetitive typing. The simplest (from a usage standpoint) is text macros. You simply type an abbreviation and hit Escape to substitute it. A text macro can have variable substitutions where you can add text.

I’ve seen a few contradictory articles telling how to add your own text macros, which don’t work in XCode 3.1, but here’s how I was able to get it to work.

First, open /Developer/Applications/Xcode.app/Contents/PlugIns/ and look for TextMacros.xctxtmacro. Make a copy of TextMacros.xctxtmacro and place it in ~/Library/Application Support/Developer/Shared/XCode/Specifications. You may need to create the Specifications folder if it doesn’t exist.

In the copy of TextMacros.xctxtmacro, go to Contents/Resources and edit any of the .xctxtmacro files such as C.xctxtmacro (anything defined there also works in C++ and Objective-C). Any changes here will override the version in XCode. If you only modify one of the macro files, you can delete the others from the copy.

My development team is supposed to add a standard copyright header to each source file. I created a macro that allows me to type ‘stdcopy’ and have it expand to the entire header, with highlighted items that I can tab to and add text. I also added a ‘history’ macro which adds a history comment below the standard copyright block.

For those two macros, I added the following definitions to C.xctxtmacro:

        {
            Identifier = c.stdcopy;
            BasedOn = c;
            IsMenuItem = YES;
            Name = "Standard Copyright Header";
            TextString = "//---------------------------------------------------------------------\n// Copyright (c) $(YEAR) $(ORGANIZATIONNAME).  All rights reserved.\n// Reproduction or transmission in whole or in part, in any form or\n// by any means, electronic, mechanical or otherwise, is prohibited\n// without the prior written consent of the copyright owner.\n//\n// < #summary#>\n//\n// < #remarks#>\n//\n// Date\t\t\tRelease\t\t\tTask\t\tWho\t\tSummary\n// =====================================================================\n// < #date#>\t\t< #release#>\t\t< #task#>\t\t< #who#>\t\t< #summary#>\n//---------------------------------------------------------------------\n";
            CompletionPrefix = stdcopy;
            IncludeContexts = ( "xcode.lang.c", "xcode.lang.java" );    // this works in Java too
        },

        {
             Identifier = c.history;
             BasedOn = c;
             IsMenuItem = YES;
             Name = "History Comment";
             TextString="// < #date#>\t\t< #release#>\t\t< #task#>\t\t< #who#>\t\t< #summary#>\n";
             CompletionPrefix = history;
             IncludeContents = ( "xcode.lang.c", "xcode.lang.java" );
        },

Scripts, which are listed in the script menu, are more powerful & flexible since they can use shell scripts, AppleScript, Perl, Ruby, or any other scripting language.

Since I’m working with CFPlugin bundles, I need to deal with UUIDs. In most cases, you would use CFUUIDGetConstantUUIDWithBytes to specify a UUID, which requires a list of byte values. The shell command ‘uuidgen’ returns a string, so converting it for use with CFUUIDGetConstantUUIDWithBytes involves some tedious editing. With a script, you can simply insert the properly formatted UUID byte values.

Here’s my ‘Insert UUID as bytes’ script:

#! /usr/bin/perl -w
my $re = "\(..\)\(..\)\(..\)\(..\)-\(..\)\(..\)-\(..\)\(..\)-\(..\)\(..\)-\(..\)\(..\)\(..\)\(..\)\(..\)\(..\)\n";
my $uuid = `uuidgen`;

my $bytes = $uuid;
$bytes =~ s/$re/0x$1, 0x$2, 0x$3, 0x$4, 0x$5, 0x$6, 0x$7, 0x$8, 0x$9, 0x$10, 0x$11, 0x$13, 0x$14, 0x$15, 0x$16/;

print "// UUID: ".$uuid;
print "CFUUIDGetConstantUUIDWithBytes(NULL, ".$bytes.")";

I’m sure there’s a more elegant way to do it in a single line of Perl 🙂

The Hit List

The Hit List is the latest entry in the crowded field of GTD software for the Mac. The most notable thing about The Hit List is its beautiful, elegant user interface, simplicity, and speed. It has become one of my favorite applications because it just “feels right”.

The Hit List.jpg

The interface looks just like a note pad. To create a new task, you simply hit return and start typing. Despite the apparent simplicity, it has some sophisticated features such as sub-tasks, which can be created as an outline, and time estimates. The Hit List can sync with iCal, and they promise an iPhone app, although it isn’t available yet.

The Hit List was the main reason I bought the MacHeist bundle; I prefer to think of it as a $10 discount on The Hit List with the other applications as a bonus.

Before I got The Hit List, I was using Things, which is also a powerful & sophisticated task management application. Although Things also has an attractive user interface, after using The Hit List, it just feels kind of clunky. Instead of hitting return to create a new task, you hit Cmd-N, which brings up a quick entry window.

Things Quick Entry.jpg

Things also lacks the outline structure with sub-tasks. One current advantage is that there’s also a Things app for the iPhone. Unfortunately they have to sync on the local network.

Update: It was pointed out on Twitter that you can create a new task in Things by simply hitting the spacebar, which creates a task inline without the popup.

Twitter client roundup

There has been an explosion of new desktop Twitter clients recently. All of them offer some unique features.

I want a Twitter client to be lightweight and non-intrusive, like the old favorite, Twitterrific. However, it’s starting to show its age and it lacks a few features I want, such as showing replies & direct messages in a separate view.

Twhirl was my client of choice for a long time, although I prefer not using an Adobe AIR application. It has most of the features I want, except groups.

Tweetdeck does support groups, but it’s also an AIR application and it takes up too much screen space, as well as too much RAM & CPU time.

Eventbox supports Facebook, Flickr, Google Reader, and Reddit as well as Twitter. Although it’s very powerful, I find it too intrusive for regular use.

Nambu is my current favorite. It has almost the same features as Tweetdeck, although it’s a native application. It’s still in beta & currently has a few bugs, but I have high hopes for it.

Groups is an essential features for anyone who follows a lot of people on Twitter. If your home screen moves too fast, you can create a view of only the people you don’t want to miss to cut down on the noise.

Update: Jonas Wisser mentioned Bluebird, another one that’s still in beta. It has some unique features like themes, but it still lacks some features. I’m not really sure what the difference between the ‘all’ and ‘friends’ view is.

Why you should buy the MacHeist bundle

There has been a lot of controversy over MacHeist, accusing it of ‘cheapening’ or devaluing software. In reality it’s a good thing for developers by bringing in sales that they wouldn’t get otherwise.

Case in point: I have very little use for Kinemac or BoinxTV, so I never would have bought those products. I’m glad to be supporting those developers with a bonus sale. Even if you only use 2 or 3 of the applications, it’s still a good deal. Furthermore, 25% of every sale goes to charity. You can either allow it to be divided among 10 charities, or donate all of it to a single charity.

I bought the bundle primarily for Acorn, Little Snapper, and The Hit List (which still hasn’t been unlocked). Even with only those applications it’s a good deal.

links for 2009-04-02

  • Over 400 different artists have recorded this song since the first recording in 1923. Margaret Walker and James Baldwin wrote poems from the song. It’s been refashioned as a musical, two novels, a short story, an award-winning graphic novel, Ph.D. dissertations and, in 2008, a pornographic feature film. The song has lived as Ragtime, a Broadway showtune, Blues, Jazz, Honky Tonk, Country, 50s Rock and Roll, Ska, Folk, Surf, 70s punk, Heavy Metal, 90s punk, Rap. Even Hawaiian. The song's character lives large in Gangsta Rap. Listen to it and we hear the evolution of modern music.
    (tags: history music)
  • During these times when the Anti-immigrant sentiment is dividing the country over the human rights of millions of undocumented immigrants,

    Raices is making sure that we don’t forget the History of America.

    Like the pilgrims and other people from Eroupe who Fled from political and religious persecussion left their homeland and their families for a better life and for freedom. America started under this premise.

    Some people say that America is “Full” and are not sympathetic to the need of these new comers. They are even organizing and rallying against them. America was Full when their ancestors came 500 years ago. They did everything and anything to get rid of the indigenous people to make room for European colonization.

  • Track wrong predictions by well-known pundits.