Monthly Archives: June 2010

“Presto” math trick in Java

According to Futility Closet, if you start with a 3 digit and place it next to the same number to form a 6 digit number, you can divide the 6 digit number by 7, 11, and then 13 and you will end up with the original 3 digit number and no remainders. For example, by taking the number 412 and making it 412412 and then doing the divisions, you will end up with 412. I wrote a small program in Java to test it.

Read more »

jQuery change event on checkbox

A lot of times, you’ll want to call a javascript function when a checkbox is changed from unchecked to check and vice versa. Up until the release of jQuery 1.4, the obvious way to do it (the jQuery .change() event) did not work properly across all versions of Internet Explorer. Instead, you had to check for the .click() event. This was an accessibility problem because it did not fire when a user changed a checkbox with the space bar instead of by clicking. Well, now we can rejoice. The following code snippet works exactly how you think it would across browsers, including IE.

Read more »