• Someone (unregistered)

    Wait, what?

  • (cs)
                           Frist?
    
  • ZoomST (unregistered)

    Someone please explain what's happening in the code - I'm feeling very lazy today. Also, dNames[frist++] = Four;

  • ZoomST (unregistered) in reply to ZoomST
    ZoomST:
    Someone please explain what's happening in the code - I'm feeling very lazy today. Also, dNames[frist++] = Four;
    I swear that at some point I had a comment page like this:
    -------------- Re: Ubertrim 2013-07-25 07:32 • by Someone (unregistered)

    413534 Reply Quote Wait, what?

    Re: Ubertrim 2013-07-25 07:33 • by Four (unregistered)

    413535 Reply Quote The temptation to frist this is too much

    Now the comment from user Four disappeared, rendering my comment less funnier - as if it was funny anyway. What's happening with the comments disappearing? Censorship?
  • dfcowell (unregistered) in reply to ZoomST

    From what I can tell all that happens is

    thisIDRACText.substr(1);
    and the wtf is that everything except that is just one massive noop.

  • Gyxi (unregistered)

    This is not pretty at all, but slow? I can't see anything there would be noticably slow.

  • anon (unregistered)

    The sample code alone doesn't explain the slowness, because the if statement with the repeated trim calls will never be entered. Something else will be slowing things down massively. Plus, even if it was entered, you should be able to apply regex and append array elements a hundred times over in milliseconds, not seconds.

    The sample is more like an example of how the author is capable of massively screwing things up in other places. I'm interested to know just how the author managed to fail that really did make things so slow.

  • iDRAC user (unregistered)

    As soon as I saw iDRAC on the page I knew this was going to be a good one. Dell makes decent hardware, but any software they make is slow and buggy as hell. Most of the time it is faster to take the 5min walk to the server room then to use the DRAC, and never ever run the linux unpackers for their firmware unless you have backup.

  • RandomGuy (unregistered) in reply to anon
    anon:
    The sample code alone doesn't explain the slowness, because the if statement with the repeated trim calls will never be entered.
    Exactly, and even if "0"==2, each inner if statement would be false, still having no additional entries in the array.
  • faoileag (unregistered)

    I like the "i" argument on the regexes:

    str = str.replace(/^\s*/gi, "");
    This definitely makes the code future-proof: should anyone introduce something like an uppercase blank, the my_trim() function will still work!

  • (cs) in reply to faoileag
    faoileag:
    This definitely makes the code future-proof: should anyone introduce something like an uppercase blank, the my_trim() function will still work!
    I thought blank was upper case already? It's the lower case blanks that you've got to look out for…
  • QJo (unregistered) in reply to dkf
    dkf:
    faoileag:
    This definitely makes the code future-proof: should anyone introduce something like an uppercase blank, the my_trim() function will still work!
    I thought blank was upper case already? It's the lower case blanks that you've got to look out for…

    "You pesky lowercase blanks! Geroff me lawn!"

  • Bob (unregistered) in reply to dkf
    dkf:
    faoileag:
    This definitely makes the code future-proof: should anyone introduce something like an uppercase blank, the my_trim() function will still work!
    I thought blank was upper case already? It's the lower case blanks that you've got to look out for…

    Please show a little sensitivity. I had a son who had a nasty case of lower case blanks. Let me assure you, it was no laughing matter.

  • Martijn Otto (unregistered)

    We work with DELL servers too, so I am familiar with DRAC. I always imagined the source code would look something like that, however have been too afraid to take a look.

    The way the pages render in anything but IE is, as usual, a good indicator of the quality of code.

  • faoileag (unregistered)

    ...of Dell's landing page (which oddly enough can be found at http://www.vbaspnet.com/2011/03/c-aspnet-crawl-pages-behind-a-login-crawl-php-login-authentication-website-for-https-authentication-the-idrac-card-to-take-equipment/ ), I see a loadXMLDocument() function that retrieves XML via AJAX-requests.

    And I see a getXMLValue() that looks like a roll-your-own XML-parser. One that parses an xml string everytime a value from that xml string is needed.

    So Nav: yes, the never-to-be-executed if-clause with all those my_trim() calls is certainly hilarious and definitely worth a submit to TDWTF, but it is not the reason for the slow loading of Dell's landing page.

  • (cs)

    I'm not sure this is that big a WTF. I'm guessing he viewed the source in the web browser, so AFTER it has been processed by the server.

    So, the source on the server probably says something like:

    var LDAPEnableMode = "<?php getEnableMode()?>";
    
    if (LDAPEnableMode==2)
    {
        tStr = my_trim( '<?php getAttribute('email')?>' );
        if (tStr.length > 0) { dNames[x++] = tStr; }
        tStr = my_trim( '<?php getAttribute('address')?>' );
    ...
    

    or whatever. So, here they're doing work in Javascript that could be done in PHP, but maybe their real server can't do clever things like PHP, so can just do text substitution, in which case Javascript has to do the work - so, it's not that big a problem.

    The delay must be somewhere else

  • faoileag (unregistered) in reply to Bob
    Bob:
    dkf:
    faoileag:
    This definitely makes the code future-proof: should anyone introduce something like an uppercase blank, the my_trim() function will still work!
    I thought blank was upper case already? It's the lower case blanks that you've got to look out for…
    Please show a little sensitivity. I had a son who had a nasty case of lower case blanks. Let me assure you, it was no laughing matter.
    And now think of the president's daughter, suffering from a bout of uppercase tabs, the poor girl!
  • (cs) in reply to faoileag
    faoileag:
    Bob:
    dkf:
    faoileag:
    This definitely makes the code future-proof: should anyone introduce something like an uppercase blank, the my_trim() function will still work!
    I thought blank was upper case already? It's the lower case blanks that you've got to look out for…
    Please show a little sensitivity. I had a son who had a nasty case of lower case blanks. Let me assure you, it was no laughing matter.
    And now think of the president's daughter, suffering from a bout of uppercase tabs, the poor girl!

    Right or wrong, people get offended over stupid $h1t.

  • Disappointed (unregistered)

    Articles like this make me embarassed that I tell people to read TDWTF, let alone to read it myself.

    Why do we have writers who either can't read code or can't apply critical thinking?
    You got a classic code snippet, I'm with ya. You needed a compelling reason for it to be found, so you took your writers liberties, reached into the bag of common motivators, and pulled out "sluggish response time". Why didn't you bother to think about whether you could attribute the response time to the code??

    I understand that there must be new content every day to keep the site alive, but it's really frustrating to see articles of this quality.

    Captcha - ludus: We continuously try to chase down great articles, no matter how often they 'ludus.

  • (cs)

    Right or wrong, that's just how string trimming was done back then.

  • Charles F. (unregistered)

    The only explanation I can come up with is based on a suspicion I've had for a while: some coders get paid by the line and nobody has let me in on this lucrative arrangement.

    Yesterday, I found this in some code: (variable names changed to protect the innocent):

    HashSet<String> moarNames = new HashSet<String>();
    nameSet.addAll(moarNames);

    This was then dutifully cut-n-pasted all over the code including just yesterday but a colleague. I asked him why he didn't delete those two lines and he explained that "I don't want to change the style of the code because that makes it harder to maintain." This is the stupidest coding practice I know (i.e. "Let's persist bad coding practices so that we don't muddle the style."). It's also further evidence of my theory about pay-per-line.

  • (cs) in reply to faoileag
    faoileag:
    And now think of the president's daughter, suffering from a bout of uppercase tabs, the poor girl!
    I once had to keep tabs on the supper cases of the president's daughter. Let me assure you, i was no laughing matter!
  • faoileag (unregistered) in reply to Charles F.
    Charles F.:
    The only explanation I can come up with is based on a suspicion I've had for a while: some coders get paid by the line and nobody has let me in on this lucrative arrangement.
    Actually, I think pscs further up has the correct explanation for all those incomprehensible lines of code:
    pscs:
    I'm guessing he viewed the source in the web browser, so AFTER it has been processed by the server. So, the source on the server probably says something like:
    var LDAPEnableMode = "<?php getEnableMode()?>";
    That seems entirely plausible, if you use a template engine (doesn't need to be php) you really do get html pages that doesn't make sense after the parsing.
  • (cs) in reply to ZoomST

    Yeah... frists seem to be getting moderated these days.

    Thank fuck.

  • Deanis (unregistered) in reply to faoileag

    Add to that the fact that the trims in the JS never ran, and this definitely wasn't the cause of the slow-down. It was more likely the server-side code that generated this JS.

    	var LDAPEnableMode = "0";
    
    	if (LDAPEnableMode==2)
    	{
    
  • (cs)

    Can all you dicks who're getting offended by stuff, stop getting offended by stuff? Thanks!

  • (cs) in reply to eViLegion
    eViLegion:
    Yeah... frists seem to be getting moderated these days.

    Thank fuck.

    Probably only the sceond frists... the frist frists seem to stick around.

  • Kevin (unregistered)

    This is just loop unrolling!

  • faoileag (unregistered) in reply to eViLegion
    eViLegion:
    Can all you dicks who're getting offended by stuff, stop getting offended by stuff? Thanks!
    Can you please stop getting offended by dicks who get offended by stuff? Thanks!
  • Anonymous Bob (unregistered) in reply to eViLegion
    eViLegion:
    Can all you dicks who're getting offended by stuff, stop getting offended by stuff? Thanks!

    I find your tone offensive.

  • (cs) in reply to faoileag
    faoileag:
    eViLegion:
    Can all you dicks who're getting offended by stuff, stop getting offended by stuff? Thanks!
    Can you please stop getting offended by dicks who get offended by stuff? Thanks!

    What gave you the impression I was offended? It was a polite request!

  • Peter (unregistered) in reply to eViLegion
    eViLegion:
    Can all you dicks who're getting offended by stuff, stop getting offended by stuff? Thanks!
    Yeah, people should try not to be offended by stuff that other people post.
    eViLegion:
    frists seem to be getting moderated these days. Thank fuck.
    Oh.
  • faoileag (unregistered) in reply to eViLegion
    eViLegion:
    faoileag:
    eViLegion:
    Can all you dicks who're getting offended by stuff, stop getting offended by stuff? Thanks!
    Can you please stop getting offended by dicks who get offended by stuff? Thanks!
    What gave you the impression I was offended? It was a polite request!
    If you already use the word "dick" if you make a polite request, I probably don't want to hear what you say when you get impolite ;-)
  • Doctor_of_ (unregistered) in reply to Anonymous Bob
    Anonymous Bob:
    eViLegion:
    Can all you dicks who're getting offended by stuff, stop getting offended by stuff? Thanks!

    I find your tone offensive.

    May the highly paid consultants of the badlands spray VB, Access & Excel all over your code base.

  • One time pad (unregistered) in reply to Anonymous Bob
    Anonymous Bob:
    eViLegion:
    Can all you dicks who're getting offended by stuff, stop getting offended by stuff? Thanks!

    I find your tone offensive.

    That's it, I've had it with this offensiveness! I'm leaving TDWTF and never coming back!
  • Peter (unregistered) in reply to One time pad
    One time pad:
    That's it, I've had it with this offensiveness! I'm leaving TDWTF and never coming back!
    Offensensitivity!
  • (cs)

    Let's see; invariant block optimization time! But yeah, this does not appear to slowing down the client. The server generating this mell of a hess appears to have some inefficiencies, but I doubt that this is the source of slow response.

  • QJo (unregistered) in reply to Charles F.
    Charles F.:
    The only explanation I can come up with is based on a suspicion I've had for a while: some coders get paid by the line and nobody has let me in on this lucrative arrangement.

    Yesterday, I found this in some code: (variable names changed to protect the innocent):

    HashSet<String> moarNames = new HashSet<String>();
    nameSet.addAll(moarNames);

    This was then dutifully cut-n-pasted all over the code including just yesterday but a colleague. I asked him why he didn't delete those two lines and he explained that "I don't want to change the style of the code because that makes it harder to maintain." This is the stupidest coding practice I know (i.e. "Let's persist bad coding practices so that we don't muddle the style."). It's also further evidence of my theory about pay-per-line.

    Exactly. The entity on the LHS of such a declaration needs to be an interface to adhere to best coding practices. Forcing it to be a HashSet makes it less flexible.

  • QJo (unregistered) in reply to no laughing matter
    no laughing matter:
    faoileag:
    And now think of the president's daughter, suffering from a bout of uppercase tabs, the poor girl!
    I once had to keep tabs on the supper cases of the president's daughter. Let me assure you, i was no laughing matter!

    What about the man who travelled on the subway with a case of diarrhoea? He accidentally left it on the platform.

  • (cs)

    All I can think is that this must be the slowdown loop. It sure serves no other purpose.

  • (cs) in reply to faoileag
    faoileag:
    If you already use the word "dick" if you make a polite request, I probably don't want to hear what you say when you get impolite ;-)

    Where is the point in politely requesting people to not get offended, if you DON'T simultaneously call them dicks? That would just be crazy!

  • (cs)

    Wow. What a piece of DRAC.

  • (cs) in reply to RichP
    RichP:
    Wow. What a piece of DRAC.

    DRAC? http://www.drac.org.uk/

  • Bubba (unregistered) in reply to QJo
    QJo:
    no laughing matter:
    faoileag:
    And now think of the president's daughter, suffering from a bout of uppercase tabs, the poor girl!
    I once had to keep tabs on the supper cases of the president's daughter. Let me assure you, i was no laughing matter!

    What about the man who travelled on the subway with a case of diarrhoea? He accidentally left it on the platform.

    Maybe he's an extreme horder waiting to corner the marketplace during a diarrhoea drought. Seems legit.

  • F (unregistered) in reply to Anonymous Bob
    Anonymous Bob:
    eViLegion:
    Can all you dicks who're getting offended by stuff, stop getting offended by stuff? Thanks!

    I find your tone offensive.

    I don't like your alf, but I don't make a song and dance about it.

  • (cs) in reply to Anonymous Bob
    Anonymous Bob:
    eViLegion:
    Can all you dicks who're getting offended by stuff, stop getting offended by stuff? Thanks!

    I find your tone offensive.

    Something has to be done about this rampant toneism.
  • (cs) in reply to da Doctah

    I figured he meant my skin tone; which happens to be puce, so fair enough.

    Addendum (2013-07-25 14:55): (Hmm... puce is a different colour than I thought it was... and now I appear to be bit racist.)

  • Peter Wolff (unregistered)

    Someone should tell the poor programmer about the elegance of loops.

    The colde would be much more readable as

    for (var i=0; i<40; i++) 
    {
      if (i==0)
      {
        if (tStr.length > 0) { dNames[x++] = tStr; }
        tStr = my_trim( '' );
      };
      if (i==1)
      {
        if (tStr.length > 0) { dNames[x++] = tStr; }
        tStr = my_trim( '' );
      };
    [ ... etc ... ]
      if (i==39)
      {
        if (tStr.length > 0) { dNames[x++] = tStr; }
        tStr = my_trim( '' );
      };
    };
    

    (cf. http://forums.thedailywtf.com/forums/p/26004/288214.aspx)

  • JW (unregistered)

    Here is a brief discussion on the geek community and racism, sexism, and other -isms, full of gross generalities and blanket statements:

    The geek community tends to be very male, very white, mostly straight, and very convincved that they're not racist, sexist, homophobic, ageist, ableist, or otherwise discriminatory. And they mostly mean well. Nevertheless, they are often unintentionally racist, sexist, homophobic, et cetera. And when you call them on that, they get pissed, 'cause they think "meaning well" is enough. And it's really not. So they get defensive, and say it was just a joke, and people shouldn't be so sensitive, which is terribly easy to say when you're not the one being made fun of. So, when I see such things here, I'm gonna call people on it.

    (Lengthy discussion of "privilege" skipped for space reasons.)

  • Pock Suppet (unregistered) in reply to JW
    JW:
    Here is a brief discussion on the geek community and racism, sexism, and other -isms, full of gross generalities and blanket statements:

    The geek community tends to be very male, very white, mostly straight, and very convincved that they're not racist, sexist, homophobic, ageist, ableist, or otherwise discriminatory. And they mostly mean well. Nevertheless, they are often unintentionally racist, sexist, homophobic, et cetera. And when you call them on that, they get pissed, 'cause they think "meaning well" is enough. And it's really not. So they get defensive, and say it was just a joke, and people shouldn't be so sensitive, which is terribly easy to say when you're not the one being made fun of. So, when I see such things here, I'm gonna call people on it.

    (Lengthy discussion of "privilege" skipped for space reasons.)

    Just curious: does the geek community also tend to be old or disabled at a lesser rate than society as a whole?

    Isn't it possible that there are absurdities about any sub-sub-sub-sub-sub-sub-sub-culture you care to find, and that geek-ish personalities are more likely to find them humorous and less likely to care about social reaction to their amusement? While we're at it, let's ban physical humor - after all, it's not funny when you're the one falling down the stairs or getting an anvil dropped on your foot.

    And isn't it possible that a particular large cultures tend to align with geek culture to differing extents, resulting in a naturally varying likelihood to have geeks?

    No, you're right - everyone's just insensitive and privileged. After all, the fact that I can't see that I'm being insensitive proves that I'm both insensitive and privileged, which makes me unable to see that I'm insensitive and privileged. Q.E.D.

Leave a comment on “Ubertrim”

Log In or post as a guest

Replying to comment #413539:

« Return to Article