• tragomaskhalos (unregistered)

    I have seen code exactly like this to create monster SQL queries (complete with the obligatory injection vulnerabilities).

    "Give me Here documents or give me death" ....

  • (cs) in reply to anonymous_coder()

    Strangely, he was having a go at QJo. I was under the (possibly mistaken) impression that QJo is just another regular, not one of the staff?

  • QJo (unregistered) in reply to eViLegion
    eViLegion:
    Strangely, he was having a go at QJo. I was under the (possibly mistaken) impression that QJo is just another regular, not one of the staff?

    No, definitely not on the staff, a devoted regular, getting irritated at the low levels of tolerance towards the writing.

    Apologies if I have been the cause of people who don't like this site no longer reading it. As for me, I don't believe people should be allowed that sort of choice. Pardon my irony.

  • Paul Neumann (unregistered) in reply to Rob G
    Rob G:
    OK, I'll shut up and you've just lost a reader by being rude to other readers.

    If you can't take criticism, stop publishing.

    QFT! i.e. practice what you preach.

    Also, learn to read the meta.

  • Guestimate (unregistered) in reply to QJo
    I would opine that this is just a case of "them as can, does; them as can't, teach; them as can't teach, criticise."

    In short, if you think you can do better yourself, start your own website. If not, shut up.

    And lets not forget the next one:

    "Them who can't stand critique utter some forbidding others to do the same" :-)

  • foo (unregistered) in reply to QJo
    QJo:
    moz:
    I'm still trying to work out whether the code is better or worse than the paragraphs above it.

    I notice there's been a lot of rudeness currently being expressed at the presentational style (by which I mean the surrounding text into which the WTF is customarily framed).

    I would opine that this is just a case of "them as can, does; them as can't, teach; them as can't teach, criticise."

    In short, if you think you can do better yourself, start your own website. If not, shut up.

    Your criticism is appreciated.

  • IBM 3277 (unregistered) in reply to QJo

    If God used COBOL we all see the world thru 80x24 tty instead of Google glasses

  • foo (unregistered) in reply to God...
    God...:
    When Darwin visited the Galapagos, he saw that the relative isolation of the islands had allowed species to evolve into forms that would never have happened on the mainland. This insight helped him to refine his theory of evolution by natural selection.

    This is TRWTF. Everyone knows I created everything 6000 years ago.

    Then why did you create Darwin?

  • (cs) in reply to Memleak
    Memleak:
    Dim F As String Dim R As String Dim I As String Dim S As String Dim T As String

    comment.text = F & R & I & S & T

    Congratulations, you just concatenated five undefined variables.

  • (cs) in reply to foo
    foo:
    God...:
    When Darwin visited the Galapagos, he saw that the relative isolation of the islands had allowed species to evolve into forms that would never have happened on the mainland. This insight helped him to refine his theory of evolution by natural selection.

    This is TRWTF. Everyone knows I created everything 6000 years ago.

    Then why did you create Darwin?

    Trying to have a rational discussion about evolution with someone role-playing God, isn't likely to lead to the satisfying victory that you're looking for.

  • fgfg (unregistered) in reply to Franky
    Franky:
    Can someone spell out to me what that code does? My eyes hurt too much before I could discern the logic ;)

    It sends an email to the presidents daughter, asking for a date.

  • anonymous (unregistered) in reply to Franky
    Franky:
    Can someone spell out to me what that code does? My eyes hurt too much before I could discern the logic ;)

    captcha: inhibeo - I suppress

    Basically this: it generates a list of demographics and spits out a mass of godawful HTML for each one.
    'Get Demographics
    Dim list As ArrayList = GetDemographics()
    If list.Count > 0 Then
    For Each item As Demographics In list
    If item.Dem_last_name > "" And item.Dem_first_name > "" Then
    Dim elem As New Label
    elem.ID = item.email_address
    elem.Text = "
    [image]" _ & "
    Demographics
    "
    _ & "Patient Name:
    "
    & item.Dem_first_name & " " & item.Dem_last_name _ & "

    " _ & "" _ & "" _ & "" _ & "" _ & "
    How did you hear about us?
    " & item.marketing & "


    Billing Address


    " _ & "Secondary Address
    " & item.address_line_1 & "
    "
    _ & item.address_line_2 & "
    Street
    <img src='/content/images/spacer.png' " _ & "width='1px' height='1px' />" _ & item.sec_address_line_1 & "
    "
    & item.sec_address_line_2 _ 'Cut, so as not to belabor the point & item.PharmName & "
    Pharmacy Name

    "
    _ & item.PharmStreet & "
    "
    & item.PharmCity & ", " & item.PharmState & " " & item.PharmZip _ & "
    Pharmacy Address

    " _ & item.PharmFax & "
    Pharmacy Fax

    "
    _ & item.PharmPhone & "
    Pharmacy Phone
    "
    PlaceHolder2.Controls.Add(elem) End If Next

    Else Dim elem As New Label elem.ID = "email_address" elem.Text = "No Results" PlaceHolder2.Controls.Add(elem) End If

  • (cs) in reply to tragomaskhalos
    tragomaskhalos:
    I have seen code exactly like this to create monster SQL queries (complete with the obligatory injection vulnerabilities).

    "Give me Here documents or give me death" ....

    OK, here's some Here documents. Please keep them to yourself.
  • (cs) in reply to Steve The Cynic
    Steve The Cynic:
    tragomaskhalos:
    I have seen code exactly like this to create monster SQL queries (complete with the obligatory injection vulnerabilities).

    "Give me Here documents or give me death" ....

    OK, here's some Here documents. Please keep them to yourself.

    Gah? He offered the opportunity to kill him, and you went with handing over the documents?

  • qbolec (unregistered)

    I think that author was asked to reorder the output so that the e3 column was moved to the left.

    TRWTF is then that author reordered variables' declartaions as well.

  • (cs)

    Hmmmm...match-book school of computer programming?

  • Brompot (unregistered) in reply to nulla
    nulla:
    London is not a vacation destination.

    Quite right. London is a holiday destination.

  • (cs) in reply to Brompot
    Brompot:
    nulla:
    London is not a vacation destination.

    Quite right. London is a holiday destination.

    Yeah... I've always thought the American "vacation" is a weird term; why use a word which essentially means "making the home empty"? I mean, yeah, you do make your home empty, but that is entirely a side effect of "going somewhere else that's nicer, for a while".

    Then again, I guess it makes no more sense than using a word for single day's religious festival.

  • (cs) in reply to I_Taught_VB3
    I_Taught_VB3:
    Visual Basic - the language of brittle, sharp coral islands barely above water at the best of times.
    I'm not sure how VB is at fault when the programmer doesn't even know how to use arrays.
  • Adin Falkhoff (unregistered)

    At least he typed them. I had a gig about a decade ago where I was welcomed by this:

    ON ERROR RESUME NEXT

    Dim A,B,C,D,E,F,...ZZ

    A = code B = A + CODE S = "Address "

    etc

    And everything a VARIANT

  • ¯\(°_o)/¯ I DUNNO LOL (unregistered) in reply to pjt33
    pjt33:
    That doesn't explain x2, y2, z2. An alternative hypothesis would be that the programmer handled change requests by creating a new variable, but not removing the old one until he was sure that the new one was giving correct output.
    Notice the snippage? There were apparently 78 lines being generated. If there had been 83 or more, e3 would have been changed to e4! (Obviously we're dealing with an inferior lifeform that doesn't understand the concept of zero.)

    If he had two brain cells instead one, he could have at least named them a01...a99 and not had the problem with 'e'. But that would be one step away from an array and a loop, which would be another slight evolutionary improvement (of the hundreds on the way to actual sane code).

    After all, if there's one thing about the Galapagos, it's that life there didn't evolve to survive around mainland animals. Its native species are just as fragile and hard to maintain as the code of Roberto's cow-orker.

  • (cs) in reply to eViLegion
    eViLegion:
    Brompot:
    nulla:
    London is not a vacation destination.

    Quite right. London is a holiday destination.

    Yeah... I've always thought the American "vacation" is a weird term; why use a word which essentially means "making the home empty"? I mean, yeah, you do make your home empty, but that is entirely a side effect of "going somewhere else that's nicer, for a while".

    The fact that you're not home is the important part to other people.

    Then again, I guess it makes no more sense than using a word for single day's religious festival.
    My thought exactly. Ridiculing dialects is like playing global thermonuclear war.
  • God (unregistered)
    If God used...

    You're all wrong. I used Ruby. Which is why there are ginger people.

  • ENOTTY (unregistered) in reply to anonymous

    You could at least use XML literals to avoid those godawful line continuations.

    Dim html as String = <html> fuckity fuck bye </html>.Value

    I wish I never had to learn this.

  • (cs)

    Not only does this code pattern itself stink, but hits just about every one of my .Net pet peeves that coders do.

    • Use of ArrayList in any code after .Net 2.0 (extremely inefficient – requires casting everything to Object, which incurs boxing/unboxing)
    • Meaningless Variable names other than iterators
    • String concatenation, especially inside of a loop – that is what a StringBuilder is for, unless you really like creating and allocating hundreds of objects.
    • Has to call a method (GetDemographics) just to get a count of the array. If that is an expensive method, you just did it twice.
    • Comparison to an empty string before checking for null/nothing – Do you want to crash if the string is not initialized?
    • Use of the And operator in an if statement (& in C/C#) instead of AndAlso (&& in C/C#). Short-circuit that call, you are in a loop!

    If there was a bunch of conditional statements on the lines I might think theprogrammer could have been trying to speed up their code and did not know about StringBuilder. Concatenating the smaller with the logic there and then concatenating them at the end would likely have been faster. Though, this is VB with the & operator instead of the + operator, so it may behave differently. Normally, + in VB and C# is compiled to use String.Concat() which, with this many arguments, will take the length of all of the strings and allocate memory once for the total rather than the creation and release of immutable objects. Without the conditional statements, though, it would have been better to just put the entire statement into one big concatenation statement , for speed. Though, if you are doing that why would you be using a label object in the first place.

    Now that I reason through it, this classifies as a WTF no matter which direction you look at it.

  • Tom (unregistered)

    One can argue whether that code evolved, or was created. But it certainly refutes the theory of intelligent design.

    And if God wrote our genetic code in SQL, we'd all be related.

  • (cs) in reply to ENOTTY
    ENOTTY:
    You could at least use XML literals to avoid those godawful line continuations.

    Dim html as String = <html> bye </html>.Value

    I wish I never had to learn this.

    Yes, but XML Literals were only introduced in the .Net 3.5 compilers alongside LINQ to .Net.

    Personally, the XML literals and processing in VB.Net is a good thing when you have to work with XML docuemnts, it is a real time saver. Just about the only thing I like about VB.Net vs other .Net languages.

  • JC (unregistered) in reply to The Bytemaster
    The Bytemaster:
    • Use of ArrayList in any code after .Net 2.0 (extremely inefficient – requires casting everything to Object, which incurs boxing/unboxing)

    As long as the elements in the ArrayList are reference types they won't be boxed/unboxed. It's still a sucky to do though.

  • Harrow (unregistered) in reply to QJo
    QJo:
    It is frequently the case where people who are unable to perform adequately at the proverbial coalface of Making Things Happen in an industrial environment are perfectly capable, and more than adequate, of passing on the knowledge of the business for which they were trained.

    On the other hand, from my experience, those who are in their element at the white-hot end of high-intensity development are complete rubbish at being able to pass on their knowledge to others.

    You realize, of course, that a white-hot intensity brought to a coalface might produce a problematical environment? This shows again the extreme danger of mixing metaphors, or even letting them get too near each other.

    -Harrow.

  • (cs) in reply to eViLegion
    eViLegion:
    nulla:
    London is not a vacation destination.

    (1) Yeah it is. It has over 15 million tourists a year. (2) Why are you attempting to contradict nothing?

    Wonderful place to visit. Do yourself a favor and get a 1 week pass for the underground. Saves LOTS of time, etc.

    Of course, visiting outside of the "rush" season (May-September) improves things. I last did it in the fall (late November). Be sure to bring a raincoat.

    If you want to have fun, go to the Underground Lost & Found and mention that you lost a black umbrella. Always a good joke!

  • (cs) in reply to operagost
    operagost:
    The fact that you're not home is the important part to other people.

    Well screw them... I'm on holiday! I can't let the drudgery of their normal lives ruin my piña colada.

    operagost:
    Ridiculing dialects is like playing global thermonuclear war.

    Or tic tac toe!

  • David Carter (unregistered)

    I used to write code like this. Hopefully not so much anymore.

    Looks like a good place for the Factory Pattern.

    Why is the output being put directly into a label?

  • foo (unregistered) in reply to eViLegion
    eViLegion:
    foo:
    God...:
    When Darwin visited the Galapagos, he saw that the relative isolation of the islands had allowed species to evolve into forms that would never have happened on the mainland. This insight helped him to refine his theory of evolution by natural selection.

    This is TRWTF. Everyone knows I created everything 6000 years ago.

    Then why did you create Darwin?

    Trying to have a rational discussion about evolution with someone role-playing God, isn't likely to lead to the satisfying victory that you're looking for.

    I'm not trying to have a rational discussion. I'm trying to get him to accidentally admit he exists which, by his own logic, means he doesn't exist.

  • The Sauce (unregistered)

    I've been one to complain about the "flavor text" accompanying the articles from time to time, and yeah it's often pretty bad.

    But I thought it was pretty good here. A new high for Remy, even!

  • Anonymous Coward (unregistered) in reply to QJo
    QJo:
    ubersoldat:
    Man, imagine if God used VB to write our genetic code and everything was like this.

    Hmmm... it would be funny if someone had the time to write some "If God used programming language X" jokes.

    If God used Java we all be snails If God used C++ we all be gazelles with a heart problem If God used C we all be virus If God used PHP we all be Chimeras If God used Bash we all be droids If God used VB we wouldn't exist If God used Perl we would all be plants (my imagination has a limit) If God used Python we would all be British If God used Brainfuck we would all be Humans If God used JavaScript we would all be males (you know, because of single threading in JS) If God used C# we would all be slaves!!!

    Feel free to modify or extend, this work is CC BY-SA

    If God used BASIC we'd all be Disney cartoon characters. If God used FORTRAN we'd all be dinosaurs. If God used Ada we'd all be military tanks. If God used Ook we'd all be at Unseen University.

    Quad-Quote <- Backwards all we would be God if used APL.

  • (cs)

    Nope. Not surprised. Seems to reference the medical industry which is TRWTF.

  • Damien (unregistered) in reply to Zylon
    Zylon:
    Memleak:
    Dim F As String Dim R As String Dim I As String Dim S As String Dim T As String

    comment.text = F & R & I & S & T

    Congratulations, you just concatenated five undefined variables.

    Someone seems to be confused on the difference between definition and initialization. They may be uninitialized variables, but they're definitely defined.

  • Anonymouse (unregistered) in reply to ubersoldat
    ubersoldat:
    If God used Java we all be snails If God used C++ we all be gazelles with a heart problem If God used C we all be virus If God used PHP we all be Chimeras If God used Bash we all be droids If God used VB we wouldn't exist If God used Perl we would all be plants (my imagination has a limit) If God used Python we would all be British If God used Brainfuck we would all be Humans If God used JavaScript we would all be males (you know, because of single threading in JS) If God used C# we would all be slaves!!!
    If God used JavaScript we would all be cookies
  • (cs)

    Oddly enough, I see magic variables about three times as often in C# .NET as I do in VB .NET. The VB .NET WTFs are a whole separate class, though.

    Remy, was this originally submitted as VB .NET code?

  • (cs) in reply to Damien
    Damien:
    Zylon:
    Memleak:
    Dim F As String Dim R As String Dim I As String Dim S As String Dim T As String

    comment.text = F & R & I & S & T

    Congratulations, you just concatenated five undefined variables.

    Someone seems to be confused on the difference between definition and initialization. They may be uninitialized variables, but they're definitely defined.

    My VB.NET is a little rusty, but I was under the impression that by declaring a variable without initialisation, it would get automatically initialised by the compiler to NULL for most reference types, or some default for value types?

    I may be wrong, but assuming I'm not, concattenating 5 uninitialised strings would give you the empty string.

  • Oh THAT Brian! (unregistered) in reply to ubersoldat

    I see it only took 7 comments before the VB bashing began.

  • (cs) in reply to eViLegion
    eViLegion:
    My VB.NET is a little rusty, but I was under the impression that by declaring a variable without initialisation, it would get automatically initialised by the compiler to NULL for most reference types, or some default for value types?

    I may be wrong, but assuming I'm not, concattenating 5 uninitialised strings would give you the empty string.

    "Nothing", not NULL.

    But yes, the concatenation that you describe will give you an empty string, along with five compiler warnings.

  • Flaming Shearer (unregistered) in reply to QJo
    QJo:
    Rnd(:
    QJo:
    ubersoldat:
    Man, imagine if God used VB to write our genetic code and everything was like this.

    Hmmm... it would be funny if someone had the time to write some "If God used programming language X" jokes.

    If God used Java we all be snails If God used C++ we all be gazelles with a heart problem If God used C we all be virus If God used PHP we all be Chimeras If God used Bash we all be droids If God used VB we wouldn't exist If God used Perl we would all be plants (my imagination has a limit) If God used Python we would all be British If God used Brainfuck we would all be Humans If God used JavaScript we would all be males (you know, because of single threading in JS) If God used C# we would all be slaves!!!

    Feel free to modify or extend, this work is CC BY-SA

    If God used BASIC we'd all be Disney cartoon characters. If God used FORTRAN we'd all be dinosaurs. If God used Ada we'd all be military tanks. If God used Ook we'd all be at Unseen University.

    If God used COBOL we'd all be?

    #DECLARE

    IF IT WAS THE CASE THAT GOD WAS IN THE HABIT OF UTILISING COBOL AS HIS MAIN TOOL FOR THE MANUFACTURE OF CREATION ALGORITHMS, IT WOULD VERY LIKELY BE THE CASE THAT WE WOULD ALL BE CONSIDERABLY MORE VERBOSE THAN WE ALREADY HAVE THE UNFORTUNATE TENDENCY SOMETIMES TO BE

    +1E11

  • Anonypony (unregistered)
    Dim _alphalist As String = a & b & c & d & e3 & f & g & h & i & j & k & l & m & n & o & q & r & s & t & u & v & w & x & y & z & a1 & b1 & c1 & d1 & e1 & f1 & g1 & h1 & i1 & j1 & k1 & l1 & m1 & n1 & o1 & p1 & q1 & r1 & s1 & t1 & u1 & v1 & w1 & x1 & y1 & z1 & a2 & b2 & c2 & d2 & e2 & f2 & g2 & h2 & i2 & j2 & k2 & l2 & m2 & n2 & o2 & p2 & q2 & r2 & s2 & t2 & u2 & v2 & w2 & x2 & y2 & z2

    I am brought to tears by the beauty of this code. It is like looking into the untamed face of the wrathful Divine. I AM UNWORTHY!

    Captcha: duis - unis duis tris Tetris!

  • Anonypony (unregistered) in reply to QJo

    If God used Lua we'd all be hookworms. If God used Mumps we'd all be X(^DNA("OID")) If God used SQL we'd all be <?= mysql_fetch_array(mysql_query("SELECT `trait` from `traits` where `lang` = '" . $_GET['lang'] . "'") ?>

  • Everyone (unregistered) in reply to God...

    Yeah....listen, we've been meaning to talk to you about that.

  • ANON (unregistered) in reply to ubersoldat

    God actually used Perl as scientific researchers have found out:

    http://xkcd.com/224/

    CAPTCHA: Eros - Didn't Eros create the world according to Greek mythology?

  • Steve Holdoway (unregistered) in reply to Flaming Shearer

    -1 You missed the final full stop.

  • (cs)
    Dim _demox As New Label
    _demox.ID = p.email_address
    

    I wonder how well that works when two records have the same email address.

  • Lisp lover (unregistered) in reply to ubersoldat

    Let's be honest, we all know that God wrote in LISP http://www.youtube.com/watch?v=5-OjTPj7K54 The Eternal Flame

Leave a comment on “Galapagos”

Log In or post as a guest

Replying to comment #:

« Return to Article