Electric grandmas

I’m here at work late trying to catch up with work that pilled up while on vacation, and so this may not be as funny tomorrow… but it is right now. Found this in a Slashdot article about “What Do People in the IT Field Do for Side Jobs?” in the comments. Naturally many people mentioned how they have become the IT support for their families, when I ran across this thread:

by 2MuchC0ffeeMan
If we could only charge our grandmothers for every time we fixed their cord not being plugged in…

by delfstrom
>If we could only charge our grandmothers for every time we fixed their cord not being plugged in…

I didn’t know grandmothers required electricity.

by Mr. Bad Example
> I didn’t know grandmothers required electricity.

This is obviously an early example of nanatechnology.

Oy… I need to go home.

Bloglines and del.icio.us

“Come on man… everybody’s doin’ it…”

Just figured I’d post about my conformance to more geek customs. I’ve been using bloglines for quite a while now, and have been loving it. I save time in not checking my normal sites every day to see no new content, but now loose time in that I have added another 50+ sites to my Bloglines list. The only reason it’s only 50+ is that I’m trying to be semi-conservative. I’m sure I could add hundreds but I would have no life other then checking things on it.

I absolutely love being able to get information so easliy. I get to sound so much more intelligent (then I actually am) when I am always talking about what I read the other day on dozens of subjects.

Just a week or so ago I decided to hop on to the del.icio.us bandwagon. It’s so much easier to post things there then to always be sending out links to friends about the latest cool site I ran into. So my delicious list slowly begins to grow as I go back to old posts to get them added.

Anyway… two cool geek things that I’m participating in that I wanted to make sure the 4 people that check my site once a month know about.

Contribution to Slayeroffice - Mouseover DOM Inspector

Steve over at Slayeroffice just posted an update to one of his “favelets” that I sent to him. So I thought I’d do a quick write-up on how it came to be (as I’m really lacking in content these days).

We are big fans of his Favelet Suite over at Sprint, and use it daily. One of the favelets is the Mouseover DOM Inspector (MODI) that we used more then the rest to get a nice quick look at how our CSS based pages are laying out by using the background color that MODI provides.

A favelet (or Bookmarklet as we usually call them here… same thing) that I had always wanted to make was one that showed the parent structure of the element you moused over. When I finally got some time, I thought that tweaking Steve’s MODI favelet would be a natural fit. So I snagged the parent structure parsing code from our Sprint IFR implementation and slapped it into a copy of MODI. After a little tweaking to actually spit out the parent structure, instead of just walk up it, it was working pretty good. Added the Height/Width while I was at it and called it good.

A few weeks later I was working on another project and was regularly trying to find the X,Y of a given element (X,Y finding thanks to PPK over at quirksmode.org). Eventually the lightbulb went off and I just added it to the MODI script that was fast becoming the one stop shop for everything we needed.

After using that for a while I finally decided to offer it up to Steve to add to his own script, so that others could use the new features as well. The update that I sent him was added today and now I can go back to just needing his Suite, and can remove a bookmark from my toolbar.

Many thanks to Steve for the great resource that he provides in the Favelet Suite (and naturally each individual Favelet). I know it has saved us a lot of time in various circumstances, and it’s an honor to be able to contribute to it.

One line to rule them all

One line to rule them all,
one line to find them.
One line to bring them all,
and in the function bind them.

The “One Line”:

if(!foo.nodeName) foo = document.getElementById(foo);

Imagine you make, borrow or steal a function that does “something” to a given element. The function is setup to require the ID of the element in question, so that you can do ye ole “getElementById” (gEBI from now on) on it to then do whatever spiffy thing you want to do to it.

But what if you already had already done a gEBI on this element, and the result of that is sitting in a variable just waiting to be used… why should you waste resources doing it all over again, and have a second variable with all the same information.

Or… reverse it. Your function is expecting a gEBI’d var but you pass just the ID. It won’t have the information it needs.

Enter the “One Line.” What the code does is check to see if the variable that was passed has an attribute (nodeName) of a gEBI’d variable (if(!foo.nodeName)). If it does then it goes merrily on it’s way. If it doesn’t, then it must have just been an ID so the line does a gEBI on it so we can do what we want to do to it (foo = document.getElementById(foo);). It sets the results of the gEBI to the same variable the ID was, so the code below it is none the wiser. Whichever thing you send to it, after this line you will have the same thing to work with.

Now granted… in a perfect world all your functions will be written ever so neatly and you will always remember what to send to them or it would always be one or the other. But since we are such a generous community, and are always sharing new ideas, I’m sure your .js files are a hodge podge of functions from various people, and even various scripts that you have written previously and pulled into a new one. The One Line levels the playing field.

So to sum up… this one line of code makes it so you don’t have to worry about what you send to your function. Either an ID or a gEBI’d var will work.

A really lame example of a function that changes your text to red:

function redText(theText){
   theText.style.color = "#f00";
}

In the above, it is looking for a gEBI’d variable to apply the style to. So it won’t work if you just pass the ID.

function redText(theText){
   if(!theText.nodeName) theText= document.getElementById(theText);
   theText.style.color = "#f00";
}

Using the One Line, it can now accept either an ID or a gEBI’d variable. Everyone is happy

One line to rule them all,
one line to find them.
One line to bring them all,
and in the function bind them.

Evil attack squirrel of death

I may have been in a pretty weird mood last night when I first read this, but when I did I laughed so hard I was crying, I couldn’t breathe, and this morning my jaw aches.

Hopfully it’s still as funny…

This was no ordinary squirrel. This was not even an ordinary pissed-off squirrel. This was an evil attack squirrel of death.

Update: The above link isn’t working any more, so I have found a copy of the original story to post here. I would love to give credit to the original author, so if anyone has info on that, please let me know.  Original story linked in the comments.  I have updated the above link.  Thanks David.

The story

I never dreamed slowly cruising through a residential neighbourhood could be so incredibly dangerous! Studies have shown that motorcycling requires more
decisions per second, and more sheer data processing than nearly any other common activity or sport. The reactions and accurate decision making abilities
needed have been likened to the reactions of fighter pilots! The consequences of bad decisions or poor situational awareness are pretty much the same for
both groups too.

Occasionally, as a rider I have caught myself starting to make bad or late decisions while riding. In flight training, my instructors called this being “behind the
power curve”. It is a mark of experience that when this begins to happen, the rider recognizes the situation, and more importantly, does something about it. A short break, a meal, or even a gas stop can set things right again as it gives the brain a chance to catch up. Good, accurate, and timely decisions are essential when riding a motorcycle.at least if you want to remain among the living. In short, the brain needs to keep up with the machine.

I had been banging around the roads of east Texas and as I headed back into Dallas, found myself in very heavy, high-speed traffic on the freeways. Normally,
this is not a problem, I commute in these conditions daily, but suddenly I was nearly run down by a cage that decided it needed my lane more than I did. This is not normally a big deal either, as it happens around here often, but usually I can accurately predict which drivers are not paying attention and avoid them before we are even close. This one I missed seeing until it was nearly too late, and as I took evasive action I nearly broadsided another car that I was not even aware was there! Two bad decisions and insufficient situational awareness.all within seconds. I was behind the power curve. Time to get off the freeway.

I hit the next exit, and as I was in an area I knew pretty well, headed through a few big residential neighbourhoods as a new route home. As I turned onto the nearly empty streets I opened the visor on my full-face helmet to help get some air. I figured some slow riding through the quiet surface streets would give me time to relax, think, and regain that “edge” so frequently required when riding. Little did I suspect.

As I passed an oncoming car, a brown furry missile shot out from under it and tumbled to a stop immediately in front of me. It was a squirrel, and must have been trying to run across the road when it encountered the car. I really was not going very fast, but there was no time to brake or avoid it-it was that close. I hate to run over animals.and I really hate it on a motorcycle, but a squirrel should pose no danger to me. I barely had time to brace for the impact. Animal lovers, never fear. Squirrels can take care of themselves!

Inches before impact, the squirrel flipped to his feet. He was standing on his hind legs and facing the oncoming Valkyrie with steadfast resolve in his little beady eyes. His mouth opened, and at the last possible second, he screamed and leapt! I am pretty sure the scream was squirrel for, “Banzai!” or maybe, “Die you
gravy-sucking, heathen scum!” as the leap was spectacular and he flew over the windshield and impacted me squarely in the chest. Instantly he set upon me. If I did not know better I would have sworn he brought twenty of his little buddies along for the attack. Snarling, hissing, and tearing at my clothes, he was a frenzy of activity. As I was dressed only in a light t-shirt, summer riding gloves, and jeans this was a bit of a cause for concern. This furry little tornado was doing some damage!

Picture a large man on a huge black and chrome cruiser, dressed in jeans, a t-shirt, and leather gloves puttering maybe 25mph down a quiet residential street.and in the fight of his life with a squirrel. And losing.

I grabbed for him with my left hand and managed to snag his tail. With all my strength I flung the evil rodent off the left of the bike, almost running into the right curb as I recoiled from the throw. That should have done it. The matter should have ended right there. It really should have. The squirrel could have sailed into one of the pristinely kept yards and gone on about his business, and I could have headed home. No one would have been the wiser. But this was no ordinary squirrel. This was not even an ordinary pissed-off squirrel. This was an evil attack squirrel of death!

Somehow he caught my gloved finger with one of his little hands, and with the force of the throw swung around and with a resounding thump and an amazing impact he landed square on my back and resumed his rather anti-social and extremely distracting activities. He also managed to take my left glove with him!

The situation was not improved. Not improved at all. His attacks were continuing, and now I could not reach him.

I was startled to say the least. The combination of the force of the throw, only having one hand (the throttle hand) on the handlebars, and my jerking back unfortunately put a healthy twist through my right hand and into the throttle. A healthy twist on the throttle of a Valkyrie can only have one result. Torque. This is what the Valkyrie is made for, and she is very, very good at it.

The engine roared as the front wheel left the pavement. The squirrel screamed in anger. The Valkyrie screamed in ecstasy. I screamed in.well.I just plain screamed.

Now picture a large man on a huge black and chrome cruiser, dressed in jeans, a slightly squirrel torn t-shirt, and only one leather glove roaring at maybe 70mph and rapidly accelerating down a quiet residential street.on one wheel and with a demonic squirrel on his back. The man and the squirrel are both screaming bloody murder.

With the sudden acceleration I was forced to put my other hand back on the handlebars and try to get control of the bike. This was leaving the mutant squirrel to his own devices, but I really did not want to crash into somebody’s tree, house, or parked car. Also, I had not yet figured out how to release the throttle.my brain was just simply overloaded. I did manage to mash the back brake, but it had little affect against the massive power of the big cruiser. About this time the squirrel decided that I was not paying sufficient attention to this very serious battle (maybe he is a Scottish attack squirrel of death), and he came around my neck and got IN my full-face helmet with me. As the faceplate closed partway and he began hissing in my face I am quite sure my screaming changed tone and intensity. It seemed to have little affect on the squirrel however. The rpm’s on The Dragon maxed out (I was not concerned about shifting at the moment) and her front end
started to drop.

Now picture the large man on the huge black and chrome cruiser, dressed in jeans, a very ragged torn t-shirt, and wearing one leather glove, roaring at probably 80mph, still on one wheel, with a large puffy squirrel’s tail sticking out his mostly closed full-face helmet. By now the screams are probably getting a little hoarse.

Finally I got the upper hand.I managed to grab his tail again, pulled him out of my helmet, and slung him to the left as hard as I could. This time it worked.sort-of. Spectacularly sort-of, so to speak. Suddenly a large man on a huge black and chrome cruiser, dressed in jeans, a torn t-shirt flapping in the breeze, and wearing one leather glove, moving at probably 80mph on one wheel, and screaming bloody murder roars by and with all his strength throws a live squirrel grenade directly into your police car.

I heard screams. They weren’t mine…

I managed to get the big motorcycle under directional control and dropped the front wheel to the ground. I then used maximum braking and skidded to a stop in a cloud of tire smoke at the stop sign at a busy cross street.

I would have returned to fess up (and to get my glove back). I really would have. Really. But for two things. First, the cops did not seem interested or the slightest bit concerned about me at the moment. One of them was on his back in the front yard of the house they had been parked in front of and was rapidly crabbing backwards away from the patrol car. The other was standing in the street and was training a riot shotgun on the police cruiser.

So the cops were not interested in me. They often insist to “let the professionals handle it” anyway. That was one thing. The other? Well, I swear I could see the squirrel, standing in the back window of the patrol car among shredded and flying pieces of foam and upholstery, and shaking his little fist at me. I think he was shooting me the finger.

That is one dangerous squirrel. And now he has a patrol car.

I took a deep breath, turned on my turn-signal, made an easy right turn, and sedately left the neighborhood.

As for my easy and slow drive home? Screw it. Faced with a choice of 80mph cars and inattentive drivers, or the evil, demonic, attack squirrel of death…I’ll
take my chances with the freeway. Every time. And I’ll buy myself a new pair of gloves.

« Previous PageNext Page »