No Mod Required

Archive for the 'sport' Category

Say Hello to JavaScript’s Native getElementsByClassName

With the recent release of Firefox 3, we’ve now got a full fledged, mainstream browser that supports the long-awaited, often replicated, getElementsByClassName method. This is good news as we’ll all be just that much speedier as we ditch the various helper functions and go right into the browser for that functionality.

The thing is, the transition, when we’ll finally be able to make it, isn’t a one to one swap. In fact, depending on what you’re using it for you could run into problems transitioning from a helper function to the native method.

Why? Well, the native getElementsByClassName returns a NodeList and the functions an Array. This is a fundamental point as a NodeList, while it has a length and can be accessed by a numerical [index], isn’t an Array. One major difference, and the one that might cause serious problems if you’re not careful, is that it’s live. It doesn’t merely grab the returned value at the time of invocation, it updates its members as the document changes over time.

Here’s a simple example where I run the two versions side by side. Click start and both functions will count the number of “sample” classed elements in the document. A couple of seconds later I simply copy the innerHTML of the container DIV, doubling the number of “sample” elements on the page. As you then see a couple of seconds after that, the native code notes the adjustment to the document, the helper function does not. The counts are different.

Check it out (assuming you have a browser that supports getElementsByClassName):

Why is this important? Well, I don’t know about you, but in doing dynamic effects I often attach classes to elements so that (a) I can add effect-specific styles to them (duh) and (b) I can remember what state they’re in when I next run the function. A lot of times when a function is run I’ll take a snapshot of that collection and run some code like this on it:

var currSelected = getElementsByClass("sample");
		for (var i=0; i<currSelected.length;i++) {
			removeClass(currSelected[i],”sample”);
		}

Which ensures that I’m starting with a clean slate by removing class “sample” from every element.

This is where it gets tricky. If I did that with the native getElementsByClassName I would get a weirdo result that looks like this. Click start and run the above code with getElementsByClassName in place of the helper:

For those of you without a compatible browser here’s a screen shot of the result:

With the helper function there would be no blue borders. Since getElementsByClassName is a live connection to the document, both the length and the elements at each index CHANGE as you remove elements from the document.

The reverse would be even worse. Adding classes to elements based on getElementsByClassName would create an infinite loop, since i will never be less than collection.length. Every time you add a new class the length increases by one and the loop never ends.

What does this all mean in practice? I’m thinking I’m going to keep my old reliable getElementsByClass function (or a variation that leverages the native method but returns an array “snapshot”) and selectively use the native method where applicable.

#17

“Talk of the Town” indeed.

celtics seventeen

And the Good News Rolls On, Introducing: the Garmin-Chipotle Team

Garmin is the new title sponsor of the Slipstream-Chipotle team | The Journal of Competitive Cycling.

For the third time in 10 days, a major international cycling team has announced a new title sponsor heading into next month’s Tour de France.

GPS maker Garmin International has signed on as the title sponsor of American professional continental team Slipstream-Chipotle through 2010, Garmin and the team announced Wednesday.

The title sponsorship, which sees the team name change to Garmin-Chipotle presented by H30, will commence immediately. A new team jersey, which will incorporate Garmin’s logo with the team’s trademark argyle motif, will be unveiled on July 3 in Brest prior to the start of the Tour.

The Tour is going to be a flurry of new jerseys with this, the new Columbia kits for High Road and the new CSC/Saxo Bank hybrids for the transitional sponsorship over there. Now if we can just get a replacement for sponsor Gerolsteiner, then things will have basically flipped on their head from last year when all the news was about sponsors leaving the sport.

Garmin, again, is a great fit for cycling. Personally, I’m a big fan of my Forerunner 205.

Check out the nice flash piece on the home page of Garmin.com.

Great Cycling News: Team High Road is Now Team Columbia

team-columbia

This is phenomenal news. Bob Stapleton is being justly rewarded for running the team without a title sponsor after Deutsche Telekom pulled out of cycling. I can’t think of a better brand to come into the sport for an American team and judging by the incredible results High Road have had so far this year, the sponsorship will be beneficial for Columbia. Immediately even, as I’d be extremely surprised if they don’t perform well at the Tour- and by well I mean winning multiple stages. Cavendish is the obvious choice to win a stage or two, but plenty of other folks could do interesting things the race (yes, George Hincapie, I’m looking right at you.)

I can’t wait to see the kits.

GENEVA, Switzerland and SAN LUIS OBISPO, California – June 16, 2008 – Columbia Sportswear Company a global leader in the active outdoor apparel and footwear industries, and California-based High Road Sports, Inc., the owner of Team High Road, today announced a new team sponsorship agreement that prominently places the Columbia brand at the starting line of the 2008 Tour de France on July 5.

Team High Road, one of professional cyclings most successful young teams with star riders such as George Hincapie, Kim Kirchen and Mark Cavendish, will compete as “Team Columbia” for the remainder of the 2008 season and will unveil its new uniforms in Brest, France on July 3, two days before the start of Europe’s largest sporting event, the 95th Tour de France. In Europe and around the world, the Tour de France international cycling event is considered comparable to the United States Super Bowl in terms of popularity among fans and media exposure.

Read the rest of the press release:
Team Columbia

Random Cycling Post- Slipstream, Boonen, Hincapie, Contador

Slipstream Featured on RollingStone.com

Visiting the Rolling Stone offices on Friday June 6: Team Slipstream-Chipotle! No, that’s not some British DJ duo — it’s the classy American racing outfit that’s making serious waves in the professional bike racing scene. Now you might think that the Capri Lounge is no place for a post about a pro bike racing team. Well, I think it’s no place for an affectionate post about the New Kids on the Block, and we’ve sure had plenty of those recently. So put that in your Joey McIntyre doll and smoke it, fanboy.

Read the rest:
The Next Rock Stars (Of Pro Cycling): Team Slipstream-Chipotle : Rolling Stone

Apparently, Tom Boonen Likes to Party


Photo courtesy flickr user John Spooner

In a positive turn of events for the sport of cycling (pun intended), one of the sports biggest stars tested positive for a recreational drug. It’s true. No suspension, no race results compromised, just good old fashioned tabloid style moral finger wagging for the naughty boy doing a little nose candy.

:)

Seriously though, this is disappointing in that we’d had a great year so far with the only big doping story being the “end” of the Landis saga. To have any story linking cycling to drugs is problematic at this point. The good thing is, Boonen can easily bounce back from this as long as he (wait for it) keeps his nose clean going forward.

The image rehabilitation begins:

Boonen apologizes

Contador will be #5

  1. Jacques Anquetil
  2. Felice Gimondi
  3. Eddy Merckx
  4. Bernard Hinault

Thanks to the ASO banning his Astana team from the Tour this year and the Giro organizers good sense in inviting Astana, Albert Contador is one Vuelta a España victory away from being the fifth man in history to win all three grand tours in a career. The last man to do it was Hinault, when he finished his trifecta with his Giro win in 1980.


Photo courtesy flickr user Bob AuBuchon

Speaking of which, is anyone betting against Contador in the Vuelta? I’m not. He rode so intelligently in the Giro he seems like a lock to win his home tour. Considering he had to ride himself into form during the Giro and was able to defend la maglia rosa against all of Italy, I’m afraid to see what might happen when he’s got time to prepare for a race.

Hincapie (and Leipheimer!)

Just when you think he’s not in great shape and is simply riding the race to get his legs under him in advance of July, George goes out and wins a stage today in the Dauphine Libere. I was disappointed with his showing in the prologue. I’m not disappointed anymore. It was a great little move to get the stage win. Hopefully that will bode well for another stage victory in the Tour.

Levi, by the way, looks like he’s going to win the race overall. With the result he had in the prologue, you know he’s on form and this is a race that he’s already won, so he has the confidence needed to fend off the strong field. By the time the pixels are dry on this post we’ll know a little better as the Individual Time Trial will really shake up the GC.

Cycling- Did Pellizotti Lose a Podium Place Because of His Flowing Locks?

In yesterday’s final stage of the Giro d’Italia Franco Pellizotti lost out on a podium position to Lampre’s Marzio Bruseghin by a scant two seconds. I think I know why:

flowing locks
(Detail courtesy flickr user cesareb)

I’m not an expert in aerodynamics, but I can’t imagine the drag created by those frosted locks helped his time. 2 seconds over 28.5 Kilometers is .07 seconds per km- would a shaved head have shaved that time off of his time trial and put him on the podium? I would love to hear from someone who is an expert on the subject if there’s actually any merit to this theory. As soon as I saw him in the start house with his lion’s mane peeking out from his helmet I started to think of it as a possibility.

Geared up for the Last Three Days of the Giro

Two mountain stages and then a time trial into Milano? A perfect ending to this tortuous three weeks through Italy. Today’s stage is likely the lynch pin of the weekend as it’s the last mountaintop finish and Contador looks to be faster than any of his most dangerous rivals (Simoni ad Ricco) in the time trial discipline. If they’re going to do it, they really ought to do it today. Tomorrow’s parkours, while including the monstrous Passo Gavia, finishes after a descent so there should be opportunity for the lead group to come back together a little bit if anyone cracks on the ascent. Today? No such luck as the as the Passo del Vivone will grind up the peloton in advance of the finish on the Monte Pora.

Thankfully all of this stuff happens in the morning, otherwise my days would be shot…

The Giro d’Italia 2008 so far…

paolo-bettini
incredible photo of “Il grillo” Paolo Bettini, il campione del mondo, courtesy flickr user rattodisabina

I haven’t commented much on the Giro so far, so this post will serve as a massive brain dump covering the first week plus in Italy- in advance of this weekend’s assault on the mountains.

  • Yeah Slipstream! First maglia rosa in twenty years for Christian Vande Velde! I was really happy for the argyles. They rode like veritable hellbats. Watching Millar pop off the back told all the story needed about the effort they put in during the race.
  • I wouldn’t be surprised to see two Astana riders on the podium. Which two? Your guess is as good as mine, but all three look like they’re going to be competitive form come this weekend. Contador, obviously, looks like the man to beat. His performance in the time trial was proof enough of that. Kloden also looks solid so he’s obviously in play and Leipheimer proved to be such a great “late” race racer in the Tour last year I can’t count him out of anything. I have to think they’re really going to control the race over the weekend. I’ll actually be stunned if one of them doesn’t win Stage 16
  • Dave Z. cracking up the way he did was a real bummer. I hope he’ll be ready for the Tour. He looked like he was in supreme amounts of pain. No fun there.
  • Speaking of cracking up, I can’t even begin to count the number of riders who have hit pavement so far. It seems like every day someone is riding into the finish with a ripped kit and some road rash. That’s even if they make it to the finish. Stage 11 was exceptionally painful, with big names crashing out on the narrow, slick and steep roads. Of special note was Visconti, the maglia rosa, crashing, getting attacked and then heading to the hospital for x-rays once he crossed the line.
  • Could High Road be having a better year? Cavendish won a stage, the first by a Brit in forever and continued the team’s string of successes so far this season. Now if big George could just sweep up another stage win at the Tour, they could wrap the whole season up in a bow.

That’ll do for now. I’ll crank through some more commentary next Tuesday, after the carnage of this weekend. Should be fun times…

Great Guy Richie Nike Football Spot (plus a few older soccer ads)

Yeah, I’m posting a commercial for free. I know.

Look, I’m doing it again

And again. this one is a real classic- Cantona’s Au Revoir at the end pleases me to no end.

Astana Given Place in Giro field- Will Le Tour Follow Suit?

The news just broke and many questions, of course, follow.

The biggest for me is- who will they bring and what will their intentions be?

Are they going to hedge their bets and hold back the Contadors, Klodens and Leipheimers of the world from a full-on GC push (so as to save them for Le Tour) or are they going there to take home the Maglia Rosa? There are no guarantees that they’re going to get into the Tour, so this might be their biggest stage of the year.

Of course, there’s also the question of fitness and form. One can’t just turn it on for a three week stage race. Is anyone ready for such a thing? Have they been prepping “just in case?” So many questions and so little time to sort it all out in time for the start of the race.

Astana given place in Giro field

Organisers of the Giro d’Italia have invited the Astana team to compete in their tour at just one week’s notice.

Astana, thrown out of last year’s Tour de France for doping violations, were originally excluded from the event.

Astana given place in Giro field

In other Giro news, Petacchi is skipping the race due to bronchitis. Petacchi basically owns the Giro, so that might give some other people a shot at some stage wins. Sad to see him miss out though, as he really is a joy to watch when he’s on form.

Bronchitis will keep Petacchi out of Giro d’Italia

[update]

Here’s Astana’s team for the race:

  • Assan Bazayev
  • Antonio Colom
  • Alberto Contador
  • Vladimir Gusev
  • Maxim Iglinskiy
  • Andreas Klöden
  • Levi Leipheimer
  • Andrey Mizurov
  • Dmitriy Muravyev

Think they’re going there to win? I do. That’s a strong team. Whatever way you slice it, three guys who have finished on the podium of the Tour de France is a pretty solid foundation and Iglinsky and Gusev have shown me a lot over the past couple of years.

I do wonder who will be their main rider. It might be whoever ends up being on best form. Which is tough to judge in advance since “the big three” have all had pretty solid spring campaigns.