|
Jesus Christ
Space Kablooey fucked around with this message at 17:39 on Aug 27, 2014 |
# ? Aug 27, 2014 17:32 |
|
|
# ? Jun 7, 2024 17:44 |
|
I'm currently working on a web app that does reporting. Whoever designed this app created these report 'frameworks' to supposedly make creating new reports easier. It doesn't. They had the stupid loving idea to put each report in its own directory with a javascript file named report.js for each report, and all js files for all reports are always loaded, even if you're not in the reporting section of the site. Each one of these files is an enormous 3k line mess and the original developer REUSED THE SAME FUNCTION NAMES IN EVERY SINGLE FILE. I don't even know how the gently caress this works at all.
|
# ? Aug 27, 2014 18:04 |
|
NFX posted:MenuBar->Visible = (m_ActiveWindow != m_MainWindow) ? false : true; The benefit of the doubt here is that this is C++ and one of those operators is overloaded, but I know in my heart that this is a lie.
|
# ? Aug 27, 2014 18:19 |
|
It actually is C++ (Borland C++ 5.0!). But there's no operator overloading anywhere near this. Can you even override a comparison operator to return a non-bool? Edit: Yes, yes you can. And it's probably been done millions of times. NFX fucked around with this message at 18:52 on Aug 27, 2014 |
# ? Aug 27, 2014 18:47 |
|
NFX posted:MenuBar->Visible = (m_ActiveWindow != m_MainWindow) ? false : true; I generally believe in the unpopular idea of having "value==true" -like statements for clarity, because, yes, the compiler will optimise it and it aids in skimming, but that is just stupid.
|
# ? Aug 27, 2014 18:48 |
|
NFX posted:Can you even override With C++, you
|
# ? Aug 27, 2014 20:04 |
|
Volmarias posted:The benefit of the doubt here is that this is C++ and one of those operators is overloaded, but I know in my heart that this is a lie. That would make it worse though!
|
# ? Aug 27, 2014 21:08 |
|
revmoo posted:I'm currently working on a web app that does reporting. Whoever designed this app created these report 'frameworks' to supposedly make creating new reports easier. It doesn't. They had the stupid loving idea to put each report in its own directory with a javascript file named report.js for each report, and all js files for all reports are always loaded, even if you're not in the reporting section of the site. Each one of these files is an enormous 3k line mess and the original developer REUSED THE SAME FUNCTION NAMES IN EVERY SINGLE FILE. I don't even know how the gently caress this works at all. I have written something almost the same as this when I was a green developer and I apologize. I at least convinced management to let us rewrite it to be more server-side and not depend on 54 script files. Edit: After re-reading your post it sounds like 100% the same project except my base file was different
|
# ? Aug 27, 2014 21:13 |
|
ijustam posted:Edit: After re-reading your post it sounds like 100% the same project except my base file was different Hah. I actually used a different filename in my post than the real filename.
|
# ? Aug 27, 2014 21:30 |
|
revmoo posted:Hah. I actually used a different filename in my post than the real filename. Sounds like you're working on my monstrosity too! In my defense, my system was meant to allow unsophisticated programmers to get poo poo done quickly, and it did that well (although the code produced by said unsophisticated programmers is of course a horror in itself), but then it morphed into doing things it was never meant to do... I have also convinced my boss to let me redo it. I guess this is a green developer phenomenon? It seemed so awesome when someone was able to write up really useful poo poo in a couple of hours, but now they're hitting roadblocks.
|
# ? Aug 27, 2014 23:56 |
|
Everyone's first big project is terrible. (the difference is that good programmers realize it).
|
# ? Aug 28, 2014 00:12 |
|
I concur, I find even now looking at code from my last job I cringe when i see some of the stuff that was done. although there are nice things as well. but when a complex system is made by a team of 8 contractors you know you are going to have problems... Note: I was not a contractor I was in the after spaghetti time, but there were whole areas that no body else would even look at. Such as Video Capturing on a website using a 3rd party video tool and linking it into an oracle database using ajax....
|
# ? Aug 28, 2014 07:28 |
|
If you don't think the poo poo you did 6 months ago is horrible then you're not growing as a developer or lying to yourself. In either case it is you who are the horror.
|
# ? Aug 28, 2014 15:41 |
|
Hughlander posted:If you don't think the poo poo you did 6 hours ago is horrible then you're not growing as a developer or lying to yourself. In either case it is you who are the horror. Fixed
|
# ? Aug 28, 2014 17:18 |
|
Hughlander posted:If you don't think the poo poo you did 6 months ago is horrible then you're not growing as a developer or lying to yourself. In either case it is you who are the horror. If you don't think you're a worthless piece of poo poo, you're a worthless piece of poo poo.
|
# ? Aug 28, 2014 18:11 |
Volmarias posted:Fixed I was going to say, some of the fixes I've had to do have made me nauseous while I was writing them. Just get it out there and pray I never have to look at it again.
|
|
# ? Aug 28, 2014 18:40 |
|
Manslaughter posted:I was going to say, some of the fixes I've had to do have made me nauseous while I was writing them. Just get it out there and pray I never have to look at it again. Funny, when I write stuff like that I pray I'll have an opportunity to look at it again before anyone else does.
|
# ? Aug 28, 2014 20:36 |
|
code:
|
# ? Aug 29, 2014 00:15 |
|
Knyteguy posted:
A tax rate of... 5?
|
# ? Aug 29, 2014 02:35 |
|
Whoever wrote that doesn't know what "proof" means. Edit: Even the "proof" shows that it's wrong: you'd expect .05 from those numbers
|
# ? Aug 29, 2014 02:39 |
|
MALE SHOEGAZE posted:A tax rate of... 5? No matter what numbers you plug into that, it'll spit out TaxAmt. What is this even for? When would you need to go from the price and price + tax to the tax rate?
|
# ? Aug 29, 2014 02:48 |
|
I've been at the end (or beginning) of a day writing code and have suddenly found basic arithmetic rules really hard to think about. I've certainly been that stupid. I've just never written down a proof of my stupidity, at least not without deleting it before commit.
|
# ? Aug 29, 2014 03:56 |
|
One of the best things about code review is that it often makes such embarrassment short-lived.
|
# ? Aug 29, 2014 04:24 |
|
code:
The clincher is that types is never a SortedDictionary, it's always a (regular) Dictionary.
|
# ? Aug 29, 2014 15:42 |
|
MGN001 posted:No matter what numbers you plug into that, it'll spit out TaxAmt. In this system (pass through seller) there is no tax rate data; vendors send total & line tax amounts over, but not rate. Probably can't go into more because of confidentiality. code:
But yea the "proof" had me laughing.
|
# ? Aug 29, 2014 17:01 |
|
Knyteguy posted:In this system (pass through seller) there is no tax rate data; vendors send total & line tax amounts over, but not rate. Probably can't go into more because of confidentiality. Doing string parsing seems really weird to me. Are you in C# doing this? I'm assuming "num2str" is setting the string as Culture Invariant, because if the user uses commas instead of decimals, this won't work.
|
# ? Aug 29, 2014 17:23 |
|
Drastic Actions posted:Doing string parsing seems really weird to me. Are you in C# doing this? I'm assuming "num2str" is setting the string as Culture Invariant, because if the user uses commas instead of decimals, this won't work. Not C# - it's x++. Syntactically it's very similar, but x++ is more akin to a scripting language. 4th parameter of num2str(...) is which separator to use, so in the code posted it should always be auto based on local currency settings. I went ahead and forced it to be a decimal just in case though to guarantee the data. Edit: 4th param not 3rd Knyteguy fucked around with this message at 18:00 on Aug 29, 2014 |
# ? Aug 29, 2014 17:43 |
|
Why not just round off taxRate after you multiply it by 100*1000?
HappyHippo fucked around with this message at 18:06 on Aug 29, 2014 |
# ? Aug 29, 2014 18:03 |
|
HappyHippo posted:Why not just round off taxRate after you multiply it by 100*1000? Well the num2str() does the rounding to the hundreds decimal place of the already multiplied realnum, and we need it in a string anyway as we insert it to an XML node just a little further down. Maybe I'm missing something though? Edit: oh the comment kind of sucks. I missed that. I'll refactor that out because I think it causes a little confusion in the wording (remove everything past the decimal place or whatever, which is inaccurate). Knyteguy fucked around with this message at 18:18 on Aug 29, 2014 |
# ? Aug 29, 2014 18:13 |
|
Looks like reals are only accurate to 0.1?! I'd avoid any decimal notion entirely and work in fixed point integers when handling money. Such as your 1000 up there, though if micro transactions are possible, I might start out at 4 decimals.
|
# ? Aug 29, 2014 18:21 |
|
Knyteguy posted:Well the num2str() does the rounding to the hundreds decimal place of the already multiplied realnum, and we need it in a string anyway as we insert it to an XML node just a little further down. Maybe I'm missing something though? Maybe I'm reading it wrong but it looks like you convert to a string and then strip out the decimal? So why not just times by 100 and convert to string with no decimal places?
|
# ? Aug 29, 2014 18:24 |
|
Learn to comprehend, that's not what it says.
|
# ? Aug 29, 2014 18:26 |
|
Snapchat A Titty posted:Looks like reals are only accurate to 0.1?! The line "The BCD encoding makes it possible to make exact representations of values that are multiples of 0.1." is misleading, I think they're trying to say that the BCD means it represents decimal values exactly (to 16 digits) unlike floating point which can't represent things like .1 exactly (because that would make for a repeating expansion in base 2).
|
# ? Aug 29, 2014 18:28 |
|
Snapchat A Titty posted:Looks like reals are only accurate to 0.1?! I'll need to look into this, but I'm not seeing the accuracy thing? I think this is represented the same way as SQL represents a real but I could be wrong. HappyHippo posted:Maybe I'm reading it wrong but it looks like you convert to a string and then strip out the decimal? So why not just times by 100 and convert to string with no decimal places? Would have the same effect really. It would just change the call to: code:
Edit oh I see vv Knyteguy fucked around with this message at 18:43 on Aug 29, 2014 |
# ? Aug 29, 2014 18:34 |
|
That's what I was thinking. Is the strRem even necessary then?
|
# ? Aug 29, 2014 18:35 |
|
HappyHippo posted:That's what I was thinking. Is the strRem even necessary then? No actually. I have to export the project real quick so I'll make that change. It removes the ambiguity. Good idea!
|
# ? Aug 29, 2014 18:38 |
|
Yeah, disregard I guess. I just get real nervous when I see non-integers used to represent things where accuracy is super important such as money. I've spent enough time fixing reporting code and checking sales numbers to last a lifetime.
|
# ? Aug 29, 2014 18:42 |
|
Derail but what does this notation: ] x ; y [ mean in the "Scope of data type" field on that MSDN page? I'm comfortable with mathematical notation for intervals of real numbers but I've never seen a range written in that way before and have no idea what I might google to find out. "Backwards square brackets" produces no obviously useful results.
|
# ? Aug 30, 2014 10:01 |
|
Hammerite posted:Derail but what does this notation: It's a range excluding its endpoints. Also written as ( x ; y ) by some. (As opposed to [ x ; y ], where x and y are included.)
|
# ? Aug 30, 2014 10:10 |
|
|
# ? Jun 7, 2024 17:44 |
|
Oh, ok. That's strange to me, I've only ever seen intervals written (x, y) or [x, y] or (x, y] or [x, y) (using a comma, not a semicolon, and definitely no weird backwards brackets) In fact I looked at the Wikipedia page before asking, but I only skimmed it and should clearly have looked more carefully, as it does explain this notation.
|
# ? Aug 30, 2014 10:22 |