Blog de Humpty

Express your heart's desire
Ego

I've been learning a lot the last couple of weeks, specifically in regards to the ego.

It started for me a few weeks ago during a team meeting at work. I had major reservations about what another team member had done and felt the only way I could express it would be construed as negative. Yet, given other realizations I've had of late I realized it was important I express myself as purely as possible. So I did and it caused the expected disharmony I thought it might. But interestingly I discovered the harmony was surface level as even our team lead had the same concerns I did, yet didn't express them until I had done so. On the whole I was very happy with myself for having spoken my truth. But in the course of doing so I believed I stepped over a line in one area that I shouldn't have upon further reflection. In the grand scheme of things what I had done wasn't hugely important, but to me it felt to be a major infraction.

I thought long and hard over the weekend after the incident about the events. Like I said, I thought I could just as well not say anything back to the person about what I felt I had done and life would continue on. But it gnawed at me, that wasn't the kind of person I wanted to be. Means very little to pay lip service to ideals, you have to live them. So, not the Monday but the Tuesday after I apologized for the specific action I took: slightly accusing of him something that wasn't entirely true. The apology was very specific as I felt I was right to bring my concerns to the team, it was only in the execution of that I felt I got a bit drunk with power, or full of myself.

The decision to apologize wasn't as easy as that paragraph made it sound though. I asked myself constantly why do so if I could get away with not doing so. No one expected me to do it, so why do it. It was in those questions that I began to become aware of, what we term the ego. It was more of an attachment to myself as being right, as if my very identity were part and parcel with my actions. In this light apologizing, consciously recognizing to another my actions were wrong or misguided, was seen as the last thing I wanted to do. It felt a death of sorts, a death of myself, a death of my identity; death of my ego. But it was an interesting questioning process, to become aware of this. That's when I began to see as separate what I once felt was one. Namely who I am and my actions. I don't cease to be by changing how I feel, think, or act.

But probably the greatest realization I think I've had to date in my entire life was how much attachment to myself as being right retards my growth. The strong maintenance of this idea is like fighting with every fiber of my being to make as little progress as possible. In certain areas of my life I readily accept and welcome mistakes and recognize how doing so enables great progress; but, sadly, these seem to be the exception than the rule. More often that which I invest a lot of energy in I tend to not want to face the idea that the direction I've been going in is wrong, that it's best to undo my previous efforts. But it is a liberating realization that, simply, I am. I am not my actions, I simply am. At any point I can change my expressions and still be me.

There is a flow to life I've been realizing. I use the term flow deliberately to evoke images of water flowing. When it flows without impediment there's an ease to things. When there's a blockage, a cessation of the ease, it is no accident. It's not necessarily the case the previous direction is still valid though, a bend of the flow might require altered actions even if we insist upon the previous direction; after all, it was valid once why is it not so now. Heh.

Unconditional Love

Depending on where this is read you may or may not have seen a previous post of mine where I lamented the decision of another. It's only important to mention now as a backdrop for this post.

Someone commented an idea of accepting the actions of others that I wouldn't make myself. Despite believing I had learned this lesson it's occurred to me since I still have much to learn. Today I was sharing a method of doing a programming task with a coworker. They appreciated the info but decided to continue doing things as they have been. Of course I really believed my way was better :) but I think by then the lesson of accepting others as they are had been sinking in. There was still a twinge of perhaps impressing my will, but for the most part I recognized my way -- despite whatever perceived advantages I see -- is just one way, a way. I was mostly happy with that. I like that I'm making progress.

I imagine unconditional love as the sun actually. Strong and powerful, but yet peaceful as well. Physically the desire to expand, to share, tempered with the weight of wisdom; a balance found.

Given this mood I found myself going through memories. People that in some way I interacted with at one point in my existence but yet no longer do now. I'm happy for them with the changes I come across. For whatever reason I decided to experience life on this planet, in this way, I'm coming to the conclusion I had a theme of acceptance. Constantly I find myself relearning this lesson, in many sundry ways. Constantly I find myself re-realizing the importance of expressing the heart, the essence of a person. In these lessons it fascinates me to discover how much there is simply to learn, the many subtle ways I doubt and limit myself without realizing it. It's quite humbling actually. Acceptance of others as they are can hardly take place until I accept myself as I am I'm realizing.

That's all for now. Hope all who've read it enjoy it. (And if not that's cool too, I accept that. lol)

Posted: Wed, Jun 16 2010 12:39 AM by Humpty | with no comments
Filed under:
Being true to yourself

It occurred to me today while mixing up a sauce for dinner why it's important to be true to yourself. This has been a prime focus of mine for a long long time now. A few days ago I was talking to a friend and I spoke about things in our conversation I don't usually talk about. Talked about changing the world by living as if it exists already, similar to what Gandhi said in being the change you seek. So then I realized the importance of expressing myself.

But it was today that the light bulb went off in a big way. I had a mock conversation with myself, which I frequently do to hash out ideas. The circumstances that led up to the epiphany aren't quite so important. But I thought, "To not act in accordance with what I feel is energetically like denying what my eyes see. If I see a brick wall in front of me I don't attempt to continue to walk in that direction, but when I act in a way I don't feel that's essentially what I do." It's quite literally a blocking and stifling of myself, no progress can be made behaving in that manner. It simply does me no good to lie to myself, to deny what I feel is true, to adopt others' beliefs as my own if they conflict with me. There's an idea in mystical realms to act on what you have been given, for thoughts and actions to be one; I think I'm starting to see why it's important. (There's also a subtle calling to know yourself, an activity I'm starting to wonder that ever ends.)

I have to say it's definitely a fascinating journey I'm having in deciding I want to live in a different kind of world. It's the awareness and synchronicities. I think about the pitfalls of religions a lot in light of my newfound desire. Highly religious people believe fervently in things they can't prove but nevertheless believe. It's the same with me, I see the parallels. But then I wonder about the heart and giving away of one's power. At one point does a person believe in a loving religion while simultaneously believing in killing, or otherwise condoning maltreatment, of other people who don't believe as they do. Fear. Fear is the mind killer. Hmm.

Oh well, back to creating my world. :)

Posted: Fri, Jun 4 2010 12:06 AM by Humpty | with no comments
Filed under:
Subconscious realization

I just remembered something today that I knew I knew, but yet didn't at the point in time I wanted to know it. It was the name of an actor I wanted to recall on the drive to work. I knew for a fact at some point in my life I had heard it, I knew of several films he had been in, but yet could only recall the character names. Off and on now for the past couple of years, when something like this happens, I make a point to exercise my memory recall by not looking up the answer and instead rely on myself. In the car ride today despite my best efforts I couldn't recall what I wanted to know, but! I have been learning more about the subconscious and I simply told it / myself to recall the knowledge and I went about my day not continually stressing over it.

It wasn't until maybe 12 hours later that out of the blue, in the middle of doing something else, I got fascinated again with remembering this actor's name. I still didn't know what it was, but it fascinated me again. I tried for a bit to remember and then set it again as a task for my subconscious. Maybe 2 hours later while eating an orange I remembered it!

What really fascinated me was the absolute surety I had, I didn't have any doubt at all that I had recalled the correct information. It was as sure as any other conscious fact you recall. By itself this little exercise is neat but it's way more interesting to me because of how I got the information and the ramifications.

You know how philosophers like to pose questions of dreaming and being alive, that's where I'm headed. The idea of the unconscious, subconscious, and conscious; different ways of denoting you. Perhaps it should've always been obvious to me but I as an individual really am fragmented between those three facets. However many facets you could count doesn't matter to me so much as the fragmentation itself, the split between the conscious and something else. So the philosophical question I alluded to earlier is what is reality? Is it consciousness and the waking life, dreams? Why pick and choose, perhaps they're all real, different ways of perception.

In modern views of science dreams are neurons discharging themselves at night, storing long term memories and other tasks, your brain forming a narrative of this activity. I don't deny it, but why not explore. Atheists would retort but why not explore the reality of the flying spaghetti monster while you're at it. :) Awareness of this view is where I willingly diverge from modern science.

As I've aged I've become more aware of non-tangible things: intuition, hunches, belief in myself, whatever you name it. The key thing is, like the surety of knowledge from my earlier memory experiment, is the surety. Something I feel strongly about despite the lack of a reason. I've tested these feelings whenever they've come: followed through at times, denied at times. For myself this other sense has become as valid as the classical five. There is still the questioning, the reaching out with my hands to touch and verify what I think my eyes see. There's also the growing realization this sense operates in its own way, a different way, but yet it's there. So as for the flying spaghetti monster I simply have no strong desire to believe in that, this sense isn't abstract like that, it is as specific as the eyes seeing this and not that.

In any case the events of my life, the attractants of my thoughts, have led me to me. Dreams, the unconscious, the spirit as a shuttle, how do I determine what is real and not, must a dream necessarily not be reality, what is reality, how do I keep from losing myself, how do I even know myself. Lots of questions, pretty exciting to begin exploring the answers. :)

Know yourself

Interesting interesting interesting day at work today! I learned something! Or I should say I'm learning something. I'll explain.

The Setup

On the team I'm working with I've been moved to a part of it responsible for improving the app we're working on, in a more long-term or substantial way. There are three of us. One of us has been designated the leader of this subsection of the team, and that one of us isn't me. :) However, our leader had some rather ambitious plans for improving the app, namely rewriting it by starting with the user interface first. This application is huge, requiring seven people to support it, and yet we still have issues dealing with it. So suggesting a rewrite in the manner our leader was suggesting was seen as foolhardy by practically everyone but him. So even though the leader is a full-time employee and I'm just a contractor, I made my feelings known to him and to the rest of the team at our group meeting.

Since pretty much everyone was in agreement his plan was crazy he was told to mostly abandon his approach and adopt a more modest phased approach. Although I'm not the leader of our group I am the only one of us who has worked on the app in a substantial way. I saw the pitfalls in our leader's plan because, although he's the leader, he's never really worked on the code and didn't fully grasp the scope of what he was trying to accomplish. So what this means is that I'm sort of a power behind the throne. I actually feel I should be in charge simply because I understand what has to be done better, the other guy on the team agrees. But I'm comfortable with the way things are: I express myself and make my feelings known so I'm happy.

Meanwhile a new member of the larger team has been causing a bit of a ruckus. He's a smart guy, I can tell, and I'm pretty sure he can teach me some things. But I think he's afflicted with the condition of many new people joining a team: I'm going to fix everything my way regardless of whether or not I realize the impact of my decisions. Three times now he's been caught modifying code outside of the scope that he was asked to look at. Two of those times resulted in runtime errors in code that previously worked, the other was a refactoring of a major section of code only weeks away from attempting to go into production. Although he's smart and knows a lot I really wish he would stop "fixing" things. He was asked by our team lead, not the same leader I mentioned above, to back out the changes he made in all three instances.

That refactored code he was working on has become his pet project. No one's asked him to do it, he's just taken it upon himself to make the code better. So even though he backed his change out he just checked it in to a different part of the source code tree. So today was a slow day at work: it's warm out – 90 degrees, yay! – all the various leaders are out, meetings canceled, you get the idea. So I get a message from the guy that he's checked in code to the area our small subsection of 3 people has been using! What in the world, you did what!! Why!? He's also noticed the code won't compile and offers to fix it.

I told him no we don't need your help to fix the code since we know it's broken already. And it's broken for a reason, namely our leader is out and left it in an inconsistent state thinking it wouldn't matter since no one but us 3 would be using it. I'm actually glad he asked before "fixing" it because he has become known for just doing stuff. But I was pissed about the code he checked in, his pet project again. I told him he needs to communicate more. It is very disruptive when you're working on something and things just start changing when you don't expect them to. He's definitely of the tact of doing something first and asking forgiveness than asking for permission the first time. It's a tactic I've used myself when I felt what I wanted to do wouldn't be approved but I thought it was the right thing to do.

The Score

Here's where the lessons begin to come into play, everything else was just preamble to give meaning to this. Because this guy asked me if he should back out his changes I felt I had power. What complicated my decision was my personal feelings against him. He reminds me of myself actually. I've been in his shoes, I've done things without telling people until I was done, and saying no was more difficult. I knew what I was doing and I can tell he does too with his latest action. I undermined our 3-man team leader in that group meeting, and to his face – or voice since he doesn't work on-site – and I felt this guy had undermined me by checking in this code. It's not "my" code actually, it's the company's, but the kind of work we're supposed to be doing isn't his domain. It once wasn't my domain either but that didn't stop me from sending emails to the people whose domain it was suggesting things. Eventually I got moved to this part of the team.

So in the moment he asked me if he should back out his change I knew I had a dilemma. Go with personal feelings or the wider view? I don't think I've ever been in this position before, a position of power. I know he feels as strongly about his pet project as I did about mine in the past. I was honest with him and told him the other team members should be consulted before a decision was made, but that personally I feel he should back it out. In this situation I actually think I'm justified in saying so because our work is going to be disruptive on its own to the main team, tacking his on top will just add more uncertainty. His work needs to be done, just not right now.

I've definitely learned in recent days I have issues with people who act like me. Not just this guy either, another guy on our team. It's more than interesting the people I have issues with… Aside from that is the lesson of power, and responsibly and compassionately using it. Although this was just one small incident I think it has a lesson for me, prompting me to orient my thoughts in a certain way, consider things I might not otherwise consider. I wouldn't mind being a team lead one day myself, and having power I'd want to use it wisely. Having to face myself and my motivations today was definitely humbling; but I think I did okay.

Know yourself.

Stymied Energy

I've been working on the latest version of a software project of mine for a while now, and having great fun doing so! But because of the need to do things like working to earn money, a lot of times I have to ponder how to design something in my head while driving, walking to work, shopping in the supermarket, etc. Usually the gap between settling on a design and coding it isn't that great. But last week I hit a point where all the questions I had about a design ended and all I could do was code it, yet I didn't have time or energy for it.

It was interesting to notice how a lot of my exuberant energy lessened as more time went by that I didn't act on what I had created. It made me think about the phrase "use it or lose it", but it especially made me think about the idea of not acting on what you know, in a spiritual sense, in a power sense. One of the reasons I write this blog is to note interesting things that I can't place in a larger context yet. One of these interesting things – which I haven't blogged about – concerns life.

I came across a statement that, paraphrased, went something like, "Life will extend by its own volition". Recently I've found myself fascinated by another idea concerning human lifespan, that it's optimally around 900 years. The reasons given for our present-day average of 70 – 80 years is that we live inharmonious lives. All 3 ideas expressed here: 1) stymied energy, 2) lifespan being a function of will / desire, and 3) we live much shorter lives than capable; seem to swirl together. It's an interesting thing to ponder: that we die as soon as we do, relatively speaking, because our life force is in some way stymied. We don't live our truths. The creative boundless energy of youth gets stuck, unable to progress, because we don't move forward and act on what we feel and know. We don't race shopping carts down the aisle because adults don't do that, haha.

I do find it very fascinating how thoughts can be attracted to things. Not in a superficial way, but long term. Those topics around which your thoughts orbit. I love life, hehe. :)

Posted: Mon, Mar 29 2010 9:50 PM by Humpty | with no comments
Filed under:
Power

So I sit here inspired enough to write again! I've found the things I say tend to be more meaningful when I wait until the feeling comes.

Lately I've been watching old TV shows via Netflix. Old as in, say, 1999. :) Time does fly, huh. Roswell was the show I never got around to watching during its original run on TV so it was nice to fulfill a dream and take a stroll down memory lane at the same time.

One theme of the show stuck out to me. It's one I've seen in many many stories, whether told via the medium of audio/visual, print, or aurally. Power. Some want it. They want it so much in fact it becomes a right for them. What's yours should be theirs by virtue of their desire. :) Not a completely foreign idea to most, the desire to want. What was interesting about Roswell was to see the motivation of those who not only desire but desire to keep all others away. Greed.

As a kid – okay and I admit sometimes as an adult :) – I've desired some special power: invisibility, super this, super that. Lately the question of why has popped up. What purpose would it serve. The benefit lies solely in its lack in others. What good is super this and that if everyone has it, it's no longer super, no longer special. It's a never ending chimera, a pot at the end of the rainbow, chasing something that will always be… just out of reach.

Posted: Tue, Mar 9 2010 11:40 PM by Humpty | with no comments
Filed under:
One word

I was composing an email to someone yesterday and at the end I hesitated about writing something. I was trying to figure out if I should say it or not, make up some excuse so I wouldn't seem so bad in the eyes of the other person. And then it just hit me, why not just write what I feel? It makes me laugh a lot now but it really was just a sudden epiphany: just tell the truth. Not a command or directive, it really came in the guise of a question.

I ended up just saying how I felt, or really the core of what I felt. But in the moment that question was posed to me I felt alive, excited, joyful, exuberant. Recently I've mentioned wanting to live my life in a certain, rather inchoate, way. But in that moment I knew exactly what, or where, that way was!

I don't want to pollute the feeling with too much intellectualizing. But if I could describe it it would be like looking at a scene you've seen your entire life and on a whim you decide to look at it cross-eyed instead! And lo and behold you see something totally different than what you've ever seen. Just like those Magic Eye images. Pop! Right there in front of you, a new way of seeing things. Been there the whole time, just had to look at it in a certain, intentioned, way.

Before I let my heart end its excitement about this and let my mind take over I do want to say I enjoy the visualization of the heart as a compass. It is a lot like that. It doesn't just draw your attention to things, it also attracts those things to you. Magnetism.

Okay, so now I can intellectualize. *(^O^)* It was eye opening to be in front of that question: why not just say what I feel. I had to think about the reasons and motivations for lying. And they are many and varied. But typically my answers revolved around saving face, fear of losing another's love or affection by openly revealing myself. But why not just say what I feel? Haha, such an honest and simple question.

Posted: Mon, Feb 15 2010 10:05 PM by Humpty | with no comments
Filed under:
Writing efficient SQL article

Writing Efficient SQL: Set-Based Speed Phreakery

Just read a fantastic article that dissected some SQL code that generated a running total report over a million rows in less than a second; thought I'd pass it on. Even if you're not "a SQL guy or gal" I think it could be of benefit, if nothing else for learning the techniques summarized at the end of the article so you can use them in other environments.

If you do decide to follow along with the article to better understand everything but don't have the tools necessary to do so, don't fret! I used SQL Server 2008 Express Edition. After you get it setup you can download the sample data via links in the article. And since they don't explain how to actually import all that data – assuming you go for the million row sample data download – use the bcp command.

  1. Create a database on your newly setup server, name it whatever you want.
  2. Create a new query window and issue the CREATE TABLE command from the article.
  3. Now you can use bcp (Bulk Copy Provider?). From a command prompt window type something like the following:

    bcp Play.dbo.Registrations in registrations.bcp -S humpty\sqlexpress -T

    Where Play is the database name I used and humpty\sqlexpress is the server name on my machine. Just press enter at all the prompts you get asked until the import starts.
Posted: Sun, Feb 7 2010 4:40 PM by Humpty | with 2 comment(s)
Filed under: ,
Mimi Rogers likes the fish

So did I ever tell you the one about the fish out of water who walks into a bar and orders a Bloody Mary? No? Ha, that's because I never knew a fish that could hold his liquor, let alone walk into a bar to get it. But what I do know is I have an itch to scratch by writing.

I had an interesting Monday this week. I was shopping in the grocery section of the grocery store when a bundle of kale fell to the floor. I thought someone else would pick it up, surely not me, but it landed in front of my path so I picked it up. Later I realized I forgot to get something, and as I decided to go get it a head of lettuce fell down in front of my path. This time I was delighted to pick it up. Honestly I had the impression someone was trying to communicate with me. Sound crazy? About as crazy as a fish boozing it up. But I'm cool with crazy. I'm rather settling on the idea limiting my thoughts to the mold of others isn't very exciting, nor fun.

So why would I think someone is trying to communicate with me given what I experienced? Just a thought, nothing more. But thoughts are things, and entertaining. One thought I like is of them being like magnets, drawing things to themselves; a thought form. Given that thought one should pay attention to what thoughts to entertain and be entertained by. :)

But the deeper thought is a desire to live my life a certain way. Almost like putting paint to canvas, or in my case code to file. My desire is getting more fleshed out, less vague. That Atlantis post attracted me and stirred something. I don't really like the way modern society operates. I was reading once where someone described modern humans as like rapists upon the Earth. We bend it to our will: blow up mountains to get at resources underneath, dirty rivers in order to continue the opportunity to blow up more mountains. The idea of working with the Earth seems so foreign to our mass consciousness.

I like the idea too of working in harmony together. What is the purpose of work? To get money to buy food and shelter? To get money to then get into debt to buy more stuff? Couldn't we simply give each other what we needed or wanted? No, because we're rapists. We want more and more, never satisfied. Why ask for one head of cabbage if I can ask for two, or three. Why tend to a garden if this other guy will just give me stuff, for free!

There've been utopian visions before, even fully acted upon, only to fail.. :( Human nature is too rapacious at times it seems. But yet I desire; without the thought there is no form, no nothing. I know in my heart it's possible.

Bizarro World

This country is crazy. Just read how Obama is going to start being concerned about the middle class again. Did it really take the loss of Edward Kennedy's seat to a Republican to bring about this sudden change of heart? Obama, did you think your actions concerning the middle class were sufficient while you were busying yourself supporting Bush's bank bailouts and trying to sell us out to health insurance companies? I appreciate your newfound concern Mr. President, I really do, but your previous actions demonstrate the kind of policies you'd prefer to pursue.

The thing that gets me the most about this whole mess is how much money there seems to be available for fighting wars, but when it comes to helping Americans suddenly the country's tapped out. Domestic programs get cut while the war in Afghanistan gets tens of thousands of new troops. Seriously, how crazy is a country that so enthusiastically supports war on foreign soil but cares so little about its own.

"These become the elite. Through these, the attempt begins to create a condition whereby the remainder of the planetary entities are enslaved by their free will."

The people I can't get are those that support decisions like the Supreme Court's to allow corporations to spend unlimited amount of money on political campaigns, because of free speech. The beneficiaries of this money I can understand being excited, they're greedy. But the people who won't get any direct benefit from this, the people who are far more likely to be harmed by this ruling, I don't get their support. Screaming and shouting about defense of free speech, really? The same corporations that admitted to lying about the addictiveness of smoking, the links to cancer, these are the corporations you want to empower to be able to spend money on political candidates? Am I living in bizarro world! You want to support a foreign owned company spending money on a candidate that'll support laws favoring their country to the detriment of the U.S.? Free speech, really?

This whole left vs. right, liberal vs. conservative fight isn't getting this country anywhere productive. While we fight it out over abortion, gun laws, or any myriad of social issues our pocketbooks get lighter and lighter while prices get higher and higher. Bank fees become more numerous and punitive. But hey, let's argue about something else instead.

Posted: Mon, Jan 25 2010 11:00 PM by Humpty | with no comments
Filed under:
Geeky programming stuff

So I'm still working on LastTab 3. Yeah I know I mentioned this in late 2008, but a sudden impromptu job search last year shifted my energies elsewhere. In any case I'm back to it. I'm actually not going to talk about LastTab specifically but a few cool things I discovered this weekend I want to share.

Consolas programming font

So I installed Visual Studio 2010 beta 2 and discovered it looks pretty sweet. Specifically it was that damn font that took my breath away! A quick trip to Tools -> Options -> Environment -> Fonts and Colors revealed the name: Consolas.

Consolas font

Apparently this thing has been around for a few years now but I'm just now learning about it. According to Wikipedia it's available as of Windows Vista / 7 or Office 2007, it's also a download from Microsoft if you use Visual Studio 2005+. I have ClearType enabled on my system and apparently you need this or it looks like crap. Not only that I've heard it looks its best on Vista or 7, not XP. But if you do have all of that this font looks good! Not even that but I also got back more editing space. Using Courier New I could only fit 159 characters of text x 48 lines, now I can fit 182 x 51.

JavaScript Closures

The other thing that got me jazzed enough to write is my ever increasing use of closures while writing LastTab. I've been using object notation to write the code ever since its inception, way back in 2004. In case you're not familiar with it it's simply this:

var object = {
property1 : value,
property2 : value
};

It's used all over the Web to keep variables and functions nice and tidy so they don't interfere with other scripts. With LastTab 3 I'm rewriting everything and I have a good deal more objects than the 2.x series. Not just that but I'm emulating as best I can object orientation: classes, inheritance, polymorphism, private members. Closures have been instrumental to this. Not always specifically to enable OOP but closures make it much nicer. Below is some sample code to illustrate this:

let LastTab = function() {
/******************** Classes ********************/
function Delegate(thisObj, func) {
return function() { func.apply(thisObj, arguments); };
}

function List() {}

/******************** Class Definitions ********************/
List.prototype = {
get Enumerator() {
for(let i = 0; i < this.length; i++)
yield this[i];
},

Add : function(item) {
this.push(item);
return item;
},

Clear : function() {
this.splice(0, this.length);
},

Contains : function(item) {
for(let i = 0; i < this.length; i++)
if(this[i] === item)
return true;
return false;
},

Find : function(predicate) {
for(let i = 0; i < this.length; i++)
if(predicate(this[i]))
return this[i];
return null;
},

FindIndex : function(predicate) {
for(let i = 0; i < this.length; i++)
if(predicate(this[i]))
return i;
return -1;
},

Insert : function(item, index) {
this.splice(index, 0, item);
},

Remove : function(item) {
let index = this.indexOf(item);
if(index >= 0)
return this.splice(index, 1)[0];
return null;
},

/********** Infrastructure **********/
__proto__ : new Array(),
constructor : List
};

return {
Delegate : Delegate,
List : List
};
}();

I left out a lot of code but what I have is just for illustrative purposes anyway. In the code LastTab is a variable, using JavaScript 1.7's let statement, and I'm assigning it a function. Or so it seems until the very end when I execute said function and the return result is an object using object notation. It's a style that jQuery and other frameworks use.

What's the point you ask. Well the whole thing is a closure so all the code within that anonymous function is free to talk to all the other code in the function, even though users of that LastTab variable only see two properties on the object: Delegate and List. You can have private classes essentially. Another useful consequence of putting everything in a closure is that it then effectively works like a namespace. Instead of me having to write LastTab.List all over the place I can simply say List.

with()

Namespaces segues into another interesting thing to share. Using closures to emulate namespaces is one of the nice benefits / side-effects of using them, but it's limited to just the code within it. If you find your codebase ballooning into the thousands of lines you'll undoubtedly want to put some of that code in other files to make it more manageable. That's where the with keyword can come into play to again simulate namespaces.

Now I first learned about JavaScript closures from Douglas Crockford and more so from this article. Douglas Crockford is a smart guy but one thing I was a little puzzled about was his branding the with keyword as evil. The crux of the argument is you don't really know if the variable you're using within a with block is attached to the object you specified in the with statement or not. Basically you can shoot yourself in the foot without knowing it. I will agree to that but used carefully the with statement is tremendously useful.

with(LastTab)
with(LastTab.Services)
{

LastTab.Focusing = function() {
/******************** Classes ********************/
let Focuser = {};

/******************** Class Definitions ********************/
Focuser.__proto__ = {
Load : function() {
gBrowser.mTabContainer.addEventListener("TabClose", new Delegate(this, this.OnTabClose), false);
gBrowser.mTabContainer.addEventListener("click", new Delegate(this, this.OnTabBarClick), false);
gBrowser.mTabContainer.addEventListener("mousedown", new Delegate(this, this.OnTabBarMouseDown), false);
}
};

return {
Focuser : Focuser
};
}();

}

In the above code you see the Delegate class that I defined within the LastTab object being used. You only know it's really LastTab.Delegate because you've seen the code above. But that is the point. If you're writing your own code or examining the object library of someone else's you know which objects are in particular namespaces. If you get it wrong you get an error.

With JavaScript getting it wrong often times won't throw an error, it'll simply create the object! Well not always, but it's easy to shoot yourself in the foot without realizing it. With Java and the .NET Framework everything is a class and every class is in a namespace. That means at a minimum to call a class method or property you have to write something.something in your code. If that something isn't really a part of that other something you'll get an error, even in JavaScript. If you follow a similar discipline in JavaScript you'll never run into the problems in using the with statement.

So up above in the code LastTab.Focusing is being used by me as a namespace declaration; and Focuser is a static class within that namespace. If LastTab doesn't already exist I'll get an error, even though the code is within a with block. Now if I left out the LastTab part then I would have created a property on the LastTab.Services object and ended up with LastTab.Services.Focusing, not what I wanted.

All in all I think the way I'm using closures is pretty neat and is making the code more maintainable. I'm using with() to simulate the using statement in C# and closures to approximate the namespace statement. Things will probably change as I continue developing, but felt like sharing all the same.

Posted: Sun, Jan 17 2010 11:08 PM by Humpty | with no comments
Filed under: ,
Visualizing Harmonics

This was too neat not to share. It's a video demonstrating different harmonic nodes from salt vibrating on a table.

Posted: Mon, Jan 4 2010 8:33 PM by Humpty | with no comments
Filed under: ,
Atlantis

"not to build into the physical vehicle its ending would be counterproductive to the mind/body/spirit complexes therein residing, for within the illusion it seems more lovely to be within the illusion than to drop the garment which has carried the mind/body/ spirit complex and move on"

It occurred to me today, and lately, that to a large degree I never really just come out and say what I mean or what I think. Were a Mack truck to hit me and cause me to depart this life, no one would really know all the kookiness residing upstairs.

I've thought about life in the form of a game for many years now. Imagine if you could live whatever kind of life you wanted as often as you wished. How boring it would become I imagine to do everything the right or proper way. If you've watched the movie Groundhog Day or the "Window of Opportunity" episode of Stargate SG-1 (season 4, episode 6) then you'll have an idea of what I mean. Sometimes when I play a game I have no intention of winning, I simply want to see what'll happen if I do such and such. "Will I die if I jump down that pit?" "Where exactly are all the gold coins?" "I'm just in a pissy mood and wanna blow some shit up man!" In the context of the game of moving towards the objective I might be playing "wrong", but it would be fun. :) What if I've already won the game and simply want to go through it again and admire the scenery.

Something I've thought about as well is Atlantis. You know that mythical land that couldn't possibly have existed. Well I seriously believe it did. Sound crazy? Perhaps, but you don't get far always playing it safe. What attracts me the most is the rational acceptance of supposed irrational phenomena. The boundaries of science continue to expand, things within the known and understood portion of this boundary are rational, things outside it, irrational. Irrational that is until the boundaries include it thus making it suddenly and instantly rational. Kinda funny when I think about it really.

I've always been drawn to both scientists and mystics, believing the two could safely intermingle. It's an interesting thing to consider mystics. More especially the ones that fit into religious molds. To be any kind of mystic you have to believe fairly strongly in things that can not be proven, the irrational. But what I find interesting are the ones who deny even the things that can be proven, the rational. It's the opposite of the extreme rational scientists, who don't believe in anything outside of what is known. The extreme mystics believe entirely in what they believe, even unto the apparent conflict with consensus reality. God(s), demons, angels, all these are real to the mystic. Why? Because they believe so, simple as that. Both extremes susceptible to stifling, self-fulfilling prophecies that invite little growth. Both would do better to make love than war.

But back to Atlantis. Personally I've never felt completely right about the world. Nothing ever really seems to make complete sense. Hard to put my finger on since it's just a feeling. There is and always has been more than meets the idea to this world. Something out of reach, but just so, only just so.

Back to back life lessons

This is more of a "write it down so I don't forget it" post.

I had a dream today that I learned something from. I'm actually a bit amazed at that since I haven't often had dreams that convey a life lesson. But in this one I found myself the recipient of a gift as part of a friendly gathering. In the course of the gathering I got into the beginnings of an argument with the person who gave me the gift. But instead of staying and arguing I decided to politely recuse myself. I did that for the sole reason of trying to be nice. In my waking life I have the same tendency, to withdraw from situations involving conflict. But what I learned in the dream is how that isn't always the best response. Removing myself from a situation prevents me from making any headway in regards to learning. Not just about the subject matter being argued about but gaining life experience I can use to better myself. In the dream I regretted leaving and not continuing to argue with the person because I was beginning to realize how the same intensity that helps me in other areas, say writing software, isn't quite so useful in regards to personal relationships.

The other thing I've learned recently concerns my cat, forgiveness, and in general the letting go of deeply felt feelings that in some way I've discovered don't serve me well anymore. I'm not going to get into what my cat did to prompt things because I don't want the focus of this post on that, but I'll say she did things to piss me off thoroughly and perhaps your imagination can fill in the gaps. But after all that she made motions to be petted and meowed to be near me. The magical moment is when I dropped my wall of anger and liked her again. It was a split second realization that the initial anger I felt had run its course and no longer needed to be expressed. So continuing to do so was making it detrimental rather than being an honest expression of feelings like it initially was. That realization, small as it was, is at the core of forgiveness it seems. I've actually noticed quite a few areas in my life where I choose to push and accentuate the anger I feel long past the incident that prompted it. It's an odd thing really. It's like there's an attachment that develops betwixt the anger and myself, so letting it go is like saying...I was wrong. And we can't have that, now can we. :P

Posted: Wed, Dec 16 2009 7:48 AM by Humpty | with no comments
Filed under: ,
More Posts Next page »