Archive for May 2007


Alternative PHP Cache Problems

May 31st, 2007 — 2:32pm

Recently, Derek and I were running into problems with CGI errors on our development server for NFI Studios. We had recently upgraded our PHP install from 5.0 to 5.2, so we started looking for differences between the two.

After a brief search on Google, I came up with a German forum with a potential solution: APC (Alternative PHP Cache). It turns out that Caching for PHP 5.2 is different than for PHP 5.0. So, I turned of APC (by editing the php.ini file).

For all of you coders out there, just an FYI.

Comment » | tech

Whose Concert Is It Anyways?

May 27th, 2007 — 2:38pm

So last Friday my wife and I met up with some friends for a few drinks and a concert. The concert in question was Mastodon, an eccentric metal band. I’m not Mastadon’s biggest fan, but I do like them a lot. So when my wife and our friends decided to show up late to the concert, I didn’t object.

We got to the show around 9:00pm at the House of Blues in Orlando. We figured we’d catch the last bit of the last opener, then we’d see Mastodon. We were wrong.

It turns out, Mastodon let one of the openers, ‘Against Me!’ to open for them. So when we showed up, Mastodon was about half way through their set. We couldn’t believe it. We were only gonna see 20 minutes of who we paid to see!

Well, it turns out that ‘Against Me!’ is a really good band. They’re a punk band, which usually isn’t my thing. They’re also politically left of center, which really isn’t my thing. But they’re really good. It’s hard to not like these guys. Their stage presence is undeniable.

It was apparent that most people at the show came to see them. I’d never heard of the band before. Yet, the vast majority of people there were screaming every lyric of every song. The crowd up front chanted it’s fist to every chord, never missing a beat. It was truly something to behold.

I just picked up their live album today. It’s worth your money.

Comment » | personal

Published Javascript Errors

May 14th, 2007 — 10:22pm

Recently, I had to write some javascript for field validation of a form. I wanted to be able to create a div element to cover the entire page, then display a modal window above that describing the user’s error. This required me to know the existing dimensions of the user’s browser window.

That’s not handled the same from browser to browser. The most notable difficulty is handling users with Internet Explorer (very common problem). I wrote all of the field validation and message creating myself, and I relied on a piece of code from David Flanagan’s Javascript 5 for determining window sizes.

Everything was working fine, until someone used IE6 to test. Of course, my code failed. I went through everything, looking for the culprit behind my disdain. Eventually, Derek got involved and we started checking the code out line by line.

It turns out, the error wasn’t mine. The error belongs to David Flanagan, a well respected and published software author! The root of all evil lied in his code for determining the coordinates of the browser on the users screen.

Examine the code below:

var Geometry = {};

if (window.screenLeft) { // IE and others
    Geometry.getWindowX = function() { return window.screenLeft; };
    Geometry.getWindowY = function() { return window.screenTop; };
}
else if (window.screenX) { // Firefox and others
    Geometry.getWindowX = function() { return window.screenX; };
    Geometry.getWindowY = function() { return window.screenY; };
}

What happens when the window position (top or left) is zero? Think about that for a minute before you answer. In Javascript, the number 0 has more than one meaning, doesn’t it?

Then..
function() { return window.screenLeft; };
function() { return 0; };
which is equal to...
function(){ false;}

So when I was trying to access Geometry.getWindowX(), I get “Geometry.getWindowX is not a function”.

Here come the naysayers with their proof positive of why a loosely typed language is a bad idea. I hear what you guys are saying, and I still think you’re wrong. There’s a fix to this:

if (typeof(window.screenLeft) == 'number') { // IE and others
	Geometry.getWindowX 			= function() { return window.screenLeft; };
	Geometry.getWindowY 			= function() { return window.screenTop; };
}

Notice how I merely prefix the javascript function ‘typeof’ to my if statement? That function returns a string describing the type of argument passed to it. Just by adding that function, my code was working. It sort of ‘hints’ to javascript what type to expect from the window and document objects. It’s not typecasting, but it’s just enough to make sure that Javascript is interpreting the number 0 as a number and not a boolean false.

For you developers out there, it’s worth your while to look around and see where you’re creating eventhandlers or callbacks where your return type might not be what you want it to be.

I checked David Flanagan’s site for any listing of errata, and came up with nothing. I know this is wrong, since I’ve seen a listing of known errors before. I didn’t see a way to contact him regarding the error, so I can only assume he’s aware of it, and doesn’t care about nit-pickers like me.

That’s fine with me.

Comment » | tech

Web Etiquette

May 6th, 2007 — 3:07pm

In the last month or so, I’ve gotten in some trouble with friends who misinterpreted what I had written to them. That got me thinking about web etiquette, which is really a specific form of written-word etiquette. I usually write in the same way that I’d speak. It turns out this is a bad idea.

I found an excellent article by Bob Selden about this at lockergnome.com. I use much of that article to convey my point here.

One of the things Bob points out is how much people rely on visual and audible cues in conversation to understand the meaning of what is being communicated to them. In any type of written word, that variable is lost, opening the floodgates of potential interpretations of what you’re trying to say.

Consider the following sentence:

“You’ve didn’t give me the report”.

I interpret this as accusatory, though it may not have been meant that way. Maybe “the report”, is a laborous task that the writer doesn’t want to recieve, and is grateful for not being given. It may very well be an accusatory statement, but without the malice behind it that a reader might believe.

For those of you who’ve been to college; I’m sure you can come up with some textbook example of ways to make sure that your point is taken verbatim. However, that relys on the concurrent thinking of the reader. By assuming that using well documented rules of writing will ensure your message is accurately recieved, you assume the reader is abiding by the same rules.

Quite frankly, that can be a big leap.

The flip-side of this discussion is; if you believe someone offended you in something they’ve written, take the time to be sure that they actually have. This may sound defensive, given the point of view I’m writing this from. However, I honestly believe that unless you know someone is being rude or inconsiderate to you, give them the benefit of the doubt.

Some things are, usually, more certain cues that you are, in fact, being persecuted by someone

  • All caps writing (YOU DIDN’T GIVE ME THE REPORT)
  • Foul language (You didn’t give me the d@$% report)
  • Superlative statements (You never gave me the report)
  • Excessive punctuation (You never gave me the report!!!!)

In short:

  • Before you write: think about it (re-think if you need to)
    • If someone’s feelings can be hurt by what your writing, they probably will.
    • If what you’re saying can be taken out of context, take the time to write each of your statements so that it cannot.
  • Before you react: think about it (call someone if you need to)

The following links have some information well worth reading:

http://www.lockergnome.com/nexus/windows/2006/03/28/email-etiquette-whats-the-missing-link

http://online.uwc.edu/Technology/onlEtiquette.asp

http://www.cadence90.com/wp/index.php?p=2793

http://www.cafemama.com/etiquette.html

Comment » | Uncategorized

Back to top