Neil's News

+ 2010
+ 2009
+ 2008
- 2007
 Sequence Converter
 Widgetless
 Visa Swap
 Voxel Brain
 Quake
 Prefix Matching
 12 Girls Band
 Waves to Wine
 Sphere Builder
 SF Panorama
 Global Warming
 Cycling at Mach 1
 First Steps
 Power
 Who Gadget
 Transposing Diffs
 Bike to Work
 Google Code
 Spaghetti Monster
 Visitors
 Maker Faire 2007
 Brave New World
 420
 COMP2405
 H-1B Visa
 Mandelbrot Scroll
 Carved Links
 New Page
 Moo Inspector
 Fridge Letters
 Vet Tax
 Boredom and Frustration
 Crescent Moon
 Nesting
 Queen Mary 2
 Social Security
 SketchUp
 San Francisco
 Traffic Bugs
+ 2006
+ 2005
+ 2004
+ 2003
+ 2002

Sequence Converter

29 December 2007

Sequences can be listed as numbers (1,2,3...) or letters (a,b,c...) or roman numerals (i,ii,iii...). Converting between them is fun. A quick search of the web revealed a lot of converters, but the code quality was generally questionable. As is often the case, Moo Canada contained a really solid implementation: $math_utils:from_roman and $math_utils:to_roman by the ever great Mathieu Fenniak. With his permission I ported it to JavaScript and embedded it into an application I'm writing at Google. There is a lot of Moo code in use here. Not surprising given the number of Mooers who are working here.

Number Alpha Roman

Above is a live demo of the three-way conversion. The library file is sequenceConverter.js and the test harness is sequenceConverterTest.html.


And for the non-coders out there whom I've just bored to tears, go read Shel Silverstein's "The Bagpipe Who Didn't Say No".

< Previous | Next >

 
-------------------------------------