Weird Looking: zero is what percent of zero again?

zero is what percent of zero again?

November 9, 2006 6:48pm (3 years, 8 months and 2 weeks ago)
tags: none
Caller.com voting results

I guess somebody at caller.com forgot to test this ColdFusion script before the election started.  That, or maybe they consider divide-by-zero errors in the output a feature.

Comments

Nov 9, 2006 6:55pm
Actually, I see now that #DIV/0! is an Excel spreadsheet error, not a coldfusion error.  How’d that happen?  I’m really starting to worry about their workflow.

Are they calling excel from the script?  Is there some way to generate an HTML report like that from within Excel?  Or did they manually embed a spreadsheet inside a Word document and save that as HTML?
Nov 9, 2006 7:07pm
Excel does indeed save (and round-trip load) HTML.  By HTML I of course mean HTML with XML-style namespaces and lots of extra Office/Excel specific tags.

You might check the original page for extra junk that would indicate the HTML was saved from Excel.  Of course, if they run the output through something like Tidy you won’t be able to tell.

To be fair, a lot of reporting tools support Excel as a target.  Then again, those same tools generally support HTML.
Nov 9, 2006 7:43pm
Wow!  The web page online is an Excel-HTML file.  Actually, it’s a bunch of HTML files that make up a workbook using frames and javascript.  This appears to be part of Office’s HTML support.

But the best part is, these excel files in particular include formula references to an external spreadsheet, and by looking at the source you’ll see references to a file stored on drive G:\.
Nov 9, 2006 7:59pm
Ah, I see.  I guess they have a bunch of spreadsheets, then this thing goes and grabs the totals from them and fills in the HTML.

<tr height=19 style='height:14.25pt'>
 <td height=19 class=xl34 style='height:14.25pt'>Kay Bailey Hutchinson-R*</td>
 <td class=xl35 style='border-left:none' x:num
 x:fmla="='G:\DailyArt\For the Web\electionNov06\[US reps.xls]Sheet1'!$B$4">2659119</td>
 <td class=xl36 style='border-left:none' x:num="0.61691000152190612"
 x:fmla="='G:\DailyArt\For the Web\electionNov06\[US reps.xls]Sheet1'!$C$4">61.7%</td>

 <td class=xl40 style='border-left:none'>a</td>
 <td colspan=2 style='mso-ignore:colspan'></td>
</tr>
Nov 9, 2006 8:01pm
That’ll teach me to take so long writing my posts.

I think The Real WTF Here™ is that they’re running a Netscape web server.
Nov 10, 2006 12:01am
How dare you blame ColdFusion for this!
Nov 10, 2006 1:01am
Oh, everything is CF’s fault.  I’m just not sure how in this case yet.

Programming with tags…  I bet Macromedia has a data modeling format based on control-flow.
Nov 10, 2006 8:24am
XSLT 4 Life!
Nov 10, 2006 2:49pm
One time I wrote something in ColdFusion that used XSL as a template engine.

Now I know you’re saying, “ColdFusion is already a template engine!”.  Yeah well… hush, or I won’t tell you about the time I used PHP’s output buffering and an XML parser to sanitize user input.
Nov 10, 2006 3:59pm
While it used to give me headaches, I’ve actually become quite comfortable with XSLT.  Granted, I don’t always do things in the best possible way, but I’ve learned a lot of neat tricks.

Most recently, I’ve formatted dates from an RSS feed using substring() and <xsl:choose>.  Sure, I could have written an external function to do so much more cleanly, but then it becomes a pain when it’s time to move from one XSLT engine to another.

I don’t understand why basic date/time functions were not included in the initial versions of XSLT/XPath.  It seems that temporal data is pretty common in XML.

I did break down and use some EXSLT functions/templates.  I especially needed str:split for parsing YouTube’s tags.  I’m almost certain I could have accomplished my goal with a recursive template, but I decided not to let NIH syndrome get in my way.  EXSLT still doesn’t completely solve portability problems, though.
Nov 10, 2006 4:59pm
I had a client-side XSLT stylesheet to format my RSS feeds for a while, but I just made a weirdlooking: namespace and used it to include formatted dates.  Because I’m lazy that way.
Nov 13, 2006 5:03pm
I was going to answer your initial question by “googling it.”

However, any Google search with a calculation involving division by zero results in Google not displaying an answer.

I assume that any error in calculation, whether parsing or actual math, results in no result being displayed.

However, the net result is that Google Calculator knows the answer to e^(pi*i) and even the answer to life the universe and everything, but it cannot tell you that 0/0 is undefined.

Leave a comment


Accepts BBCode with a few enhancements.