Monday, November 23, 2009

JavaScript - Find position

This is kind of a useful script for setting the window's scroll position to that of an object's in javascript.

function Scroll2Pos(cID) 
{
var obj = document.getElementById(cID);
var curtop = 0;
if (obj.offsetParent)
{
do
{
curtop += obj.offsetTop;
}
while (obj = obj.offsetParent);
window.scrollTo(0, curtop);
}
}

It is based on this.

JavaScript - Find position


Thursday, November 05, 2009

Unit Testing: When You Should and When You Shouldn't

Unit Testing and Test Driven Development are all the rage right now, and rightly so, especially for the type of work some of the developers I work with do (low level switch programming on telecommunication critical infrastructure). But there are often cases where TDD and Unit Test is, well, overkill.

This article provides a much needed balancing perspective-


http://blog.codeville.net/2009/11/04/selective-unit-testing-costs-and-benefits/

Hat Tip: Elijah Manor