- 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
:-/ oops
I missed the second page, with the 10 or so replies that already pointed this out.
My bad.
I'll just have to hope that nobody bothers reading the third page and sees me making a fool of myself
;-)
waves at the cameras
Admin
I do not see the WTF in this story at all. It's just another description of some knuckle head programmer. The industry is full of these people. Most have a chip on their shoulder and are quick to blame others rather than considering the possibility that the failure might be a result of something they have done. What? A programmer with a complex! What next, sales and marketing people that use buzzwords?
Admin
This whole wtf is kinda based on hearsay, isn't it? I mean, the dumb guy probably was dumb, but I can believe that the "top 5" comment meant something like "I didn't write any queries with 'top 5' in them", rather than "I don't know what 'top 5' means. And maybe the logging tools remark didn't mean that the logging tool was mangling his sql, only that it wrote its own sql. I doubt it--the guy is probably just a arrogant halfwit--but the beauty of the whole dailywtf concept for me is that when there is a code sample the dumbass-ness is incontrevertible.
Admin
s;\s+; ;g; s;^ ;; ;s; $;;;
Admin
The big wtf I see......
.....how long does it take two programmers to track a simple failed DB query?
Seriously, how can you continue on for another hour or so when the problem is a basic syntax fault during an attempt to run a query?
Maybe its the sleeping pills kicking in, but wouldn't the DB log the error, even if some "on error resume next" nonesense was causing the app to skip over and make the tracking harder?
Admin
That I can definitely agree with. :-)
Admin
*chuckle* Yeah, probably a good bit of advice.
I tend to be that way on Open Source projects that I contribute to. I guess its because I'm really interested in being accepted as part of the group of people who work on that project. Where at most of the jobs I've had, I've not been that interested. Particularly since most commercial code I've seen has been highly icky, and if an Open Source project is icky, I don't contribute anything but bug reports.
But, it'd probably work out better for me if I showed a little more humility, even if I didn't feel that the respect had been earned.
Admin
Ahhhhh, the normal reaction of a computer science person:
"It can't be! It simply cannot be this way!"
(Happens to me every day ;) )
Admin
Unless the guy making the mistake is the fair haired boy of some bigshot manager and you might find yourself out of a job or relegated to deadend jobs if he doesn't like you.
Been there, done that.
Admin
Variant? [:'(]
Admin
http://developer.apple.com/qa/me/me05.html
Admin
What's important is fixing the problem, not whose code it is. Placing blame is stupid, but so is going through contortions to avoid hurting people's feelings.
In MY experience, a good programmer most of all does not deal in "I think"s and "maybe"s, he adds logging or fires up a debugger and finds out what actually happens, at which point the code he has written and understands well interfaces with someone else's code and gets an unexpected reaction. He checks specs to see whether his input and the reaction are in fact allowed, and then either changes his code to deal with an unexpected but correct reaction, tells the other guy about his code's incorrect reaction to a correct input, or (all too often) sits down with the other guy and an analyst to tighten up the specs.
Admin
I have seen visual query building tools that add things like Top 5 and Top 100 to queries without being asked...
Admin
.. And we have a big, hairy spider ("the bug") that is placed on top of the monitor of the most recent offender... :-)
Admin
"TOP n" doesn't appear to work in MySQL...
In those database systems where it does work, however, how does it differ from "LIMIT 0,n"? It doesn't strike me as particularly more elegant or readable. In fact, since the limiting statement is obviously executed after sorting by the "ORDER BY" statement, wouldn't the logical place for it be after that statement - as LIMIT is, unlike TOP?
Or am I missing something?
Admin
Admin
Definitely Ziggurat. I hope the prevailing winds come from top/right. And that the foundation is sturdiest on that end.
Admin
Actually, Alex, a better rule of thumb is: If you're going to do math with it, it's a number; if you're not, it's a string.
Admin
You have obviously never worked on large applications developed with the "Big Ball Of Mud" design pattern where logging was never a design thought. You will some day -- these apps require hoards of mainteance programmers just to keep running -- and when that day comes, hopefully you'll remember this question of yours and think "now I see; why did I take this job again?" That was my first reaction with such an experience
Admin
I wonder what the size limit of a post is? 8000 characters maybe?
Admin
Yes it's legal. Has been since SQL 6.5 (or longer) but for 2000 and before when the predicate datatype dos not match index datatype, the index is not used and the table scanned. Depending on the table size ... That would be an issue.
Admin
The WTF is basically that the "SQL developer" had never used "TOP n" in a SELECT clause before. Not such a good post Alex. You've posted better. A couple of points here:
It would have been useful to post the actual offending query, so maybe we could have an idea of what the developer's error was. If the original author was able to supply the *top five* query in full (I'm guessing this is a real table name - Googled "DLX_APPLICATION_DOCS" and got nothing), then why could they not supply the actual bug??
Sorry, but this post is lame. Normally they are much better and complete to boot. It took me quite a while to realise that the single, weak WTF was that a self proclaimed SQL programmer hadn't seen a "TOP n" query before.
N.B. Why *still* does the CAPTCHA never work first time round?
Admin
I've seen people that didn't know what "Top N" meant. I came across this recently where someone selected latest N news headlines to appear on the front page of a small portal type website, and then had variables counters for each one (anyone say re-use?). This was in classic ASP, he created a recordset, set the recordset pagesize to 20, then looped until "VariableCounter[N]" equaled the recordset pagesize... which had nothing to do with what he was actually trying to do.
Admin
The captcha times out. If you write a big post, it's gonna time-out on you.
Got that?
Admin
The WTF is that he was a complete all-knowing, "can't possibly be ME who made an error" asshat.
I worked with people like this.
There was that one guy who updated his code from sourcesafe, and it started crashing because he got a code change that I just made. He immediately went "hey, it's crashing, and it cannot possibly be me since I didn't change anything and it worked just before"
It was a multiplayer game with several mini games, and I just had put in a change to setup IA players in complement of human players.
So, a little irritated but knowing that having a look at it myself would probably be the fastest way of resolving the problem, I went over to his pc and started looking. He immediately left to smoke a cig.
10 seconds later, I had found out that he was simply calling a method on the joypad class to test a button, and since he didn't check that the joypad pointer was null, it crashed.
When he came back and asked me "so, did you fix it ?", I managed to stay calm and just pointed out to him what the problem (with HIS fucking code) was. He didn't even say as much as "oops, sorry".
Moral of the story: fucking spend at least 30 godamn seconds to do a minimal amount of research before complaining about a problem.
Admin
Alex thanks you for your helpful criticism!
No sir, nothing funny at all about a junior programmer parading his ego in front of several co-workers.
Admin
I was just stating my opinion. I do genuinely think we see better WTF examples here every day. I just didn't think this particular one was a well constructed WTF that's all. It's just a bad ego.
Also thanks to CaptchaMan. I didn't realise the CAPTCHA timed out. I've now got it!
Admin
Admin
I think the point is he was claiming to be some kind of hardcore, full-on, seen-it-all experienced legend in SQL and ASP.Net when, in fact, not knowing "TOP" is a valid (and useful) SQL keyword means he is a total n00b.
TOP is MSSQL/Access specific (or maybe transactSQL)..
You would be able to achieve the same results with an order by and a limt clause.
Admin
Here, here. There's no way I would store a credit card number as an integer type inside a database.
Admin
I want to work where you work. You seem to have well documented interfaces and stuff there. I sometimes dream of working in a place like that.
Sometimes its clear the code is doing the wrong thing. Sometimes its not so clear and things are well enough documented (if they're documented at all) that you can figure out what the right thing is supposed to be. So then you go get to hash it out with someone and figure it out as you go.
Admin
Um, yes it will It will return the top 5 matching records (if any) just like it says. By 'a lot' I'm guessing you meant to say 'I don't do a lot of SQL'?
Admin
If his assumption that APPDOC_NUM is a PK is correct, only one row would be returned since PKs are unique by definition.
Sincerely,
Gene WirchenkoAdmin
More like 30 minutes. And even then don't be too loud about who you blame. I've spent too many days working on a problem that seemed to be in someone else's code (a device, so I couldn't ask the original programmer for help), only to find the bug in my code.
Moral: when something seems like a bug in someone else's code, approach them as in you need an extra set of eyes because you cannot find the problem and it is related to their code. That way if it is their problem (which it is once in a while) they can admit it - approach it wrong and they get defensive about their code lest their boss find out and give them a bad review. If it is your fault you can thank them for the help because you were overlooking something obvious...
Admin
Major as in most used. Not as in most usefull. Popular programming languages are like popular music. Its not too shabby, its not great either, just mainstrain. And your list only contains imperative programming languages, except sql. So ehm, regardless of the marketing buzz, their all the sort of the same semantic features, different syntax. So presenting it as _the_ list of major programming languages: its the list of the major used imperative programming languages.
Admin
Haven't you figured that out ? Its problely saving only the name of the last CAPTCHA image that is has shown. So the more time inbetween page load and 'post', the bigger the chance some one else has opened the 'post a new message' box at some point during that time.
Its problely a shared session variable that shouldn't be shared.
Admin
Oh, that's scary! No arachnofobics at your company? I am.. and I live in Norway ;) Guess if I ever end up working at your company then I can not make any single error, otherwise I'll be doomed since I get paralyzed of 8-legged creeps and won't be able to do any work. And not being able to do any work sure will make me get that creep at my monitor for ages.
Admin
And how many matching records will a a query using the PK return?
C'mon...you can do this...right! At most 1. Now, what is the top 5 of 1 record?
Idiot. I'm guessing you meant to say 'I don't do a lot of thinking'?
Admin
What kind of programmer don't test it's code at least to the level of the syntax error ?
Sql statements can became very complex and an obscure error can luck in.
But the fact that a syntax error can stay unfixed on a production server shows much about the sw development cycle on this company, wich is much worst than the fact that the programmer don't want to accept he made a mistake.