Posts filed under 'Programming'

Remove All Children!

When searching for an easy method to remove all of a node’s children in JavaScript, I really need to remember to include the search term “JavaScript”.

Add comment October 22nd, 2009

JavaScript/CSS: how do I check if an element has overflowed?

Something I want to know just infrequently enough.  How is it done?  How do I know, if I’ve got an element with “overflow:auto”, if it’s generated the scrollbar?  And why do I want to know?

This is a handy technique when trying to, for instance, truncate unwieldy text within a fixed space.  The trick?

Compare the element’s clientWidth (or clientHeight) to it’s scrollWidth (or scrollHeight).  If the scrollWidth > clientWidth, the element has gone off the edge.  Voila!  Hopefully next time I need to remember this, I remember where I wrote it down.

Add comment December 11th, 2008

The Incredibly Specific Error

Something frequently encountered when using computers is the ubiquitous error message. There are lots of them that are inane, and, indeed, there are sites out there with whole sections devoted to this.

But there’s another peculiar brand of error message: The Incredibly Specific Error. For instance, this java.lang.IllegalArgumentException:

Path does not start with a "/" character.

I could understand if, perhaps, the path as a whole was invalid, or otherwise syntactically incorrect, but in this case, couldn’t the software try just a little harder? Couldn’t it throw the slash on there itself and just kick out a polite warning?

Add comment January 14th, 2008


Calendar

September 2010
M T W T F S S
« Aug    
 12345
6789101112
13141516171819
20212223242526
27282930  

Posts by Month

Posts by Category

Feeds