- 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
The "Select One" row isn't that odd. You just check for a state code of "none" when you process the form, and don't have to do any more work. Also, easy localization: SELECT FROM states WHERE shortName != 'none' OR state_id == 51 + LanguageIndex;
Admin
Bill: John's contract finished up lat month. Fred: Yes, I sent the billing request to jan last week. Bill: ID Fred: uhhh ?
Admin
Admin
Also, legal requirements expire. US Federal tax audits go back seven years, and businesses can delete older records.
Admin
I think the states he has been to do include Hawaii--he went to high school there...
Admin
Unless you die because the plane's engine falls on your bed while you sleep...then you'll have to run around doing crazy shit to make sure you are in your bed at the time so you can actually die because if you don't, the universes start to branch and multiply. I think.
Admin
Sometimes, when interfacing between two systems, you need to come up with workarounds just to get data from one system to another. I have one system that when you export data from it, instead of allowing a null value it actually sends #NULL. I had to do something very similar to that forth one. It looks dumb but it prevents throwing errors.
Admin
Admin
God help us come 2013, indeed. If Hollywood and New Age lunatics have taught us anything, anything at all, it's that we are all screwed December 23, 2012. Hence, the lack of any year afterwards.
Admin
Admin
I've got a client whose table of states (tblStates, of course) contains rows for all 50 states plus DC and Puerto Rico. The ID on the table isn't sequential by any known rhyme or reason, and skips some numbers (Hawaii, Alaska and Puerto Rico are numbers 52, 54 and 58, respectively). So they've got another column, which is "display order". These are mostly in a sane order, except that the order value for Texas is null...
Admin
My table of states only has 10 entries, and that's including one for Head Office and one for Unspecified. (This is the data warehouse, so we need that one for everything that we can't pin a real state to.) Obviously this is a far more efficient implementation.
Admittedly this could also have something to do with being in Australia. :)
Admin
Wow, they seceded already?
Admin
Seems sensible to be. It makes the form code a lot simpler, and if client side validation (say, javascript) is bypassed, the database isn't going to end up with an invalid foreign key somewhere. (Of course, server-side validation should prevent that anyway.)
It's also possible it's doing double-duty as the value used for people outside the US. (The javascript form asks for country first, and only shows State if they choose USA as their country). That would be kludgy though.
Admin
Clearly your table should only be 8 entries long(including head office and "unspecified").
Admin
Haha, that reminds me of the old Candlejack meme. Supposedly, after saying/typing his name you sudd
Admin
...now why is my CAPTCHA "eros"? Are you coming on to me?
Admin
God I hate fixing code written by people like you.
Admin
The 51 state rows sounds clever. It can be used to display "Choose One" in the state field until you do.
The real WTF is that there is no D.C., as I've never seen a state drop down box without it.
Admin
Alex WTF?
The Daily WTF was down yesterday. I needz my daily dosage of WTF or i get all depressed. snif I feel a lot better now. Thanks.
Sandor
Admin
Ofcourse there is no 2013 and further in the table! Everybody knows the world ends in 2012!
Admin
Admin
Yeah, it was a little silly, I guess. Everybody has their berserk button, though. shrug
(I tried linking "berserk button" to TVTropes, but Akismet said no. So... just imagine there's a hyperlink there, I guess.)
Admin
IMHO.
Admin
He was referring to the states he had been to on that particular campaign trip, not all the states he had ever been to in his entire life.
Admin
I don't think we'll need to worry about 2013... everyone knows the earth will end in 2012
Admin
ROFL! What an original joke!
Admin
I understand the reasoning but it is not correct. The default item in a drop down in this case is not a State. They can accomplish the same thing with something as simple as a union on their select from on the database. Or even on the front end in their code they can insert it.
Admin
It's a optimization in fact :)
Admin
Admin
Admin
Admin
Admin
To which I would only add, "unneccessarily".
Admin
Admin
Admin
I'm pretty sure there's no "designer of the year" for databases award.
Admin
More like bunslop or bunslap.
What the hell kind of a company is that anyway?
Admin
Order Processed/Sent/Billed/Texas
Wait.. what?
Admin
Admin
Year tables can also be necessary for querying things like events per year when you need all years even if there are no events. Outer join FTW!
Admin
As a resident of Select One, I'm amazed at how ignorant my fellow Americans are of geography. Select One may be the smallest state, but we've got big hearts, and we pay taxes just like you fancy North Dakotans.
Sincerely, mypalmike Springfield, SO
Admin
Client-side validation anyone?
Admin
Admin
I was responding to the notion of "confusion" between business and presentation, which is what the maintainer of the code will experience when having to update business rules in both layers. If business rules are just in the business layer, the client-side validation will mean passing those rules up to the presentation layer somehow, which eliminates confusion but IMO entangles the two layers via the rules-containing machinery that passes from BL to PL.
As long as we need to discriminate between numbers and letters, this is going to be an issue in a tiered architecture where one data-providing tier cannot be trusted.
But this conversation is probably about the definitions of "confusion" and "entanglement" rather than what we agree on: in an ideal world, tiers have no coupling at all.
Addendum (2009-12-17 17:41): Maybe client-side validation is the forced compromise; that I can definitely agree with.
Admin
`i wonder if jan ever sent him his check?' - my guess is this is what you get from those tools that let you 'edit' your database schema. The cause is most likely they hit F2 to rename the column (or maybe just a double click like a file manager, who knows how easy these tools make it these days) and Ctrl-V to paste and they had something crazy in their clipboard.
Admin
m0ffx:
bored: bored is absolutely correct here. You can prevent having an invalid foreign key by correctly enforcing foreign keys in the DBMS. Except that if you do shit like this, you can't, because from the DBMS point of view, 'Select One' is a valid state name; and if the validation on the client-side fails somehow, you end up with database records with this listed as a state. This is not an theory I'm inventing--I have seen it happen, and it is virtually impossible to clean up the database afterwards. Not to mention embarrasing when a senior VP of marketing sees it on his reports. And frankly, it's not really that hard to code the application to display correctly. I mean, it's always harder to do something right than to do it half-ass, but this is really a matter of a few minutes of coding time--why not just set it up correctly in the first place? If you don't know enough to do this pretty easily, you probably don't know enough to make sure the front-end validation works right anyway.Loveknuckle:
Plus, you'll piss off Loveknuckle. :-)Admin
the name of the column as the fist row??? ...I wonder if that's *
Admin
Whats the matter with an Asterisk as a Boolean Flag? There is a big three letter company out there where ' ' equals false and 'X' or 'x' equals true.
Grown codebases are the best.
Admin
For the first 2 screen shots, what is the program being used to view the databases?