Today's Joke... June 25, 2011
"I better do the lawn tomorrow before people start thinking a bunch of homeless people live here"
I kill me.
Fixed my event class June 7, 2008
Here's the updated code which should work all the time.
var EventList = new Array();
var g_eventIndex = 0;
function Event(obj, type){
if (obj._eventIndex){
if (EventList[obj._eventIndex][type]) return;
}
else
obj._eventIndex = g_eventIndex++;
if (typeof(EventList[obj._eventIndex]) == "undefined")
EventList[obj._eventIndex] = new Array();
EventList[obj._eventIndex][type] = true;
this.handlers = new Array();
this.type = type;
this.obj = obj;
this.obj._event = new Array();
this.obj._event[type] = this;
if (typeof(this.obj.addCustomEvent) != "function"){
this.obj.addCustomEvent = function(type, fn){
if (typeof(fn) == "function"){
this._event[type].handlers.push(fn);
return true;
}
return false;
}
}
this.raise = function(sender, args){
for(var i = 0; i < this.handlers.length; i++){
this.handlers[i](sender, args);
}
}
}
// addEvent(obj, "event", func);
function addEvent(obj, evType, fn, useCapture){
if (typeof(obj._eventIndex) == "number" && EventList[obj._eventIndex][evType] && obj.addCustomEvent){
var r = obj.addCustomEvent(evType, fn);
return r;
}
else if (obj.addEventListener){
obj.addEventListener(evType, fn, useCapture);
return true;
} else if (obj.attachEvent){
var r = obj.attachEvent("on"+evType, fn);
return r;
} else {
alert("Handler could not be attached");
}
}
Now it will handle events of the same name in different objects. I just didn't want to have to come up with different names for events in different objects that did nearly the exact same thing.
I was reading a bit on the internets about how people do this type of thing. I read a post on Yahoo! that said the YUI event handling mechanism is "only 2KB". This is 55 lines with liberal white spacing. The thing about computer science is that sure, there might be something out there that does what you need it to do, and you can get it for free, but it's gonna do tons of other stuff that you really don't need. Not yet anyway. Same goes for software in general. If you need a simple photo editor, you're not gonna pay $600 for Photoshop when iPhoto will do (part of a $79 package with tons of other neat software, which also is overkill if you don't need that other stuff). So, if I need something very specialized, small, and easy to use, I'll write it. If you need this as well, feel free to use mine directly or for knowledge. It's not big or special, but will be used as part of a big and special project :) That will come soon.
If I don't like something, I let it be known February 21, 2007
I can imagine a lot of things I don't like. The smell of crap, certain food, cheap coffee and most light beers, stuff like that. I haven't really not liked a lot of people in my lifetime. You'd have to really bug me. However, I don't discriminate between something that I don't like and get paid to do, and everything else. If I don't like something, no matter WHAT, I let people know.
I have certain ways of portraying my dislike for everything. If there's a stink of crap in the air, I'll either leave or spray something. I don't buy cheap coffee or light beer, and I don't buy or eat food that I don't like.
In contrast, if I love something, I indulge. Music, people, certain foods (although I have been getting just salad for lunch lately), movies, programming, everything. If I love it I will try to get as much exposure to it as I can. I've been listening to ONLY Bob Marley for about 3 months straight now. See my music post (search music for title in the filter above) for examples.
I can't imagine another way of expressing dislike. It may come up in conversation or something, and you can say "I hate crap." But really, if you smelled crap, you wouldn't just say "I hate crap" and then continue to breath in the fumes. If you don't like something, the only way to take action against it is, well, to take action against it.
There is a tough situation in there though. If you don't like something, but that something really loves you. Like, I might not like a certain person but they'll really like me. Conversely, I might like smoking and coffee, but that stuff is bad for me. This makes for bad situations.
I can't imagine how many people are in a job that they don't like. I couldn't imagine being in a job that I didn't like. You get paid for it, it takes up your whole day, you have to go against your desires and inhibitions and go to bed early in order to be on time for it, you get bossed around (unless you're the boss), you have to deal with people that are sometimes less fortunate in the intellect department, and best of all, you're stuck there until something better comes along. I don't know how to deal with a job that I don't like, except by showing that I don't like it. Acting like you would when you open a bathroom door and you are overwhelmed with crap. "OH GOD THAT WREAKS!!"
So, to my surprise, the way that I show I don't like stuff is not the way to show that I don't like a job. Apparently, you are lucky to be there. You should express your gratitude for having a job that you don't like by going against your instinctive knee-jerk reaction of displaying dislike for a job. And God forbid you do anything other than work for 2 minutes and your boss sees you not working.
Some other things you might not know about me. I'm not the best. I'll explain. I don't look down on people. Some people might show me that their idiots sometimes, but if they're in a position that requires not being an idiot, then I'll accept that they might only sometimes show idiocy. Likewise, I'm not the worst. I don't see people as being better than me. Ever. That's not to say that I'm as good as anybody in everything. That's just the simple, God given fact that "All People Are Created Equal." I hold this truth to be self evident. So, to insinuate that you're better than anyone, because that someone made a mistake (or 11), is saying that you're perfect. Ok, Perfecty McPerfect. So, when a boss shows disrespect to me, I in turn show disrespect to them. Their TITLE in a JOB at a COMPANY might say to them that they are better than me, but that's a joke. If I ever use my professional status in a stupid job as an excuse to disrespect anyone, please shoot me in the f%!#$ing temple.
One other thing, because of this, a side effect is not necessarily giving a rat's ass of what anybody thinks of me.
Remember the thing about not liking something that likes you? I didn't like this job but my boss really liked me in the job. So, in effect, my job like me. This was a tough situation, as I've said, and one that likely drew out the time that I was there. Due to other circumstances outside of my control, I was also obligated to be there longer than I wanted. Not obligated because it was my job, though. For the same reasons I'm not obligated to breath in crap and drink shitty coffee.
So, overall, the moral of this story is that I'm done with bad jobs as soon as I start them and find out that it's a job I don't like. This will prevent many headaches in the future. If it's bearable, then it's bearable. If it's a bad job, I'm f@#%@#$ing out of there.
I'm getting sh%@faced this weekend. New job starts on Monday.