• Karel (unregistered)

    Or other languages for that matter

  • SR (unregistered)

    MyComment = Replace(MyComment, "FRIST", "")

    frist

  • (cs) in reply to Karel
    Karel:
    Or other languages for that matter

    The spec only asked to strip the Greek and English languages. lang=FR is fine, as is LANG=fR.

    It really seems like there should be a regular way to express this without hardcoding all the different possibilities. Oh well.

  • no it isn't (unregistered)

    lAng=frist

    this is still funny right?

  • (cs)

    Better hope you never get a URL where the lang parameter is the first of several parameters.

  • Ymgve (unregistered)

    I love how the second section of replaces will break any query string by removing the vital "?" mark.

  • SoaperGEM (unregistered) in reply to no it isn't
    no it isn't:
    lAng=frist

    this is still funny right?

    No. "Frist" was never funny to begin with. It's just beating a dead horse. A very, very, very dead horse.

  • Me (unregistered)

    I sense some EN-Gr in his co-worker...

  • (cs)

    Varg aurait dû être inquiets que la solution ne fonctionne pas ... Que? Je ne peux pas parler Anglais. Quelle domage!

  • Philip Newton (unregistered) in reply to akatherder
    akatherder:
    The spec only asked to strip the Greek and English languages.
    Then it didn't do a very good job, since Greek is "el". ("gr" isn't registered as a language tag at all, at least not with IANA: http://www.iana.org/assignments/language-subtag-registry )

    Also, it should have replaced the "?lang=xx" forms with "?" if a "&" followed, otherwise "bla.php?lang=en&img=true" would turn into "bla.php&img=true" which wouldn't du what it was supposed to.

  • getofmymetriclawn (unregistered) in reply to SoaperGEM
    SoaperGEM:
    No. "Frist" was never funny to begin with. It's just beating a dead horse. A very, very, very dead horse.
    Yes, but by also using the "reusing the WTF-pattern in the article with some meta-reference to the comment" meme, he is beating one dead horse with another dead horse, which could, in theory, still be funny.
  • Anonymous (unregistered)

    Brute force string replace - now that's a classic WTF. A bit boring, but classic nonetheless.

  • Anonymous (unregistered) in reply to getofmymetriclawn
    getofmymetriclawn:
    SoaperGEM:
    No. "Frist" was never funny to begin with. It's just beating a dead horse. A very, very, very dead horse.
    Yes, but by also using the "reusing the WTF-pattern in the article with some meta-reference to the comment" meme, he is beating one dead horse with another dead horse, which could, in theory, still be funny.
    Eh, maybe. If he was beating a dead horse with a dead horse whilst riding a dead horse over a pile of dead horses, that would be funny.
  • Ralph (unregistered)

    That looks like some perfectly normal VB to me. Yes it would be atrocious in other languages, but again, perfectly fine VB!

  • Yo dawg (unregistered) in reply to Anonymous
    Anonymous:
    If he was beating a dead horse with a dead horse whilst riding a dead horse over a pile of dead horses, that would be funny.
    So he can beat a dead horse while he beats a dead horse?
  • Stacy (unregistered) in reply to Anonymous
    Anonymous:
    getofmymetriclawn:
    SoaperGEM:
    No. "Frist" was never funny to begin with. It's just beating a dead horse. A very, very, very dead horse.
    Yes, but by also using the "reusing the WTF-pattern in the article with some meta-reference to the comment" meme, he is beating one dead horse with another dead horse, which could, in theory, still be funny.
    Eh, maybe. If he was beating a dead horse with a dead horse whilst riding a dead horse over a pile of dead horses, that would be funny.

    I dunno... I think once you have more than 3 dead horses it becomes less funny and more sad.

  • Drew (unregistered) in reply to Ralph
    Ralph:
    That looks like some perfectly normal VB to me. Yes it would be atrocious in other languages, but again, perfectly fine VB!

    Boooo...

  • Knux2 (unregistered)

    I would love to see how he would handle "Replace any 6 digit numbers with their hexadecimal equivalents."

    MyPage = Replace(MyPage, "000000", "00000") MyPage = Replace(MyPage, "000001", "00001") MyPage = Replace(MyPage, "000002", "00002") MyPage = Replace(MyPage, "000003", "00003") MyPage = Replace(MyPage, "000004", "00004")

    ...

    MyPage = Replace(MyPage, "999999", "F423F")

  • DonaldK (unregistered) in reply to Knux2
    Knux2:
    MyPage = Replace(MyPage, "000003", "00003") MyPage = Replace(MyPage, "000004", "00004") ...

    MyPage = Replace(MyPage, "999999", "F423F")

    Avoid the common caveat of not uppercasing the strings ... because if "999999" translates to "F423F", then surely uppercase("999999") should also translate to "F423F". And just for good measure do a lowercase("999999") as well...

    Unless you're supposed to return "f423f" ... or "f423F" ...

    Hmmmm

  • (cs)

    You have to love how VB.Net has its own special namespace with slightly different implementations of already available string methods.

  • A Tester (unregistered)

    Acarily I actually came quite close to writing this today, seeing as I can't be bothered to learn .NET regexes.

    My solution is as follows, where I want to replace the value of the parameter:

    string urlTemplate;
    string quantParam = "quantity=" + quantity;
    int quantIndex = url.IndexOf(quantParam, StringComparison.OrdinalIgnoreCase);
    if (quantIndex == -1)
    {
        urlTemplate = url + "&Quantity={0}";
    }
    else
    {
        string actualQuantParam = url.Substring(quantIndex, quantParam.Length);
        urlTemplate = url.Replace(actualQuantParam, "Quantity={0}");
    }
    
  • (cs)

    It's a shame they weren't using TDD. It might be fun to keep adding an additional failing case once a day, assuming Varg's colleague had to keep fixing it. (And who knows, after a few months, the colleague might actually fix it correctly.)

  • Bobbo (unregistered) in reply to Knux2
    Knux2:
    I would love to see how he would handle "Replace any 6 digit numbers with their hexadecimal equivalents."

    I get asked to do this literally ALL the time.

  • anonymous coward (unregistered) in reply to Bobbo
    Bobbo:
    Knux2:
    I would love to see how he would handle "Replace any 6 digit numbers with their hexadecimal equivalents."

    I get asked to do this literally ALL the time.

    Why? Didn't you do it right the first time?

  • (cs) in reply to Philip Newton
    Philip Newton:
    akatherder:
    The spec only asked to strip the Greek and English languages.
    Then it didn't do a very good job, since Greek is "el". ("gr" isn't registered as a language tag at all, at least not with IANA: http://www.iana.org/assignments/language-subtag-registry )

    Also, it should have replaced the "?lang=xx" forms with "?" if a "&" followed, otherwise "bla.php?lang=en&img=true" would turn into "bla.php&img=true" which wouldn't du what it was supposed to.

    No, GR is greek and SP is Spanish! You might think that because they suck at regular expressions, they are resourceful enough to get the correct language abbreviations. It seems the incompetence is uniform throughout all facets though.

  • Buddy (unregistered) in reply to getofmymetriclawn
    getofmymetriclawn:
    SoaperGEM:
    No. "Frist" was never funny to begin with. It's just beating a dead horse. A very, very, very dead horse.
    Yes, but by also using the "reusing the WTF-pattern in the article with some meta-reference to the comment" meme, he is beating one dead horse with another dead horse, which could, in theory, still be funny.
    Kind of grotesque image, that - beating a dead horse with another dead horse.

    I guess one dead horse would have to be very small so it could be wielded as an instrument to beat the other dead horse. Like one of those miniature horses, which is still classified as a horse and not a pony. It would have to be quite fresh too, and not too decomposed, otherwise it would fall apart early during the beating process. The other horse can be any size and level of decomposition, so there's a bit of leeway there.

    Even then, typically in the IT industry one doesn't find that many dead horses lying around. In my career, the closest I could have ever gotten to this is beating a dead pigeon with a dead fish, or vice versa.

  • (cs)

    This is an instantly fire-able offense.

  • (cs)

    TRWTF is being called Varg and no varg jokes yet

  • SR (unregistered) in reply to anonymous coward
    anonymous coward:
    Bobbo:
    Knux2:
    I would love to see how he would handle "Replace any 6 digit numbers with their hexadecimal equivalents."

    I get asked to do this literally ALL the time.

    Why? Didn't you do it right the first time?

    Using the brute force method he could still be doing it for the first time. I hope your boss is relaxed about deadlines, Bobbo1

  • dave (unregistered) in reply to A Tester
    A Tester:
    Acarily I actually came quite close to writing this today, seeing as I can't be bothered to learn .NET regexes.

    The source of many a good WTF. Looking forwards to seeing yours!

  • Also Anonymous (unregistered) in reply to Anonymous
    Anonymous:
    Brute force string replace - now that's a clbuttic WTF. A bit boring, but clbuttic nonetheless.

    FTFY

  • (cs) in reply to savar
    savar:
    This is an instantly fire-able offense.
    What? Beating dead animals with other dead animals?
  • (cs) in reply to akatherder
    akatherder:
    It really seems like there should be a regular way to express this without hardcoding all the different possibilities. Oh well.

    QFTFY

  • (cs)

    "We've just added 3 more languages to our webpage and we need you to tidy up a bit the code your predecessor left. Huh, what's a front controller? Why would we do that, we just copy-paste the code to every page, it's simple. Anyway, get started, this shouldn't take you more than an hour"

  • Anonymous (unregistered)

    A bonus meta-WTF:

    We are currently narrating this post.
    Can't wait to hear that...

    "My page equals replace open bracket my page comma double quote and lang equals E N double quote comma double quote double quote close bracket"

    "My page equals replace open bracket my page comma double quote and lang equals G R double quote comma double quote double quote close bracket"

    ...

  • Arantor (unregistered)

    FFS.

    This is the 21st Century. We're even a decade in.

    Are there really any sensible languages that DON'T have regular expression support?

    Oh wait. You said VB, right? :P

  • THG (unregistered) in reply to Buddy
    Buddy:
    getofmymetriclawn:
    SoaperGEM:
    No. "Frist" was never funny to begin with. It's just beating a dead horse. A very, very, very dead horse.
    Yes, but by also using the "reusing the WTF-pattern in the article with some meta-reference to the comment" meme, he is beating one dead horse with another dead horse, which could, in theory, still be funny.
    Kind of grotesque image, that - beating a dead horse with another dead horse. [ ... snip ... ] . In my career, the closest I could have ever gotten to this is beating a dead pigeon with a dead fish, or vice versa.

    on an embedded system with no file-system, only Irish Girl can mix metaphors with memes

  • Izhido (unregistered)

    Hmm... I see your point in here, people. Correct me if I'm wrong here, but TRWTF here is that, instead of manually generating all possible cases for the replaces... he should have used a CASE tool to generate all that code, that automatically considers all poosible cases for him... right?

  • (cs) in reply to dave
    dave:
    A Tester:
    Acarily I actually came quite close to writing this today, seeing as I can't be bothered to learn .NET regexes.

    The source of many a good WTF. Looking forwards to seeing yours!

    To be fair, learning regexes is also a source of many good WTFs.

  • Spoe (unregistered) in reply to akatherder
    akatherder:
    No, GR is greek and SP is Spanish! You might think that because they suck at regular expressions, they are resourceful enough to get the correct language abbreviations. It seems the incompetence is uniform throughout all facets though.

    HTML 4 is speced (and carries over, in essence, to XHTML and HTML5) to use RFC 1766 for languages, however. RFC1766 specifies using ISO 639 two letter codes which, indeed, are "el" for Greek and "es" for Spanish.

    http://www.ietf.org/rfc/rfc1766.txt In the primary language tag:
    -    All 2-letter tags are interpreted according to ISO standard 639, "Code for the representation of names of languages" [ISO 639].
    
    -    The value "i" is reserved for IANA-defined registrations
    
    -    The value "x" is reserved for private use. Subtags of "x" will not be registered by the IANA.
    
    -    Other values cannot be assigned except by updating this standard.</div></BLOCKQUOTE>
    

    This is carried over in RFC 3066, which specifies the ISO 639-1 interpretation for two letter codes and ISO 639-2 for three letter codes. This adds "gre" and "ell" for modern Greek (for bibliographic and terminology purposes) and "SPA" for Spanish.

  • (cs) in reply to Izhido
    Izhido:
    Hmm... I see your point in here, people. Correct me if I'm wrong here, but TRWTF here is that, instead of manually generating all possible cases for the replaces... he should have used a CASE tool to generate all that code, that automatically considers all poosible cases for him... right?

    No, TRWTF is that he didn't write a .bat (batch?) file to generate the different cases automatically from an Excel spreadshit.

  • (cs)

    Bah. I'm not impressed. Lyle could have come up with twice as many Replace permutations, in the same amount of time!

  • Mike (unregistered) in reply to anonymous coward
    anonymous coward:
    Bobbo:
    Knux2:
    I would love to see how he would handle "Replace any 6 digit numbers with their hexadecimal equivalents."

    I get asked to do this literally ALL the time.

    Why? Didn't you do it right the first time?

    +1 sir

  • PITA (unregistered) in reply to SoaperGEM
    SoaperGEM:
    no it isn't:
    lAng=frist

    this is still funny right?

    No. "Frist" was never funny to begin with. It's just beating a dead horse. A very, very, very dead horse.

    Something, something, dead horse.

  • vovo (unregistered) in reply to m a t t
    m a t t:
    savar:
    This is an instantly fire-able offense.
    What? Beating dead animals with other dead animals?

    Why are we beating a dead horse with another dead horse? Let's start beating the guy beating the dead horse with another dead horse.

  • Anonymous (unregistered) in reply to A Tester

    Why not just convert the query string to all lower (or upper) case and then just remove the "lang=el" part of it?

  • RandomUser423692 (unregistered) in reply to Ralph
    Ralph:
    That looks like some perfectly normal VB to me. Yes it would be atrocious in other languages, but again, perfectly fine VB!
    No, this is pathetic VB, also.

    Err...wait. You're a troll, aren't you? Blast!

  • Ubermensche (unregistered) in reply to no it isn't
    no it isn't:
    lAng=frist

    this is still funny right?

    Not relaly, lAng=Fritz is funnier.

    Only though if you're in Metropolis.

    CAPTCHA=enim : Not quite a rap star. Yet.

  • (cs) in reply to Anonymous
    Anonymous:
    Why not just convert the query string to all lower (or upper) case and then just remove the "lang=el" part of it?

    How would you put it back to its previous capitalization? ;)

  • re:me (unregistered) in reply to SoaperGEM
    SoaperGEM:
    no it isn't:
    lAng=frist

    this is still funny right?

    No. "Frist" was never funny to begin with. It's just beating a dead horse. A very, very, very dead horse.

    Perhaps you didn't notice the name of the poster?

Leave a comment on “RePLaCeD”

Log In or post as a guest

Replying to comment #:

« Return to Article