I installed a new, PHP-based URL shortening package today. The home-built one I've used in the past remains in place, but new entries will use the new package, which is more robust than the old one.
Recently in Site News Category
I spent some time today reworking the style sheet for the site, to hopefully give it a cleaner, more modern look. Luckily, the basic structure of the site makes it easy to update to change the layout.
I added Pibgorn to the comics page. Pibgorn is an online-only, 3-day-a-week strip by Brooke McEldowney, creator of 9 Chickweed Lane.
I added four more months to the top of the Headache page, so it now displays two full years, with daily details for the most recent twelve months, and summaries for the preceeding twelve months.
Also, an overlib box with details from that day's entry are now displayed when you hover over a medication day (in yellow).
The Odds and Ends sidebar section for remaindered links has been updated to use the overLIB tool tips library. In the past, the Movable Type excerpt (if any) was displayed as regular text following each link, and there was no way to determine the category of an O&E link.
Now, hovering over a link displays an overLIB floating tooltip, with the category as the caption and the excerpt as the body. If the excerpt is blank, a single is used to persuade some height into the body of the tooltip. Double quotes in the excerpt are converted to entity reference ".
Since entries in the Odds and Ends weblog have titles that are full link tags, the only way to add the required onmouseover/onmouseout entries was to use the MTPerlScript plug-in, with a function that takes three arguments: MTEntryTitle, MTEntryCategory, and MTEntryExcerpt. The code builds the overlib call using the excerpt and caption, then modifies the title string to include the overlib and nd calls.
EasyRGB - Color harmonies, complements and themes.
I used this to come up with a complementary color for the background of the menu bar on the new Grey style. It's a big improvement over the first, semi-random color I had chosen.
I revamped the grey style to use larger, white letters on an grey-blue background. The header logo is now a background image, and the entire header is clickable to return to the home page, ala the LAPI site. I should convert all the style sheets to this type of header.
Long URLs can be a pain. If you send them by e-mail, they often wrap, making it tedious to cut and paste them back together. Amazon URLs are notorious, but in the course of any busy day on the web, you're bound to come across others.
The solution is to create a shorter equivalent for the long URL. TinyURL is the most cited example, but there are tons of other sites that do the same thing. The problem with external services like TinyURL is that you do not control your own destiny &mdash if they change their TOS, or even just go out of business, all your shortened links are now worthless.
My solution was to build a URL shortener on my own site, under my own control. I call it microURL, and it consists of five parts:
- a database table to hold the URL data
- create.cgi, to create the shortened URL's
- u.cgi, to handle the redirection from a short URL to the original site
- .htaccess changes
- a bookmarklet
Database
For my setup, I create a new MySQL database named goption_url, and then a table named conversion:
+---------+---------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+---------+------+-----+---------+----------------+ | id | int(11) | | PRI | NULL | auto_increment | | fullurl | text | | | | | | hits | int(11) | | | 0 | | +---------+---------+------+-----+---------+----------------+
create.cgi
This little Perl script takes a long URL and create a short equivalent, using these steps:- First, check the database to see if the long URL is already in the table; if so, it's
idis used; - If this is a new long URL, insert it into the database:
INSERT INTO conversion (id, fullurl) VALUES(NULL, $fullurl)
idis auto_incremented on the insertion. Theidfor the new record is used; - The
idfrom either step 1 or step 2 is converted to base 62 (using the characters 0-9, A-Z, and a-z), and the result is appended to the base redirection URL:http://goption.com/u. So, the first record created has a short URL ofhttp://goption.com/u1, and so on.
u.cgi
This script handles the redirection for a short URL. The short URL tag is converted from base 62 back to decimal, and the result is loaded from the database. The hit counter for that URL is incremented, and the CGI.pm redirect function is used to go to the original, long URL.
.htaccess changes
To make the short URL as short as possible, .htaccess is used to rewrite the short URL into an equivalent call to u.cgi:
RewriteEngine on RewriteRule ^u$ u.cgi RewriteRule ^u([0-9,A-Z,a-z]+)$ u.cgi/$1
This changes a URL in this format:
http://goption.com/uaZ
into this format:
http://goption.com/u.cgi/aZ
A Bookmarklet
Finally, to make it easy to create a new microURL, create a new bookmarklet like so:
javascript:void(location.href='http://goption.com/create.cgi?
url='+location.href)
and load it onto your Bookmarks Toolbar. When you're viewing a target page, just click on the bookmarklet to create a microURL for the current URL.
This is a simple, flexible way to create my own short URLs that last as long as I want them to - under my terms. Full source after the jump.
Update: The original version of create.cgi did not accept long URLs with embedded ampersands - a major limitation. I reworked it to use CGI.pm's query_string function when it's called from the bookmarklet, to get the entire URL (which is decoded into a normal URL string).
For as long as I can remember, I've wanted to make two upgrades to my Movable Type setup: a better monthly archive list, and an actual Recent Categories listing. Today, I finished both.
Previously, all pages but the main index page used the standard MT monthly archive listing. As the months and years go by, this listing became so long as to be unusable - or at least quite ugly. A few months ago I was reading the Tiny Pineapple weblog, and noticed that the author used a yearly table format. I sent him an e-mail asking how he did it, and he good-naturedly admitted to building and updating it manually.
In my mind I was assuming that a lot of deep MT work would be needed to build it automatically. This morning, I decided to try a different, much simpler method: use the MTPerlScript module to open the archive directory, find the year archives, and print the monthly archive table. It took a few iterations, but it now works quite well, if I say so myself.
I've had a Recent Categories section on my main page sidebar since the last redesign, but the categories listed were hard coded in the template and rarely updated. With my MTPerlScript success with the monthly archive table, I dived in to automate the section, using raw DBI code instead of MT internals. It took a couple of minutes to lock down the SQL, and I needed to "borrow" the dirify function from MT::Util, but now the Recent Categories section is fully automated.
My webcam caught a bird flying past my office window, at 8:41 this morning:

The camera face north-northwest so I don't get the best of the sunset pictures, but last night's view was pretty nice:

I've been using small, teaser graphics in the upper-right corner of many posts for a while now, but always just added the necessary spacer info directly to the tag - normally
align=right style="margin-left: .5em; margin-bottom: .5em;". Some of the teasers are in macros in the banner template, and some are just inline in individual posts.
This morning, I converted the teaser-specific formatting into a class in the style sheet. I changed all the macros to use the class, and changed the most recent inline teaser (lightning) to use the class.
The calendar on the Headache page started out with three months, grew to six months, and is now (and forever) a full twelve months. From the beginning the monthly calendars have been wrapped in a <div id="calendar"> tag. With the recent change over to a Print-specific style sheet, I decided to move the daily narrative section of the Headache page to a new page when printed. The calendar entry for the print.css style sheet now includes "page-break-after: always;", which FireFox happily supports.
Each of the doctors that I hand the diary to are interested in the calendars, but they don't seem to really care about the narrative. With the calendars on a separate page, their bookkeeping will be simplified.
I'll take the new printout to Dr. Liao on Thursday morning, along with my fully-notarized Advanced Health Care Directive.
I print out my headache diary each time I visit a doctor, with varying results. What looks pretty (enough, at least) on the screen doesn't translate well to a printed page. IE has big trouble printing it in portrait, as well, with the text getting cropped on the right margin.
In honor of this morning's visit to Dr. Wogenson, I created a print-specific style sheet, and changed a couple of templates to make it work. The Meta template now includes media="screen" on the original style sheet LINKs, along with a new link to print.css with media="print". The Banner template includes a new #printhead div, with goption in stylized text. The screen style sheets set display:none; for #printhead, and the print stylesheet sets display:none; for the standard header and menu div's.
The print style sheet also removes the page background, the border around the master div, and a few other minor changes.
The site looks the same when viewed on the screen, but now looks much better when printed.
I finally bit the bullet and upgraded to Movable Type 3.1, specifically as part of an evaluation of a new tool called reBlog.
Currently, when I want to cross-post a link I find in Sharp Reader, I drag the link to my Windows desktop, then drag it into Firefox, then use the JustBlotIt! extension to post it. reBlog is a package with it's own RSS aggregator and MT extensions to help automate the cross-posting of links.
I'm still working on it, and it'll probably be a while before I switch away from Sharp Reader, but there are some potential advantages: a) I can read my RSS feeds from any computer; b) I can cross-post without having to drag things around.
Over the years, I collected a variety of web sites that I either managed directly or indirectly. Back in March of '04, I setup a reseller account with iNetter. The account offered a lot of flexibility, and lots of disk space, for a reasonable price.
Within a week of moving all my domains there, the server I was on became a spamming haven, and was pulled by iNetter's co-location company, which promptly reformated the drives and re-sold it to another provider. I had no backups; iNetter had no backups; there was no way to make a backup. I was not a happy person. Luckily, my old hosting company sent me a backup, so I only lost a few days worth of activity.
Before the server problem, it was easy to get tech support, but as the weeks went by after the crash, it became harder and harder. They had a lot of clients on the server that died, and I think a lot of them left, leaving iNetter overworked and under revenued. I stuck by them - until this week.
Last week, the httpd daemon on the server I was assigned to mysteriously crashed. You could ssh into the server, you could get your mail, you could ftp, but you couldn't view your websites. Now, a few of my client sites are AYSO sites, and this is the busy season for youth soccer. It was a very bad time to have these problems.
To make it worse, it was impossible to get ahold of anyone at iNetter. The phone number listed prominently on their website was out of service (never a good sign); their tech support chat was always offline; help desk requests went unanswered for days, or mysteriously disappeared.
The httpd outages continued for 8 straight days. I had to make a change. Without sufficient research, I found a new hosting company (IncognitoNetworks), and signed up for a basic reseller account. I moved one of the AYSO sites there under heavy pressure, before realizing that most of my help desk requests were taking 8-24 hours for a response. I put in some more time researching alternatives, but there's not a lot out there that fit my needs - SSH access, plus lots of disk space and bandwidth, all for a reasonable price.
I finally found a hosting company I could live with: Hosting Zoom. I signed up for 10gb of disk, 75gb of bandwidth, plus ssh, a full Fantastico (which iNetter didn't support), plus 24/7 live support chat. During the transition I've had occassion to use their tech support, and am very impressed.
I needed to leave bcisys.com at iNetter for the duration, so I setup a new domain for my hosting service: Xoption.com. So far, I've moved all but two domains: bcisys.com, which provides critical e-mail support, and ayso98.org, which is orphaned at Incognito for now, until their webmaster is ready for another host move.
It's always a pain to move websites, especially ones that use database backends, but this has gone smoothly (so far...), and I'm looking forward to having a more reliable server.
Over the last few days, I've made these changes to the Headache page:
- I replaced the old format with an unordered list, to reduce the page size;
- Using Brad Choate's MTCalendarEX plug-in, I added a third monthly calendar. The page now lists the current month and the previous two months;
- Highlighted days in each calendar are now links to that's day's full text entry;
- Using Brad Choate's PerlScript plug-in for MT, I've added a line below each monthly calendar that lists the number of Imitrex days for that month;
I had a problem uploading the pictures of Gabriela's graduation, and invested in Photo Rescue, a nice program that recovers deleted and/or damaged photos from a camera memory card.
Here's the exe: Photo Rescue Expert
