|
Carbon dioxide posted:You misspelled MongoDB. I hear it's webscale
|
# ? Dec 9, 2017 17:44 |
|
|
# ? May 30, 2024 13:23 |
|
ratbert90 posted:I hear it's webscale
|
# ? Dec 9, 2017 19:26 |
|
Ralith posted:webscale: a difficult-to-remove residue that accumulates on a project that process large amounts of HTTP. You just need some webtenders friend and that web scale will come right off
|
# ? Dec 11, 2017 01:09 |
|
Ralith posted:webscale: a difficult-to-remove residue that accumulates on a project that process large amounts of HTTP. The medical term is diPHPtheria.
|
# ? Dec 11, 2017 01:16 |
|
"Names must be descriptive", indeed.code:
|
# ? Dec 11, 2017 17:38 |
|
There is a series of inventory control machines that are used by some of our clients. I've been tasked with evaluating how difficult it would be to add support for them to our software. I spent a few hours reading docs, chatting with the company's implementation people, and playing with a simulator they provided. When I present my findings at the next dev meeting, I had this exchange with one of the other programmers: Me: ...and you talk to the devices via ODBC. Him: Isn't ODBC on its way out? Me: I... that's debatable and not relevant. Him: Shouldn't we use an API instead? Me: Um... you don't... this isn't... I... Him: I just think we should use something modern, like an API. Me: ... Sometime our sales guys say weird cargo cult stuff like this, but this guy has been programming for almost 20 years.
|
# ? Dec 11, 2017 20:00 |
|
Student code doesn't count as a horror, but circumstances forced me to fix some of it myself, so let's all dive in. In a large class with animation based projects, one student turned in a remake of the phone game Crossy Road, where you jump around cars like in Frogger. They did a good job: The course website showcases finished projects. On it I noticed that theirs was the slowest to load for some reason, making it impossible to flip through all the submissions without Crossy Road locking the index page up, so I ran Chrome's profiler on it. It lit up all their calls to create pretty much anything in the game. It was slow to create a row of grass, or the player, or any of the other simple primitive shapes in the scene. I looked deeper and found that every ground strip, every car, the player, even the scene itself all extended a base class that called this code: code:
But what's this call to getShapes() they added? We didn't give them that part. Well, it turns out we did. Function getShapes() turned out to be inexplicably wrapping a very complex demo I had made for them showing how to generate tons of different possible shapes using math, by taking arbitrary steps to get to the next row or column of a deformed sheet. My demo code showed how to define lots of possible arbitrary deformations (as JavaScript arrow functions), generated a lot of shapes using them, and stored them all in big arrays of points at the end. It was meant to be a full demonstration of possibilities, and never to be used for real, much less called more than once. The shape in my avatar came from that demo: This Crossy Road game didn't just call it more than once, it called it every single time a strip of the ground or piece of a car needed to be made. All because one of the included shapes in my demo was a cube. Rather than putting "new Cube()" in their class that drew the ground or whatever, calling only the 10-line Cube class that copies its little array over to the GPU (or better yet only ever doing it once during the program since it's always the same), they instead for every ground strip just re-called that whole demo and made the CPU painstakingly re-calculate all the demo shapes' huge arrays again. They created a custom pyramid shape too by using their own small class, but again, rather than putting "new Pyramid()" inside their other class that needed a pyramid, they instead added their pyramid to the end of my huge list of demos, running the whole thing every time they wanted one. code:
To prevent this I added a line "if( cached_shapes ) return cached_shapes;" at the beginning of their getShapes() where a global cached_shapes starts as null and gets set at the end of getShapes(). No more long load times, and the index page doesn't hang when flipping to their project in the showcase. The rest of their code was reasonably impressive, with abstract superclasses of every shape and lots of subcategories of drawable objects each organized nicely into little files... but with just that one big oversight. Happy Thread fucked around with this message at 02:02 on Dec 12, 2017 |
# ? Dec 11, 2017 20:32 |
|
"If I can reproduce it, I can fix it. If I cannot reproduce it, I cannot fix it". Well then, I'd put my on you not being able to fix it.
|
# ? Dec 11, 2017 22:57 |
I don't know if this counts as a coding horror, exactly, but...java script: The Good Parts posted:Unlike most other programming languages, there is no separate integer type, so 1 and 1.0 are the Are Also, I love this: "problems of overflow in short integers are completely avoided", as though you couldn't avoid that problem by, say using a 64-bit int by default (or, like Python, using arbitrary-precision integers) Eela6 fucked around with this message at 23:44 on Dec 11, 2017 |
|
# ? Dec 11, 2017 23:41 |
|
Just looked for the first time at the HTML source a vendor-provided web app generated. The page has 75 style sheets and an 18-line ASCII art logo at the top. The logo incorrectly capitalizes the name of the product. Also I changed somebody's last name to "><b> and exactly what you'd expect happened.
|
# ? Dec 11, 2017 23:51 |
|
In ponylang, which, despite the name, seems to be a reasonably serious if unfinished programming language, and which actually looks kinda neat... they decided to have divide by zero return the number 0, because otherwise the error handling would get too annoying.
|
# ? Dec 11, 2017 23:56 |
|
Eela6 posted:I don't know if this counts as a coding horror, exactly, but... So, problem of short integers is solved by not using short integers? Pretty tautological, I'd say. Also, my browser feels a bit suicidal now
|
# ? Dec 11, 2017 23:59 |
|
Eela6 posted:I don't know if this counts as a coding horror, exactly, but... Douglas Crockford is completely convinced of the virtue of a language having only one built-in number type, though he does not think javascript has the right one.
|
# ? Dec 12, 2017 00:39 |
|
Doc Hawkins posted:Douglas Crockford is completely convinced of the virtue of a language having only one built-in number type, though he does not think javascript has the right one.
|
# ? Dec 12, 2017 00:52 |
|
Doc Hawkins posted:Douglas Crockford is completely convinced of the virtue of a language having only one built-in number type, though he does not think javascript has the right one. What hardware actually supports base10 though?
|
# ? Dec 12, 2017 00:54 |
|
Doc Hawkins posted:Douglas Crockford is completely convinced of the virtue of a language having only one built-in number type, though he does not think javascript has the right one. single-cycle additions but comparisons to zero require 255 checks. lmao.
|
# ? Dec 12, 2017 01:16 |
|
steckles posted:There is a series of inventory control machines that are used by some of our clients. I've been tasked with evaluating how difficult it would be to add support for them to our software. I spent a few hours reading docs, chatting with the company's implementation people, and playing with a simulator they provided. When I present my findings at the next dev meeting, I had this exchange with one of the other programmers: Your living in my favorite Dilbert strip! http://dilbert.com/strip/1995-11-17
|
# ? Dec 12, 2017 01:18 |
canis minor posted:So, problem of short integers is solved by not using short integers? Pretty tautological, I'd say. What I'm trying to say is that he implies the alternative to using floats for ints is using shorts for ints. What language does that?
|
|
# ? Dec 12, 2017 01:19 |
|
Doc Hawkins posted:Douglas Crockford is completely convinced of the virtue of a language having only one built-in number type, though he does not think javascript has the right one. "make everything floats" is a bad idea, "make everything into a number type optimised around the ease of implementing printf" is a baffling idea
|
# ? Dec 12, 2017 01:21 |
|
Jeb Bush 2012 posted:"make everything floats" is a bad idea, "make everything into a number type optimised around the ease of implementing printf" is a baffling idea We’re all floats down here
|
# ? Dec 12, 2017 01:23 |
|
Sedro posted:What hardware actually supports base10 though? ugh: quote:The exponent can be unpacked at no cost on x64 architecture because the least significant byte can be accessed directly.
|
# ? Dec 12, 2017 01:26 |
|
Suspicious Dish posted:single-cycle additions but comparisons to zero require 255 checks. lmao. Not defending this thing, but you don't need 255 checks, you would just mask off the exponent.
|
# ? Dec 12, 2017 01:42 |
|
Lime posted:Not defending this thing, but you don't need 255 checks, you would just mask off the exponent. yeah i know, but nan semantics are weird. > There is a special value called nan that has a coefficient of 0 and an exponent of -128. was curious what doug did. https://github.com/douglascrockford/DEC64/blob/master/dec64.asm#L1444 oh
|
# ? Dec 12, 2017 03:56 |
|
http://shitcode.net/
|
# ? Dec 12, 2017 09:31 |
|
Had an issue at work where a grid navigation control on a web table wasnt working quite sensibly. On page one clicking > would go to a page starting at record 201. Then on 201 clicking > would go to 2211 , then 22311 and so on. Turns out javascript was taking the record number, adding 20, then adding 1 *as a string*, the reason being that for some reason the REST endpoint was putting quotes around the index. And Javascript being a dumpster fire of a language, instead of typecasting it to an int, or raising an error , decided 20 + '1' = '201'. I hate my job.
|
# ? Dec 12, 2017 13:54 |
|
Sedro posted:What hardware actually supports base10 though? The 6502 series, aka God's own architecture
|
# ? Dec 12, 2017 15:17 |
|
duck monster posted:Had an issue at work where a grid navigation control on a web table wasnt working quite sensibly. @ the fact that that paging is broken even without the javascript horror.
|
# ? Dec 12, 2017 16:01 |
|
perhaps the endpoint quoted the index because in a strongly-typed language on the other end it happens to be a 64-bit int, and if it were interpreted as a JS number it would parse as a double and lose precision?
|
# ? Dec 12, 2017 16:22 |
|
I'm the user clicking "Next" 9 quintillion times.
|
# ? Dec 12, 2017 18:32 |
|
Internet Janitor posted:perhaps the endpoint quoted the index because in a strongly-typed language on the other end it happens to be a 64-bit int, and if it were interpreted as a JS number it would parse as a double and lose precision? Twitters API legitimately has to encode Tweet IDs as strings because they exceeded 2^53 Tweets, so the IDs can no longer be represented as Javascript numbers
|
# ? Dec 12, 2017 18:43 |
|
repiv posted:Twitters API legitimately has to encode Tweet IDs as strings because they exceeded 2^53 Tweets, so the IDs can no longer be represented as Javascript numbers They weren't using an ID format that could represent an arbitrarily large number of unique Id's?
|
# ? Dec 12, 2017 21:06 |
|
Taffer posted:They weren't using an ID format that could represent an arbitrarily large number of unique Id's? To be honest, if you asked me to pick an ID format for something, I'd probably pick 64-bit int by default. That's 18 sextillion! That's a lot! The fact that this is limited to 9 quadrillion in Javascript would not have immediately leapt out to me as a problem.
|
# ? Dec 12, 2017 21:15 |
|
duck monster posted:And Javascript being a dumpster fire of a language, instead of typecasting it to an int, But it does, just not in the case of the + operator, which is legal on strings. Had it been -, / or *, the string would have been converted to a number first. That's how you end up with so many accidental NaNs in Javascript code: if a string can't be converted to a proper number, it's converted to NaN instead, which propagates through all operations Javascript is a really simple language (to a fault) and it's not hard to fully learn it. Treat it as the language it is, instead of the languages it looks like, and it won't be so surprising
|
# ? Dec 12, 2017 21:31 |
|
I still don’t understand how 64-bit is somehow different between Javascript and anywhere else.
|
# ? Dec 12, 2017 21:34 |
|
Pollyanna posted:I still don’t understand how 64-bit is somehow different between Javascript and anywhere else. Javascript doesn't have integers, all numbers are represented as 64-bit floats. Those can only store exact integers up to 53-bits long and silently become imprecise beyond that. code:
|
# ? Dec 12, 2017 21:42 |
|
Pollyanna posted:I still don’t understand how 64-bit is somehow different between Javascript and anywhere else. quote:JavaScript Numbers are Always 64-bit Floating Point Unlike, say, .NET, where a long integer is a signed 64-bit integer, and not a floating point value. quote:long -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 Signed 64-bit integer
|
# ? Dec 12, 2017 21:42 |
|
TooMuchAbstraction posted:To be honest, if you asked me to pick an ID format for something, I'd probably pick 64-bit int by default. That's 18 sextillion! That's a lot! The fact that this is limited to 9 quadrillion in Javascript would not have immediately leapt out to me as a problem. Unless there's a peculiar need for speed I just default to a full-length UUID for anything that needs an identifier. It's overkill but I know it's always big enough E: I dumb
|
# ? Dec 12, 2017 22:16 |
|
code:
|
# ? Dec 12, 2017 22:23 |
|
Not even final, ugh!
|
# ? Dec 12, 2017 22:24 |
|
|
# ? May 30, 2024 13:23 |
|
Taffer posted:Unless there's a peculiar need for speed I just default to a full-length UUID for anything that needs an identifier. It's overkill but I know it's always big enough There's always need for speed, and there's never a need for arbitrarily reducing it. The system will have enough bottlenecks as it is, why introduce a new one for no reason? UUIDs are fine if you have distributed databases, but if you don't, why bother?
|
# ? Dec 12, 2017 22:26 |