Some items taken from http://catless.ncl.ac.uk/Risks/
<http://catless.ncl.ac.uk/Risks/>  may be of interest
  _____  


 <http://catless.ncl.ac.uk/Risks/21.67.html#subj20.1> X-ray machine risk

Asa Bour <[EMAIL PROTECTED]> 
Thu, 27 Sep 2001 23:16:04 -0400 (EDT)
I had to get some x-rays recently. I felt real confident when I saw a bright

yellow post-it note on the x-ray machine with bold print stating that the

measurements were in mm (millimeters) and not in cm (centimeters).  Since

the note was needed, one can assume they had problems with people

calibrating the machine properly with the right units.  I think the x-ray

software interface needs some improvement to eliminate this danger of

miscalibration.



E. Asa Bour <[EMAIL PROTECTED]>

http://www.scripturememory.org/ <http://www.scripturememory.org/>
http://www.schemer.com/ <http://www.schemer.com/> 

 

  _____  


 <http://catless.ncl.ac.uk/Risks/21.74.html#subj14.1> Dates in Visual Basic

John Sullivan <[EMAIL PROTECTED]> 
Fri, 9 Nov 2001 16:56:45 +0000
I was just writing a test-harness in Visual Basic (VB6 SP5) when I noticed

the following annoying and potentially downright dangerous behaviour.



Part of the code generated a series of dates, and I'd entered the start date

as a literal date of the form #2001-11-08#. This worked fine as I expected

and as it wasn't at all important at this stage so I didn't look twice at

what I'd just typed.



When I came back to it today, I noticed it read #11/8/2001#. Now, I never

code dates in non-ISO format if possible, and being in the UK with my locale

set to UK never, ever, use US mm/dd format unless I know it's the only

format a broken program accepts. Retyping it showed that the date was

changed in front of my eyes:



  #2001-11-08# becomes #11/8/2001#  (2001-11-08)

  #11/8/2001#  becomes #11/8/2001#  (2001-11-08)

  #8/11/2001#  becomes #8/11/2001#  (2001-08-11)

  #15/11/2001# becomes #11/15/2001# (2001-11-15)



It changes as soon as the cursor left the line. So you type it, check it,

find it correct, go off somewhere else, blam!



The first has reduced the comprehensibility of the code. The second and

third give no feedback that they're not conforming to the current locale.

The last two show that VB is not even being consistent in its parsing.



The Risks:



Dumb programs thinking they're smart enough to change a programmer's code

can lead to unpredictable behaviour. If you assume that what you type is

what gets saved then you may not even notice, and errors in strings of

numbers are immediately less obvious than structural or logical errors.



If I (or a colleague) came back to the first example in a few months time,

will we know whether it means 8th Nov or 11th Aug? It would be natural to

assume it's using the current locale, but in this case it isn't. What I

actually typed was unambiguous.



I use VB, and dates in VB, so rarely that I may not even remember this

behaviour myself a year or two down the line. Thankfully I don't have to use

this noddy little toy for writing Real Programs in.
  _____  

Baron Causmarter
 
Compute Against Cancer
http://www.parabon.com <http://www.parabon.com/> 
 

Reply via email to