- 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
frist
Admin
frist
sorry for decimal post
Edit Admin
TRWTF is a desktop application connecting directly to the database without a server in between. Someone can extract connection settings and just edit the database directly without any validation or security checks.
Admin
Not necessarily. Such system usually allow editing data only via stored procedures, with all sorts of validations and permission checks within. So, properly implemented, it can be reasonably safe. But it is still a TRWTF, I fully agree on that.
Edit Admin
Speaking from experience, if the worst they got is a wrong word in an error message I'd say the got off easy.
Edit Admin
I agree for the most part but some time it's not necessary. For instance one of our customers has a packing area in a processing plant with several packing lines and in every line there is a terminal with a label printing application that connects directly to a SQL Server in a local network. The app can only call one stored procedure that returns the next batch of labels, passing the line number as a parameter. As long as the network is properly segmented and the BD user is properly configured to only allow exec for the required SPs it doesn't really matter if someone gets the credentials and since they can only be used locally it's easy to detect missuse.
Edit Admin
So, what you're saying is, in essence:
I mean, sure, everything else should be completely secured, but that's a honking big pile of details you have to get right every time you implement this again, and that you have to revalidate at any infrastructure change, addition of new functionality, or whatever. Good luck with that.
Edit Admin
I mean, there's a world where the database is managed locally (Sqlite, or in Microsoft land there was explicitly a SQL Server for Applications or something like that that bundled a database with the app). I've worked with a lot of apps that did 90% of their work in a local database and then synced to a central database rarely (because I was building software for factories which didn't have reliable Internet connections and had to work 100% offline). The sync would go more through an N-tier approach, but obviously the local database didn't.
Though, obviously, based on the error, this is connecting to a real server, so yeah, I'm rambling with no real point.
Edit Admin
My beef with this is that someone actually got paid to decide to use Doubles to calculate financial data despite enormous infomation available about how bad this is.
Admin
I once had trouble explaining to a co-worker (whose experience up to that point was in finance and web-applications) why his decision to store engineering data in a database (gauss, teslas, approximated voltages, and wattage) as decimal instead of float/double was a bad idea.
Admin
This seems depressingly common. I once worked for a fintech startup that was using floats for all its financial data. When I suggested changing to fixed-point, the CTO (!) said we weren't dealing with numbers big enough to matter.
He was right, in a roundabout way: the company folded a few months later, partly due to a dearth of users, so the implementation really didn't matter.
Edit Admin
And of course, even if the global replace had worked, just changing from
double
todecimal
won't magically fix all rounding errors. If I want to divide a dollar between three people, I'll have a cent left over which needs to be accounted for.Admin
I don't know what's wrong here.
Admin
Back around 1975 I worked for a computer service bureau. We had an IBM 370 model 145, a 32-bit machine. We provided computer services such as accounting for companies that did not have their own computers.
We took on a new customer that migrated their accounting system to ours from a different computer. I think it was a GE-600. The accounting system was written in Fortran. Yes, Fortran. I don't know why. But not problem. The 370 had a Fortran compiler.
When the first report was printed, the numbers didn't quite match up. $20,000.12 plus $20,000.12 yielded $40,000.25.
You've probably figured it out. The programmers used floating point, because Fortran didn't have fixed-point like COBOL did. The mantissa for the 36-bit computer had 28 bits but in the 370 the mantissa had 24 bits.
So we had to go through the code, changing all the floats to doubles.
Admin
That reminds me of the hilarious time when someone tried to move a S9(5)V9(7) value to a S(9)5V9(5) field.
Admin
Ah well, what comes adecimal, goes adecimal
Edit Admin
Actually this is what the modulo operator is for.
Admin
That is what my rounding account is for - just pop the cent in there so it does not get lost.