Saturday, November 20, 2010

Roman numerals redux

A simple JavaScript function to validate Roman numerals, convert them to Arabic numbers, and back again.

I checked Google Analytics this morning and noticed I've been getting a lot of hits on my October 9 entry on JavaScript Roman numeral conversion. In brief, I wrote a simple function to take a number and build its Roman numeral equivalent. While I was mulling it over this morning, I spontaneously thought of a method to validate and parse a Roman numeral and turn it back into Arabic numbers using regular expressions.

Monday, November 15, 2010

The crazy geometry of basketball courts

I saw an interesting question on dy/dan today about posing basketball-related math questions to students. One of the reader suggestions was to talk open-endedly about the geometry of the court itself, to which Dan suggested writing a program that would draw a court given two mouse clicks to denote the baseline. That sounded right up my alley, so I wrote one.

Before starting to code, I had to learn about the measurements of a basketball court, and I was a little surprised by what I found. First and foremost, every league has its own sizes for every piece of the court, most differing by a foot or less. The biggest discrepancy is with the length of the court, which is 10 feet less for high school than for NCAA and above, or about 2 running steps. Naturally the FIBA league had measurements rounded to meters where all the US leagues are rounded to feet.

Thursday, November 11, 2010

Jury Duty

On Wednesday, when I was up walking around to limber up after reading in a chair for a few hours, I came across the bulletin board in the jury pool waiting room. The board had several local newspaper op-ed pieces on jury service that may as well have been written by a chatbot, randomly generating from a dictionary of truisms and catch-phrases. "Ten Reasons I'm Glad I Served. 1: To see the inner-workings of the law. 2: To meet new friends..." Hence this post, a gritty look at my experience being on jury duty. The management summary: my experience was interesting, but the process is flawed. Like Randy Pees used to say, "Our legal system is terrible. The only one worse than ours is everyone else's."

About two weeks prior to my reading of the platitude-laden corkboard, I received a summons in the mail to report for jury duty. I tried to get out of it by replying with a letter claiming a child-care burden, as I pick up Scout from school on Tuesdays and Thursdays so that Liberty can attend later classes on those days. I got a phone call the next day telling me basically to suck it up and make other arrangements. Conveniently, this did not prove to be an actual problem: On Tuesday we were released before 5pm, and the courthouse was closed today for Veteran's Day.