- 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
cat /dev/null>/dev/db
Admin
TRWTF is putting code into production and only then checking it into source control.
Admin
I take it that the obvious fix didn't work: $query .= odbc_iif("SUM(price) = 0", 0.0, "SUM(priceact)/SUM(" . odbc_iif("price != 0", 1, 0) . ")") . " AS price_avg ";
Admin
The real WTF is people using something that hasn't even been patched in more than a decade. Security? we don't need no stinking security.
Admin
I still QA a FoxPro codebase. It keeps me gainfully employed. Really what gives it legs is the fact that you can use a SQL backend and keep your old FoxPro code for the frontend.
Admin
FoxPro's opinion of determining datatypes is The Root Absolute Real WTF here. Holy giblets.
"0" is not a single-digit number. Well it is, but it's also a two-digit number, a three-digit number, and in fact has an infinite number of digits in both directions. Deciding that a number is even an int or a float based on an example being 0 is futile. I wouldn't even think 0 being the first entry in a number set is uncommon, so there's no way this is a rare problem.
Total design failure.
Admin
Clearly, a "0" is a candidate for storage as a bit field. Also a bit field can be a Boolean. So, store a "0", then store a "9.99", catch the exception, then try to retrieve the "9.99". Result? FILE_NOT_FOUND , so we must expect this field to produce True, False, or FILE_NOT_FOUND.
Admin
Fortunately, FoxPro is not supported by modern malware
Admin
Wouldn't saying
odbc_iif("SUM(price) = 0", 0.00...
be an option? Then it's not implicitly an integer, but explicitly a decimal/float/double/whatevertypethat supportsdecimalsAdmin
irb(main):001:0> x = 0 => 0 irb(main):002:0> x.class.name => "Fixnum" irb(main):003:0> y = 0.0 => 0.0 irb(main):004:0> y.class.name => "Float"
Lots of languages behave that way.
Admin
The Real WTF is the defeatist mentality that only constant patching is secure. Back when programming was a profession practiced by professionals, a product could be usable on release. It's only with the advent of code monkeyism from hindustan that quality had taken such a massive nosedive thar has scared people into the cult of neverending patchwork.
Admin
Trying to store the number 0 in a bit field will throw an error in FoxPro. The logical datatype supports values ".T." and ".F."
Admin
It sure would be! Just as well it didn't happen in that order in real life!
Admin
So oddly, decimals seemed to be stripped, so "0.00" was effectively the same as "0" and would crash in the same way. However, there's another place in the code that we use "0000000" as a result, to make sure that there's enough of an int size first-row result for when another SUM() has digits in the millions :)
Admin
I'm a little offended by this article. I've programmed for years in FoxPro as a tool for the smaller companies (up to 100 people) where Oracle and SQLserver are too expensive and it was a good product and a very fast database. If you use a 0 in your query instead of 0.00 then it is possible that the column in the created temporary table is integer instead of number. That is no WTF, that is standard FoxPro knowledge. And as others said, common to other languages as well.
The real WTF with FoxPro is that if the users are connecting to a FoxPro database directly, they can bring down the whole table to his knees, making it unusable, by switching off (or crashing) their PC on the wrong moment. For that reason we switched the database to SQLServer while still using FoxPro as the language.
Admin
I've had the "pleasure" of working with a certain piece of crap written in FoxPro. Not only is the piece of crap in question insanely expensive - it's also software that human lives depend on. Yes - people can actually die if it fails. Trying to actually use it is ... fun. The entire thing is singlethreaded and blocked, so the damn thing stops pumping window messages when it's, for example, making a heavy DB query...
It takes a small army of overpriced consultants to keep the damn thing running.
Admin
i am reminded of an old story where someone used a forced divide-by-zero instead of a Stop or End command! i forget his weird excuse.
Admin
"It's only with ~~the advent of code monkeyism from hindustan~~ the advent of internet connected computers under constant security threat ~~that quality had taken such a massive nosedive~~ causing people to lose their privacy, money and security ~~thar has scared people into the cult of~~ that has lead to actual professionals realizing that the only way to keep closing the gap with hostile actors is neverending patchwork." FTFY
Admin
Lol, the "data access layer" (I'm not sure that's the right term tbh) in the apps I support uses the open source version of LLBLGEN. LLBLGEN stopped being open source in 2002. The apps were written between 2008 and 2014...
Admin
This must happen a lot. We still have customers running on a Sybase database.
I remember one Sybase db update completely ruining the production databases. From then on patches on our Sybase dbs were no longer done...
Admin
Sorry you can't design a system that works and is secure but some of us can.
Admin
FoxPro does not determine the type of a field by looking at its value in the first record.
It determines the field type in exactly the same way that SQL databases do: by looking at the table definition (while FoxPro's programming language is dynamically typed, its database engine most definitely is not).
I'm not sure what exactly was actually going on here, but the explanation provided in the article is clearly wrong.
Admin
The article is fabricated, so don't think a lot over it.
Admin
"Trying to store the number 0 in a bit field will throw an error in FoxPro. The logical datatype supports values ".T." and ".F.""
.T. .R. .W. .T. .F.