Getting old: Band battles are for kids

Jason writes about Battle of the Bands and how he and Goaty (the wife) studies the kids.

Goaty had a good time identifying cliques and social heirarchies in the
various fast-moving packs. I had a good time watching the performers
pull out moves they had obviously perfected in front of basement
mirrors – guitars were flying, fists were pumping, sticks were
twirling.

Go read the whole thing. And, while you’re at it, consider reading the man’s feed. He has a grip on his prose that I envy.

Skype creates extra stuff, viral marketing

Some of the genius of Skype is their very open attitude to their corporate story. People like telling it, and it is “viral-enabled” already in itself. My Dad can tell it to me.

But when they also create very easy-to-use buttons and widgets that people can add to their websites, and put a great deal of effort into these, then they go above and beyond the regular “give ’em a banner and sell ’em some t-shirts” mode.

Now, with their 2.0 Beta features (of which Video is the main one), they get to redefine what a webcam is, and how to use it in one’s daily life.

A very nice feature that was talked about was pre-loaded USB phones that had a RAM on them, so that I could have my Skype account, Skype software and everything Skype on that phone/headset, and take it with me when I travel. Or change rooms. Or change computers. (Hm, will that flash RAM have Mac, Linux and Windows software on it? Probably. But in reverse order, as that is the release plan for Skype.)

Skype changes people’s minds about stuff. I might even get a webcam.

See you.

More useful JS: Prototype revisited

OK, for those of you watching from the sidelines, remember when we talked about the Prototype framework, and I said it could be done slicker? I am now correcting those little errors.

First of all, I was not using enough parts of Prototype, and so I was doing unnecessary stuff, and also, I was leaving empty `` tags in the DOM, not removing them like I should.

Continue reading “More useful JS: Prototype revisited”

DHH handles trollish comments well

Yeah, [Ruby on Rails is 1.0](http://weblog.rubyonrails.org/articles/2005/12/13/rails-1-0-party-like-its-one-oh-oh) Someone comments on the project’s website running PHP:

> How’s this deployment of PHP based “RoR website” related to believing in your own technology, I ask?

And the project lead answers:

> We’re running PHP, Python, Perl, and Ruby on this machine. Picking and choosing for whatever task is a good fit. For just doing includes with a few parameters? I love PHP. For running great applications like Trac, I’m more than happy to have Python installed.

> For home grown applications, like Hieraki, Typo, and i2, of course we’re using Ruby on Rails. Being passionate about something doesn’t mean throwing out everything that came before it.

I like that. Prag[matic]!

Prototype grows on me

Usually, these days I add a comment to a Delicious link, building on the mountain of metadata of the commons, but this calls for more verbose plappering: Prototype Meets Ruby: A Look at Enumerable, Array and Hash from the [Encytemedia blog](http://encytemedia.com/blog/), written by Justin Palmer.

The [Prototype](http://prototype.conio.net/) Javascript framework implements a lot of the “language features” people scream about: `each`, `collect`, hashes, `inject`, `include`, `findAll`, `detect`, and `invoke`. Mr. Palmer has dug up Prototype author Sam Stephenson’s test cases, and learnt a lot from them. He links to [the test cases](http://dev.conio.net/repos/prototype/test/), and urges you to read them, if improved Javascript using Prototype interests you. Palmer’s explanations are worth their weight in gold, though.

Looking at the code, I predict that future Javascripts will become so much shorter.

Thanks, Justin P.

*PS:* [The unittest.js](http://dev.conio.net/repos/prototype/test/lib/unittest.js) is also linked from the enumberable test case. Readable code.

Useful Javascript: Prototype for your forms

Proposed subtitle: “Ease into Prototype.”

You started using the [Prototype JS lib](http://prototype.conio.net/) everyone was talking about. Everyone was doing AJAX stuff, animating little boxes, and you did not have the time for that. You had a day job.

But then one day: a use case appeared. You inserted some stuff in the HTML, in a form validation. This was the form:

`
` `` `` `` `
`

You had decided! This form was to be checked and validated using some neat JS stuff in Prototype. You included it:

``

And in the Javascript function `check_this_baby()`, you had this:

  `  var labeltext = "Fill that out, too!";`
  `  if (!Field.present("idcity"))`
  `{`
    `new Insertion.After('idcity', labeltext);	`
  `}`
  `if (!Field.present("idstreet"))`
  `{`
    `new Insertion.After('idstreet', labeltext);	`
  `}`

See! It does an INSERTION of labeltext, after the element with given ID. But only if there is anything present in the fields with given ID. (The Field.present() can even return true/false when given a list of elements! I love that little guy.)

But the next time you activated the above, the page wrote the labeltext again. `Fill that out again!Fill that out again!` Looked bad.

So you add a class to the STRONG element:

  `  var labeltext = "Fill `
  `that out, too!";`

This enabled you to use the new `getElementsByClassName` thing of Prototype. It returns a list of elements that have given class name on them. We did this to remove the labeltext text before looking at the form again:

  `var lbls = document.getElementsByClassName("removable");`
  `  for (i=0; i

As you can see the Prototype library does a few things Just Right. Read the finer details at the [Unofficial docs for Prototype](http://www.sergiopereira.com/articles/prototype.js.html).