dans.blog


The miscellaneous ramblings and thoughts of Dan G. Switzer, II

Finished jQuery Tablesorter mod for Collapsible Table Rows

I've been pretty quite the past two weeks. I've been really plugging away doing a lot of client-side UI programming in jQuery. I'm working on a complete revamp of some portions of our application and than means modernizing the UI.

One of the tasks I needed to accomplish was to create a UI component that would allow for sortable, collapsible table rows. jQuery already has a very good (an official) plug-in for sorting column rows called tablesorter.js. The Tablesorter is part of the jQuery UI project and allows for sorting of multiple columns—which is a really nice feature.

However, the current tablesorter.js codebase does not have anything in place to allow for "children" rows—which is needed to provide a collapsible architecture. Essentially I need a way to tell certain rows that they belong with the row above.

After playing around with some different variations I finally came up with a solution that worked elegantly and had minimal impact on the Tablesorter codebase. The way I solved the problem is to add a class to "children" rows, which tells the Tablesorter plug-in to include the row as part of the last row that does not have the "child" class. This allows me to actually have multiple children rows, that are all grouped together and ignored by the sorting algorithms.

I'm working with Christian Bach to get the mods added to the official codebase—and it looks like that might happen as early as next week. I've upload my Tablesorter mod and an example of implementing collapsible rows.

The example uses the "Pager" add-on for Tablesorter, just to show my mod attempted not to break backwards compatibility.

If you have any comments, please leave them. They will only help me and Christian in the long run.


Robotic Tennis Ball Cannon is Truly Dog's Best Friend...

I can't even tell you how much my yellow Lab would love this toy. If we set this up in our house, I'd never see her again.


Frozen in Grand Central Station...

This video is a couple of months old, but I just came across it (actually my mom sent me a link it.) This is another Improv Everywhere video. The premise on this video is that 200 people all go into Grand Central station and all freeze at exactly the same time and resume exactly 5 minutes later. I'm sure it would have been very freaky to witness in person.

Very cool!


Boston Dynamic's BigDog Quadruped robot is pretty amazing...

It's pretty cool to see this kind of robotics in motion. This is definitely something you want to watch all the way through. The highlights for me were watching it regain it's balance after being shoved and after slipping on ice. It's also pretty cool to watch it run and jump. It's pretty spooky just how close it looks like a quadpedal creature.


Safari CSS :hover and Adjacent Sibling Selector Bug

I recently discovered a bug in Safari (Mac and PC) related to use the :hover pseudo class in conjunction with an adjacent sibling selector. The problem is that the mouseover event correctly changes the adjacent sibling's style, but when the mouseout event occurs the style is never reset. This means if you have the selector ul li:hover + li the adjacent selector's (+ li) style will be changed when the user hovers over the element, but the style is never reset once the user mouse's out of the element.

I've tested this CSS selector combination in IE7, IE8b1, FF2 (PC and Mac) and FF3b4 and in all those browsers when the mouse leaves the element being hovered, the style of the sibling element is reset to it's original state.

One problem with stating this as a "bug" is that I believe the CSS spec is unclear on what the correct behavior should be, but I do believe that the other browsers got this right. I definitely expect any visual changes applied to the screen on the :hover pseudo class to be undone when mouse leaves the target area.

It turns out I'm not the first to find problems with Safari's implementation of the :hover and adjacent sibling selector.

To see this bug in action, move your mouse pointer from the bottom of the list to the top. If you move from top to bottom you will not see the bug since the style is correctly reset once you mouse over the sibling element.

  • Item 1
  • Item 2
  • Item 3
  • Item 4
  • Item 5
  • Item 6
  • Item 7

Here's what the CSS looks like behind the scenes:

<style type="text/css">
ul {
    margin: 0;
    padding: 5px 5px;
    list-style-type: none;
    width: 250px;
    height: auto;
    background-color: #e1e0e0;
    /* define font here for IE6 */
    font: 11px Arial, Helvetica, sans-serif;
}
ul li {
    cursor: pointer;
    white-space: nowrap;
    color: #666;
    border-top: 1px solid #fff;
    padding: 2px 20px 2px 6px;
    margin: 0 10px;
}
ul >
li.end {
    border-bottom: 1px solid #fff;
}
ul > li:hover {
    border-top: 1px solid #999;
    background-color: #999;
    color: #fff;
}
ul > li:hover.end {
    border-bottom: 1px solid #999;
}
ul > li:hover + li {
    border-top: 1px solid #999;
}
</style>

Odds are high that you might never run into this bug, but I'm working on a menu system that requires a pretty complex CSS rule set and this bug is causing me serious problems in Safari. I may end up needing to implement a JS in order to resolve the problem.


Iron Maiden Frontman Bruce Dickinson Writes Horror Movie

Bruce DickinsonI just read that Bruce Dickinson has penned a new movie titled Chemical Wedding (which is also the name of his 1998 solo album.) I've always been a big fan of Maiden and Bruce's vocals, so I'll definitely be following this movie. I've got no clue if the movie will be any good, but for those of you who follow Iron Maiden, you know that their huge book and movie buffs—a good portion of their songs are based on either old movies, books or TV shows.

The information I've been able to find out about the movie is sparse, but apparently the movie is about a professor who brings back to live Aleister Crowley.


Blizzard 2008 Pictures...

In the past 24 hours we've been dumped on with probably 14" of snow here at the house. We've been in a Blizzard Warning for the past 18 hours or so (and it's to continue for another 6 hours.) This is the first Blizzard in this area since 1978. While this amount of snow fall is a drop in the hat to what some places are used to, it's a huge snowfall for what this area is used to seeing in a 24 hour period of time.

I love the snow, so I'm really enjoying it. We've got a nice brand new huge 6' x 6' window in our front room, so I'm just enjoying watching the snowfall. I've taken our oldest dog, Maddie, out a couple of times to play in the snow. Nikki (the one that just had surgery) really wants to play when I take her out to go potty, but the snow is just too deep to let her really trek around in. Anyway, Jenn got the camera out and we took these pictures about an hour ago.

blizzard_20080308_01 blizzard_20080308_02 blizzard_20080308_03
blizzard_20080308_04 blizzard_20080308_05 blizzard_20080308_06
blizzard_20080308_07 blizzard_20080308_08 blizzard_20080308_09
blizzard_20080308_10 blizzard_20080308_11 blizzard_20080308_12
blizzard_20080308_13 blizzard_20080308_14 blizzard_20080308_15
blizzard_20080308_16 blizzard_20080308_17 blizzard_20080308_18
blizzard_20080308_19 blizzard_20080308_20  


Smashing Magazine's 35 (Really) Incredible Free Icon Sets

Smashing Magazine recently posted a an article on 35 (Really) Incredible Free Icon Sets. There's a number of sets I haven't seen. The one that immediately caught my eye was pinvoke's PI Diagona Pack.

It comes with 200 unique icons in two different sizes (10x10 and 16x16.) It has a similar look to the famfamfam set of icons called Silk. Here's what the icons look like:

pi_diagona_pack

It seems the pinvoke site's getting a lot of downloads at the moment, but I was able to find a mirror of the pi_diagona_pack.zip file.


The Beatles' Abbey Road...

Almost 40 years later and Abbey Road is still one of the best albums of all time. My father was a huge Beatles fan and many of my earliest memories are of sitting in my car seat and singing Beatles tunes with my parents. I've been heard Abbey Road countless times, yet it still gives me the same thrill every time I listen to the record. I might go months between listens, then I'll pull it out again and amazed at the greatness of the album all over again.

This is an album that should absolutely be on everyone's mp3 player. If you don't own Abbey Road go buy it right now; if it's not on your mp3 player, go load it.

For your listening pleasure, here's I Want You:

For extra bonus coverage, here's a rehearsal of I Want You with Billy Preston and the guys going through a run through:

If you can find it, Eric Gales does a great cover of I Want You on his Picture of a Thousand Faces album.


Operator Precedence in ColdFusion

Simon Whatley had a good post yesterday on operating precedence in ColdFusion. It's important to understand the priority in which statements are evaluated, but what I think is more important is to explicitly define the precedence by using parenthesis. This makes the code much easier to read and much less likely to be misinterpreted. Take the equation:

x = 3 + 4 * 5;

What is the value of x? The correct value is 23, since the multiplication operator takes precedence over the addition operator. However, it's very easy to misread the equation as 3 + 4 = 7, 7 * 5 = 35. Here's the equivalent line of code, but with the precedence of the operations explicitly defined:

x = 3 + (4 * 5);

This is much clearer to the reader on how the equation should be executed. Writing code that easy to maintain should always be one of your top priorities and using parenthesis around your statements is one great way to help the readability of your code.


RIP Dungeon Master - Gary Gygax 1938 - 2008

From c|net News.com: Gary Gygax, 1938-2008: Rest in peace, Dungeon Master

Gary Gygax GenCon 2007Gary Gygax, co-creator of Dungeons & Dragons and one of the fathers of tabletop role-playing games, died on Tuesday at the age of 69. He had suffered from heart problems. 

The news was first announced on the message board of Troll Lord Games, the publisher of Gygax's most recent works. It has since been directly confirmed by the company, which will post an announcement on its Web site later Tuesday.

Gygax was best known for helping create Dungeons & Dragons and Advanced Dungeons & Dragons. He also pioneered tabletop role-playing games. The first D&D rulebooks were released in 1974 by TSR, and since then have produced three full-fledged sequels, numerous revisions and updates, and dozens upon dozens of additional rulebooks, settings, and campaigns. While Gygax hadn't had much direct involvement with D&D for many years, he developed and contributed to many role-playing games, including Troll Lord Games' Gary Gygax's Fantasy Worlds.


jQuery Calculation Plug-in v0.3 released...

I've updated the jQuery Calculation Plug-in with a few changes:

  • Refactored the aggregate methods (since they all use the same core logic) to use the $.extend() method
  • Added support for negative numbers in the regex (now uses /-?\d+(,\d{3})*(\.\d{1,})?/g)
  • Added min/max aggregate methods
  • Added defaults.onParseError and defaults.onParseClear methods to add logic for parsing errors

The onParseError/onParseClear methods are useful when you need to flag the element that threw the error—such as changing the background color of the element to highlight it doesn't contain a valid number.

Make sure to check out the example of the avg() method on the documentation page. If you input an alpha string into any of the fields, the field will turn red to indicate the parsing engine could not find a number in the field.

I also added support for negative numbers—which was an oversight on my part.


jQuery Tip: Matching Paired Elements

A common task you might want to accomplish in jQuery is to match elements that are paired together. For example, you have a page full of authors and only want to show their biographies if they click on a link.

Your first thought might be to do something like the following:

$(document).ready(function (){
    $("dt").click(function (){
        $("dd").slideDown();
    });
});

The problem with this approach is that when you click on the <dt /> tag it will open all of the <dd /> tags. This is because the selector being used specifies all of the <dd /> tags and doesn't do anything to filter the tags to the specific matching tag.

more…


What if David Lee Roth tried out for American Idol...

I found this clip on VanHalen.com. It's basically an audio clip of what it might sound like if David Lee Roth tried out for American Idol.


Removing attached PST from corrupted MS Outlook profile

Probably the biggest problem I've had with Microsoft Outlook over the last decade is with my Outlook Profile getting slightly corrupted, preventing me from closing open "archive" PST files. When you attempt to close the PST, you'll see the following message:

  The operation failed. An object could not be found.
Error: The operation failed. An object could not be found.

This is actually caused by a Registry corruption to the Outlook profile that is in use. Microsoft recommends creating a new profile, but that makes you re-create all your E-mail Accounts and you lose your rules, autocomplete addresses, etc. You can back up your rules, but re-creating a profile is a bit of a pain if you have a complex Outlook configuration.

Today I ran into this problem again. I was migrating all my archived "Deleted Items" for 2007 to a new PST so I could permanently archive the file. After moving all the files, I wanted to compress my archived "Deleted Items" folder but couldn't because I was getting this error message.

Since I really didn't want to re-create my profile, I went out searching for a tool that might be able to clean up my profile for me. Fortunately after a few minutes of Googling, I came across CodeTwo PST Ghostbuster.

This program worked like a charm to clean up my profile. You'll want to use the "Backup" feature before you attempt deleting a PST—just to make sure you can restore things if something goes awry.

If I could make an improvement to the program, it would be for the list of PST files to delete to be a select box of attached PST files instead of having to type the name of the PST folder into the text box. However, the program worked as advertised and saved me lots of time since I didn't have to migrate to a new profile.