|
Switzerland posted:Hail Satan. iospace posted:Hail Satan ultrafilter posted:Hail Satan. Could somebody refactor this so we're not just cut'n'pasting code everywhere?
|
# ? Jun 4, 2019 05:12 |
|
|
# ? May 21, 2024 02:58 |
|
Sail Hatan Ah poo poo I forgot to write a test first
|
# ? Jun 4, 2019 05:23 |
|
CPColin posted:Sail Hatan My IDE says you have a typo in your variable name, did you mean "SailHating"?
|
# ? Jun 4, 2019 06:52 |
|
redleader posted:tldr: software is hell, testing won't help, hail Satan. hail Satan. e: what the hell happened to the function that was supposed to capitalize sentences?
|
# ? Jun 4, 2019 07:25 |
|
culture.setPhrases["religious-greeting"].format(culture.findSignificantFigure("devil", "trickster")) // fix POST-42069 cultural sensitivity
|
# ? Jun 4, 2019 08:17 |
|
Hi guys, i wrote a better function. Can someone write some test cases and accept my pull request? Thankscode:
|
# ? Jun 4, 2019 15:39 |
|
code:
DaTroof fucked around with this message at 16:16 on Jun 4, 2019 |
# ? Jun 4, 2019 16:09 |
|
ultrafilter posted:Something I've been thinking about lately is metamorphic testing, which involves looking at how the output of a function/program changes when the input changes. In a lot of cases it's much easier to reason about what those changes should be like than to figure out what the output should be for a given input. I do a lot of geometry programming and have a few tests like that they end up super useful in checking. The issues you can often run into is floating point numbers whose pathologies will just mess everything up... You tend to have to end up defining the results up to some tolerance and then most of the results you naively expect to hold have weird edge cases that dont. For example the point of intersection between 2 lines (sensible) can often be a point that cannot be exactly represented in doubles as a point that lies on both lines, if you define everything up to a fixed tolerance you can get potentially several points that are (to tolerance) on both lines but are distinct (to tolerance). Really the issue is that a lot of geometric methods which are nice and easy to specify tend to have vast numbers of edge cases when transfered to an approimate world and result in methods that are woefully underspecified. Otoh in nearly all actual non pathological cases everything makes sense.
|
# ? Jun 4, 2019 21:15 |
|
euclidian88 posted:I do a lot of geometry programming Wonderful id and post combo.
|
# ? Jun 5, 2019 03:38 |
|
euclidian88 posted:I do a lot of geometry programming and have a few tests like that they end up super useful in checking. The issues you can often run into is floating point numbers whose pathologies will just mess everything up... Yeah, I wrote a 3D math library once and there were dumb times where I had to test an edge case, get it to fail, spend an hour puzzling out why (or sometimes just see the output of the number) and be like: code:
And then, if you were dumb enough to write a clone for both widths of float (even if it's templated code), you can probably reuse all the same tests, but you get all the fun of figuring out your tolerances again. Linear Zoetrope fucked around with this message at 04:02 on Jun 6, 2019 |
# ? Jun 6, 2019 03:36 |
|
Floating point is hell, testing won't help, hail Satan.
|
# ? Jun 6, 2019 04:13 |
|
ultrafilter posted:Floating point is hell, testing won't help, hail Satan. You're right, and this post is giving me anxiety. Hail Satan.
|
# ? Jun 6, 2019 04:22 |
|
ultrafilter posted:Floating point is hell, testing won't help, hail Satan. It is known.
|
# ? Jun 6, 2019 14:29 |
|
Give me my embedded land. Only work in ints. I say that as a project of mine uses trig
|
# ? Jun 6, 2019 14:55 |
|
iospace posted:Give me my embedded land. Only work in ints. Do you get to enjoy the many wonders of fixed point arithmetic?
|
# ? Jun 6, 2019 15:37 |
|
ultrafilter posted:Floating point is hell, testing won't help, hail JavaScript. Hail
|
# ? Jun 6, 2019 15:41 |
|
Qwertycoatl posted:Do you get to enjoy the many wonders of fixed point arithmetic? I have in the past but floats, when you're actually dealing with baked in functions, work well enough.
|
# ? Jun 6, 2019 15:50 |
|
I found a servlet that we still use in Production, but also still store in SVN. It was from when my predecessor started, ten years ago.Java code:
Guess they hadn't gotten the hang of what makes a good comment yet.
|
# ? Jun 7, 2019 00:11 |
|
CPColin posted:I found a servlet that we still use in Production, but also still store in SVN. It was from when my predecessor started, ten years ago. On the one hand, that's ridiculous. On the other, I'd rather have that guy on my team than someone who calls everything $var1 $var2 etc and has to ask me what characters start a comment.
|
# ? Jun 7, 2019 00:23 |
|
I found IMiscellaneousService at work today and I can't stop laughing.
|
# ? Jun 7, 2019 00:28 |
|
At least with awful redundant comments you can always just delete them all.
|
# ? Jun 7, 2019 01:17 |
|
ultrafilter posted:Floating point is hell, testing won't help, hail Satan. What else are you going to use to store currency in your database? GreeterFactory.newGreeter.greet("Santa")
|
# ? Jun 7, 2019 04:29 |
|
I store my currencies in VARCHAR such as "100,000.00 USD" or "88.750,00 EUR", which represent the same value.
|
# ? Jun 7, 2019 05:00 |
|
xtal posted:I store my currencies in VARCHAR such as "100,000.00 USD" or "88.750,00 EUR", which represent the same value. It's also best if you use the current locale for the decimal separator when parsing/saving these strings. Hail Satan.
|
# ? Jun 7, 2019 06:06 |
|
Bruegels Fuckbooks posted:It's also best if you use the current locale for the decimal separator when parsing/saving these strings. Hail Satan. For the longest time our codebase called this function something like a gazillion times per second (all number formatting, all calculations, all database i/o on numeric columns...): code:
|
# ? Jun 7, 2019 10:16 |
|
NihilCredo posted:For the longest time our codebase called this function something like a gazillion times per second (all number formatting, all calculations, all database i/o on numeric columns...): jits aren't magic. it's very unlikely it did either of those things. the tostring implementation is probably quite complex, so it probably won't have inlined it, so it probably won't have had any distinction between this input to it and any other input to it, so it probably won't have done anything fancy at all based on this input being constant.
|
# ? Jun 7, 2019 11:00 |
|
code:
|
# ? Jun 7, 2019 11:18 |
|
I was just severely tempted to leave the next guy dealing with this code thisC++ code:
|
# ? Jun 7, 2019 14:17 |
|
The only horror there is the board/bored homophone.
|
# ? Jun 7, 2019 14:40 |
|
Cuntpunch posted:Found this gem of relatively recent legacy code when I saw that line in the logs. The rest is just icing on the cake. Add a comment that says "to big or not to big? that is the question."
|
# ? Jun 7, 2019 15:26 |
|
Trying to figure out what database this super old code connects to and fortunately my predecessor put the connection string and credentials right in the source, since they didn't know better at the time. (Time to add another "scrub credentials from source" to the backlog.) Trying to connect to the purported URL of the database times out. The hell's going on here? I ended up grabbing the .class file from the server and decompiling it to discover that, at some point, my predecessor decided to override the hard-coded database URL in the dumbest way possible. This: Java code:
Java code:
This change was never checked into source control, by the way, nor was the original connection string ever deleted from the code. My predecessor made the change, compiled it, and dropped the .class file right onto the server. This is also the official way to update the hard-coded list of users who are allowed to use this application. Time to start from scratch! Edit: Oh, also, _con is static.
|
# ? Jun 7, 2019 18:57 |
|
that's a good honest coding horror Edit: what field are you working in? sunaurus fucked around with this message at 19:07 on Jun 7, 2019 |
# ? Jun 7, 2019 19:03 |
|
I work on a college campus for an auxiliary company that has to be separate from the rest of the university for reasons I've never had explained to me properly.
|
# ? Jun 7, 2019 19:31 |
|
CPColin posted:I work on a college campus for an auxiliary company that has to be separate from the rest of the university for reasons I've never had explained to me properly. Probably for-profit vs. non-profit shenanigans
|
# ? Jun 7, 2019 19:34 |
|
The Fool posted:Probably for-profit vs. non-profit shenanigans Possibly, but it's a public university, so who knows. I think it's something about budgeting and being able to accept gifts as a "separate" company. I try to dodge having to explain, any time somebody asks where I work. Same thing happened when I worked at Experts Exchange. "No, we don't answer the questions ourselves. Other people do it. No, they don't get paid."
|
# ? Jun 7, 2019 19:39 |
|
CPColin posted:Trying to figure out what database this super old code connects to and fortunately my predecessor put the connection string and credentials right in the source, since they didn't know better at the time. (Time to add another "scrub credentials from source" to the backlog.) Trying to connect to the purported URL of the database times out. The hell's going on here? This is obviously horrifying but maybe not as horrifying as having the real creds in source control? Maybe?
|
# ? Jun 7, 2019 20:06 |
|
Going over old pages in our web interface looking for things to mark for cleanup.code:
|
# ? Jun 7, 2019 20:43 |
|
Eggnogium posted:This is obviously horrifying but maybe not as horrifying as having the real creds in source control? Maybe? I just found a second set of credentials in the same repo, to another database. Edit: This one is in a JSP file. Yes, a JSP file is manually opening a connection to a database and doing queries on it, with all of the connection parameters hard-coded right in there. Edit2: This JSP file is supposed to be implementing an autocomplete popup, but it doesn't work because the place that's supposed to use it uses absolute paths and stuff moved sometime in the last ten years. It's a good thing, too, because the queries being run include a clause for restricting results to those a certain user can see. That user is specified as one of the URL parameters, so not the most secure bit of functionality. CPColin fucked around with this message at 22:38 on Jun 7, 2019 |
# ? Jun 7, 2019 21:48 |
|
CPColin posted:user is specified as one of the URL parameters, so not the most secure bit of functionality.
|
# ? Jun 7, 2019 23:03 |
|
|
# ? May 21, 2024 02:58 |
|
CPColin posted:I just found a second set of credentials in the same repo, to another database. Hahaha. This reminds me of another JSP page that I had the pleasure of seeing a few years back: It was holding the currently logged in users in a static java.util.Hashtable. 2 people could not log in/browse at the exact same time or the application would crash. That was in addition to its many other issues. "Can you fix it?" was the question. "No" was the only possible answer that i could give.
|
# ? Jun 8, 2019 00:35 |