Javascript tip

I was having the most unusual problem in a function that used a for loop to find selected items in a html select list. My iterator variable “i” was for some reasen ending up with a value higher than the for loop would allow.

As it turns out, if you declare a variable without using the “var” keyword, that variable has global scope.

Case in point:

function pressRemove() {
  fromBox = selBox;
  toBox = allBox;
  for (i=fromBox.length-1;i>=0;i--) {
    if (fromBox.options[i].selected) {
	  addOpt(toBox,fromBox.options[i].value,fromBox.options[i].text,2);
	  fromBox.remove(i);
	}
  }
}

The function addOpt includes it’s own for loop, also using a variable named i. That inner for loop was overwriting the value in this for loop!

...
  for (var i=fromBox.length-1;i>=0;i--) {
...

By changing all the for loops to declare their variables, the problem was solved. Personally, I think that is a really stupid “feature”, but since both IE and Firefox do it, it is expected.

Mac vs PC?

Apple is right, 100%. OS X is better than windows hands down. Expecially better than Vista.

Mac computers, on the other hand, are far inferior in value, performance, features, expandability and future-proof-ness.

All of the consumer Mac machines are either one-piece or extremely compact. Can you upgrade? No, Apple makes more money if you buy another EXTREMELY overpriced computer if your old one get too slow.

Every one of Apple’s computers were designed with form overshadowing function. They are pretty, and stylish, but they lack the things that really matter.

If OS X was available on hardware that I could control, upgrade and modify at will, (e.g. a PC) I would switch immediately. Apple could destroy Windows by doing this, and at this point it would be trivial for them to do so (research the Hackintosh…). They will not, though. Apple is well aware that their lucrative hardware sales are driven by the superior operating system, and that nobody in their right mind would pay $2,000 for a Mac when they could get the same thing for $750 in a PC.

I want to create something!

Sometimes I get it the mood to make something beautiful.

Like right now. I want to make music. Composing it would be fine, or performing. But guess what? I cannot do either.

I can hear something, and tell that it is beautiful. I am very good at analyzing music… but I just can’t create it! Nor can I play it very well. My sister has amazing piano skill she takes for granted. A song I struggled with off and on for a month to get one hand at a time slowly… she could sight read both hand at near full speed.
With practice I can get better at a song, but not at playing. When I mess up, I cannot gracefully recover.

It is similar with visual art. I wish I could express the imagery in my mind on paper (or some other format) but my hands are incapable. I can only draw well when I trace, and even then it looks like the work of a child.

I am left-handed. Doesn’t that mean I’m supposed to be more creative?

I often argue that my art is in writing code. I express my creativity through programming. But this is something very few people can appreciate – most would rather not even try.
Occasionally I can be creative with words, but I tend not to write about beautiful things.

It is a stange feeling, the desire to create. It is even more strange to be unable to.

Revenge of the spam-bot

I guess the spammers saw my totally useless complaint about spam, because somehow they managed to defeat the capcha for comment posting.

I’m guessing there was a nucleus exploit, so I have upgraded to the latest version and will see what happens.

Confederate flag = State's rights?

The argument I have heard from “open-minded” individuals is that the use of the confederate flag, or an appreciation / loyalty to the Confederacy is not so much about slavery as it is about state’s rights.

I hereby proclaim this bullcrap.

http://en.wikipedia.org/wiki/Cornerstone_Speech
The Cornerstone Speech is so named because of one section.
In particular,


The new constitution has put at rest, forever, all the agitating questions relating to our peculiar institution — African slavery as it exists amongst us — the proper status of the negro in our form of civilization. This was the immediate cause of the late rupture and present revolution. Jefferson in his forecast, had anticipated this, as the “rock upon which the old Union would split.” He was right. What was conjecture with him, is now a realized fact. But whether he fully comprehended the great truth upon which that rock stood and stands, may be doubted.

(Jefferson’s) ideas, however, were fundamentally wrong. They rested upon the assumption of the equality of races. This was an error. … Our new government is founded upon exactly the opposite idea; its foundations are laid, its corner–stone rests, upon the great truth that the negro is not equal to the white man; that slavery — subordination to the superior race — is his natural and normal condition.

I’m afraid this leaves no room for discussion. The confederacy wasn’t about state’s right; it was about slavery. The confederacy was formed because Republicans – the anti-slavery party – had gained power, and the south didn’t want to lose their cheap labor.

Rationalizing the use of the confederate flag, and glorifying the confederacy is much like doing the same for the swastika, and the nazi party.
Indeed both movements were based on the belief that one race is somehow superior to another.

The difference:
Germany has the common decency to be ashamed of what it did.
The Southern U.S. still doesn’t see what it did wrong.

Hate Spam?

I know I do. Not the meat product – I’m man enough to admit liking it – the emails.

What I find fascinating about them is that I can usually tell in under 1 second whether an email is spam or not from the subject alone. Even on those rare emails that slip through gmail’s filters. Granted, not all people have such a finely tuned spam-o-meter, but it still amazes me that spam continues to be difficult to block. It is so easy for me to tell, yet so hard for a computer. There must be a way to represent the problem is a way that is easier for a computer to comprehend… but I’m not going to waste time pondering that.

Even if we block it, spammers will still send it because it is essentially free, and guaranteed to make it as far as your mail server, and at least into your spam folder where you MIGHT look at it.

The way to significantly reduce spam is to put the filtering software at the other end. Spammers send out large numbers of emails from the same IP address (or small range of IP addresses). When these emails first hit the network, there could be “filtering” software watching for abusive emailing. My support of such a solution depends on how email works – which I am unclear about. If email works like http – where I can set up a server and the ISP does nothing beyond routing packets – then it would be bad to allow ISPs to start snooping. But if sending emails requires the use of an ISP – or somebody’s email server, then the ISP is already involved, and such a filter would be a small imposition. Done right, it could cut spam off at the source, before the complaints start rolling in.

Of course, if everybody used gmail, spammers might realize they are wasting their time.

Open Source

I have long been fond of Open Source solutions, often choosing Open Source over other commercial alternatives for my own use. One reason for this is purely financial: I simply cannot afford a personal copy of photoshop or windows server. So I use The Gimp and Linux.

Now that I am searching for a solution in a corporate environment, needs change. The company will pay for whatever solution I choose.

In particular, I am looking for a future-proof replacement for a bunch of Oracle Forms and Reports. I was initially considering following Oracle’s recommended migration path – switching to Oracle Application Server using Oracle’s java Application Development Framework.
Until I saw the licensing and support costs…

For what we need, the cost is outrageous. The fact that we have to pay a full licensing cost for the dev and production environments is unreasonable.

So I have started looking into other free or Open Source alternatives. JBoss and Geronimo are the two main Open source app servers, but there is no clear winner, nor any decent comparisons other than pseudo-religious GPL vs Apache licensing debates. I need something that will be easy to manage and diagnose. As a relative Java newbie, ease of use is the most important feature.

If I choose a commercial solution, I will undoubtedly get some kind of support from the manufacturer. After having worked with Oracle’s Global support services for two years, I can confidently declare that it is not worth $8,800 / CPU / year (and that is just the database).

But if I choose an open-source solution, I am on my own if something breaks… sort-of.

Oracle’s database is robust and feature-packed, but not if you don’t have access to Metalink (Oracle’s paid support site). Following the publicly available documentation will often run you into bugs. For example, if you try to install Grid Control on a SuSE machine, it will invariably fail if you have any environment variables with spaces, semicolons, percents or other strange characters. This information is only available through Metalink.

Searching the internet will usually not get you any better info about Oracle, because all the support info is hidden in a very expensive support site.

In the case of Open Source software – such as MySQL – all that support information is on the internet. MySQL has a paid support site, but it is generally less useful than newsgroups or forums.

My point is that with commercial software, there isn’t much support on the internet because not as many people use it, and those that do only deal with the software vendor for support. Additionally, the software vendor may consider support proprietary information, and not allow it on the internet. The only option is to pay for support.

With Open Source software, most people look to the internet for support, therefore making most solutions available to the public free of charge.

I still have not made up my mind, but I believe that ultimately free software will provide a significant cost savings.

Words?

When you speak, your words are in my head.
Not a stream of random consonants and vowels.
Not a hierarchy of nouns and verbs.
Not a set of sentences, nor a block of text.

That my ears hear the sound is of small significance;
For me to understand you, I must speak in unison
 - for a moment, despite all else, we think alike -

              Your words, inside my head.

Vote your heart

A perfect example of the corruption inherent in our election process became apparent today with the endorsement of Rudy Giuliani by Pat Robertson (television evangelist extraordinaire). Essentially, Robertson chose the candidate he believed was most likely to win — disregarding the man’s thoroughly non-christian voting record and personal life.

All people – not just those with religious agendae – should support the candidate they agree with the most. Don’t support Hillary when you agree with Obama because she is “more likely to win”; Support Obama if you agree with him. Likewise, do not support Giuliani when you agree more with Ron Paul — support the person YOU think will make the best candidate, and ignore the media, the statistics and others’ opinions. Look to the facts.

We need to support the right candidate, not the wealthiest, prettiest, youngest, or most popular.

When was the last time we had a president that did not have a priviledged upbringing?

Cable company lies

I’m quite fed up with these commercials from cable companies making claims that “cable is way faster than DSL” and “cable bundles cost less than a phone line’s services”

Charter Communication and Comcast have made such claims, and they are bold faced lies.

Where I live, I can pay $50/month for 5-mbit cable internet, or $30/month for 6-mbit DSL. Hmm… which is a better deal? Which is faster??

Here’s another fact cable companies don’t want you to know: your bandwidth is oversold – cable providers sell more service than their infrastructure can support, assuming that most people will use a small fraction of their allowed bandwidth.
Yes, you can burts 10-mbit/sec, but if you sustain 10-mbit/sec for too long, they will probably place a bandwidth cap on your account.

Right along with this, you are sharing your bandwidth with everybody else in the neighborhood – if somebody decides to “abuse” their bandwidth, it will (after a point) reduce yours. The more people who have cable internet, the less you have to use.

DSL is largely immune to such shenanigans. Your connection is yours, and (as long as you live in the US) you can use all of without fear of repercussions. You can usually run servers if you feel like it (usually explicitly forbidden by cable internet providers). And most importantly, your neighbors and you are not sharing anything*.

The catch is that DSL is not as widely available as cable internet, and in some areas, DSL is slower than and more expensive than cable. But not most!

These advertisements are false, and I don’t understand why phone companies aren’t fighting back. Cable is not inherently faster than DSL – it all depends on what service level you purchase.