Posts from 2012/11

Exceptionless Programming

November 28, 2012 00:00

I am a big fan of writing code that generates no runtime errors. This is an implementation of a function that takes the first element of an array.

template<typename T>
T first(std::vector<T> array)
{
    if (array.size() == 0) { throw EmptyArrayException(); }
    return array[0];
}

This is ...

Read post

Nice Visualization of a Cross Product

November 18, 2012 00:00

[This] is a very nice Java applet that allows you to see what a cross product is. The applet shows A x B = C (i.e. C is the cross product of A and B) in 3 dimensions. You can drag A and B around to see the effects on C.

This UI ...

Read post