But it’s easy…

  • Comments: Comments Off

Here’s a sample of how your “it’s easy” and my “sure, probably half an hour” becomes “half a day”:

  1. You want me to make the Thing clickable?
  2. Is just the Thing clickable or the whole line?
    1. Just the Thing – introduces technicalities (below)
    2. Whole line – quirky on small screens in portrait
  3. When you move your mouse over – how does it change to indicate it is clickable?
  4. How shall we give it an affordance (make it look clickable)?
    1. The heading nearby is the same color as our standard link color. If we are to use our standard link color for the Thing, we must make all headings dark blue, which results in disbalance.
    2. Add an icon – we’ll introduce clutter, plus the icon is not always visible on smaller screens, let alone it’s harder to implement
    3. We can reduce icon clutter by increasing line height, but then Other Things no longer align and the Whole Thing looks disbalanced
  5. The Thing sometimes displays in gray. How do we make THAT Thing clickable?
  6. Oh, and we’ll need to test pretty much every variation on PC, iPhone and Android and then when finally happy-ish – double check on all Internet Explorers.

All this just to make one thing clickable, that wasn’t ever really meant to be clickable.

Ah, here’s another one:

  1. Let’s have a chat facility…
  2. Let’s show user’s online status…
  3. How do we know they are logged in?
  4. What if they have the chat open multiple tabs?
  5. What if they log out in one of these tabs?
  6. Oh, let’s just see when they last loaded the page?
  7. What if they leave a tab open for 30 minutes, but don’t do anything?
  8. What if they have us as their homepage, therefore they visit often, but usually don’t even look at the chat?
  9. What if they go to another tab and browse Facebook?
  10. What if they have two tabs and go to another tab and don’t browse Facebook?
  11. What if they leave the page open and go home?
  12. What if they leave the chat open and go to the toilet for 30 minutes and then spend 30 minutes in Excel?

Oh, so we should have a state where they are “online”, but “idle”? Congratulations, you just doubled the complexity.

Some changes are easier. Some are even trickier. I can’t recall the last time I said “sure, it’s trivial”, and it really was…

☑ Write a blog post this year.

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.

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.

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.

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.


  • 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


Hello world!

  • Comments: Comments Off

There is no long story. My blog in Lithuanian will have a second birthday in 5 days. Here’s my present to myself.

  1. I write, you read and comment
  2. ???
  3. PROFIT!

Oh, and yes, you’re right – now that I have a blog, I will not update it frequently.