- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
hehe i think yahoo did something similiar (not sure if they still do) but they had a link on the webmail page that read: "If you are not Joe Blogs click here to log in as yourself".
Logically this makes sense, but in reality it just makes you aware of the fact that you could potentially be logged in as someone else, on public terminals at least.
[If you are not Junkieman click here to get of my interweb]
Admin
Deleting users is ALWAYS a bad idea, especially if you use userID anywhere in your database. (logs, etc)
I wonder if another developer take a look at isDeleted = "Pink" will he immediately know what does it mean? Absolutely not. Your suggestion is a surefire way to an application that is horror to maintain. Statcodes are way better, especially if you use flags and descriptions.
Admin
You guys arguing with Paula Bean know that it's pointless, right?
You've bean here before and know of Paula's Brillance, surely?
Admin
For those of you who aren't familiar with the significance of the name "Paula Bean" or the term "brillant", please put those strings into the Search box at the top of the page and click on the "Site" button.
Thank you.
Admin
I'm glad I got a new frame-based sarcasm detector...
Admin
Good thought... but the union doesn't work that way.
The union means both table searches happen, and that table scan happens every time no matter what, since now there's two searches: one on the user password (optimizable), and one on the invitation password (not optimizable).
Admin
wtf why isn't isActive and isDeleted just combined in an enum. Status = isActive would be a better choice imo.
Admin
Admin
Schrödinger's thought experiment actually suggested that the user exists and doesn't exist for a considerable interval of time (i.e., for minutes or hours, not femtoseconds).
This is an important part of the thought experiment--if there was a single outcome of the experiment (deleted or not) and you just didn't know which outcome had occurred, the Copenhagen Interpretation wouldn't conflict with common sense. CI requires both apparently distinct states to occur simultaneously, which is why quantum mechanics is so counterintuitive to lay people.
OTOH, we don't know the business requirements. For all we know, they've got a large number of users who live in opaque steel boxes with timers, Geiger counters, explosives and/or poisonous gases, so the database has to support users in these exotic superpositions of quantum states.
Admin
Well, yes and no.
The first part of the union can be optimized into an index scan (if there is an index, the optimizer supports automatic optimization by using index scans, etc).
The second part is more interesting. SQL semantics require the WHERE condition to behave as if it was tested on every row in the table. It is possible to optimize this if (and only if) the database can logically prove that doing something other than scanning the whole table always produces the same result. For constant boolean expressions this is fairly straightforward, but for expressions involving UDFs it's not so simple. This is why "SELECT * FROM foo WHERE id_field = some_random_id()" behaves so differently from the way novices expect.
UDFs on some database systems can be marked as volatile or not, so aggressive optimization is still possible (but given the coding skill displayed so far, not likely).
Admin
Admin
The first rule of data storage is deletion is the last resort. Arching old user data and utilizing changelogs in databases are key to a smoothly running application.
Admin
It's awesome when tables are named using sql keywords and columns are named using sql system function names. :D
Admin
To a fellow employee of Turkish origin:
Ünal replied.
Of course! Why didn't I think of that??? 0xBD needs no comment because it's bloody obvious!
I don't know why I'm getting so upset. After all, since then he's fixed it:
me bangs head on wall...
Admin
I once came across a piece of code that said:
ResultSet rs=stmt.executeQuery( "select userid from userlist where userid='"+userid+"' and pswd='"+pswd+"'");
Where userid and pswd came straight from the input screen. Then it checked if any records were returned.
So, umm, what if a user enters someone else's userid, and a password of, say, "whatever' or 'hello'='hello". (Where the single-quotes are part of what they type and the double quotes are not.)
Admin
Oh forget it. Even that doesn't make sense... this sh%t is just nonsense.
Admin
/Many people here need to have their sarcasm-detectors readjusted...
Admin
Why did they use a UNION in this case anyway? Doesn't their SQL implementation support `OR'?
Admin
First of all, there's no obvious distinction between minutes, hours, or femtoseconds. Nor need there be. Who, other than the cat (provided you have s self-aware cat that would prefer to live for hours or minutes, rather than femtoseconds) would care? Superposition within a quantum probability field is superposition within a quantum probability field. Even morons like me, who rely on whatever version of common sense might be on special offer through Readers Digest at this particular time of day, can understand that.
Secondly, there's a point to "thought experiments," otherwise they remain simply Gedankenexperimenten (I leave Ernst Mach's usage of the phrase to one side for these purposes). Einstein's "thought experiments" resulted in the Special Theory of Relativity (although not, as far as I am aware, the General). Schrodinger's Cat resulted in nothing more than an amusing joke at cocktail parties for theoretical physicists and associated dweebs.
Incidentally, what was the cat's point of view on the observer outside the box?
Admin
Congratulations. You have just discovered SQL Injection - http://en.wikipedia.org/wiki/SQL_injection.
Admin
That's an awfully simplistic way of looking at things.
The IsActive flag is to verify that all the "necessary" account information is in place and maybe that their email is validated or something similar. It can serve a completely different purpose than IsDeleted. Now, the state never should be Active and Deleted, but it's just good defensive programming.
Secondly, I'd hate to see your code if you're just deleting things willy-nilly. Hopefully nobody ever accidentally disables their account and has to call you for support to re-activate it.
...Jeeze you like to make things unrealistically simple.
Admin
g Are you a ghost writer for Alex?
Admin
And how would you refer to an account that is not activated, nor deleted? I would question you further, to demonstrate the inaneness of your comment, but I deem it unworthy of my time.
Admin
Actually, DELETE FROM is generally bad practice. Perhaps you want to drop that user, but want to retain records linked to this user.
For instance user may have unpaid expenses linked elsewhere. You may want to retain records to sue his/her a$% later, who knows.
Good SQL practice is generally to mark something as 'Deleted', or perhaps to have an inactive date.
Admin
Paula Bean
And tape backups always work so perfectly.