Category: Webbie stuff

Category RSS

DublinJS August meetup kata

  • Comments: Comments Off

I’m doing a kata for this month’s meetup of Javascript Dublin group and my choice is Roman Numerals. It’s simple enough and it also demos some interesting transformations of the code during the whole TDD process (if you stick to the mantra of “write the simplest possible thing”). I found that I could also put some of the new ES5 features into practice: Object.keys(), Array.prototype.forEach() and Array.prototype.reduce().

The Coding Dojo page for this kata also has a video of it performed in Ruby. There’s also a link to a video of it in Excel, but as much as it sounds good, it’s just building a VB macro…

You can find my code on GitHub. I have also prepared a walk through on how I arrived at my solution (txt is the new ppt!)

The previous kata sessions used Jasmine – and it works just fine – but I chose to do things with YUI Test. If you feel like it – I prepared a skeleton for the project. Note that it loads YUI from Yahoo’s CDN, so make sure you’re online (or update the harness.html).

Opera Extensions: messaging example

  • Comments: Comments Off

I already vented out my frustration with examples that have flaws, so this one is more constructive and tries to actually explain and solve things. You’re welcome to skip all of that and just get the example code.

It may not be 100% correct, it may have it’s own flaws, and obviously it may soon become obsolete, as Opera 11 is still in alpha, but I did create a more reliable example of how to communicate between the user scripts and popup windows.

This article assumes you already grok the introductory information on Opera extension. In fact, knowledge of Chrome extension flows may also help.
(more…)

Just how much does performance matter?

  • Comments: Comments Off

I have recently moved my dedicated server to a new provider. I mostly did this for pricing reasons, but there’s also the benefit of network speed, as most of my visitors and now – the server itself – are in Europe. This move, coupled with a few optimizations, has opened my eyes towards some data – the impact of page load time on “pages per visit” metric. While the general theory behind the relationship of the two is clear to everyone, the actual numbers did shock me.
(more…)

Benchmark: HTML outlining/TOC scripts

  • Comments: Comments Off

A bit over a week ago Chris Heilmann published a post on table of contents generators, where he listed a couple of JavaScript methods to do that. It’s been always in the plans to optimize the performance of my own implementation of the HTML5 outlining routine – and what better way to measure it, than to compare it with some other approaches while I’m at it. To no surprise, I lost. Big time.
(more…)

ASP.NET MVC generates invalid ClientIDs

  • Comments: Comments Off

This week I had a joy of spending several hours trying to solve and intermitently happening bug. In short, some 2 times out of 3 the YUI selector utility failed to lookup elements in an XHR loaded HTML fragment. After digging quite deep into the YUI code, I found that it was actually the fault of the way ASP.NET MVC treats partial views.

Summary

  • ASP.NET MVC allows use of ASCX as “partial views”
  • It correctly assumes, that uniqueness of ClientID should be preserved
  • It incorrectly does not prepend an alpha-character to automatically generated GUID based IDs
  • User agents and selector libraries may correctly ignore such invalid IDs
  • Solution: override ViewUserControl.UniqueID

(more…)