WTF Bites
-
Man, I could go for a break right now.
-
@sebastian-galczynski Use a normal
while
ordo-while
whenever it makes sense to do so.And
#define ever (;;)
-
@Zerosquare said in WTF Bites:
I see
goto
s.The
thread is
-
I'm afraid I don't get this one
-
@sebastian-galczynski said in WTF Bites:
Another great pattern from our highly credentialed genius: Every other loop is a
while(true)
, and it only ends by breaks or throwing, which usually happens in complicated if/else blocks. Of course one of those loops didn't end after I changed something in a different place. It's so nasty I'm starting to think he was punking them.Likely was. BTW, I'm also a credentialed genius, and that's fucking stupid.
-
-
I'm also a credentialed genius
Someone gave you a login?!
They credentialed me in my youth. The test gave up on measuring my abilities but turned up some troubling inabilities. And, due to a shocking lack of followup, I walk free among you.
-
-
So I've had an account with Gaijin Entertainment (War Thunder, Star Conflict) that's been locked for years now. The reason it's locked? I clicked an unsubscribe link on one of their spam e-mails once. Yes, seriously.
Once in a while I try to get the account unblocked, which has so far always failed because I couldn't get customer support to even reply to my tickets. I tried again on a whim yesterday, and wouldn't you know it, I actually got a reply this time!
Yes, "Julia", I have access to the registration e-mail, I am using it to talk to you right now, which I'm sure the Zendesk interface shows you. And you want me to send you a what now? Are you fucking kidding me???
-
@blek Take a screenshot of your inbox but make it look like it contains a ton of emails about classified military manuals.
-
@blek Take a screenshot of your inbox but make it look like it contains a ton of emails about classified military manuals.
If you send your email address to the War Thunder folks, maybe this could turn into a win-win.
-
@blek so she readily admits they blocked your account because you unsubscribed from their newsletter?
And they don’t see how that might be a tad retarded??
-
At her pay grade, I doubt she's supposed to understand it.
And even if she does understand it, I doubt she's supposed to care.
And even if she does care, I doubt she can do anything about it, anyways.
-
@Zerosquare And in the off-chance that she were on the right pay grade, it was probably her idea in the first place.
-
@topspin Yeah. I used to get a generic error when trying to log in for a long time, but at some point they changed it and now it actually just says so on the login screen:
-
@boomzilla said in WTF Bites:
Good jerb, guys. I went to their "Accessibility Help" page and told them about how I can't access the registration page.
Imagine if they fixed it—people would just sign up like that and someone might even file a claim! Can't have that.
-
@blek
just send her a the screenshot with every thing blurred/blacked out except the generic mail interface
-
@Zerosquare said in WTF Bites:
I'm afraid I don't get this one
It was a bit of a reach.
:**Jam**aica:
:noodles (alias for) steaming_bowl:
.
-
SQLite sucks ass.
BEGIN TRANSACTION; UPDATE something; MAKE A TYPO; UPDATE something else; COMMIT;
Congratulations, now your database is broken.
-
@sebastian-galczynski said in WTF Bites:
SQLite sucks ass.
BEGIN TRANSACTION; UPDATE something; MAKE A TYPO; UPDATE something else; COMMIT;
Congratulations, now your database is broken.
Sounds like you need to forcibly set the WAL back, and/or are screwed to the floor. Too bad they don't support
ROLLBACK
... oh, you just hadn't issued one, now it's too late?Sharp tools are safer. Eventually. The rate of accidents will drop over time. This will not correspond with all users' experience.
-
-
@sebastian-galczynski said in WTF Bites:
Congratulations, now your database is broken.
Editing a live prod database directly remains a bad plan, even when there is no database server involved.
-
@sebastian-galczynski said in WTF Bites:
Congratulations, now your database is broken.
Editing a live prod database directly remains a bad plan, even when there is no database server involved.
It wasn't prod, but still I expect a failed transaction to be rolled back. What's the purpose of transactions otherwise? It turns out that to achieve this in SQLite, you have to write
UPDATE OR ROLLBACK
instead of mere UPDATE, and even then if there's something preventing the query from being executed (like a bad table name), it will not roll back, but simply exit and leave the transaction half done.
-
@sebastian-galczynski The SQLite shell is pretty stupid; it assumes you're doing things interactively and notice faults as you type them (or at least at the end of the command). It's also really unlikely to ever be made much smarter.
...
You could have set
.bail on
so that errors don't leave things in an unexpected state.
-
@sebastian-galczynski said in WTF Bites:
SQLite sucks ass.
BEGIN TRANSACTION; UPDATE something; MAKE A TYPO; UPDATE something else; COMMIT;
Congratulations, now your database is broken.
In which tool?
It's been a couple of years, but I used to work with SQLite a lot and transactions always worked correctly for us.
It wasn't prod, but still I expect a failed transaction to be rolled back. What's the purpose of transactions otherwise? It turns out that to achieve this in SQLite, you have to write
UPDATE OR ROLLBACK
instead of mere UPDATE, and even then if there's something preventing the query from being executed (like a bad table name), it will not roll back, but simply exit and leave the transaction half done.update or rollback
is to rollback that transaction if it can't find anything to update. If you want the transaction to abort on themake a typo;
line, that's unrelated. And is a problem of the tool running the “batch”, not of sqlite (the library that you embed in your application). You are not supposed to script with the command-line tool. Just use TCL or Python instead.The tool just exiting is, however, perfectly fine. There is no way to make sure the rollback will happen when a transaction is failing—most applications embedding SQLite just throw from their database operation, log the problem and terminate the process, so there is no chance for SQLite to actually do the rollback anyway—so the rollback is done when there are abandoned transaction when opening the database again.
Of course that can only happen if the rollback log, which lives in a separate file, is still around!
@sebastian-galczynski said in WTF Bites:
WAL
SQLite:DDDDD
SQLite has WAL mode. It is faster for most things and it allows reading while transaction is in progress (with proper isolation). It makes sense to use it for most cases, but since there are a couple of limitations (like not working on network filesystems), it wasn't made the default. You most likely should switch to it.
-
-
ATMing in English. So far so good.
ATMing in Swahili. Due to the increasing number ATM card owners who go by the name of "Little Juma Pwnie", or "Juma<script>alert("pwned!")</script>Abdallah" in full, the bank has added an extra layer of securentity.
Of course you're only really really most securestest if you don't even expand your own placeholders.
-
@boomzilla said in WTF Bites:
I really hate it when I follow a link in an email, get redirected to login, and then after logging in, the site forgets where I was trying to go and dumps me back at my home page.
You should know better than to use your own software.
-
You thought the days of Adobe software in the browser being the most popular malware vector were over? Think again and meet Microsoft Edge, the future universal installer platform for Windows!
-
@LaoC because PDF.js was too fast, simple, and secure, so they need to bring in the Adobe bloat?
-
Since forgetting the lessons of the past has been the modus operandi of MS since Windows 8, I fully expect them to excitedly reinvent ActiveX sooner or later.
-
@LaoC because PDF.js was too fast, simple, and secure, so they need to bring in the Adobe bloat?
I assume Adobe have provided Microsoft with an enhanced experience so that Microsoft can provide their users with an enhanced PDF experience.
-
-
In which tool?
The standard sqlite console.
OK, full context: normal operations here are handled by libsqlite linked in different programs. They work fine (when it comes to the database at least).
I'm using the console only to migrate schemas and data fixtures. The problem is that I have a lot of instances which differ in subtle ways (due to manual tweaking), so the migration scripts may fail unexpectedly. Each script is wrapped in a transaction and simpy piped to the sqlite console - this is how they always did it. Of course db file is copied and moved, so there's no possibility of actual data loss.Now, I'm mostly used to postgres (only used sqlite in toy projects), which, when you run
psql < migration.sql
, will not do any changes if there's any error (be it syntax error, constraint violation, bad identifier etc), as long as it's all wrapped in one transaction. So does mysql and other servers. I'm just confused why is the behavior so different here.update or rollback is to rollback that transaction if it can't find anything to update.
How can I make it rollback on constraint violation? And anyway, is there a tool to read a file starting with BEGIN and ending with COMMIT so that it either succeeds completely or fails completely?
-
among you
Sus
Nah, I'm legit. Meet me in the engine room and I'll explain.
-
You thought the days of Adobe software in the browser being the most popular malware vector were over? Think again and meet Microsoft Edge, the future universal installer platform for Windows!
Terrifying superlative density. Not even literal shit needs this much sugarcoating.
-
update or rollback is to rollback that transaction if it can't find anything to update.
I just checked and this is incorrect.
-
@sebastian-galczynski said in WTF Bites:
update or rollback is to rollback that transaction if it can't find anything to update.
I just checked and this is incorrect.
Never doubt the unresearched statements of an uninvolved lunatic.
-
You could have set .bail on so that errors don't leave things in an unexpected state.
This doesn't work, or at least not as I expected. I can issue the following:
.bail on BEGIN; UPDATE... -- good update UPDATE... -- error: no such column COMMIT;
and the end state is as if the good update was executed. OTOH, in postgres any statement issued after the bad one will fail with 'transaction aborted'.
-
@Zerosquare said in WTF Bites:
Since forgetting the lessons of the past has been the modus operandi of MS since Windows 8, I fully expect them to excitedly reinvent ActiveX sooner or later.
We still have COM/DCOM in use, tho. Also, DirectX is still using an -X name. Maybe as a DirectX sub-technology - DirectInjection 😀
-
@sebastian-galczynski said in WTF Bites:
You could have set .bail on so that errors don't leave things in an unexpected state.
This doesn't work, or at least not as I expected. I can issue the following:
.bail on BEGIN; UPDATE... -- good update UPDATE... -- error: no such column COMMIT;
and the end state is as if the good update was executed. OTOH, in postgres any statement issued after the bad one will fail with 'transaction aborted'.
Ew - it's C-y, did it expect you to check a return value or SQL state global?
-
Ew - it's C-y, did it expect you to check a return value or SQL state global?
No, it expects me to pass
-bail
option, and pipe the file. Only then it works. In the interactive mode, the option makes no difference. Whether this is good design is left as an exercise to the reader...
-
@sebastian-galczynski said in WTF Bites:
In the interactive mode, the option makes no difference. Whether this is good design is left as an exercise to the reader...
Well, interactive mode implies the presence of a user to interact with...
-
Well, interactive mode implies the presence of a user to interact with...
A user that doesn't know how to copy and paste more than one line of text?
-
A user that can read and respond to error messages.
-
A user that can read and respond to error messages.
Not if he pastes multiple lines with COMMIT at the end, which he will at some point do if he learned SQL on any other engine.
At the end, this difference in behavior is simply another thing to remember or trip over, belonging in the same place astypeof(null) == 'object'
, NaN in JSON,array_search($needle, $haystack)
(or was it the other way round?), IE6 box model and other 'solutions'.
-
@sebastian-galczynski said in WTF Bites:
You could have set .bail on so that errors don't leave things in an unexpected state.
This doesn't work, or at least not as I expected. I can issue the following:
.bail on BEGIN; UPDATE... -- good update UPDATE... -- error: no such column COMMIT;
and the end state is as if the good update was executed. OTOH, in postgres any statement issued after the bad one will fail with 'transaction aborted'.
Hm… I think it was
sqlite -batch -bail database.db < script.sql
. Yeah, the tool is poorly documented.… otherwise there's the option of calling it from tcl (sqlite started as tcl plugin) or python (but has to be at least 3.6, the standard sqlite plugin was intentionally broken before that—that story deserves a lot of s).
@sebastian-galczynski said in WTF Bites:
update or rollback is to rollback that transaction if it can't find anything to update.
I just checked and this is incorrect.
Right, sorry, I wasn't paying attention when I looked it up. It is for what to do when it fails on a constraint.
… and the documentation says that the default is ‘or abort’ and that that's what ANSI SQL specifies. But what the other SQL implementations actually do is that they spoil the transaction, so that when the commit comes around, it fails. SQLite apparently does not have such flag, making aborting the whole tool or function the only way.
-
@LaoC because PDF.js was too fast, simple, and secure, so they need to bring in the Adobe bloat?
Also, NIH. And of course it doesn't provide "a seamless path to even more value" in the accounts of Adobe managers and Latvian haxx0rz.
-
… and the documentation says that the default is ‘or abort’ and that that's what ANSI SQL specifies. But what the other SQL implementations actually do is that they spoil the transaction, so that when the commit comes around, it fails. SQLite apparently does not have such flag, making aborting the whole tool or function the only way.
The library itself gives an error code (often mapped to an exception in language-specific wrappers) when given a syntax error. The shell prints an error message. When doing interactive exploration of the DB — definitely the primary use-case for the shell — this is what you want, and spoiling of the transaction is not. 's problem was in part the expectation that it would be any other way. (Also, this sort of thing would be totally on-topic for the SQLite Forum.)
The actual mistake is doing a migration without testing it first. Making a test DB (with trivial amounts of data) is so easy there really is no reason to not test.
-
python (but has to be at least 3.6, the standard sqlite plugin was intentionally broken before that—that story deserves a lot of s).
Using Python 3.6 or before at this point would qualify as a given that they're out of security support...