Archive for the 'IT' category

Sign of the Dollar

September 13, 2007 9:02 pm

I was perusing some JavaScript the other day and saw a strange notation that I had never seen before:

$("report")

"What is this?", I thought. It looks like Perl or PHP -- have I missed some big piece of JavaScript or is this some new feature? In a word: No.

It turns out that this is actually a function contained in the Prototype JavaScript Framework. The definition of the function is along the lines of:

JavaScript:
  1. function $() {
  2.     var elements = new Array();
  3.     for (var i = 0; i <arguments.length; i++) {
  4.         var element = arguments[i];
  5.         if (typeof element == 'string')
  6.             element = document.getElementById(element);
  7.         if (arguments.length == 1)
  8.             return element;
  9.         elements.push(element);
  10.     }
  11.     return elements;
  12. }

Functionally, this is nothing special: pass in a name and get back the object. Or pass in an array and get back an array of objects. The really cool thing is the simple elegance of this method and how it cleans up your code.

JavaScript:
  1. // 'Classic' way
  2.  document.getElementById('userName').value = 'admin';
  3.  
  4. // Dollar way
  5. $('userName').value = 'admin';

This is so simple, that it seems obvious! This saves on programmer typing, saves on page size and makes the code more readable.

In a word: beautiful.

Boxing Day Sale Knocks Out Future Shop

December 25, 2006 1:10 am

Future Shop (and Best Buy Canada) started Boxing Day early at 8pm EST on December 24th. http://marketnews.ca/news_detail.asp?nid=2424

It seems that they were totally overwhelmed by the response. The servers were getting hammered resulting in many errors. Service Unavailable was a frequent message along with HTTP Server Too Busy as well as random vbscript errors (a common message was dictContext.Value is null or not an object). I also saw some HTTP 403 errors saying that there was a permission problem running a CGI script. After limping along for a couple of hours where it was almost impossible to pull a page up they tried to free up some processing by turning off some images and turning off the inventory information on the product pages. Also, they put a limit in so that you would be blocked from using the site; a page with no images would appear instead of the page you want with an invitation to browse the flyer with a message they no new users were allowed on the site at the current time (or words to that effect). As of 12:45am the site seems to be functioning much better.

BestBuy.ca was also affected but not to the same extent. I was able to place an order on BestBuy.ca within half and hour whereas futureshop.ca took me almost 3 hours to place an order. I think they share the same infrastructure and code base so I don't attribute it to any technical differences between the sites. I think it just shows how much more popular Future Shop is than Best Buy (Future Shop also had better deals :) ).

It will be interesting to see if they do this same promotion this year. Customers may be put off by the technology problems but the real people that I feel sorry for are the technical staff who must have been fighting fires like crazy trying to get (and keep) the site up and running. Not how I would want to spend my Christmas Eve.

I'm surprised that Futureshop/Best Buy haven't moved to a .NET implementation yet -- it's been at least 4 years of being in the mainstream.

Microsoft “Office”

November 23, 2006 4:04 pm

Ricky Gervais and Stephen Merchant have done two amazingly funny videos for Microsoft where he plays his character from the BBC version of "The Office". These are internal Microsoft training videos about values where he insults virtually everyone. Totally Hilarious!

Part 1: http://video.google.ca/videoplay?docid=9076288729387457440

Part 2: http://video.google.ca/videoplay?docid=959125392868390030

Here is more information on the videos.

http://www.timesonline.co.uk/article/0,,2-2326336,00.html