# Posts by John

2 publicly visible posts • joined 14 Aug 2006

### Lateral thought saves sizzling server

#### Only on hot Days

I had one of these "at random problems" once. And it too only happened on hot days. But only if a certain member of staff was not at work. An apple talk network between three Macs drifted in and out of connection. I was up there staring at the screen and sure enough watched the macs appear and disappear on the network. As I was watching it thinking how could this be, I leant back and noticed an oscilating fan moving at the same speed that the computeres were blinking on and off. The fan was on the other side of the desk to where an employee usually sat if he was at work. He wasn't that day! Aha I noticed that a plastic wall plate holding the network socket was lifting slowly when the fan blew air at it un obstructed by the missing employee. I redid the didgy network connection and put the wall plate back on the wall and voila!

flames - because it's only ever on a hot day!

### The trouble with rounding floating point numbers

#### Another real world example.....

I did some work on an allocated pension calculator that required a tweaker (ashamed to say so, but it worked). I had to calculate how old a person would be on their retirement date. If they retired on their birthday the old code didn't show them as being a year older - hence the tweaker. Here is the offending javascript:

DOB = new Date(y,m,d);

RET = new Date(ry,rm,rd);

DIF = (RET.getTime()) - (DOB.getTime())

AGE = DIF / (1000 * 60 * 60 * 24 * 365.25);

AGE_Attained = Math.floor(((Math.round(AGE*1000))/1000) +.001);