WTF Bites
-
@MrL in my case the “other side” is actually writing their API tool chain in C# .NET - and I’m one of several clients (in my case, PHP with Laravel) proving you can write stupid in any language.
-
@Arantor Apart from mostly enforced type safety I don't think C# has any actual safeguards against stupid. As opposed to random excrements of the JS world, it's a cargo cult instead.
And it does have quite a few legal ways to do stupid if you're determined enough:
I have a permit.
This just saysunsafe
?I especially love the internets wisdom of the lists of n keywords you should never use.
-
@Applied-Mediocrity sure, you can write stupid in any language, it’s just JavaScript is the Ralph Wiggum version, sat in the corner eating paste saying “I’m in danger!” while C# makes you type extra words in that might prompt a thought or two longer pause on it first.
Also are we still putting “go to” on those lists??
-
@Applied-Mediocrity said in WTF Bites:
I especially love the internets wisdom of the lists of n keywords you should never use.
Those are always fun, especially when it is clear that the person who wrote the list has no idea why. (In Java you should never use
goto
, but that's because it isn't implemented, just reserved in the lexer.)
-
Actually, the server will return
200 OK
with an HTML document describing the error (instead of the usual JSON or XML or whatever format). Because of course it does.We've had this same problem recently. And since it was an API for retrieving a raw file from a repository, I had to add some kludgy code to detect if the reply is HTML, and not accept it if it is (thankfully the repository is not supposed to contain genuine HTML files).
Good news is, I've made a pull request for a change that would cause it to return the actual error code. Bad news is, the machine turns slowly...
-
@ixvedeusi said in WTF Bites:
applying the clue-bat to the devs
For those devs, I suggest a "clue-bat" that looks like this:
-
I know! We'll use a parallel data stream addressable by the filename!
Don't cross the streams, it would be bad.
You can never parse the same stream twice.
Yeah you can. Just use
Unsafe
.
-
the main obstacle to programmers ever getting a standardized API to list and access them.
That's close. The main main obstacle is that they are a terribly bad idea.
-
@Applied-Mediocrity said in WTF Bites:
...
(In Java you should never usegoto
, but that's because it isn't implemented, just reserved in the lexer.)Iirc some use of it occurs in the pcode?
I suggest that INTERCAL2024 incorporate a
cursed
modifier for declarations. At least one item on one such list should be correct, after all.
-
@HardwareGeek said in WTF Bites:
the things we’ve actually seen from the past about predictions about our time.
I want my flying car. We were promised flying cars.
Ah, that explains why I was shipped two.
-
@Gern_Blaanston said in WTF Bites:
Those wacky Japanese
https://nitter.kavin.rocks/omically/status/855836584024956928#m
-
-
@BernieTheBernie What's with the Random size changes and bolding in the URL?
-
@HardwareGeek Don't ask me...
All digits and%
are smaller... so not completely random.
-
@BernieTheBernie said in WTF Bites:
That might be fun when you try to type that URL in your browser:
%E0%B8%81%...
Apparently the QR code is representative:
https://medthai.com/%E0%B8%81%E0%B8%A3%E0%B8%B0%E0%B9%80%E0%B8%88%E0%B8%B5%E0%B9%8A%E0%B8%A2%E0%B8%9A%E0%B9%81%E0%B8%94%E0%B8%87/
I guess it's supposed to look like this: https://medthai.com/กระเจี๊ยบแดง/I still can't imagine someone trying to type it though.
-
@BernieTheBernie said in WTF Bites:
@HardwareGeek Don't ask me...
All digits and%
are smaller... so not completely random.Looking more closely, you are correct that all the digits are smaller. However, 3 of the
%
s are big and bold. Probably not coincidentally, these 3%
characters are not preceded by digits. It looks like it's formatting "numbers" differently than "text", and it interprets3%
or5%
or whatever as a number.
-
: Hey MrL, can you take over this service we got from [the other] department?
: Sure.Ok, let's have a look... it's getting data from those systems, sends them to those... ok... Structure is kinda flat, too flat for my taste, but nothing horrible. Style is terrible, will have to change that for sure... As for logic... first let's see data models... ... ...
huh, where are they?
[confusion] No data models?Oh. I see. There's only one data type for all operations.
dynamic
-
No data models?
Oh. I see. There's only one data type for all operations.Oh lovely. Task one: discovering what the data model really is, because "it could be anything" is impossible for anyone to work with. It could be a small number or it could be a handle to a terabyte of binary data or it could be the control channel to a cluster. Anything is anything!
The real answer to "why" is probably that they just didn't want to write it down "just in case" they wanted to change it. It's sort of an OK approach for version 0.1 of a service ('ve seen that sort of hack done multiple times by students) because it takes time to work out what's needed, but stuff does need to get regularized as things become more production-ready.
-
No data models?
Oh. I see. There's only one data type for all operations.Oh lovely. Task one: discovering what the data model really is, because "it could be anything" is impossible for anyone to work with. It could be a small number or it could be a handle to a terabyte of binary data or it could be the control channel to a cluster. Anything is anything!
"Working in dynamic language gives me greater freedom of expression than you have", as one of my node "colleagues" once said.
The real answer to "why" is probably that they just didn't want to write it down "just in case" they wanted to change it.
No, that's just pure lazyness. Data model is completely defined in other systems. Most of which were made by the same people, just before dynamic was available (or before they heard about it).
-
"Working in dynamic language gives me greater freedom of expression than you have", as one of my node "colleagues" once said.
That sounds familiar. Mine followed it with: "I don't need a compiler because I test my code"
-
-
@homoBalkanus said in WTF Bites:
"Working in dynamic language gives me greater freedom of expression than you have", as one of my node "colleagues" once said.
That sounds familiar. Mine followed it with: "I don't need a compiler because I test my code"
And here I am, thinking that if we had more formal verification we wouldn’t need to test so much.
-
"Working in dynamic language gives me greater freedom of expression than you have", as one of my node "colleagues" once said.
In my experience, scripting languages are well suited to writing the controller parts of MVC applications, but aren't so great at the models and views tend to be hybrids (they have some bits that need to be high performance, but the configuration of those is less performance sensitive). Compiled languages are usually good at models and performance-sensitive parts of the code, but intensely annoying to use for all the little bits of crap you have to deal with doing a controller. (In a web application, you hoist a lot of the controller and view logic to the client browser, so your local server-side stuff is otherwise looking a lot like it can be a fully compiled app. Apart from that horrible JS blob that you have to push...)
Sure, you don't have to do things that way, but it ends up being quite painful.
-
And here I am, thinking that if we had more formal verification we wouldn’t need to test so much.
"Beware of bugs in the above code; I have only proved it correct, not tried it." — Donald Knuth
-
And here I am, thinking that if we had more formal verification we wouldn’t need to test so much.
"Beware of bugs in the above code; I have only proved it correct, not tried it." — Donald Knuth
Sure. But at least I don’t write 97 tests to check that a parameter is actually an integer and not string or a json object. Because I have a compiler!
-
I don’t write
97teststo check that a parameter is actually an integer and not string or a json object. Because I have a compiler!
-
@topspin That tends to not be a big problem in the first place. Or rather you test the parser where you convert the external world into the internal world (which might be at the point when you convert things into the model), and that you test thoroughly (if you're wise!) but after that you're mostly not needing to worry about stuff.
The controller tends to be worrying about "if this is invalid then show the right kind of warning indicators to the user, with suitable pulsing animation if they've not disabled it in the accessibility settings" and so on.
-
@Tsaukpaetra said in WTF Bites:
@BernieTheBernie said in WTF Bites:
That might be fun when you try to type that URL in your browser:
%E0%B8%81%...
Apparently the QR code is representative:
https://medthai.com/%E0%B8%81%E0%B8%A3%E0%B8%B0%E0%B9%80%E0%B8%88%E0%B8%B5%E0%B9%8A%E0%B8%A2%E0%B8%9A%E0%B9%81%E0%B8%94%E0%B8%87/
I guess it's supposed to look like this: https://medthai.com/กระเจี๊ยบแดง/I still can't imagine someone trying to type it though.
See: that's interesting.
On the signboard, they say the Thai name isกระเจี๊ยบ
, but in the URL, they addแดง
(red).
-
It's sort of an OK approach for version 0.1
It's a dangerous approach for version 0.1, because version 0.1 will inevitably be pushed into production, called good enuff, the programmers called off to some other task and then some hapless soul will end up having to find out what the data actually look like five year later when some would-be-trivial-if-it-was-documented change will be needed.
-
-
@BernieTheBernie: do you speak Thai, ou did you brute force it?
-
It's sort of an OK approach for version 0.1
It's a dangerous approach for version 0.1, because version 0.1 will inevitably be pushed into production, called good enuff, the programmers called off to some other task and then some hapless soul will end up having to find out what the data actually look like five year later when some would-be-trivial-if-it-was-documented change will be needed.
I'm currently fighting (and hating) a data model change. Having to do all sorts of gymnastics around ids for this one type of model object. Why?
They're stored in the DB as autoincrementing BIGINT (don't ask me why, that was before my time). But they were transferred (via JSON) as strings, because JSON doesn't have a BIGINT type. Neither do some of the clients. Most of the clients said "ok, they're opaque strings". But the iOS client...there someone decided to be smart and deserialize them as integers.
But now we're moving to using UUIDs for keys (they're still stored with a BIGINT primary key, but ideally only the DB should care about that because indexes). The other clients accept that gracefully--a string is a string, after all. But the iOS client? Nope. Barfs because converting a UUID to an INT produces... -1. And -1 is not a valid id for anything. So the api calls that use this id fail. So now I have to jump through these hoops so that existing clients can use the numeric db id OR a string uuid. Which changes lots of things. But only until the transition of the clients is complete, after which everything should be using the uuids. Maybe. If we're lucky.
Oh, and there's accumulated legacy data that was in all sorts of validity for years. Including flat out invalid data that we have to at least not barf on. Ticket from hell.
-
I just captured the image because it was cool. The WTF is in the text below the image.
-
I just captured the image because it was cool. The WTF is in the text below the image.
So, since they disabled location embedding in the photo, it was marked "location not shared" but then the poster put the location in the caption (which was not interpreted), and thus WTF?
-
@Tsaukpaetra said in WTF Bites:
it was marked "location not shared" but then the poster put the location in the caption
Ah, but where in Pecos, Texas?
-
@Tsaukpaetra said in WTF Bites:
it was marked "location not shared" but then the poster put the location in the caption
Ah, but where in Pecos, Texas?
Right there, naturally!
-
@Zerosquare said in WTF Bites:
@BernieTheBernie: do you speak Thai, ou did you brute force it?
yes
.
I learned that language a little. It's fun!
Still, I am never really sure if I pronounce things right (5 tones)... like mixing updog
(ma
with falling tone) andhorse
(ma
with high tone). Fortunately, Thai people are polite.
-
@Benjamin-Hall Wait, I thought database BIGINTs were not "big integers" as we know them, but merely 64-bit integers... How can you store an UUID, which is a 128-bit integer, in one?
-
database BIGINTs
TINSTADT
One database's BIGINT might be very different from another database's BIGINT.
-
@BernieTheBernie said in WTF Bites:
@Zerosquare said in WTF Bites:
yes
.
I learned that language a little. It's fun!
Still, I am never really sure if I pronounce things right (5 tones)... like mixing updog
(ma
with falling tone) andhorse
(ma
with high tone). Fortunately, Thai people are polite.I appreciate that they are polite about it, but they should get off their high tone horse.
-
-
@Zecc Should they rather import the Chinese 馬 falling tone horse?
Chinese horse and Thai dog are pronounced in the same way - could be an issue at the food shop.
-
It's a dangerous approach for version 0.1, because version 0.1 will inevitably be pushed into production
Well yes, but that's still probably better than things never happening at all, which is the usual alternative in reality. It's only later on that manglement realizes that actual resources have to be spent on making this thing be properly scalable and supportable.
If you want to head that stuff off at the pass, make sure your v0.1 has really obvious failures in its user-facing façade so that even the dumber bosses can see this is a western film set on a back lot at the studio instead of a full town in Arizona.
-
@Benjamin-Hall said in WTF Bites:
Barfs because converting a UUID to an INT produces... -1.
-
@Benjamin-Hall said in WTF Bites:
Barfs because converting a UUID to an INT produces... -1.
What's error checking, anyway.
-
@Benjamin-Hall said in WTF Bites:
Barfs because converting a UUID to an INT produces... -1.
Makes sense to me. C-esque hex parsing function that returns -1 when it chokes on something, and then it either chokes on the non-initial minus signs, or detects overflow.
Of course, having your function return -1 when it chokes is a bad idea in most languages that support exceptions, but that's a detail: If the parsing function threw an exception instead, you'd still have the problem of "UUID can't be parsed asint
".
-
@Medinoc What about stuff like
bool success = parseInt(string input, out int output)
?
-
@Rhywden Still, in the C# equivalent
Int.TryParse
,output
must receive a value before the function can return.
-
@BernieTheBernie said in WTF Bites:
@Rhywden Still, in the C# equivalent
Int.TryParse
,output
must receive a value before the function can return.Is that enforced by the language?
-
@topspin It is.