Ajax’d!

I’ve finished the first part of a web app that is used by our staff to manage our products, specifically item descriptions, features and specifications. One of our number complained that the current implementation – built on the very fine – is too damn slow.

And it really is slow. But that’s mostly because we do a post and refresh … every time we change something. Worse, I have 4 instances of the editor (!) for the four separate sections (description, item includes, features and spec chart).

How did I let this happen? How had it come to this? I dunno. Don’t ask me.

Inspiration

A couple of months ago I’d toyed a bit with Ajax to put together a fairly simple catalog ordering interface: https://www.uniquephoto.com/xm.php

(note you have to be a registered member of our site to see it, it’s – you guessed it – (Beta)ware).

I know I’m late to the Ajax party. So bear with me if I’m a little like the kid next door that just “discovered” Led Zeppelin.

So a version of this ordering interface seems to be working pretty well for our wholesale customers (different site). I thought, well, maybe time’s come to Ajax us a better back end for product management.

The Pieces

I came across Ekit, a Java applet. I didn’t let the fact the the demo didn’t work daunt me. Download was quick and painless and the included demo HTML worked pretty well and quickly, too. Documentation was a bit light, and the comments in code appear to be in German. But it worked, and had a getDocumentBody method that I could access from Javascript.

(Sidebar: I just can’t get over how damn cool that is: Calling a java method from javascript.)

I updated my Sajax toolkit from modernmethod.com. This code makes me nervous. Code that writes its own code always makes me nervous. I’m afraid it will become self-aware.

I already had the MySQL database and apache server, so we were all set!

Some Code Concepts

The editor applet exposes 2 methods that I needed to make it all work:

getDocumentBody the editor’s treats each document it works on as an individual html page – that is, it adds <html><head> etc tags. But this method will deliver only the html between <body> and </body>.

setDocumentText a way to get the information from my database into the text editors view pane.

Given a <textarea> called TextViewer in a <form> called ekitForm here’s how I get text from/ put text into the Ekit applet:

function getText()
{
document.forms["ekitItemForm"].TextViewer.value
= document.applets["Ekit"].getDocumentBody();
}

function putText(someText)
{
document.applets["Ekit"].setDocumentText(
document.forms["ekitItemForm"].TextViewer.value );
}

That’s the heart of it all, right here. Remember I had four distinct database fields: description, includes, features and specifications. I handled this by create 4 hidden input fields in my form. When I read from the database, I assigned the 4 hidden fields, and simply used the getDocumentBody and setDocumentText methods to switch between them.

Neat stuff!

Bryant’s boot gives Bucs improbable win

There is no joy in Eagle land today after Matt Bryant’s 62 yard field goal as time expired capped another bizarre game by the Eagles. No, wait, not bizarre. Poor. Yeah, that’s the right word for it. Poor.

Are the Eagles a good team? The statistics say they are – I guess. Yesterday they rolled up 506 yards of total offense; running 63 plays gaining an average of 8 yards per play.

Fans and talking heads have been complaining that third down efficiency has been poor – well, yesterday, it wasn’t. The Birds went 7 for 11, a conversion rate of 64%.

A more telling stat, though is the one called “Goal-To-Go Efficiency,” where they went 0-1 right there at the end of the first half. Not that I’m pleased to see 5 throw 2 picks returned for TDs – but just how much can I really blame on him? The guy more than made up for his mistakes and put the Eagles in a position to win. But that play at end of the first half was a complete mental meltdown on all involved parties – but, eh, I dunno who the involved parties were. Was McNabb really supposed to throw that ball? Was Smith really supposed to run a route that kept him in front of the End Zone? Coach Reid, please tell me you didn’t draw up a play that called for Smith to catch that ball.

(Side note: why don’t the Eagles ever dial up a damn bootleg down there? Or have they, and I just haven’t noticed?).

So whom to blame for this latest fiasco? – and yes, you need to call it a fiasco. Here’s why: the Eagles are making the same mistakes week after week. Poor penalities, shaky special teams, poor starts.

For those of you whining about the Phantom Mask call, you’re just plain wrong. It would be hard not to call this intentional, given the view here.

So why is McDougle kicking the penalty flag in that case? What does he think that will accomplish, exactly? Give ’em an extra 15 yards, why not?

That led directly to 3 points given away. Given away. If you’re going to blame McNabb – and you should – for giving away 14 points, then don’t you have to give him credit for getting back 21? But here the decision to give 15 yards to the – let’s face it – useless Bucs offense is unforgiveable. In one play the Eagles surrendered 30% of the field – all of their own volition.

And then again after Westbrook scored to take the lead 21-20, the special teams coverage was horrid.

Credit, though, to Bruce Gradkowski for having the presence of mind to throw the ball away quickly to allow the shot at the field goal.

Now, a lot of folks have made a Big Deal out of Bryant’s field goal, Bryant may not be known as a long field goal kicker, but the truth is, he’s never had – well any chances, as it turns out. (Thanks for asking that question, Dad!). In his first 3 seasons in the league, spanning 31 games total, with the New York Giants(27), Indianopolis Colts(1) and Miami Dolphins(3), Bryant had attempted exactly … Zero field goals of 50 yards or more. Zero!

Last year, Gruden sent him out there for Field Goals of 50 or more yards twice, and he hit once.

Oh, I forgot my original point – the Eagles are not a good football team. Good football teams do not continue to make the same mistakes week in and week out. Falling behind early, poor clock management and poor penalties are making every week an adventure. That none of these problems are getting corrected means they are not a good team.

Can they straighten this out? In 3 losses this year, the answer seems to be no. Not Good.

Link to FOX Sports – NFL – Bryant’s boot gives Bucs improbable win

Clarke, Hitch are Gone … | Moves stun but approach stays

And just like that, it’s all over. Of course it’s about 4 years late, but Robert Clarke has resigned. Ken Hitchcock’s gone with him, although less willingly.

John Smallwood wonders in the Philadelphia Daily News if this really changes anything at all:

John Stevens, who replaces Hitchcock, was the Phantoms’ head coach for the past six seasons before being named a Flyers assistant in June. He was a third-round pick of the Flyers in the 1984 draft.

Paul Holmgren, who takes over as interim general manager, has been the assistant general manager since 1999 and is a former Flyers head coach and player.

If a new philosophy is needed for the Flyers to be successful in today’s NHL, the guys taking over are still very much indoctrinated in the old one.

Now that I’ve written that, I’m thinking it’s 21 years overdue – at least. The Flyers had some of the best teams of the mid-80s, but kept getting mowed down by Gretky’s Oilers.

20 years later, we’re still getting mowed down by Speed and Finesse.

The Organ-eye-zation was built in the Image of Bobby (not Robert) Clarke. And I mean the entire franchise, up and down the line from the minors on up. We were so enamored of Clarke (some, like Ed Snider, more than others) that he got a Free Pass to let this franchise decline into one of the worst in the NHL.

While I’m sure John Stevens will give it his best, what can we reasonably expect from this odd assortment of players? Nothing this year, so I’d start Right Now rebuilding by dumping what we don’t need: Hatcher, Forsberg, Rathje, Sanderson, Knuble and Esche. We might be able to get value in return, some young fast legs.

And for once we need to quit griping about goaltending as we’ve done since Ron Hextall took us to game 7 All Those Years Ago. The players in front of these guys have looked lifeless since the Lightning and Martin St. Louis zapped us in 2004. How can it be we are even more slow now?

Link to Philadelphia Daily News | 10/23/2006 | John Smallwood | Moves stun but approach stays