Uncategorized

MSIE focus() quirk

This morning I was working on an issue where clicking a tab link would cause Internet Explorer to jump to a scroll position lower on the page as if to a named anchor.  The accessibility consultant I’m working with recommends that when a tab is activated, the focus should go to that tab’s content area.  I thought maybe the tab switching code was just missing e.preventDefault() or return false  on the click event but when I opened the file, the code to cancel the click was there. Eventually I deduced that the call to focus() was causing the jump but didn’t understand why exactly.

IE focus causes scroll

… and other assorted variations didn’t turn up many useful results in Google. I showed the issue to my coworker (and manager) and he immediately noticed that the browser was scrolling just far enough for the whole focused element to be within the viewport.  After some experimentation, we discovered this odd feature: when focusing an element that has a defined height, Internet Explorer will scroll so that the entire element is in view. We tested in IE7 – IE9 and got the same result every time. In a way, it kind of makes sense that the browser would ensure the element is visible but unfortunately there’s no way to cancel it as far as I can tell. As a workaround, avoid defining a height for the element receiving focus.

Quickly and easily do a large commit from Vim

Today at work I figured out a quick way of doing a large commit from Vim. I hope that other Vimmers can use this tip!

First, use the vim :read command, using the external command for subversion status as input: :r ! svn st

Look through the list and delete the lines with files you don’t want to commit, with dd.

When only files which you plan to commit are left in the buffer, run gg <C-V> G w d to delete the status column.

Next, enter visual mode and select all the lines and join them: gg <S-V> G <S-J>

Yank this line ( yy ), then run the external command :! svn ci <C-R>" -m 'Your log msg here'. Typing Ctrl+R and ” will expand to the last register that you yanked.

That’s all! It’s not very difficult, and it made the process of doing my commits much more efficient. Let me know in the comments if it helped you.

Lifehacker featured my userscript!

gawker-no-galleries
I was pleasantly surprised this week to discover that Lifehacker featured my Remove Gallery Links userscript on Dec. 3rd, 2009. I guess this explains why today when I checked on this script for the first time since I created it on Oct. 17, it had over 1600 users.

To celebrate, I decided to include the entire Gawker network in the script, something I really should have done in the first place.

Compare before and after photos using CSS Clip and jQuery

UPDATE: Turns out this has already been done! Oh well, I still had fun with it.

Last night I followed a link from Reddit to The Berlin Wall: 20 Years Later on the New York Times site. It was an interesting feature, but I thought that the use of Flash to display the before and after photos was a little bit gratuitous, especially considering that they could make the content accessible to a wider range of user agents (mobile browsers and Google image search come to mind) by using CSS and Javascript.

Read more »

Imogen Heap is not Genesee Keevil

There’s kind of a funny story to go along with this video, and one that I should tell before I forget all about it. On August 31st, the lady and myself were back in my hometown of Burk’s Falls, Ontario for an intimate Hawksley Workman show in the Towne Theatre, which seats about 150.

While we were waiting for the show to start, a very tall and distinctively dressed woman, with a particular, familiar hairstyle walked down the aisle past us, and set down a few rows ahead of us. I thought “that has to be Genesee!” (my friend and an ex-bassist of my ex-band). It wasn’t completely outside the realm of possibility that she would be back from Whitehorse visiting her family who live in the area. Since this would be the first time I had seen her in a few years , I was excited about this and tried to stage-whisper her name to try and get her attention. After a few unsuccessful attempts, I started to feel like I was making a scene and I would either have to try again later, or find her after the show.

The show, by the way, was excellent. It was my first time seeing Hawksley with a full band, and the set list was a great cross-section of his catalogue. I was especially happy that he played “Your Beauty Must Be Rubbing Off On Me,” but the video of that didn’t turn out (too much bouncing to good music). At around the halfway point, he announced that he would like to invite a special guest on stage to help out with a song. Surprisingly, the woman I thought was Genesee stood and took to the stage… It turns out that I was wrong, and as much as I thought they looked alike in a dark theatre, Imogen Heap is not Genesee Keevil.

Tomboy Notes on the Web and your iPhone

Yesterday I was backing up my home directory to move everything over to a larger drive and a new install of Ubuntu, and for some reason I was curious which format my Tomboy notes were stored in. When I discovered that the ‘.note’ files in  ~/.tomboy/ were XML files, I was excited about the idea of creating a web interface for Tomboy with PHP.

I searched the Tomboy mailing list and browsed around the wiki, and found that I wasn’t the first person to think of this (of course). I found a blog post about a mockup for Tomboy Online, but this was more of a hosted, social type of app and I was interested in making a standalone script. Also, it was only a concept, and no code exists for it.  In the comments of this article there was a link to tomboy-web, but it was written in Java, so I couldn’t really play with it.

Eventually I came across the shell scripts and PHP of Erik Torsner, which I only needed to tweak slightly in order to use with the fantastic iUI library.

Rather than using shell scripts to sync up, I suggest following the steps outlined in Synchronize Tomboy Notes with Anything.

Download / Install

  1. Grab the zip file (demo)
  2. Unzip and upload to your web server BUT not before reading the security warning below.
  3. Put your .note files in the ‘note-storage’ directory, either by manually uploading notes every once in a while or (way cooler) following the instructions in this blog post.

Warning!

This is only a proof of concept, it’s a really bad idea to sync your confidential tomboy notes to your webserver. There are no security measures whatsoever. On the other hand, WordPress has an optional ‘blog by email’ feature which relies on the obscurity of a secret email address… if you are going to risk it, place the files in a very obscure directory (named as an md5 hash or similar).

And I thought *I* was a fan of jEdit

This guy started a whole blog about jEdit!

Until I came across this on Addictomatic, I had no idea that it was possible to write macros for it in Javascript. I’m looking forward to more macros, tips and tutorials on writing my own jEdit plugins from this blog.

Awesome,

Professing an Undying Love for jEdit

One of my daily reads, Lifehacker, did a reader poll recently on the best text editors… I have to say I was pretty much incensed that jEdit wasn’t even in the running!

I’d been considering eventually writing a post to extol the many virtues of this free, open source, cross-platform and feature packed programmer’s text editor, but when I saw that it was snubbed in the LH poll, I was sort of inspired to post something in defense of it.

Read more »

jQuery Slug Plugin

I’ve had a snippet of jQuery and javascript kicking around for a while, that I have found handy in the past for generating post slugs. Finally I’ve packaged it as a plugin to share: jQuery Slug Plugin.

This is my first jQuery plugin, so it doesn’t follow the more advanced plugin development pattern by Mike Alsup, instead I followed a more rudimentary plugin authoring tutorial.

Here’s an explanation of the plugin, and examples of its usage.

Twigg’s gets Heal Thy Health

Heal Thy Health

In North Bay snacking news, my friend Sherry Milford’s organic, wheat-free, vegan baking is now available at Twigg’s on Fraser street.

Sherry of Heal Thy Health is a certified nutrition consultant, and along with her partner Yan Roberts is also the proprietor of the Piebird Bed and Breakfast, in Nipissing Village.