|
HoboMan posted:wait, List doesn't have it's own Clone method???? It's easy if you've got a list of value types, everything gets complicated once you start dealing with object references though. There's no way for a clone function to instantiate a valid copy of an arbitrary object - even the MemberwiseClone function I mentioned earlier won't work on an object that's got its own object references. Powerful Two-Hander posted:im AssId "sqlexception" I'm AssId "Object reference not set to an instance of an object" I love FirstOrDefault().SomeFunction() 'cause it lets you error ever so slightly later than you would have with First() Chalks fucked around with this message at 15:56 on Nov 18, 2016 |
# ? Nov 18, 2016 15:54 |
|
|
# ? May 26, 2024 02:30 |
|
raminasi posted:"greater new york area" always means new jersey. how did you not know the company location before you interviewed? I've interviewed at their office in Chelsea before and they still have many dev jobs in Manhattan. The job site filter only had "Greater New York City Area" and other NJ listings spelt out the name of the town. KidDynamite posted:Yo send this my way https://www.linkedin.com/jobs/view/...pbw~iv1ctxzw~t4
|
# ? Nov 18, 2016 16:48 |
|
attempting to teach one of our younger engineers how to debug and problem solve and its uhhh tricky
|
# ? Nov 18, 2016 17:10 |
|
make http://debuggingrules.com/ required reading for everyone imo
|
# ? Nov 18, 2016 17:12 |
|
oh god yes a general purpose debugging reference i am buying this for every fucker i work with
|
# ? Nov 18, 2016 17:14 |
|
Bloody posted:oh god yes a general purpose debugging reference i am buying this for every fucker i work with
|
# ? Nov 18, 2016 17:18 |
|
people fresh outta school have their minds blown by super simple debugging poo poo. a guy at work was super impressed when i worked backwards from an error by searching for the error message in the code. conditional breakpoints are gonna make his brain shoot out of his ears.
|
# ? Nov 18, 2016 17:47 |
|
I just came across this deep in my company's code base. It's in a job that really hasn't been modified since 2008 - this was added in 2005 for some reason... It's not called, they're all empty objects; they are all just sitting there taking up space.code:
|
# ? Nov 18, 2016 17:51 |
|
Barnyard Protein posted:make http://debuggingrules.com/ required reading for everyone imo just bought this, will report back
|
# ? Nov 18, 2016 17:52 |
|
leftist heap posted:people fresh outta school have their minds blown by super simple debugging poo poo. a guy at work was super impressed when i worked backwards from an error by searching for the error message in the code. conditional breakpoints are gonna make his brain shoot out of his ears. conditional breakpoints never work in vb6 because if the variable you want to break on isn't in scope when you write the breakpoint (that's right, you can't set them without the program already running) it'll either never hit it or just crash randomly.
|
# ? Nov 18, 2016 18:12 |
|
geeves posted:I just came across this deep in my company's code base. It's in a job that really hasn't been modified since 2008 - this was added in 2005 for some reason... It's not called, they're all empty objects; they are all just sitting there taking up space. lmao
|
# ? Nov 18, 2016 18:24 |
|
Chalks posted:I love FirstOrDefault().SomeFunction() 'cause it lets you error ever so slightly later than you would have with First() .FirstOrDefault().ToMaybe().Map(someFunction)
|
# ? Nov 18, 2016 19:18 |
|
Chalks posted:It's easy if you've got a list of value types, everything gets complicated once you start dealing with object references though. There's no way for a clone function to instantiate a valid copy of an arbitrary object - even the MemberwiseClone function I mentioned earlier won't work on an object that's got its own object references. i feel like every time i use .First() i'm committing some sort of hate crime even when I know i'm gonna get exactly one result back
|
# ? Nov 18, 2016 19:23 |
|
leftist heap posted:people fresh outta school have their minds blown by super simple debugging poo poo. a guy at work was super impressed when i worked backwards from an error by searching for the error message in the code. conditional breakpoints are gonna make his brain shoot out of his ears. no matter what IDE i've used--sunstudio (ugh), eclipse or VS2013 or VS2015 conditional breakpoints have always given me guff, be it awful performance or just plain not working, so i've given up and done poo poo like adding this to code and recompiling code:
|
# ? Nov 18, 2016 19:24 |
|
i can't help it if people are using terrible languages or ides
|
# ? Nov 18, 2016 19:33 |
|
Ciaphas posted:i feel like every time i use .First() i'm committing some sort of hate crime even when I know i'm gonna get exactly one result back that's why they made .Single()
|
# ? Nov 18, 2016 19:42 |
|
loving rear end goblins why am i so terrible (thanks) Ciaphas fucked around with this message at 19:50 on Nov 18, 2016 |
# ? Nov 18, 2016 19:47 |
|
that's like when I spent an hour trying to work out a nice way to Convert a string like "10001011011110" from base 2 To a base 10 UInt64 Got it down to like three lines of rather clever linq and casting then welped when I saw the one line built in solution
|
# ? Nov 18, 2016 19:49 |
|
oh neat
|
# ? Nov 18, 2016 19:58 |
|
i tend to use firstordefault when i think there will probably be multiple things in the ienumerable but i dont care about them. also FirstOrDefault becomes much more tolerable when combined with the ?. and ?? operators
|
# ? Nov 18, 2016 19:58 |
|
i actually had a conversation today where a data consumer could not understand that my job was not to ensure that the data conformed to their arbitrary expectations i.e. that there would only be one result in a set. i guarantee their offshore devs will just return the first result because they didn't understand my point about exception cases. this happens all the loving time with 'programme managers' that don't understand that when you do a variable assignment in sql but returned multiple rows in the set the variable will be assigned a 'random' value based on the order of the set. i had a full on argument with a guy that refused to believe that changing a 1 to 1 to a 1 to many relationship would gently caress any existing consumer.
|
# ? Nov 18, 2016 21:14 |
|
Powerful Two-Hander posted:im AssId "sqlexception"
|
# ? Nov 18, 2016 21:40 |
|
Bloody posted:i tend to use firstordefault when i think there will probably be multiple things in the ienumerable but i dont care about them. also FirstOrDefault becomes much more tolerable when combined with the ?. and ?? operators Yeah, FirstOrDefault is fine and ?. makes it actually really cool to work with - but I always laugh when someone's gone to the trouble of writing "OrDefault" then immediately written code that would crash if the default was ever returned. And when I say someone, it's me 90% of the time. I usually use the function if I'm going to write some complex object creation code if the value is null, but I must admit I never knew about .Single() or .SingleOrDefault() so now I guess I'm going to start using those instead. I wonder how many latent bugs will be revealed as a result!
|
# ? Nov 18, 2016 21:51 |
|
unit testing with hardware is dumb and annoying
|
# ? Nov 18, 2016 21:57 |
|
Chalks posted:Yeah, FirstOrDefault is fine and ?. makes it actually really cool to work with - but I always laugh when someone's gone to the trouble of writing "OrDefault" then immediately written code that would crash if the default was ever returned. And when I say someone, it's me 90% of the time. Keep in mind that both .Single() and .SingleOrDefault() will throw an exception if there's more than 1 element in the collection
|
# ? Nov 18, 2016 21:59 |
|
Potassium Problems posted:Keep in mind that both .Single() and .SingleOrDefault() will throw an exception if there's more than 1 element in the collection Yeah I just checked my code and about half of my .First() calls could be changed to .Single() but there were a surprising number where I want to explicitly handle cases of 2 or more, or where I really do just want First() and I don't care about row ordering because the values I'm retrieving after the First() are guaranteed the same in every row 'cos of a .Where() or whatever Still, more tools in the toolbox
|
# ? Nov 18, 2016 22:06 |
|
Also I loving hate being stuck on VS2013 because I really really want ?. right now
|
# ? Nov 18, 2016 22:06 |
|
Bloody posted:unit testing with hardware is dumb and annoying actually its not even a unit test “A test is not a unit test if: - It talks to the database - It communicates across the network - It touches the file system - It can’t run at the same time as any of your other unit tests - You have to do special things to your environment (such as editing config files) to run it.” [1] M. Feathers, "A Set of Unit Testing Rules," 2005. i know what you mean tho i'm struggling with the same kind of thing right now concurrency is hard
|
# ? Nov 18, 2016 22:06 |
|
names are dogmatic it tests one unit of functionality its not my fault that that unit of functionality happens to live 50% on a pc and 50% in an fpga
|
# ? Nov 18, 2016 22:08 |
|
Potassium Problems posted:Keep in mind that both .Single() and .SingleOrDefault() will throw an exception if there's more than 1 element in the collection Yeah, that's why I'm wondering if it'll reveal some pre-existing bugs. In pretty much every situation I use FirstOrDefault I can only have one result unless I've done something stupid like a cross product join or something, so it'll be good to catch any cases where that's happening.
|
# ? Nov 18, 2016 22:34 |
|
Ciaphas posted:Yeah I just checked my code and about half of my .First() calls could be changed to .Single() but there were a surprising number where I want to explicitly handle cases of 2 or more, or where I really do just want First() and I don't care about row ordering because the values I'm retrieving after the First() are guaranteed the same in every row 'cos of a .Where() or whatever really you should only use .Single() instead of .First() if you need to enforce that there is only one matching element in the collection. .First() bails out after it finds a matching element, but .Single() has to traverse the entire collection.
|
# ? Nov 18, 2016 22:35 |
|
good news fam looks like its just a concurrency bug
|
# ? Nov 18, 2016 22:43 |
|
also if you use .Single in linq to sql, it pulls back the entire result set. entity framework is smart enough to just limit to top 2.
|
# ? Nov 18, 2016 22:43 |
|
entity framework fuckin sucks
|
# ? Nov 18, 2016 22:46 |
|
Barnyard Protein posted:actually its not even a unit test
|
# ? Nov 18, 2016 22:46 |
|
Ciaphas posted:Also I loving hate being stuck on VS2013 because I really really want ?. right now i can confirm that ?. is cool and good
|
# ? Nov 18, 2016 22:52 |
|
Bognar posted:also if you use .Single in linq to sql, it pulls back the entire result set. entity framework is smart enough to just limit to top 2. Pulling back the entire result set doesn't seem too bad if you're going to thrown an exception anyway if it's more than a single row.
|
# ? Nov 18, 2016 23:01 |
|
Shaggar posted:entity framework fuckin sucks better than writing raw sql though this is my first foray into EF so i really don't have a fukken clue what i'm doing
|
# ? Nov 18, 2016 23:20 |
|
currently i'm annoyed that i can't seem to set entity class accessibility to internal instead of public without causing nullreferenceexceptions It compiles fine, but as soon as I do any query involving an association it explodes if every single entity class isn't public Which is annoying because I want to enforce this poo poo shouldn't be usable outside of the project it's in At least making the DbContext derived class internal seems to work ok, so that's a start
|
# ? Nov 18, 2016 23:22 |
|
|
# ? May 26, 2024 02:30 |
|
On another topic Oracle continues to be literally Hitler, he says as he tries to figure out how to get PL/SQL to call a C++ function from an external dynamic library, or a C function from another external library calling aforesaid C++ function
|
# ? Nov 18, 2016 23:23 |