- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I wonder if missles are related to breastles?
Admin
OK, here, my own WTF was not reading the comments before posting. Type without reading, and you end up with somebody making a profit joke just before you...
Admin
My guess is that the developer planned for calibration of the temperature sensors, but never got around to it. The real WTF is not observing YAGNI.
Admin
And that's really the ONLY non-C thing you noticed? Either this is written in some other (custom?) language or trwtf is that this site's editor or the poster can't even copy code example correctly...
Admin
And now, so I'm not the "asshole" that just criticizes your ignorance without explanation:
The = operator returns to the left-hand-side the value on the right-hand-side. This behavior allows such statements as a = b = c to set a equal to b equal to c as would be expected. Therefore, returned to the if statement (the left-hand-side) in the above example would be, without surprise, the value zero. This would, as noted, effectively "save the world."
Admin
There are little pills that can help you with that.
Admin
Unfortunately, it would prevent them from ever being launched, as it would always evaluate false regardless of the value of code.
Admin
Guess I'm the only Seinfeld fan here...
Admin
Yes, the Kelvin scale is a linear shift from the Centigrade* one. So, there is no useful reason to convert. However, I'm pretty sure that the shift is +273.15K = 0C.
Why aren't their thermometers more accurate? The K2C() function uses integers, not floating point. That's a bigger WTF!?!
Rant: *Anders Celcius named his scale Centigrade. So, that's its name!
The proposed Metric "Grade" (100 G = 90 Degrees) angle is not in use. So, the "Centigrade" (1/100th of a Grade) does not exist!
The real Metric angle measure is (and should be) Radians!
Admin
I was speaking of the "control reaches end of non-void function".
Admin
Oh you need a new Johnson Rod. Oh well better install one of those...
:)
Admin
Obviously the real WTF is failing to issue an "Out of Range" message if the temperature is under 273K. The excessive line-by-line coding for each degree is merely from being paid by the line.
It would also work much better if the framistat was degreased, calibrated and photographed on a wooden table.
Admin
I wasn't aware hardware guys had write access to the code.
Admin
That makes no sense. Of course it gives a warning on low temps. [I need more coffee.]
Admin
Yup. I find jokes funnier after you explain them too.
Admin
There is your answer.
Admin
Admin
"input - 273" isn't a correct Kelvin to Celsius conversion. You want to subtract 273.15.
returning "input - 273.15" would, IMO, be correct for a conversion function. A conversion function shouldn't be doing any bounds checking outside of those inherent to the conversion (e.g. you can't have a negative temperature in Kelvin). Bounds checking for the specific test should be separate. As written, this TCS couldn't be used to monitor a freezer since anything below the temperature of water is "out of range" nor could it monitor most electronics (Intel, for example, has published maximum case temperatures for normal operation up into the 70s Celsius).
Admin
Oh thank god I was starting to fear that nobody here knew about that functionality :)
I concur. He must have thought "gee, I don't want to type a lot of consecutive numbers", and Excel is a nice "trick" to help you do that.
Of course, the REAL WTF is that he knows tricks like that, but doesn't realize that he could (should) make it into a function...
Admin
Admin
I would have rewritten the whole application as a web 2.0 application, and included a Fahrenheit converter for American users, using an XML-base configuration file to specify the temperature scale per locale. Of course, it would need a TemperatureScaleFactory to get the correct scale.
And since F = 9*(K - 273.15)/5 + 32 is too processor intensive, I would just use a combination of the simplification I use when I check the weather when I'm in Europe and a simpler way of getting celsius from Kelvin:
F = C*2 + 30 = (K - 270)2 + 30 = K2 - 510.
273K comes out as 36F, 173K (boiling point) would be 164F. Of course, I would need a F2K function to compute the K2F(t1) - K2F(t2) difference in Kelvin. Hold on ... would that work? ... hmm never mind, too close to the deadline, we'll fix it in the next release. There's a workaround anyway, just use a calculator.
Admin
Admin
Admin
Admin
Of course I did. You can't convert integer Kelvin to integer Celsius. In this case, yes, the effect is fairly benign (due to the straight additive nature of the conversion) and may well be withing the engineering tolerances needs, but can lead to error.
For example, if you're trying to maintain a temperature above the freezing point of water this conversion will convert a temperature slightly below freezing (273 Kelvin) into freezing (0 Celsius or 273.15 Kelvin). And depending on what other operations might be done on the converted temperatures, this error can snowball.
Or maybe I just spent too much time in the physics program before switching to CS.
Admin
The real WTF here, obviously, lies in arguing with a Sicilian when life is on the line.
Admin
It seems that some people think that if(x=y) returns the value of if the assignment was successful or not. I don't know how that idea came about, but it seems to be the logic flaw people are following. i.e. The assignment worked, return True! If the assignment didn't work, it would throw an exception instead of false. Like I said, no idea how that got started.
BTW, HELP DESK GIRL FOREVER! She even has a tattoo!
Admin
Best. WTF. Ever!
I actually had to cover my mouth to contain the hysterical laughter to avoid making a scene.
Admin
const int CODE_RED = 0; /* saved the world */
You fool. Missles are things which prevent the collision with the asteroid. World destroyed !
Admin
Clearly, he should have modeled the temperature as a wide sense stationary, mean ergodic stochastic process and run it through a 14th order filter with a nilpotent matrix representation, and taken the square root of the power spectral density.
oh, wait, those are actually real things. my bad.
captcha: sino => sin(0)
Admin
Admin
There's sort of an idea that there are two kinds of functions:
a) Functions which return stuff
b) Functions which do stuff
Most operators are in the a) category, but = is in the b) category. And most functions in the b) category return whether the doing stuff worked, not what was done. Although in various situations you can have a function do BOTH, if it's typed like PHP or you can have a return value that specifically means 'failed'.
But generally.. a function that does something, usually is considered to fail or succeed, and returns like that. = is kind of an anomaly in that respect. No part of "Assign left value to right variable" implies "return the new value of the right variable"
Admin
Also has no one heard of Paste Special -> Values before?
Admin
He didn't type in B1, B2, B3 manually, he grabbed the first value and dragged downwards, letting excel add one on each time for him.....rinse and repeat for D.
I think he deseves a break for speeding up the development process.........maybe not.
Admin
This causes me pain.
Admin
In C, = is not a function. It's like +, or +=. It has specially handling and therefore should not be expected to follow the "rules" of functions. In C++/C#, and other more modern languages, =, +, +=, etc, are all functions now. However, these languages also have exceptions, and so functions no longer return "success" or "fail", they instead are implicitely successful unless you recieve an exception. It is also not actually rare to have a function that does something and returns something. You sometimes have functions that do things and return many things (thanks to out parameters/pointers or referances).
Admin
You know what they say the three scariest things in the world are:
Admin
The real WTF is giving users access to source code (even if it's read only). That just leads to problems with "smart" users who think they know what they're talking about.
Admin
I always thought absolute zero is at -273,15˚C ...
Admin
Uh, yes. I think the problem here is that IV was telling what is sometimes technically referred to as a "joke".
I suppose you are also complaining that "getting to the other side" is clearly only an intermediate goal and the last speaker has still failed to adequately explain the chicken's underlying motivation.
Admin
"Someone had apparently typed each Kelvin and degree Celsius value in by hand"
I suppose it's possible that the person was spreadsheet-y and did a click-drag to fill in the linear steps..
Admin
Isn't TRWTF the assignment-instead-of-equality-operator?
Admin
This is the best WTF that I've seen in a while. It's a CWTF (Cascading WTF).
I was kinda expecting to see a "See tempconv.csv" somewhere on that sheet.
Admin
Doesn't if (Ktemp = 273) always true?
Admin
I bet they only used Excel's handy auto-increment feature to generate the list of Kelvin and Celsius numbers. If you need to generate a list of numbers from 1..30 quickly, Excel's one of the fastest non-programming ways to do it.
Admin
You don't have to type all of those lines in by hand to avoid not using a function in excel. You just highlight all of the cells and in the bottom right corner of the highlighted area is a box you can drag down and it will copy the cells down using "AI" in the instances where a number should just be incremented on each subsequent copy.
For example, type in A1: 1, then in A2: 2, highlight both A1 and A2 then drag the box down.
Excel was a perfectly good solution for producing that type of code!
Admin
It's amazing how many places I've seen Excel as a "data source". I just finished maintaining/fixing a classic ASP app that did just that.
There was a field "Employees Trained" that was kept in an excel spreadsheet. The app opened up the spreadsheet, read that value, and then put it on the front page informing everyone how many users had been trained.
Don't change the spreadsheet name or it breaks.
Heaven forbid someone either put it in an include file (remember, classic ASP) or even better, have and admin page where the user can actually change that value. Or put it in the HR system when a user is trained and read from that. But in an excel spreadsheet? Yikes!
Admin
On my first reading of this, I read tempconv.xls as tempconv.xsl, and got all enterprisey excited. Imagine the letdown to see dumb old Excel and not a stylesheet.
Oh, and absolute zero is 0 Rankine.
Addendum (2008-02-27 15:21): BTW: 0 Rankin is the temperature that The Bumble froze.
Admin
It's amazing how many places I've seen Excel as a "data source". I just finished maintaining/fixing a classic ASP app that did just that.
There was a field "Employees Trained" that was kept in an excel spreadsheet. The app opened up the spreadsheet, read that value, and then put it on the front page informing everyone how many users had been trained.
Don't change the spreadsheet name or it breaks.
Heaven forbid someone either put it in an include file (remember, classic ASP) or even better, have and admin page where the user can actually change that value. Or put it in the HR system when a user is trained and read from that. But in an excel spreadsheet? Yikes!
Admin