Lokken All American 13361 Posts user info edit post |
League of Legends client. 8/27/2013 1:09:56 PM |
Lionheart I'm Eggscellent 12776 Posts user info edit post |
Get the word from a project manager that we need to build a prototype. I ask the PM for the user requirements. He says we need to just prove we can read data from their DB. I say of course we can but how and what we do with it needs to be written down so we aren't just running around with our heads cut off. He states that since we have the document that described the data model we don't need any written down requirements. My objections are ignored.
So long story short I have to build a prototype to interface to an unknown piece of software with no user requirements and nothing but an external data model specification with no context for what it's intended to be used for . 6/16/2014 2:48:35 PM |
afripino All American 11433 Posts user info edit post |
Sometimes project requirements aren't that specific. Just do it and stfu. That is all. 6/16/2014 3:03:27 PM |
aaronburro Sup, B 53136 Posts user info edit post |
Bring me a rock. *brings a rock* no not that one, what are you, stupid? 6/17/2014 12:15:34 AM |
aaronburro Sup, B 53136 Posts user info edit post |
public string[] FooProperty { get { string[] FooProperty = new string[6]; // yes, they created a local variable in the getter with the same name as the property _fooBacking = SomeComplicatedMethodOfGettingIt(FooProperty); return _fooBacking; } set { _fooBacking = value; } }
and then there was this one...
public class SomeForm : Form { public SomeControl ReallyFuckingImportantPartOfForm; // SomeControl derives from Control }
public class SomeOtherClass { private void someMethod() { SomeForm window = new SomeForm(); SomeForm.ReallyFuckingImportantPartOfForm = new SomeControl() { Property1 = something, Property2 = somethingElse }; window.ShowDialog(this); } }
]6/26/2014 10:32:10 PM |
FroshKiller All American 51913 Posts user info edit post |
I'm converting a financial report (a balance sheet) from an old reporting style to a new one. The old report relied on a hand-written SQL query to retrieve the account balances.
The simplified schema for the table of balances, which we'll call account_balances, is:
* entityID, a foreign key reference to the entity the balance is recorded for * accountID, a foreign key reference to the account * period, a datetime value for what accounting period the balance is in * balance, a numeric field for the actual balance
If I wanted to retrieve the balance of a given account for a given entity in a given period, the query should be straightforward:
select balance from account_balances where entityID = 1 and accountID = 2 and period = cast('01-Jan-2014' as datetime)
Instead, whatever genius originally wrote this report retrieves the account balance like so:
select sum(case period when cast('01-Jan-2014' as datetime) then balance else 0 end) from account_balances where entityID = 1 and accountID = 2
Way to drive memory usage way the fuck up while the database engine spins through your silly fucking inner loop, guy. DURRR LET ME JUST SUM OVER EVERY BALANCE IN EVERY PERIOD EVER RECORDED
[Edited on June 27, 2014 at 9:29 AM. Reason : syntax error]6/27/2014 9:28:24 AM |
Noen All American 31346 Posts user info edit post |
^Umm, except if the period is larger than a single balance, thus containing multiple balance entries? (although I dont know that summing them is correct either).
Granted though, it would be a bajillion times more efficient to do what you're doing and just return all matched records and then iterate the rows (adding balances) on the client. 6/28/2014 1:08:25 PM |
afripino All American 11433 Posts user info edit post |
^if there are multiple balances in a period, he could just do a sum in the new statement. Still more efficient. 6/28/2014 3:18:49 PM |
FroshKiller All American 51913 Posts user info edit post |
Imagine there's a unique constraint on entityID, accountID, and period. 6/28/2014 7:00:34 PM |
Noen All American 31346 Posts user info edit post |
^That's what I figured
I just know after years of being a contract developer working off of really shitty requirement specifications with no access to the customer or even other developers, there have been a number of time's I've written equally stupid code just to make sure I covered possible edge cases.
There's still no excuse though, that's probably the least efficient way possible to cover that condition (unless MAYBE he/she only had DB access and no ability to touch the rest of the codebase). 6/28/2014 10:19:22 PM |
aaronburro Sup, B 53136 Posts user info edit post |
DateTime A,B,C; ... if ((DateTime.Compare(A,B) < 0 || DateTime.Compare(A,B) == 0) && (DateTime.Compare(B,C) < 0 || DateTime.Compare(B,C) == 0)) { ... }
Also spotted yesterday:
var foo = new StringBuilder(); ... foo.Append("|"+someString); ]6/29/2014 1:23:47 AM |
FroshKiller All American 51913 Posts user info edit post |
I recently reported a bug in the generation of some financial reports by a module I support. Exporting the report to Excel resulted in an exception thrown by the .NET runtime: "Input string was not in a correct format."
I did my troubleshooting and determined that the renderer was passing a number in scientific notation (e.g. 3E-14) to System.Number.StringToNumber. I don't actually know whether StringToNumber has options for handling strings in that format, but if it does, we obviously aren't using them.
The funny thing is that the value should have been 0. So I checked the source for the report renderer, and sure enough, we're using the fucking Double type everywhere for currency amounts instead of Decimal.
I write up my bug report with concise documentation of the issue and point out that we will need to change the data types as well as the method signatures throughout the solution, since they expect Double parameters rather than Decimal. I provide sample source files that I already built and tested against the data and write up detailed replication steps.
Soon, I get a notification that the bug report has been marked as resolved and checked in. Now, nobody is just going to check in the file I sent, so I look it up in source control.
One line has been changed. We went from this (anonymized):
cell.Text = SwissArmyKnifeUtilityClass.GetString(arbitraryCurrencyAmount)
To this:
cell.Text = SwissArmyKnifeUtilityClass.GetString(Math.Round(arbitraryCurrencyAmount, Filter.DecimalDigits))
I don't think I could facepalm harder than this.
[Edited on August 28, 2014 at 9:27 AM. Reason : ///]8/28/2014 9:27:15 AM |
CapnObvious All American 5057 Posts user info edit post |
In a previous software release, we had a developer create a feature that used the customer set string identifier to map an object to a communication file. The problem is that this object can be updated at any time and that change would then break the link. We identify all objects by a hard-coded ID that can _never_ be changed, though, so it drives us nuts that they didn't use that. They still refuse to. A bug was written, but it was deferred because the feature is seldom used. Bringing us to...
I find out in the newest release that instead of trying to actually fix the bug (deferred for being seldom used), they have tried to change our whole system architecture (essentially a company protocol) to dictate when this string can be altered and by whom. They have created fancy flowcharts and new UI buttons on no less than four screens . . . all because they refuse to use the set-in-stone identifier as opposed to the customer facing, editable string... 8/28/2014 8:52:37 PM |
Noen All American 31346 Posts user info edit post |
^^If there's a significant amount of division going on, I can understand why you'd store everything internally as doubles and only truncate at the very last possibly moment.
However, they should be truncating, not doing a split round. With financials, $1.99999 is still $1.99, not $2. Those kinds of rounding errors are why you never store values in decimals, only using that for absolute final outputs. It can make a monstrous difference.
I wrote a billing system a long time ago for a medical transcription company where everything was billed in very low amounts (cents and partial cents) at incredible volume. They were doing it manually up until that point and a very simple rounding error was costing the company almost $3k a month in billable revenue. 8/28/2014 11:11:17 PM |
FroshKiller All American 51913 Posts user info edit post |
It's very sweet of you to assume that there's a performance- or resource-related reason for it, but there isn't. I guarantee the decision to use Doubles was made because it was the first number type with a fucking decimal point the programmer read about in class.
Floating point arithmetic is not intuitive, and it's easy to trust a number that looks close enough, you're absolutely right.
A follow-up: After posting that yesterday, a co-worker asked me to look at an issue where invoices show the wrong discount available. The vendor was configured for a 2% discount, but the discount amount was 1.94%, 2.04%, etc. This is going to wind up having an equally stupid, related cause.
[Edited on August 29, 2014 at 8:09 AM. Reason : ///] 8/29/2014 8:08:37 AM |
Noen All American 31346 Posts user info edit post |
^Ugh. 8/31/2014 3:11:41 AM |
HaLo All American 14271 Posts user info edit post |
Sounds like apple forgot to lockout accounts after x number of failed password attempts at find my iphone. Whether the cause of the leaked pics or not still pretty stupid mistake. 9/1/2014 6:50:26 PM |
gs7 All American 2354 Posts user info edit post |
*shakes head*
http://www.reddit.com/r/technology/comments/2hwlrk/new_windows_version_will_be_called_windows_10/ckwq83x
Quote : | "cranbourne 839 points 1 day ago Microsoft dev here, the internal rumours are that early testing revealed just how many third party products that had code of the form
if(version.StartsWith("Windows 9")) { /* 95 and 98 */ } else { and that this was the pragmatic solution to avoid that." |
About 13,963 results: https://searchcode.com/?q=indexOf%28%22windows+9%22%29
ExpectEmulation.java in expect4j (http://expect4j.googlecode.com/svn/trunk/)
String OS = System.getProperty("os.name").toLowerCase(); if (OS.indexOf("windows 9") > -1) { // Windows 98
About 5,805 results: https://searchcode.com/?q=startswith%28%22windows+9%22%29
WindowsAttachProvider.java in java-1.7.0-openjdk (git://pkgs.fedoraproject.org/java-1.7.0-openjdk)
String os = System.getProperty("os.name"); if (os.startsWith("Windows 9") || os.equals("Windows Me")) { throw new RuntimeException( 10/2/2014 1:37:54 PM |
aaronburro Sup, B 53136 Posts user info edit post |
http://www.theregister.co.uk/2014/12/18/delta_fixes_flaw_that_allowed_hacker_pass_to_any_flight_anywhere_any_class/
12/18/2014 12:24:33 AM |
jaZon All American 27048 Posts user info edit post |
well i wish i had known about that 12/18/2014 1:02:26 AM |
aaronburro Sup, B 53136 Posts user info edit post |
...
while (DateTime.Compare(date, startDate) < 0) { date.AddDays(1); days++; }
...
1/7/2016 12:34:00 AM |
FroshKiller All American 51913 Posts user info edit post |
Hold up, though. Is that C# code written by someone who found out that DateDiff is a Visual Basic function and not part of the .NET Framework? I can almost see how that would make sense. But don't you get TimeSpans from doing arithmetic using DateTimes anyway? Like why wouldn't you just do something like:
int days = Math.Abs((date - startDate).Days);
NB I don't work with C#.
[Edited on January 7, 2016 at 9:44 AM. Reason : ...]1/7/2016 9:43:14 AM |
afripino All American 11433 Posts user info edit post |
^^hahaha...that's hilarious!
[Edited on January 7, 2016 at 9:43 AM. Reason : ] 1/7/2016 9:43:33 AM |
aaronburro Sup, B 53136 Posts user info edit post |
^^ The line of code you gave is precisely what should have been done. Far more readable, and amazingly better performance, too. Not to mention that using DateTime.Compare() instead of a direct comparison operator pisses me off to no end on its own.
[Edited on January 8, 2016 at 1:31 AM. Reason : ] 1/8/2016 1:30:39 AM |
smoothcrim Universal Magnetic! 18968 Posts user info edit post |
serious question - if you're so beyond these plebes, why are you working with them on what looks like shittacular back office one off type stuff? you always post stuff that probably doesn't matter on the scale it appears to be written for. just sayin... 1/8/2016 11:39:02 AM |
aaronburro Sup, B 53136 Posts user info edit post |
1) It's front office 2) It's by morons from several years ago who were replaced by people smart enough to know that shit's not acceptable who are slowly sucking the stupid out of it. 1/10/2016 7:33:41 PM |
smoothcrim Universal Magnetic! 18968 Posts user info edit post |
ahh so you aren't working with them, just inheriting shite. sucks either way, but sounds slightly more tolerable 1/10/2016 10:54:42 PM |
FroshKiller All American 51913 Posts user info edit post |
Not exactly in the spirit of the thread, but I accidentally checked in a change that included the word "fart" in all caps in some sample data yesterday. 1/20/2016 8:38:44 AM |
krallum2016 All American 1356 Posts user info edit post |
lol at the above. I fixed a shitty peice of code I had with a pretty retarded date calculation yesterday 1/21/2016 4:31:49 PM |
Noen All American 31346 Posts user info edit post |
I fixed an open issue in Electron back in the fall that enabled the recycle bin for file delete behavior.
I also managed to use a method with a flag only valid in Windows Vista+. This broke Electron deleting files in Windows 7. Whoops. It's fixed now, but I felt like an idiot. Took me literally 2 minutes to fix and verify.
[Edited on January 24, 2016 at 11:54 PM. Reason : .] 1/24/2016 11:54:02 PM |
Fry The Stubby 7784 Posts user info edit post |
i've seen someone name a class New.java i was somewhere between laughing, being mad, and throwing up 1/25/2016 12:41:24 AM |
aaronburro Sup, B 53136 Posts user info edit post |
Sooooooooooooo many ViewModels with references to Views
In other news, we told these contractors to stop doing code-behind in our WPF project. This aint WinForms, after all, and there's usually a better, more reusable way to do whatever the hell you were trying to do anyway. So, a week after we told them to get rid of the code-behind, we are pleasantly surprised to see that the .xaml.cs file has no more code-behind. Score!
So, I look in the SVN logs to see what all they did and admire their rapid learning of WPF. I see one new file. ViewBehaviors.cs. This can't be good. Yup, they moved all of the code-behind from the .xaml.cs file to a generic "attached behavior" with a type-parameter of the view, copy and paste, and just updated all the click and event handlers in the XAML to point to the copied methods on the "behavior." I've never wanted to murder someone so badly in my entire life.
[Edited on February 16, 2016 at 12:25 AM. Reason : ] 2/16/2016 12:13:18 AM |
moron All American 34183 Posts user info edit post |
^ that seems like a weird situation... if you didn't want it in Web Forms, this seems like something that should be specified in the scope, then asking someone to convert from mostly web forms to WPF (correctly...) seems like a big change order-- this isn't a trivial task depending on your app.
And there's nothing inherently wrong with Web Forms depending what you're doing.
Hope youre not being too ornery with your contractors...
[Edited on February 16, 2016 at 12:41 PM. Reason : ] 2/16/2016 12:41:11 PM |
aaronburro Sup, B 53136 Posts user info edit post |
I'm not sure where you got the idea that there were WebForms involved. The app in question has always been WPF. That would be quite a change request, lol. 2/16/2016 9:37:41 PM |
Novicane All American 15416 Posts user info edit post |
nintex , infopath, and sharepoint. 2/18/2016 6:58:42 AM |
BigMan157 no u 103354 Posts user info edit post |
the romantic subplot is there to appeal to women, duh
it's like you've never seen a movie before 2/18/2016 8:19:15 AM |
aaronburro Sup, B 53136 Posts user info edit post |
Sonofabitch.
I've been working in a topic branch off of where I had been making the changes I talked about earlier. Today I finished the work on this topic branch and was ready to merge it back, but I did my usual check of the SVN logs to see where I might run into merge issues. What do I see? These morons REMOVED some of the XAML I had written to replace their code-behind and replaced it with the original code-behind, only with a minor tweak.
I reverted that shit with a quickness when I saw it and sent out an email that basically said "don't EVER replace XAML with code-behind. period." The guy who did it responded back that it wasn't code-behind because it wasn't located in the xaml.cs file and was instead in a class named "FooViewBehavior," so it had to be a behavior, and there was no other way to do what he had to do, and if I had a better suggestion of how to do what he needed to do I should speak up.
He sent this email directly to me. I responded to the original email's audience, our entire group. First, I stated that the name of the file doesn't determine if something is code-behind; the fact that he wrote a freaking click-event handler is what made it code-behind. Then, since he said there was no way to do it without a click-event handler in the code-behind, I kindly pointed him to the class I had already written which did exactly what he needed done, only without any code-behind. Next, I pointed exactly where it was hooked up in the XAML file that he edited, noting that his edits had removed those very lines; as in, it used to work, but you freaking broke it. Finally, I noted other usages of this component in other parts of the app which are functioning exactly the way he wants the part he edited to work.
Bitch, don't tell me there's no way to do something when I've already written it for you and hooked it up. Oh, and that minor tweak he needed to make? He wants the view to directly change the viewmodel when a property on the model changes.] 2/19/2016 12:12:06 AM |
aaronburro Sup, B 53136 Posts user info edit post |
Today I saw code that was polling a data source populated from a Coherence cache every second in order to see what data had changed in the cache. 4/8/2016 10:46:38 PM |
Lionheart I'm Eggscellent 12776 Posts user info edit post |
More of an observation but I had to explain to a new fresh out of school employee today what a serial port is. I had to stop and tell myself this kid was mostly around since USB became ubiquitous and I felt really old. 4/11/2016 2:57:58 PM |
krallum2016 All American 1356 Posts user info edit post |
In what industry do you work? 4/11/2016 5:06:31 PM |
moron All American 34183 Posts user info edit post |
The "S" in USB stands for serial... technically a serial port... 4/12/2016 12:57:09 PM |
Noen All American 31346 Posts user info edit post |
Universal Serial Bus 4/12/2016 1:46:45 PM |
Lionheart I'm Eggscellent 12776 Posts user info edit post |
seriously we all knew what I was talking about
[Edited on April 12, 2016 at 4:56 PM. Reason : lets be real obtuse and say rs232 com port]
4/12/2016 4:55:00 PM |
krallum2016 All American 1356 Posts user info edit post |
Me and that teenager you work with didn't know what you were talking about :^) 4/12/2016 5:47:44 PM |
FroshKiller All American 51913 Posts user info edit post |
I don't work with XML often, but I've been assigned some tasks that require changes to large XML files we generate for a partner. I thought I'd peace up in here with an XSLT and be out. Imagine my surprise when the XML files I'm starting with don't validate and I discover that we're building the motherfuckers with .NET StringBuilder instances.
[Edited on April 14, 2016 at 8:43 AM. Reason : ...] 4/14/2016 8:43:00 AM |
Fry The Stubby 7784 Posts user info edit post |
good luck and condolences. ironic that i had a discussion at work earlier today about the nightmare that xml + xlst can be 4/14/2016 8:29:12 PM |
moron All American 34183 Posts user info edit post |
Microsoft has such nice XML support with Xdocument, why would anyone try to build their own... 4/14/2016 9:00:38 PM |
krallum2016 All American 1356 Posts user info edit post |
xml is the worst yo 4/15/2016 1:29:40 PM |
aaronburro Sup, B 53136 Posts user info edit post |
We created a new UAT server environment this past week so that another team could work on another initiative without affecting our current environment. Did we give the task to devs who actually know how the app servers work? Of fucking course not. We gave it to an idiot from offshore who apparently doesn't even know what a server is, much less what a server environment is or what it even needs in order to operate.
Our first hint of trouble came when she committed the environment settings and said "fire her up!!" Our environment manager took one look at the settings, saw they were bogus, and asked "are you sure these are right?" Her response? "I have no idea. I just committed some shit." I mean, that's all you need, right? Just commit some shit!
After much back and forth, they eventually get something to load up, and she assumes it's all fine and dandy. That is, until, we start getting reports from all over that one of our existing UAT environments is fucked up. Data isn't loading right, queries are returning absurd results... As everyone is chasing their tail, I make the connection that we just started up this new UAT environment, and I think "no way she did what I think she did." So I tell them to shut the new environment down, and as soon as they do, the existing environment starts working perfectly.
Come to find out, this fucking moron just copied the settings for the existing environment into the settings for the new environment. The only change she made was renaming symbols which looked like the environment names. She didn't create new databases (kind of a prerequisite to host separate data). She didn't create new message queues. The host names and ports were all the fucking same.
I love offshore. 10/19/2016 12:34:53 AM |
moron All American 34183 Posts user info edit post |
Everyone has to start somewhere... 10/19/2016 1:22:09 AM |