The More You Know » 2007 » July
When I say cars are awesome, I mean they are awesome in the same way as waking up in a bathtub of ice, suspiciously missing a kidney. Don’t get me wrong, I love getting around fast and on my own. If I didn’t have my car I would probably stumble on my way to find proper transportation to and from work. I just wish there was a “just as good” replacement for our gas guzzling prizes of joy.
The main reason for my hate of the automobile, is the sheer number of moving parts and possible failure points. As you have guessed I was recently visited by the inspection fairy. Also, it is worth mentioning that this post is for Flora. I love you chica, and I hope you are doing well.
———————
It was supposed to be routine, but it was far from it. I had gone to see the new Harry Potter movie, which I had found to be quite delightful, and was dropping off a friend at his place. He lives only a few downtown blocks away and thus it was agreeable for us to carpool together.
As I pulled into the drive way of his place I flicked my head lights off. They were shining into what I suspected was some happily sleeping person’s room. I thought to myself on what a good person I was for thinking about doing that. My friend and I chatted about the movie for a second and he departed. I proceeded to pull out onto one of the main roads in the area on the way back to my comfy bed. I lavished in the thought of spending the next eight or so hours unconscious.
You never really realize how flashy police lights are until they are flashing behind you for half a block. They are in fact, really annoying and that is what I thought as I pulled to the curb to let this police car pass me on his/her way to whatever emergency was occurring. I even got a little more annoyed when the car seemed to follow me to the side of the road. My head dropped and shook as I realized I was the emergency.
Still looking down I was surprised by a flash of light on the passenger side of my car. A man was using a flashlight to peer into the rear of my car. Checking for other people, weapons, or illicit materials I mentally quipped. “Ha!” I thought, knowing he wouldn’t find any. “Take that! I don’t have anything illegal in here.” Taking pleasure as if my silent thoughts had any effect on them. A knock on my driver side window made me jump a little my bucket seat. Another flashlight, momentary blindness, and then realization, not one, but two. Smart little guys eh?
“Hi, is there something wrong?” said I to the now six foot something officer who has just entered my focus. “Well, uh, many things actually….Where to start…”
You can imagine the mental mind fuck I was putting myself through. How often does a police officer lose his words to describe exactly what you just did wrong, let alone “things,” in the very plural sense. And how many of these “things” were wrong enough to confuse him on which was the most important to mention first. “Is this your car?” Oh my god, did I steal my own car? No, what a silly thought, how can I steal from myself.
“Yes it is mine.”
“What happened to the front of your car?” Well let me tell you what happened to the front of my car. I was slipped out on some black ice on a freeway, did two complete three-hundred-and-sixty degree spins counter clockwise; I had been trying to turn left on a curve. I then caught some traction spinning my steering wheel the other direction, fish tailed my car in the reverse direction, pressed on the brake, avoided all other cars around me, and ran up a snow embankment which took out the lower portion or my license plate holder and cracked some of my front wind spoiler.
“Hit while parked at a movie theater. It was a hit and run….” So much shorter and easier to say. I can feel my heart racing and I am pretty sure when you are talking to a cop, anything where you hit something sounds like a bad idea to verbalize in his general direction. Besides it was half truth, I did get hit there and it did crack the front wind spoiler, at least the first time.
“Well you were driving without your headlights on. You don’t seem to have been drinking, you didn’t have anything did you?”
“Nope, just got back from a very sober Harry Potter movie.”
“Let me see your license and registration.” I hand over my very out of state drivers license, I am still a full time student who has one half that wants to move back and the other half doesn’t know if moving back is the best idea.
“Do you have a license from this state?”
“Nope…I am a student.”
“We will be right back, we just need to run this through.” Followed by an audible sigh.
I think at this point you are allowed to breath, so I breathed long, deep, and slow. In the way I would imagine someone who hyperventilates tries to but fails at. My window is down and I give a slight shiver in my kaki cargo shorts, brown sandals, and brown short sleeved polo. It just isn’t as warm at midnight as it is at ten. Sitting, I contemplate whether my inspection is up, my registration valid, and …. wait. I moved, I didn’t update my address. I am going to get hefty fine or gain a cell mate. Life is probably over, no, wait, I am over reacting. I will probably just be left eating ramen for a month. Poor me, I hate ramen.
After what seems like an eternity, the other officer comes back to the window. “Must be lots of tickets since it took so long” I think to myself. As he draws closer to the window I notice he is younger than the other officer. Hell, he is younger than me. He also isn’t as confident as the first officer, and by golly I think he is being trained. I ring a noiseless tune in my head as a glimmer of hope bursts into a bon-fire possibilities. All of which include me not losing my shirt over this ticket.
“I’m gonna have to give you a ticket for driving without your head lights on.” Bah, there go the perks of being a good person to whoever was sleeping in that room. “You will have to go down to the local traffic violation office to pay it. The fine can’t be set by us. The address is listed on the back along with a telephone number. Also, your inspection and registration are up for renewal within the next two weeks. I suggest you get on that.”
“Thank you officer, I will.” He hands back my license and other car related documents. I am happy. Happy to get a single ticket and not multiple tickets. It’s amazing how a man in uniform can make you doubt your condition. I pull out, and I think, “Damn, I must get my inspection done.”
I sleep somewhat soundly.
———————
Car inspections are like willingly entering a hostage situation. The hostage is your car. The ransom, is fixing anything, even that thing that doesn’t need fixing. The stakes, your independence, ability to get to work, and quite possibly your livelihood. It’s an amazing feeling to gamble your bank account away on something like this. Where I live, when you get your car inspected, the first thing they do, is remove the old inspection sticker. If the terrorist you willingly hand your car over to is part of a full garage, be prepared to pay the highest stakes to get your car back as they will sternly warn you that you can’t legally drive off the premises without an inspection sticker.
My terrorist of choice, Sears. And yes, it was a bad idea, but I had to get it done quickly. It was the closest place for an inspection just short of a five minute drive from my work. I could drop it off in the morning, get a ride back with a co-worker, and pick it up later after work. Perfect.
I drop it off, I get my ride back, and I work, humming happily to myself as I close ticket after ticket. I am a software engineer and closing bugs in past projects is a decent part of my job. Nothing is more satisfying as helping fix something that helps other people.
My cell phone is on vibrate and located on the corner of my keyboard so that if it vibrates I can feel it while I am typing. Having it ring would only annoy other people as I wouldn’t hear it ring after ring as I continued to bob my head and tap my foot to some trendy type of music. I even mouth the words, utter a few under my breath as I rock out. My fingers feel a series of vibrations, my phone says “Sears Automotive”.
My fears are quickly solidified into reality. I need four hundred dollars worth of work in addition to the inspection cost. My head sinks lower than when the I realized I was pulled over. If I were in an online game, I would have typed “/emo /wrists” (translates to “I am emo” and “Slash wrists”) in an emote fashion to denote that I am not only sadder than a emotional angst filled teenager, but death might be a little more pleasant than this. I need two new control arm ball joints. They also suggest new front pads and two new rear wheel cylinders very soon.
Translation, “Give us money now and by the way we probably loosened some bolts here and there ensuring you will come back in a month. We know you work right up the street and the next closest place is thirty minutes away. We own you, your car, and your balls. Welcome to not being a man anymore. Thank you and have a nice day.” All said with a used car sales man’s grin.
This followed up with “You won’t pass inspection without at least the control arm joints replaced…” further translates into, “Yes we are bad ass and we are your terrorists. Welcome to our Iraq.” Granted, they probably didn’t loosen anything or damage my car in any way, but you can’t demonize normal wear and tear or the fact that I have a crappy car.
I cry on the inside and say “Okay, get it done then”.
“Great sir,” I am a sir now, I deserve respect, almost like I did all along. “We can get this done today, all the parts and everything.” Says the mechanic with a helpful tone.
“Awesome, I’ll be by some time after six to pick it up.”
They weren’t done at six or by closing time at eight. I had to come back the next day and put forth my ransom. At least I got the car back and I could get home on my own. At least I am good for another year. Well after I get down to the DMV to change my address and renew my registration. Oh the joys.
Cross window scripting is one of those most useful techniques when using multiple windows to display different parts of the same site. It allows information between pages to be refreshed and for presentation of data to become synchronized. It is important to know that IFRAMEs are just embedded windows and that given the element node reference of an IFRAME, you can obtain its window context. All JavaScript variables, functions, objects, etc are defined within the window context. To illustrate this point consider the following code:
var myGlobalVariable = "Hello"; function myFunction() { alert( myGlobalVariable ); } function myFunction2() { alert( window.myGlobalVariable ); } myFunction(); window.myFunction2();
The result of the above code is that an alert box that says “Hello” is shown twice. “window” is a keyword in JavaScript and it gives the current execution block’s window context. Knowing that everything in JavaScript is directly defined within the window context allows you to do things like run functions across two windows. To help us find other window contexts, we are given the following key words:
- parent: Returns the parent window context. JS running within an IFRAME will return the containing window’s context (i.e first outermost). Windows opened from another window with window.open form this parent child relationship as well.
- top: will return the eldest window context. Meaning if we have windowA open windowB who has an embedded iframe windowC, using “top” in any of the windows returns windowA
To traverse into an IFRAME, you can not simply use an IFRAME element reference as the window context. Example:
var iframe = document.getElementById( "myIframe"); //doesn’t work iframe.someJsFunction(); //does work as long as someJsFunction is defined //on the page in that iframe. iframe.contentWindow.someJsFunction();
The technique explained above is called cross window scripting, or XWS. It is meant to allow windows that share the same domain interact with each other. When used properly it is quite powerful. However, as all powerful things go, it can be misused.
When a site is embedded in another and the parent window and the child window do not share the same domain, browsers do not allow cross window scripting. In other words, cross window scripting only works if both windows are from the same domain. There are ways around this via exploits and it is considered bad form to use it. It directly breaks the security rules put in place by browser producers.
When scripts break this security concept, it is call cross site scripting, XSS for short. It is nearly always part of a site attack.The usual method of implementation is usually via an exploit in some web application, SQL injection, or custom user content.
XSS attacks can do things such as watching user events on password/login fields, stealing user names and passwords or even simply obtaining session information from URL’s and cookies in order to allow sessions to be hijacked.
This one came up during a discussion about Prototype 1.5.1 while looking through its documentation. Basically when you do the following in JavaScript, you are not copying the array, but rather creating another reference to it. In order to properly clone or duplicate an array you have two choices; loop through the array and copying its values or using the concat method. I personally suggest the concat method since its cleaner and keeps the operations withing the native code of your browser.
function cloneArray( originalArray ) { return originalArray.concat(); }
As always there is a pre-extended version of this functionality in the Array class when using Prototype.
var originalArray = [document.getElementById( "someId1"), new Object(), new Array()]; var cloneArray = originalArray.clone();
The following will not work the way it is intended in most cases as the array second assignment will just be a secondary reference to the original array. Meaning if you alter array2 using any methods or direct action you will also alter array1.
var array1 = [document.getElementById( "someId1"), new Object(), new Array()]; var array2 = array1; array1.shift(); //will alter array1 and array2;