WTF Bites
-
@sebastian-galczynski said in WTF Bites:
I think the next shit I'll be rewriting in java when the COBOL mainframes run out will be broken as hell npm backends.
I wonder what will happen to the front-end. Because the SPA they put in front of it is not pretty either. It has all the hallmarks of a modern SPA:
no backend form validation whatsoever (your username was already in use? fsck you!)
form submissions failing silently on api errors
unlinkable views
broken history / back button behavior
middle-click on "links" not working, even if they are actual links
broken state when started from a link other than '/', including a hilarious bug in which a single react component clones itself on every F5, filling all the screenThat's just common modern web frontend design.
I guess I'm not yet into that level of modern yet. Those all (mostly) work fine in (what's currently implemented) my rewrite project.
Granted, the UI doesn't properly show backend validation errors (though they are provided to the frontend) just yet, at least the frontend is nice enough to pop a red on the item in question...
-
broken state when started from a link other than '/',
This unlike our old HR self-service app, which would throw an error accusing you of having used the 'back' button, and telling you to close all browser windows and restart from
/
. This was when wanting to cross-reference last year's appraisal forms while filling in the new ones.
-
-
@topspin As I recall, just telling the browser to purge cookies for that subdomain worked as well. But that's not an instruction you're going to give to a sales analyst who accidentally hit that arrow button in the browser toolbar.
-
@sebastian-galczynski said in WTF Bites:
for x in {1..100}; do echo -e "AT+CMGS=\"+48$MY_NUMBER\"\r\n" > /dev/ttyS1 sleep 2; echo -e "dupa\032\r\n" > /dev/ttyS1 sleep 10; done
So,
dupa
is more or less polite thankurwa
?
-
@BernieTheBernie said in WTF Bites:
@sebastian-galczynski said in WTF Bites:
for x in {1..100}; do echo -e "AT+CMGS=\"+48$MY_NUMBER\"\r\n" > /dev/ttyS1 sleep 2; echo -e "dupa\032\r\n" > /dev/ttyS1 sleep 10; done
So,
dupa
is more or less polite thankurwa
?
A lot more polite.
-
@sebastian-galczynski said in WTF Bites:
Why in the world is a backend being built with node?
They wanted "ThE MoDErN StACk", with Apollo GraphQL. Also they hired bootcamp-educated "web developers" for this job. So javascript (typescript to be precise) it is. They spent a year writing the CRUD, and it's still not even close to functional. I know, it's lunacy, you could just use any old ass web framework with CRUD generation to crank it out in a month, but that's apparently not the current thing.
GraphQL is not a CRUD by its very nature. So if they really made CRUD with GraphQL API, it's even without any JS involved.
-
@Kamil-Podlesak said in WTF Bites:
GraphQL is not a CRUD by its very nature.
It's not REST (because mutations and queries can use completely different data formats which do not necessarily represent the state of the data), but it may be used for CRUD.
-
@sebastian-galczynski said in WTF Bites:
@Kamil-Podlesak said in WTF Bites:
GraphQL is not a CRUD by its very nature.
It's not REST (because mutations and queries can use completely different data formats which do not necessarily represent the state of the data), but it may be used for CRUD.
Yes, but it's a bad idea for this very reason: CRUD makes sense if the data format is the same (or almost the same) for all four operations (well, three, Delete usually does not need full data). CRUD with different data formats is a very shitty CRUD at best.
-
Discovered why the application I'm developing has been failing weirdly occasionally; half the hardware it is controlling was taken out of service several months ago (to be repurposed or sold). Which would explain rather well why I can't route any messages to it over the management backplane.
I need to rebuild the system model completely, but in the meantime I'll just mark things as out-of-service. I'll also make the software handle the routing failure better because it might happen as a rare failure mode, and the current mode of failure is plain nasty.
-
@Kamil-Podlesak said in WTF Bites:
Yes, but it's a bad idea for this very reason: CRUD makes sense if the data format is the same (or almost the same) for all four operations (well, three, Delete usually does not need full data). CRUD with different data formats is a very shitty CRUD at best.
There are edge cases where the different formats (also known as CQRS) are beneficial. One of them being the problem of a collection of embedded objects (especially m2m) inside another object. When you post such a structure, it might not be clear whether the backend should create new embedded objects, or link existing ones. Or unlink old object and link a new object, which just happen to have the same data. With REST I usually use the "missing id == new record" convention, but it relies on having artificial IDs everywhere. It won't work when the PK is a column (or columns) with actual data.
One PHP framework I used uses the array/hash duality to create "missing indexes in array" for removing embedded objects, but that can't be represented in JSON consistently. It's not all that obvious.
-
@sebastian-galczynski said in WTF Bites:
One *** framework I used uses the array/hash duality to create "missing indexes in array" for removing embedded objects, but that can't be represented in JSON consistently.
Not directly, but that's an
Either<Existing<T>, Deleted<T>>
as types go, and that can be represented consistently.the standard warnings don't apply here, I never use
Either
s.The actual problem with CRUD is that it tells your invariants and business logic to get fucked and just does stuff to the data. Congrutalations, you have made a worse database connection.
-
Not directly, but that's an Either<Existing<T>, Deleted<T>> as types go, and that can be represented consistently.
In JSON or XML. But that framework did this trick to keep it compatible with native HTML form submissions via x-www-form-urlencoded or multipart/form-data, without hidden fields. And it even worked, as opposed to this node abomination.
The actual problem with CRUD is that it tells your invariants and business logic to get fucked and just does stuff to the data. Congrutalations, you have made a worse database connection.
That's the problem with REST, not CRUD. CRUD doesn't define any particular interface for performing the operations. If you create a foolproof database where you can only access specific functions like add_user(), activate_user() etc, it's still CRUD, but not REST, because you call procedures instead of transfering raw data.
-
@sebastian-galczynski said in WTF Bites:
CRUD doesn't define any particular interface for performing the operations.
It just defines the operations.
If you create a foolproof database where you can only access specific functions like add_user(), activate_user() etc, it's still CRUD, but not REST, because you call procedures instead of transfering raw data.
That's RPC with stored procedures.
-
@sebastian-galczynski said in WTF Bites:
REST
Our bug database has a REST interface nowadays. This means direct db connections are getting discouraged and will be disabled in time.
The REST interface does not do error checking. At all. If you do an invalid request, the underlying pl/sql will throw an exception which does not give any clue what you did wrong.
-
@sebastian-galczynski said in WTF Bites:
REST
Our bug database has a REST interface nowadays. This means direct db connections are getting discouraged and will be disabled in time.
The REST interface does not do error checking. At all. If you do an invalid request, the underlying pl/sql will throw an exception which does not give any clue what you did wrong.
I didn't realize Discourse had moved to PL/SQL backend.
-
@PleegWat You should file a bug about that.
-
@HardwareGeek said in WTF Bites:
@PleegWat You should file a bug about that.
Preferably in a way that makes it a recursive error.
-
I didn't realize Discourse had moved to PL/SQL backend.
@HardwareGeek said in WTF Bites:
@PleegWat You should file a bug about that.
But only if @PleegWat wants to be No Longer Welcome there.
-
@dkf Haha! Chaos Monkey strikes again!
-
Preferably in a way that makes it a recursive error.
Are the bugs a tree-like structure by any chance? If there's no validation, you could try creating a loop. We'll see if the pl/pgsql checks for that.
-
@sebastian-galczynski said in WTF Bites:
That's the problem with REST, not CRUD.
REST doesn't require you to be stupid. Or to use a model that is exactly what is in your database. It is the simplest CRUD form (just wrapping XML and/or JSON around the DB) that does that, but even that is just making life difficult for the client writer.
-
-
half the hardware it is controlling was taken out of service several months ago
Sometimes it can be quite interesting to test your software with defective hardware. Because it should be able to somehow stay running as far as possible and show some failure messages etc. since the customer (who else?) may be able to achieve such defects.
-
@BernieTheBernie said in WTF Bites:
since the customer (who else?)
may be able to achieve such defects.
-
@sebastian-galczynski said in WTF Bites:
If you create a foolproof database where you can only access specific functions like add_user(), activate_user() etc, it's still CRUD, but not REST, because you call procedures instead of transfering raw data.
I must disagree here. CRUD means there are three operations/functions: Create Read Update Delete. If you have
activate_user
, it's not CRUD.
-
@Kamil-Podlesak said in WTF Bites:
three operations/functions: Create Read Update Delete.
... you may want to come in again for that one
-
@ixvedeusi
ok so we have 4 operations: Create, Read, Update, Delete and activate_user
-
@ixvedeusi
ok so we have 5 operations: Create, Read, Update, Delete, activate_user, and off-by-one-errors
-
@ixvedeusi
ok so we have 4 operations: Create, Read, Update, Delete and activate_userAnd almost_fanatical_devotion_to_the_Pope I hope.
-
@BernieTheBernie said in WTF Bites:
half the hardware it is controlling was taken out of service several months ago
Sometimes it can be quite interesting to test your software with defective hardware. Because it should be able to somehow stay running as far as possible and show some failure messages etc. since the customer (who else?) may be able to achieve such defects.
That's why I'm going to fix the software before fixing the configuration.
-
@Kamil-Podlesak said in WTF Bites:
@sebastian-galczynski said in WTF Bites:
If you create a foolproof database where you can only access specific functions like add_user(), activate_user() etc, it's still CRUD, but not REST, because you call procedures instead of transfering raw data.
I must disagree here. CRUD means there are three operations/functions: Create Read Update Delete. If you have
activate_user
, it's not CRUD.You can have part of the application be CRUD. You don't have to have every resource follow that restrictive form of REST. (It sounds like
activate_user
would usually be aPOST
, as that's for any non-idempotent operation, but aPUT
could work with the right structuring, such as to anis_active
sub-resource of the user.)
-
@ixvedeusi
ok so we have 5 operations: Create, Read, Update, Delete, activate_user, and off-by-one-errorsNo.
did not place an Oxford Coma betweenDELETE
andand activate_user
.
-
-
grep -v "${LIST_OF_WORDS// /\|}"
-
@BernieTheBernie said in WTF Bites:
Oxford Coma
:person-in-hospital-bed-wearing-tweed.png:
-
@BernieTheBernie said in WTF Bites:
Oxford Coma
:person-in-hospital-bed-wearing-tweed.png:
Never seen an Eton Mm, huh?
-
@BernieTheBernie said in WTF Bites:
@ixvedeusi
ok so we have 5 operations: Create, Read, Update, Delete, activate_user, and off-by-one-errorsNo.
did not place an Oxford Coma betweenDELETE
andand activate_user
.
Who is using an Oxford comma?!
-
Gradle newsletter says, last call for a webcast about Predictive Test Selection... to cut test execution time by $LIES% by using machine learning to only run the tests likely to provide useful feedback. Did you trust your regression suite, hitherto? Maybe stop.
-
Hey kids! How would you implement a boolean column in your relational database?
Today's WTF comes courtesy of Polish Social Insurance, who - for years - have been providing a dedicated program for filing declarations, etc. Its reputation as a source of is legendary, both among the users, and people such as myself who sometimes interact with the nuts and bolts.
As you might have guessed, I needed to read a boolean type (as opposed to boolean-typed) column from the program's database (SQL Server). Normally, I'd expect this to be a bit column, to be read with
IDataRecord.GetBoolean
or some such. Not here.Instead, someone thought it an excellent idea to store the answer to a true/false question as
char(1), null
.Being nullable is understandable, I guess, because they're adding columns to a long-running table to account for the law changing. Most of the previous years' records won't and can't have data. So, I'm guessing the
char(1)
takes'T'
or'F'
?Wrong. It takes
'X'
- for true.So,
NULL
isfalse
and'X'
marks the spot.
-
So, NULL is false and 'X' marks the spot.
C/C++ programmer brain damage: At least they used false-y and true-y values.
-
@cvi At least it resulted in a line that's going in my personal all-time favourites:
bool myvalue = !record.IsDbNull(n) ? (record.GetString(n) == "X") : false
Magic value intentional (plus, it's not my magic): when this breaks, it will mean that they changed the way they handle these values, probably to replace it with something even less sensible.
-
@GOG Not even case insensitive comparison?
-
@Zecc No! Magic is magic.
(More seriously though: I want it to break as soon as anything changes, because the Lord only knows how it's gonna change.)
-
when this breaks, it will mean that they changed the way they handle these values, probably to replace it with something even less sensible.
Maybe they will switch to much more sensible "V" for true, "☐" for false, and null for 'not applicable'.
-
Maybe they will switch to much more sensible "V" for true, "☐" for false, and null for 'not applicable'.
Unlikely - that would require the devs to be capable of typing "☐".
-
Maybe they will switch to much more sensible "V" for true, "☐" for false, and null for 'not applicable'.
P - prawda
NP - nie prawda
N - nieważny
-
@Applied-Mediocrity said in WTF Bites:
Maybe they will switch to much more sensible "V" for true, "☐" for false, and null for 'not applicable'.
P - prawda
NP - nie prawda
N - nieważnyOoh, that would be sneaky (instinctively,
'N'
parses as false, when contrasted with the true'P'
).Unfortunately, it's a
char(1)
so no-go.
-
-
a boolean type (as opposed to boolean-typed) column from the program's database (SQL Server)
Are you sure it's not Oracle?
Because with Oracle, there is no boolean...