Web

Mac OS X Service to shorten a URL with Bit.ly

Since the Bit.ly URL-shortening service is all the rage lately, and I hadn’t seen anyone create a Mac OS X Service for it yet, I decided to try my hand at it.

Here’s the result. The core is a relatively simple Python script and requires Mac OS X 10.5 (or Python 2.5 if you have an earlier version of Mac OS X). The Service was wrapped up with ThisService by Peter Hosey. It’s my first attempt at creating a Mac OS X Service — with or without ThisService — and I hope it works for you. However, it is provided “as-is” with no warranty.

That said, if you have comments or suggestions, please feel free to contact me.

Also, I’m not counting this as an endorsement of Bit.ly; I just looked at info on their site and thought I could probably script it and, as you can see, I did.

To install the Service:

  1. Unzip the downloaded file.
  2. Drag the unzipped Service to /Library/Services (for all users) or ~/Library/Services (for just the current user).

To use it:

  1. Select the full text of an “http” or “https” URL that you’d like to shorten. (Don’t just select a site’s domain name. The Service is specifically coded to work on full URLs starting with “http” or “https.” So, “www.jaharmi.com” will not work but “http://www.jaharmi.com” will.)
  2. Choose “Shorten URL with Bit.ly” from the Services submenu of the application menu. The selected URL will be replaced with the text of the shortened URL from Bit.ly. If it is not, the original URL will remain.

Of special note, however, is that if you shorten URLs with Bit.ly this way rather than through your browser, you probably won’t see them show up in your history (the most recent 15 URLs you’ve shortened). The script just shortens URLs for you and does so outside of your browser, so whatever cookies or other tracking Bit.ly is doing to generate your history, it doesn’t appear to carry over when using this simple little Service.

AttachmentSize
ShortenUrlWithBitly.zip34.17 KB

Is that site running Drupal, curl edition

The Lullabot Web site has a clever way to help answer the question of “Is that site running Drupal?” Angie Byron mentions that the HTTP “Expires” header returned by Drupal corresponds to a specific default date. Look for that date in the HTTP headers, and you can make a reasonable guess that a site is a Drupal site — or at least one that hasn’t modified one of the core files.

Some commenters posted notes about how to do the same thing with wget and then curl. I expanded on the curl instructions to make them a little more robust (especially in the case of redirects or URL rewriting), and here’s the result:

$ curl -fsIL http://jaharmi.com/ 2>&1 | grep -q -m 1 "Expires: Sun, 19 Nov 1978 05:00:00 GMT" && echo "Yes, this appears to be a Drupal site." || echo "No, this does not appear to be a Drupal site."
Yes, this appears to be a Drupal site.

Hunting Snow Leopard

I’ve been thinking for a few months that Mac OS X 10.6 (or the like) would be introduced to developers at WWDC 2008. I’ve said as much to those unfortunate enough to be within earshot. I haven’t mentioned it here … and in recent days I’ve felt less confident about this gut feeling based on the public WWDC session schedule.

If Apple was trying to return to an 18-month release cycle for Mac OS X, my thought process went (after the CEO announced just such a push), a developer preview would almost have to be shown at this WWDC. That has lingered in the back of my mind. It also provided a reason to go to the conference if you were interested more in the Mac track than the iPhone.

Now there are rumors flying around, based on various strings in Apple software and from other sources, that there will be a preview release of Mac OS X 10.6 at WWDC. And it’s being referred to with the moniker, “Snow Leopard.”

If, as these rumors say, the upgrade will focus on reliability and security, then the general lack of room for schedules on it is more plausible. The name distinguishes it little from Leopard, but maybe just enough.

However, unless this release were more like the free-with-$20 shipping Mac OS X 10.1 update, who would buy it? Would Apple charge $129 retail for stability and security? It seems that there would have to be more.

I can definitely see that security could be enhanced by greater adoption of certain features — some reasonable candidates for further enhancement since Leopard — which are the focus of several sessions at WWDC, according to the published schedule.

Since I’m always watching for when old rumors swing back around, I’d guess that one additional change we could see is the mythical “Illuminous” user interface. (Assuming, of course, that this is not the unified interface style we already have in Leopard.) It usually takes two years for fun old rumors to become reality, if they ever do — that’s enough time for many to have forgotten about them and for actual development work to have taken place. A new interface with a new name would jack up the value of a new OS in some people’s minds. Moreso if it actually works better than the old one.

If the lack of PowerPC support were true, then this would be an astounding announcement. It would cut off upgrades for a large (but ever-decreasing) percentage of the Mac population. Already, Leopard itself was limited to G5s and the newest G4s. This could have an interesting effect on those institutional customers who bought G5s for their compute power. Let’s recall that although the Intel Macs have been out since January 2006 and the transition was relatively quick, the high end Power Mac and Xserve systems were the last to be replaced. For a while yet, there can still be Apple PowerPC-based systems that are less than three years old.

Ah, we’ll see what happens Monday. You never know with rumors. I have no inside information and even I wouldn’t make any important decisions based on these musings.

When I ruled the world?

Does anyone else think that Apple has some ulterior motive for promoting Viva la Vida, the track on the new iTunes ad featuring Coldplay? That maybe its lyrics are indicative of something going on at Apple?

“When I ruled the world,” indeed.

No matter. I find it a fantastic visual treat and now the haunting music is stuck in my head. I would not be surprised if it were featured at WWDC 2008 in a few weeks.

Drag and drop tabs in Safari

Frankly, I had utterly ignored drag and drop tabs in Safari. This feature didn’t work in older versions of the app and only appeared in Safari 3, so I hadn’t yet adjusted to it. The recent article on tag dragging modes at Daring Fireball comes about a week after my own interest in the feature suddenly piqued.

So, yes, drag and drop for tabs appeared relatively late in Safari’s development. I fail to use this feature even though I’ve wanted it for a long time. Together, these facts buttress my conviction that certain features need to be in a product on day one, or they will not get used. I refer to this as the “PageMaker window” problem, for it wasn’t until PageMaker 6-ish that you could open up more than one document at a time in PageMaker. By that time, I’d been using PageMaker for long enough that I had user interface scar tissue built up around the single-window limitation. Even though I had a feature I wanted, it was left unused most of the time.

Even if I did want to use tag drag and drop, its behavior in Safari is weird. I probably wouldn’t have taken the time to understand what was going on if it hadn’t been for the DF post. Or, at least, I wouldn’t have realized there were different modes at all. (It’s like user-interface-by-Zork-text-adventure. You have to discover the odd set of steps — which make some sense in hindsight — that drops the critical key from the keyhole onto the placement you’ve carefully slid under the door.)

My own experience with Safari 3 has shown that if the tab is the leftmost one in a Safari window, dragging it in any direction results in both the inter- and intra-window drag behavior described on DF. That’s the only tab position that works in this manner, though.

I also thought that holding down Option or Command during a drag would make a difference; I could swear that happened last week when I tried drag and drop, but I must be wrong. I can’t reproduce it today.

Update: There’s an older article at Betalogue that describes tab drag and drop, and mentions the behavior of the first tab.

Google Analytics plunge due to module change?

It looks like some recent change to the Google Analytics module for Drupal 5 broke my link to the Analytics service. Well, I’m being overbroad there. It really was working, but apparently only tracking when my administration account and users from a certain other user role (think: group) were logged in.

Well, obviously, that could lead to a significant traffic drop — if for no other reason than anonymous users weren’t being tracked — and that’s what I was seeing throughout my Analytics data. I only check Analytics every once in a while, and it’s currently only a curiosity to me, but it was still confusing as to why I saw all the graphs plunge starting March 7.

My best guess is that one of my recent module update binges loaded a new Google Analytics module which changed something, and only two user roles were set up to be tracked. (The Drupal 5 update process leaves something to be desired. Sure, I should have read the “read me” to find out about the change beforehand, but when you have so many modules to update, you just want to get it done. Wish it had warned me that something needed my attention.) Now that I’ve changed that setting and other user roles — including anonymous — will be tracked again, we’ll see what happens.

Seeking Drupal 6 modules

In order to figure out if I can upgrade to Drupal 6, I have to review the compatibility of the following modules I use under Drupal 5:

  • Bad-Behavior
  • account_reminder
  • acl
  • actions
  • akismet
  • amazon_filter
  • atom
  • backup
  • biblio
  • captcha
  • cck
  • copyright
  • countdown
  • creativecommons_lite
  • custom_breadcrumbs
  • custom_links
  • date
  • fckeditor
  • freelinking
  • globalredirect
  • google_analytics
  • gsitemap
  • htmlcorrector
  • image
  • imagefield
  • img_assist
  • import_typepad
  • importexportapi
  • inactive_user
  • inline
  • ip2cc
  • jquery_interface
  • jquery_update
  • messagefx
  • multiflex37
  • nodewords
  • nofollowlist
  • onlinestatus
  • openidurl
  • path_redirect
  • pathauto
  • porterstemmer
  • print
  • recaptcha
  • recent_changes
  • relatedlinks
  • safarisearch
  • service_links
  • sifr
  • site_map
  • smartypants
  • spam
  • sparkline
  • systeminfo
  • tac_lite
  • tagadelic
  • taxonomy_access
  • taxonomy_manager
  • tbcheck
  • technorati
  • textile
  • token
  • trackback
  • twitter
  • update_status
  • upload_image
  • upload_preview
  • views
  • views_bonus
  • votingapi
  • workflow
  • xmlsitemap
  • zeitgeist

Not all of these are essential, of course. Heck, they aren’t even all enabled. But it will still take some time to review what modules I need and don’t need to make the site run in the way I’m accustomed to it running. Still, the urge to throw caution to the wind and upgrade blindly is certainly there.

The Achilles heel of Drupal, as I perceive it, is the core philosophy of “the drop is always moving.” Although I can appreciate that the software needs to break with tradition at times, the compatibility rat race is really painful.

I run a site. I want/need modules to make that happen. The modules are written for specific versions of Drupal. Each major version of Drupal has new module requirements. There’s no guarantee any module will be upgraded to work with the next version of Drupal. Old modules don’t even run in a reduce functionality state. It’s rather aggravating; there are modules I wanted to run that haven’t been upgraded since Drupal 4.6 or 4.7, so they weren’t even compatible with 5.x. The only recourse may be to upgrade the modules yourself if you are that interested in them, as I haven’t seen a bounty to upgrade a module work yet.

Of course, it’s worse if the module isn’t even hosted in Drupal’s contributed module repository (aka “contrib”).

Unfortunately, I’m not at a point where I feel I can contribute much to making the modules compatible with Drupal 6. Most of that work requires coding PHP and testing on a non-production site, two tasks I’m ill-equipped for right now.

Our long electronic domain nightmare has ended

Yes, I forgot to renew my domain. Yes, that became a real pain very quickly when I realized what the repercussions were.

For future generations, I suggest not having to deal with this when:

  • you want to switch domain registrars
  • you want to switch DNS hosting providers
  • your goal is to save money
  • you have never switched either registrars or DNS hosts for any domain before
  • your domain’s WHOIS records are severely out-of-date (mostly because, through a comedy of errors, your host won’t let you update them)
  • most of your administrative e-mail goes to a now-defunct mail address whose inbox you cannot access (I’m looking at you, .Mac, with your costs that went from $0 to $99/year in one year, and your vexing lack of forwarding)
  • the rest of your administrative e-mail goes to an address in your expired domain (“because that’s the one e-mail address I’ll always have control over! Not like that .Mac account, no!”)
  • you forgot that the reason why you didn’t switch domain and DNS providers earlier was because of the WHOIS hassle, and you just blithely plunged ahead with it
  • you’ve waited until the day the current domain hosting provider has cut off your service (“hey, why can’t I connect to anything in my domain today? Er … ah … hm … oops. Maybe I should Twitter about this.”)
  • you have to converse with the support organizations of at least two companies, and one of them is losing business
  • you have better things to do with your life.

Lesson learned.

Anyway, it looks as if the long electronic nightmare of jaharmi.com being offline for Web and e-mail purposes has now ended. I can see this site. I can send and receive e-mail.

Good day.

Front page access denied errors

I was trying to look at my very own site, which you see here, before I did the upgrade to Drupal 5.6. I got “access denied” errors on the home page!

After a little bit of trial and error, where I discovered that:

  • Firefox showed me the page just fine
  • I could log in and front page worked
  • there are several threads about this at Drupal.org

… I took one of the steps suggested on Drupal.org, and deleted the browser cookies related to the site. I quit Safari, relaunched it, connected, and it worked again. This was the first time I’d seen this with Drupal and I hope it’s not that common.

My online sales chat regarding the new Mac Pro models

I spent some time with an agent on the online sales chat in the Apple Store last night. I had a few questions about the new Mac Pro models, and I got some interesting answers quickly. I’d recommend using the online sales chat if you have questions about your Mac purchase.

First, I wanted to know if both the Radeon HD 2600 XT and the GeForce 8800 GT had display rotation support. This is more useful to me now that I have a display that can rotate. As it turns out, both cards do support this.

Second, I asked about the AirPort Extreme card, which is a BTO option, because I wanted to know if it could be added later as a customer installable part. (Some items are not installable in Apple computers by customers, unless you want to void the warranty. The list of items varies by model and you can never assume that even commodity parts like RAM and hard disks are CIP. To my knowledge, there’s no Apple Web page that collects this information.) The Wi-Fi card can only be added at build time, or by an Apple authorized service center later. On the plus side, I noted in the specs that it supports 802.11n as well as the a, b, and g standards.

As for the increased cost of the Mac Pro’s only off-the-shelf configuration, the agent did bring up that the minimum RAM had been increased to 2 GB, the default hard disk had grown from 250 to 320 GB, and the processor had jumped from a dual 2.66 to a quad 2.8 GHz CPU. These are all fine and good, but the model that was for sale on Monday was the same model that went on sale in August 2006. Due to the relentless march of technological advancement I’d expect something better in January 2008, and not necessarily with this price increase.

I’m still going to wait to see what comes out at Macworld Expo next week. The price increase on the Mac Pro makes me wonder whether room was being made for something new between the professional tower and the Mac mini / iMac models. I’m still one of those people who remember with fondness that at one point, Power Mac G4 towers were reasonable options for home computers, with a starting price around $1199. Ever since the Power Mac G5, this economical option for an expandable system has been lost.

Syndicate content