Because sometimes I'm just fucking right...

Month: January 2007

Dairy Section Psycho

Remember how I told you I had a sick and twisted mind? Well, this evening I had a flash of sick and twisted in the Dairy section of the local Price Chopper. So, to set the scene, I walk into the cheese and yoghurt aisle and about half-way down the way is a stocker who’s loading up the yoghurt. As I walk toward him I noticed he had a handy belt-sheath for his box cutter. What happened next made me grin with evil ecstasy. Essentially, an image flashed through my mind. I saw myself stepping up behind this young man, sliding his box cutter out of the sheath, flicking it open, reaching around his head, covering his mouth and slitting his throat from ear to ear. Then I would simply pocket the knife and calmly walk away. Sick, eh?

The funniest part of the whole five second psychotic episode was that once it was finished, I instantly started analyzing the feasibility of the action. I found myself scanning the aisle for security cameras, other customers, obstacles that would keep my in the aisle longer than I needed to be, etc. I decided the most important part would be not getting blood on my clothes, which if the victim was held appropriately, the blood spray would not touch me, and the wiping my prints from the knife. That was the hard part. I couldn’t keep the knife because the police would most likely show up before I left. I couldn’t hide the knife as the police would close the store and tear it apart, eventually finding it. The conclusion I came to was that to effectively clean the knife, I would need to go to the cleaning aisle, open one of the cleaning wipes boxes and wipe down the knife as well as the box. I’d then drop the knife behind the boxes in the row and also clean off the box which I opened. Of course, this leaves me with a wipe to get rid of but that’s easily disposed of in a trash can or even in another shoppers cart. The final piece that would hopefully keep me out of jail would be the pure lack of motive. The only motive for the action would have been the act itself.

So, have I disturbed you yet? You know, sometimes I disturb myself. Anyway, I obviously did not follow through on my imaginings but it did remind me of a story I wrote a long time ago about a young man who worked in a toy store. The essence of the story was that the young man slaughtered all of his co-workers during the restocking period after the store closed. He did it with a box cutter and was found giggling madly in a pool his co-workers blood. It was a good story and quite disturbing all at the same time. Anyway, it’s possible the flash of imagery in the Dairy section came from the subconscious memory of that story but I really couldn’t say.

Anyway, that’s all for now!

Who would you call?

I have a rather sick and twisted mind and sometimes it comes up with the most absurd ideas. Today’s idea was this. Who would you call if you accidentally (or on purpose) killed someone and needed to cover it up? Is there anyone in your life you could trust that much? Is there anyone who wouldn’t bat an eye but would instead calmly ask where you kept the hack saw?

Now this was an interesting concept for me. I thought long and hard on what the answer would be. I have 3 friends who I’ve known since childhood and they are the closest thing to brothers I’ll have ever have. Does that mean I’d call them? At first, I thought, “Absolutely!” They’d have my back. And in the initial stages, I honestly think they would. Each of them would be there with the hacksaw, ready to go. But the more I thought about it, the more I realized I probably wouldn’t call any of them. One is too damn honest. In the end I think he’d have to tell the truth. I view this as a strength of his, by the way. Certainly not a weakness. Another would be so torn with guilt that he’d end up telling random strangers until we were all thrown in jail. Again, not a weakness. An active conscience is a good thing. The third is more complicated. I think he’d go along with whatever I needed and I also think he would keep quiet. The problem with him is that I think it would slowly break his sense of self; his sense of purpose; his belief in the innate goodness of man and himself and I just couldn’t be responsible for that. So, in the end, when I accidentally kill someone, I’m pretty much on my own. That was kind of a bummer at first. And then it got me thinking about something else. Would someone call me?

I did an intense internal audit while at the grocery store this evening. Could I live with the guilt of hacking up and disposing of a body? Probably so. It’d take some getting used to but I don’t think it’d be all that horrendous. Could I keep my mouth shut? Absolutely. There are some things you just don’t talk about and that would be one of them. And finally, would it change my own self-worth? Would it change how I view myself? Would it make me feel less of a man? Honestly, I don’t think so. I’ve got a dark side that I accepted a long time ago. One of my best friends said of me once, “Mike, everyone has a dark side. You just acknowledge and embrace yours.” It fits to a tee. I think part of it is that I accept who I am and am not afraid of what I could become.

So, would I be a good person to call in this situation? That just depends on how much I like you.

Javascript Magic w/Optgroups

A good 8 years ago or so, a co-worker of mine and I worked out how to use javascript with select objects to create a “to and from control” like you’d see in Outlook for selecting to, cc and bcc from your address book. Essentially we setup 2 selects with arrows in between. We populated to the two and then used javascript to move the options back and forth between the two. It’s a fairly straight forward process and the javascript is pretty simple once you strip it down. Since then I’ve always wanted to figure out how to do a to and from control using optgroups but have never taken the time to do so. Well, a recent project at work finally gave me the excuse to figure it out.

The requirements for this control were pretty straight forward. First, it must function in IE6, IE7 and Firefox. It should work by moving an option from one select to the other, while keeping the option within its defined optgroup. For instance, if Kansas is in the optgroup Midwest, when Kansas is moved to the other select, it needs to go in the Midwest optgroup. If the Midwest optgroup doesn’t exist then the optgroup needs to be created first. I also toyed with the idea of removing the optgroups once they were empty. I got it working but there are some odd idiosyncrasies to the way the hasChildNodes function works so I’m most likely not going to include it in my project. The final, and perhaps most important requirement, is that the tool needs to keep track of what items are added and removed from the right-hand side select. So, how do we do this?

To start, we pass in the ids of the three controls. The to select, the from select and the hidden that will be storing our values. Assuming they load appropriately, we should be good to go.


function optgroupMove(toID, fromID, addID)
  var to = document.getElementById(toID);
  var from = document.getElementById(fromID);
  var deletedOptions = new Array();
  var hidden = document.getElementById(addID);
  var index=0;

Next, we cycle over the from select. Any option that is currently selected will be moved to the “to” select. To do this, we retrieve the selected option, get its optgroup, create a new option, add it to the select and then assign the text and value to it. It may seem odd to do the text/value assign last but it was the only way to get the appendChild function to work in IE.

for(x=0; x<from.options.length; x++)
  if(from.options[x].selected == true)
    /* Create the option, add to select and then add text and value.
     * We do this because IE6 and IE7 lose the text and value when
     * added to the select after the text and values have been set.
    var option = from.options[x];
    var optgroup = option.parentNode;
    var optgroupMove = document.getElementById(toID + optgroup.label);
    var newOption = new Option();
    newOption.text = option.text;
    newOption.value = option.value;

So far, we’ve just stuck the option in the select. It’s not associated with an optgroup. But, the optgroup we want may not exist. So, we check to see if it does and if not, we create one.

    // Check to see if the optgroup exists. If it doesn't create it
    if (!optgroupMove)
      var optgroupNew = document.createElement('OPTGROUP'); = toID + optgroup.label;
      optgroupNew.label = optgroup.label;
      optgroupMove = document.getElementById(toID+optgroup.label);

Now that we’re sure that we have an optgroup we can append our option to it. We also then add the old option to the deletedOptions array, as well as the provided hidden variable, if it exists.

    // Add our wayward option to the optgroup
    deletedOptions[index++] = option;
      hidden.value = hidden.value + option.value + ',';

The final piece of the puzzle is to remove the option from the originating select. To do this we simply loop over the deleted options array, removing each option from its corresponding optgroup. This block also has the code to remove the optgroup if it’s empty. This is a bit finicky in how it works though. I’ll explain more below…

for (y = 0; y < deletedOptions.length; y++)
  var optgroup = deletedOptions[y].parentNode;
  /* The following removes the optgroup from the select if it is
   * empty. I made this optional because there is odd behavior
   * in the return from hasChildNodes if there is any whitespace at
   * all within the optgroup as it was orignally defined.  White space
   * constitutes a child node.
  if(DELETE_OPTGROUPS && !optgroup.hasChildNodes())
    var pNode = optgroup.parentNode;


The problem with deleting the otpgroups (from what I’ve gathered so far) is that the hasChildNodes function will return true if there is any whitespace within the optgroup. In other words, when you define your optgroup, it has to be on one continuous line otherwise the whitespace is reported as a childnode and hasChildNodes returns true. This isn’t an issue if you populate your select through javascript but if you do it by hand or dynamically through php, jsp, etc. you’ll most likely put the whitespace in. If you don’t, then the delete will function appropriately.

Finally, the last piece is to deselect the selects so the have no options selected.

  // Unselect all options in both "to" and "from" select
  to.options.selectedIndex = -1;
  from.options.selectedIndex = -1;

And that’s it. View/test the code. Enjoy!


Like flies to death the birds clouded the lot.
As I approached I saw an injured squirrel.
The birds were eating it alive.

A banshee scream drove back the birds.
They hopped about, waiting to feed,
Only a step away.

The squirrel’s hind quarters
Were a flattened penny
Left on the rails.

My coat, a stretcher
For a careless man’s act.
I tried to be gentle.

The squirrell shredded the coat like leaves
As it struggled
To be free.

I placed him in a bush
Where the fowls could not go.
Safe, but not safe enough.

Life w/out Cable and Tivo

Very soon my television viewing life will enter a dark and terrible phase. Due to family additions, the budget must be cut and the first two things to go are cable and tivo. I’m not sure how I feel about that. On the one hand, not having 70+ channels to surf on will keep me away from the television much more but the loss of the never having to remember when the shows I like are on is going to be hard to deal with. Granted, without the cable, I’ll only have broadcast shows to watch but there are several that I do enjoy watching. Heroes, My Name is Earl, and Bones to name a few. Anyway, I couldn’t tell you off the top of my head what days those shows are on so I’m either going to have to do some creative programming magic with the shell that is my Tivo box or I’m going to have to learn what nights those shows are on. Sigh..

On the plus side, I am adding another dvd to my out-at-a-time limit with Netflix. Hopefully that will keep my TV needs sated for longer periods. I’m planning on using 2 for movies and 2 for televison series (I’m watching season 5 of 24 right now). Hopefully it won’t be too bad. Of course, with the new little one, I may not get the chance to do a whole lot of TV watching but you never know.

Anyway, I’m going to go start my search for info on how to maximize the usage of my brick that was a connected Tivo service. Technically speaking, you’d think I’d be able to overhaul it somehow. I’m just not sure my technical skills are up to the task. I’ll keep you all posted on what I find…

© 2024

Theme by Anders NorenUp ↑