|
Bloody posted:welp doing a few db inserts has absolutely ruined my application for some reason. was good at 2k requests per second with no db stuff, now some simple db logging is basically broken at 100 requests per second How long does each request take? The connection creation is probably your biggest overhead if you've not got connection pooling going on, but 100 requests per second seems low even taking that into account.
|
# ¿ Nov 3, 2016 21:39 |
|
|
# ¿ May 12, 2024 05:50 |
|
Bloody posted:i dunno! how does npgsql connection pooling work? Never used it myself but connectionstrings.com has this: code:
Powerful Two-Hander posted:I thought the sql connections got auto pooled or something? so even if you close the connection in code or dispose of it it actually gets retained in the background and reused There are usually settings that let you control how the pooling works in the connection string, but I have no idea what they default to if you don't specify them. You'd have hoped it would default to pooling but who knows.
|
# ¿ Nov 3, 2016 21:46 |
|
LeftistMuslimObama posted:lol, the feedback was: lol @ the idea that developers are expected to instantly write code that works first time. If a candidate ever quickly wrote perfect code I would immediately think that perhaps we've hosed up and given them a task they'd completed in the past or they had advanced knowledge or something. The coding tests that we run for recruitment use a fictional language with unusual syntax and a subset of the features you'd normally expect in order to get candidates to take their time and solve the problem on the spot instead of just parroting something they've done a million times. What strange feedback, especially about the resumes bit. I agree that you may have dodged a bullet here!
|
# ¿ Nov 5, 2016 11:33 |
|
hobbesmaster posted:looking forward to updates on fark and digg! - a post on somethingawful.com in 2016
|
# ¿ Nov 7, 2016 20:50 |
|
Shaggar posted:that's not com's fault its word's Yeah, the word com api is absolutely terrible. I've done work involving editing and generating documents via that API and holy crap you can do some wonderful things. We had code that deleted a particular line in a table embedded in the document. If the table didn't contain that line, the delete command still ran on the location it thought that element should be but instead managed to delete the end of the document. I don't mean it deleted some content from the end of the document, but it literally deleted what ever concept word has meaning "the document ends here". The document would literally scroll infinitely downwards until word exploded.
|
# ¿ Nov 8, 2016 10:49 |
|
HoboMan posted:when you want to make a rest api but your boss insists you use soap Indeed. Unless you love soap envelopes, I guess.
|
# ¿ Nov 15, 2016 17:41 |
|
Bloody posted:such an astonishing amount of effort to avoid writing sql Linq is pretty good. Pissing around with sql data readers on the other hand...
|
# ¿ Nov 17, 2016 22:55 |
|
KidDynamite posted:so a coworker ran into some poo poo yesterday that broke my brain and made me realize I am even more terrible than I thought, C# code If the List<AssList> is a list of objects then it'll be a list of object references. If you instantiate a new list with that list of object references, I believe you'll get a new list of references pointing at the same objects. So you've got two distinct objects, with two distinct lists, but both lists contain pointers to the same objects so when you iterate over them you're looking at the same data. You can do something like code:
Chalks fucked around with this message at 12:38 on Nov 18, 2016 |
# ¿ Nov 18, 2016 12:17 |
|
KidDynamite posted:will report back if we remain terrible If the object you're calling clone() on doesn't actually implement that function, you may be able to very quickly implement it yourself using MemberwiseClone or you might have to do something more fancy in the clone method. I've not used that function myself, but it looks cool.
|
# ¿ Nov 18, 2016 13:09 |
|
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 |
|
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 |
|
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 |
|
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 |
|
the talent deficit posted:linq is cool but people should learn sql prob if they deal with databases. you have to learn 90% of it to use a lovely query generator anyways, may as well learn the last 10% and not rely on weird magic Ah, you see, I started off with a 15 year old database and then had to implement entity framework database first which is something that entity decided wasn't supportable a long time ago. Hand crafting the entity generation logic onto a database that's only ever been interacted with using SQL certainly teaches you a lot about both technologies. Now, not only do I know the data structures by heart, but I also have an intimate understanding of how the entities work and when it's all inevitably broken as gently caress, it's entirely my fault! You really get a good understanding for why entity abandoned database first generation when you embark on something like this. Holy poo poo.
|
# ¿ Nov 19, 2016 12:26 |
|
eschaton posted:lotta unironic Sybase love ITT Put Oracle and Sybase side by side and Sybase wins every time IMO. gently caress oracle.
|
# ¿ Nov 20, 2016 11:27 |
|
raminasi posted:in f# you can use double backticks to just type a drat sentence and it kinda owns That sounds like something that could get a bit out of hand.
|
# ¿ Nov 21, 2016 17:44 |
|
Devops tip of the day: If you accidentally erase 1.7 million files, please don't just send an email to some senior staff members then keep using the disk for 8 hours until people wake up, read the email and poo poo themselves. Today has been fun.
|
# ¿ Nov 22, 2016 17:55 |
|
Just spent a while trying to work out why some code was working perfectly on QA but crashing on production and eventually working out it's because the account id was being cast to a short at one point and all the QA accounts being tested with had low account ids. This isn't the first time we've had this either, for such an obscure bug I'm surprised how often the scenario has come up.
|
# ¿ Nov 29, 2016 16:47 |
|
Stringent posted:an example of the kind of comment i'm talking about is one i just made on a bit of code that has to send a request to an external service Yeah, the "a comment is an apology" concept might work well in a world where you're responsible for every line of code, but as soon as you start interacting with third party libraries that don't necessarily function in a sensible way, you're going to be commenting workarounds and unusual behaviour pretty often. I write integration with accounting system software that's been around for decades and that stuff works in the most bizarre ways, often undocumented. Comment dat poo poo. Shaggar posted:Gotta optimize To be fair it was interfacing with a language where integers are actually shorts, longs are actually integers and in order to use a long, you have to use a datatype called a longlong. I guess that makes it a bit less surprising that this sort of poo poo happens. What I'm saying is, never touch SAP Powerbuilder.
|
# ¿ Nov 30, 2016 09:41 |
|
Weekend Bridges posted:alternatively, wrap it in a more sensible interface that can ensure proper access to the broken one. it's not always possible and it depends on how expressive your language is, but the great, great majority of the time there's nothing stopping you except putting the effort in, and that way you end up with a significantly more robust solution. sometimes you don't have the time to fix things, but i think it's worth keeping in mind that needing to comment things virtually always represents settling like that Yeah, but often it's not just the usage but the behaviour - as in, you're setting a combination of settings for a reason besides their obvious purpose. In cases like that "proper" access is difficult to define since enabling one feature requires the alteration of settings that affect other features - putting that behind an interface makes those interactions less clear. You go from needing a comment to explain why you're altering other settings, to the developer not knowing those other settings are being altered at all which can lead to further problems. As a minimum, your wrapper would need to document the reasons for the calls you're making in comments.
|
# ¿ Nov 30, 2016 11:09 |
|
Weekend Bridges posted:if those interactions are still visible to users of your wrapper, then you wrote a lovely wrapper I think we're talking cross purposes. Say you're writing software that interacts with an archaic accounting system. In order to enable feature A, you have to change 4 different settings, each of which have a primary purpose entirely unrelated to what you're trying to achieve. If you write a function of "EnableFeature()" that just does all of that, a developer using it will suddenly find different parts of the system behaving differently than they expected. They may go and change some of those settings back after making the function call, or go into your wrapper and remove the lines that are changing these settings because why the hell are these lines of code there anyway? Little do they know that you spent a week wrestling with this archaic and barely documented system to discover that these settings have to be set a certain way for the feature to work without exploding at some point in the future. Fortunately, commenting your apparently random code avoids this confusion. raminasi posted:I believe the point is that somewhere you have to write weird code, no matter how many layers of abstraction you hide it behind, and that weird code should get comments, because it's weird code Exactly - when you're starting from scratch you can always refactor your stuff so that it's clear (I mean who the hell writes a feature as a side effect of a bunch of other settings being set to invalid or unusual values?) but when you're dealing with 20 year old third party systems they tend to be written by piling random bullshit on top of stuff that nobody really thought through, and weird code is the world you live in.
|
# ¿ Nov 30, 2016 14:57 |
|
loving hell why is proper source control so loving complicated.
|
# ¿ Nov 30, 2016 17:31 |
|
LeftistMuslimObama posted:i mean, all y'alls first mistake is thinking gender can be used meaningfully for calculations anyway. a strict type doesn't matter because the reality is if you start using gender for calculations you are likely already loving up. for example, my creatinine clearance looks like im about to die if you use the gender to calculate reference ranges. using gender as a clinically significant factor for 90% of things is outdated medicine. Surely using any physical attribute to estimate based on statistical averages has the same issue? I'm a little surprised that there's no distinction between "sex" and "gender" in a medical scenario, but I guess recognition of that sort of thing is more recent than many ancient systems big organisations like that would be working on.
|
# ¿ Nov 30, 2016 20:51 |
|
LeftistMuslimObama posted:you misunderstand. this is my entire point. sex/gender is not a physical attribute. neither has any real bearing. sex has correlations with size, anatomy, hormones, etc, but it is not a guaranteed predictor. you're performing medicine-by-proxy when using sex or gender for these calculations. a big part of this push is moving people toward using the actual data they want (size, serum hormone levels, anatomy, blood pressure, etc). Sorry, I mean I assume there's a medical term for the generic attributes of I referred to as "sex" (such that would be useful in diagnosis) and I just figured that medical systems would use more medicalised terminology. And sorry if you thought I was interrogating you, I was just expressing surprise that a medical system wasn't using medical terminology from day one. I've always imagined that such systems would use all sorts of specific terminology to avoid ambiguity. I obviously understand that statistical information obtained from basic attributes like age/race/sex aren't guaranteed predictors, but often more general information will be used prior to doing the physical testing to establish the real data, as you say.
|
# ¿ Nov 30, 2016 21:28 |
|
LeftistMuslimObama posted:wasn't yelling at you in particular. more my idiot coworkers. It's cool, I really appreciate you taking the time to respond to my dumb posts I feel like I have more of an understanding of the issues now so maybe if I end up doing any work in that sort of field I'll be able to avoid being terrible! Bloody posted:actually i really like visual studio I absolutely adore visual studio (although performance and stability wise it's on a bit of a downward slope in recent versions) We use azure and visual studio team services at work and the integration is cool as hell. A really great IDE all over.
|
# ¿ Nov 30, 2016 22:20 |
|
fleshweasel posted:isn't there a contradiction between "gender is just an idea invented and propagated by society" and "I am undeniably mentally a different gender than the gender I was raised as and whose genitals I possess" Ones mind contains many ideas invented and propagated by society, gender being an extremely powerful one. But yeah, not really programmer chat.
|
# ¿ Dec 1, 2016 09:35 |
|
Soricidus posted:well yeah, but gender is treated kind of differently from a lot of these things. we don't have different pronouns for rich and poor people. You do have terms like Lord and Lady, but yeah, that sort of structure is mostly a thing of the past.
|
# ¿ Dec 1, 2016 13:04 |
|
carry on then posted:today we are grappling with the fact that our git repo is 3GB and takes 50 seconds to print a git status welp cya Is that just sheer quantity of code? We've had issues like this in the past but it's usually because someone decided to commit their binaries or something.
|
# ¿ Dec 1, 2016 16:26 |
|
HoboMan posted:so i only put the dev in devops. how would i have vs2015 also rename some files on publish? or is there some 3rd party deployment thing i should use instead? You can use .targets files to add extra tasks into the msbuild process. This might be useful to you: https://msdn.microsoft.com/en-us/library/ms366724(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/3e54c37h.aspx
|
# ¿ Dec 1, 2016 23:34 |
|
LeftistMuslimObama posted:dick presence sounds like a bloodborne secret boss Either that or a really weird christmas Chalks fucked around with this message at 07:59 on Dec 5, 2016 |
# ¿ Dec 5, 2016 07:56 |
|
Finster Dexter posted:Agreed but as a bad programmer not sure how else to implement this very bad search filtering poo poo they want where they want to search through db rows based on any or all of about 20 different search parameters. Generating a parametrised query in your code probably isn't too terrible, I assume you're not taking things like table names and field names from user supplied data. I'm going to be needing to do a similar thing soon in order to have grouped filtering checkboxes on a product search. When generating dynamic (x and y and (a or b or c)) stuff, this seems like the only approach. Chalks fucked around with this message at 15:11 on Dec 6, 2016 |
# ¿ Dec 6, 2016 15:08 |
|
NihilCredo posted:I have learnt through much pain to never use nulls if any other way of representing a missing value is available. What sort of issues do you encounter with nulls? Other than .net's stupid DBNull type, I've never been particularly concerned by them. I get rather irritated by code doing things like putting blank strings into fields to indicate that the value has been cleared because it can lead to really subtle bugs.
|
# ¿ Dec 6, 2016 18:50 |
|
NihilCredo posted:Well here's one from less than 48 hours ago: Wait, the database structure has the columns as "not null" but they contain nulls? Admittedly almost all my database experience has been with Sybase products but with those if you try to set a column to not null where it contains nulls you get an exception when trying to update the structure. Dealing with nulls in .net is the biggest pain I've found - you'd have thought that if a column contains a null then returning null would be a pretty sensible thing rather than some bizarre "DBNull" data type that seems to exist solely to irritate me. You just have to extend the data reader to return actual useful nulls instead though and then it all just works but the main reason it annoys me is because I'm apparently too dumb to ever remember this until my code crashes. Can't cast DBNull to string! Fucks sake. In general though I like nulls. In the example you mention, I guess there's some appropriate "default date" that you can use, but it could well be the case that if no end date is specified then there's some context specific end date that you use instead (like the end of the next working week or something based on other attributes of the record). I'd much rather use a null for that instead of setting the date to 01-01-2999 and then having a special case for that magic date or whatever. With dates that seems really insane but you see people doing magic crap like that with strings and integers all the time. Chalks fucked around with this message at 21:31 on Dec 6, 2016 |
# ¿ Dec 6, 2016 21:28 |
|
HoboMan posted:agreed that DBNull being it's own datatype is annoying as gently caress. lead to a bug for me just today in fact! I've seen it argued that when you're doing something like execute scalar it's relevant to know whether you got a null value or whether the scalar returned zero rows, but my god there has to be a better way.
|
# ¿ Dec 6, 2016 22:00 |
|
redleader posted:i know that vue.js (think knockout, but in 2016!) supports react-style server-side rendering. there's a third-party thing that allows server-side rendering in asp.net iirc I've been impressed with vue.js in terms of being pretty straight forward to use when you're doing relatively simple things. I'm not particularly experienced with it though
|
# ¿ Dec 8, 2016 10:40 |
|
Just finally got to the bottom of one of our systems being really unreliable for no apparent reason. Turns out that a third party API that we're integrating with will return the same authentication token to multiple login requests made by the same account. As soon as one of the processes calls LogOut, all other processes that happen to be running at the same time will break. Seems to be working fine in development but just randomly breaks in production because you're more likely to get overlapping requests. Workaround until the third party fixes it: never call LogOut.
|
# ¿ Dec 8, 2016 14:46 |
|
Soricidus posted:const has never meant "won't change". Besides the fact that the word "constant" literally means "won't change"
|
# ¿ Dec 11, 2016 23:10 |
|
Soricidus posted:maybe they'd have used the word constant if they had meant constant, instead of using a vaguely similar word to indicate a vaguely similar concept? You mean the way that it's nothing to do with the word "Character"? Maybe the word "Const" isn't a shortening of the word "Constant", or maybe it is. I'm tending towards the explanation that involves them being english words rather than completely random series of characters that just happen to coincide with words. Chalks fucked around with this message at 11:47 on Dec 12, 2016 |
# ¿ Dec 12, 2016 09:37 |
|
ultravoices posted:i wouldn't call myself competent, but I can google what I don't know. This is literally the only thing you need to learn to be a programmer. Nehacoo posted:Why would I want git support in my editor? Someone mentioned that a page or so ago, I think, and I'm genuinely curious what the benefits are. I usually just keep a terminal open in another workspace and use git cli there and I've never felt constrained by that. In VS you get little captions at the top of functions saying "Last updated by Dumb rear end in a top hat 5 days ago with a commit note of 'Farts' and work item 'Needs more farts'". Branch, commit, merge, diff, never leave your IDE again! Chalks fucked around with this message at 17:53 on Dec 13, 2016 |
# ¿ Dec 13, 2016 17:47 |
|
|
# ¿ May 12, 2024 05:50 |
|
Finster Dexter posted:No that's... I don't... Yeah, in our interviews we intentionally set problems that require the solution to act unusually in certain conditions. They're free to use google to help them with the answer, but they'd better read and fulfil the specification. It's a much better test of someone's ability to actually carry out a real world task rather than their ability to pointlessly memorise algorithms.
|
# ¿ Dec 13, 2016 18:05 |