• MatsH (unregistered)

    I enjoy the simplicity in that no comments exist except this one. But that doesn't count.

  • 6672697374 (unregistered)

    Please don't blame me. Code written below is not mine.It was written against me.

  • (cs)

    I don't see the big deal with the JVM error. Maybe Dominic doesn't know about Java development debugging. Lucky for him, he hasn't seen an Spring stack trace.

  • pixel (unregistered)

    Reminds me of a function I found somewhere deep down in our code base:

    procedure DoNothingWithDate (const aDate: TDateTime) begin ; // do nothing end;

    And it was called like this:

    DoNothingWithDate (validDate); // Make compiler happy

    It seems to still exist, but isn't used anymore.

    Captcha: decet. Detect a decent defect?

  • Felix (unregistered) in reply to ubersoldat

    I think the "deal" witht the JVM Error is that the error is "ShouldNotReachHere", which apparently it did :-)

  • SuperCabbage (unregistered) in reply to 6672697374

    5368686868212050656f706c6520617265206c697374656e696e672e

  • Esse (unregistered)

    I don't need a Society Decoder ring. It's hexadecimal ASCII. Just split it up in groups of two chars and look it up on an ASCII table.


    • Please don't blame me. Cod
    • e written below is not min
    • e.It was written against m
    • e.
  • (cs)

    The 80's called, they want FRISTers back.

  • faoileag (unregistered)

    Stephen's submit:

    /// Behold! The mighty God Object of ! Errr, I mean, this is the class for the main window.
    public partial class Form1 : Form
    

    This is certainly one of the finer wtfs, this takes dedication!

    A lot of people don't change the auto-generated names provided by Visual Studio when you click together your ui. This is a wtf but a common one.

    Adding a comment in the declaration part nobody usually looks at when using Visual Studio: another minor wtf.

    But with the knowledge that the name of the form is non-descriptive and in need of explanation just to edit the generated source file to add a comment but not to change the name of the form in the editor: priceless! :-)

  • (cs) in reply to pixel
    pixel:
    Reminds me of a function I found somewhere deep down in our code base:

    procedure DoNothingWithDate (const aDate: TDateTime) begin ; // do nothing end;

    And it was called like this:

    DoNothingWithDate (validDate); // Make compiler happy

    I suspect this is to stop an over-eager optimiser from throwing validDate away. I've had to do similar hacks in the past, but not for a long while....

  • (cs) in reply to Felix
    Felix:
    I think the "deal" witht the JVM Error is that the error is "ShouldNotReachHere", which apparently it did :-)

    If it was "CANNOT...." then I would agree. But putting an exception in code where all known/expected conditions should have cause a previous change in execution path seems quite reasonable to me...

  • Anon (unregistered)

    What's wrong with globals?!

    I'll have none of that fancy encapsulation malarkey around here thank you very much!

  • illum (unregistered) in reply to Felix
    Felix:
    I think the "deal" witht the JVM Error is that the error is "ShouldNotReachHere", which apparently it did :-)
    Maybe that's why it's called an "error".
  • faoileag (unregistered) in reply to Anon
    Anon:
    What's wrong with globals?!

    I'll have none of that fancy encapsulation malarkey around here thank you very much!

    But you can have OO and globals! No problem at all, the technique is called the "Singleton Pattern". It's in the book, so it must be ok to use ist! :-)

  • John (unregistered)

    I did once work on a project whose leaders thought that there was something wrong with an if that lacked its else, and the official coding standard required an else for every if. In this case, the main compiler that the company used didn't accept empty code blocks, not even a standalone ";", so every else had to have a non-empty instruction. For some (a)esthetic reason, things like "i = i;" tended to offend the group's leaders and led to lots of wasted time explaining why the code included something so obviously stupid.

    We did verify that the compiler's optimizer deleted such instructions, but that wasn't good enough, so most of us adopted the minor game of inventing cute code chunks that weren't obviously just fancy no-ops. All this did sometimes cause wasted time during debugging and/or adding newly-required tweaks, and sometimes the compiler wasn't clever enough to optimize them out. But mostly it just gave us one more source of geek humor as we found new ways of subtly insulting the intelligence of the people who impose such coding "standards".

  • (cs) in reply to Esse
    Esse:
    I don't need a Society Decoder ring. It's hexadecimal ASCII. Just split it up in groups of two chars and look it up on an ASCII table.
    Rookie. Anyone worth their salt remembers the ASCII table. Letters start at 0x41, lowercase is 0x20 higher than uppercase, digits start at 0x30.

    And you call yourself an IT professional!

  • The Fury (unregistered) in reply to Roby McAndrew
    Roby McAndrew:
    pixel:
    Reminds me of a function I found somewhere deep down in our code base:

    procedure DoNothingWithDate (const aDate: TDateTime) begin ; // do nothing end;

    And it was called like this:

    DoNothingWithDate (validDate); // Make compiler happy

    I suspect this is to stop an over-eager optimiser from throwing validDate away. I've had to do similar hacks in the past, but not for a long while....

    I can't quite see a use for this. Also any decent compiler would just throw the lot away in any case.

  • Smug Unix User (unregistered) in reply to John
    if foo:
      DoSomething()
    else:
      CodingStandardsLib.NoOp()
    #snip....
    def CodingStandardsLib:
       """ This isn't a waste. Now you can add code to every else case. Think about a sleep or a wait here so you can instantly 'improve' application performance by decreasing the sleep amount. """
       return False
    
  • Esse (unregistered) in reply to nonpartisan

    I am indeed an IT professional. That is why I wrote a PHP script that does the work for me.

    
    <?php
    
    $decode_strings = array('506C6561736520646F6E277420626C616D65206D652E20436F64', '65207772697474656E2062656C6F77206973206E6F74206D696E', '652E497420776173207772697474656E20616761696E7374206D', '652E');
    
    foreach($decode_strings as $decode_string) {
    	$decode_string = str_split($decode_string, 2);
    	if (array_walk($decode_string, function(&$item) { $item = '%' . $item; })) {
    		$decode_string = join($decode_string);
    		// 09-05-2013 terry: Removed because of slow performance
    		//$decode_string = '%' . implode('%', $decode_string);
    		$decode_string = urldecode($decode_string);
    		echo $decode_string;
    	}
    	else {
    		throw new Exception('This should not happen');
    	}
    }
    
    ?>
    
    
  • faoileag (unregistered) in reply to Esse
    Esse:
    I am indeed an IT professional. That is why I wrote a PHP script
    There are people who think that the highlighted terms are mutually exclusive, you know.
  • (cs) in reply to The Fury
    DoNothingWithDate (validDate); // Make compiler happy

    Functions like that are used in functions which are called by a framework, and hence the framework defines the called methods signature. So, we may have something like:

        void MyCallBack(int someNumber, aDate validDate)
        {
            SomeImportantFunction(someNumber);
        }
    

    Now, most compilers will give a warning, saying validDate is unused and can be removed. However, it can't be removed, as the framework is going to pass it when it call MyCallBack. So, they add the DoNothing function, just to keep the compiler thinking both parameters were used.

  • (cs) in reply to faoileag
    faoileag:
    Esse:
    I am indeed an IT professional. That is why I wrote a PHP script
    There are people who think that the highlighted terms are mutually exclusive, you know.

    Those people are usually known as elitist wankers, and they say the same thing about VB and any other language they once saw used badly.

    It's not the language's fault that idiots with hammers will try to treat everything as a nail.

  • eVil (unregistered) in reply to tin
    tin:
    It's not the language's fault that idiots with hammers will try to treat everything as a nail.

    No, but it is the languages fault that it's syntax is badly thought out, unreadable shite.

    The symptom of lots of bad PHP code results from the morons unable to see just how badly designed it is, and thereby not steering clear.

  • eVil (unregistered)

    In B4 grammar people succeed in not being funny, yet again.

  • mrfr0g (unregistered)

    public void ShouldNotReachHere() { // Uh oh }

  • dr memals (unregistered)

    the encoded message is "Please don't blame me. Code written below is not mine.It was written against me."

    50,6C,65,61,73,65,20,64,6F,6E,27,74,20,62,6C,61,6D,65,20,6D,65,2E,20,43,6F,64,65,20,77,72,69,74,74,65,6E,20,62,65,6C,6F,77,20,69,73,20,6E,6F,74,20,6D,69,6E,65,2E,49,74,20,77,61,73,20,77,72,69,74,74,65,6E,20,61,67,61,69,6E,73,74,20,6D,65,2E

    http://textmechanic.com/ASCII-Hex-Unicode-Base64-Converter.html

  • (cs)

    That "80s code" has been working bugfree for 25 years (most likely). These young programmers are always changing things, sometimes for no good reason, and are always introducing bugs.

  • synp (unregistered)

    I haven't been in the comments section for a couple of weeks ago, and everything has gone to hell.

  • GoF (unregistered) in reply to faoileag
    faoileag:
    Anon:
    What's wrong with globals?!

    I'll have none of that fancy encapsulation malarkey around here thank you very much!

    But you can have OO and globals! No problem at all, the technique is called the "Singleton Pattern". It's in the book, so it must be ok to use ist! :-)

    Hey, now, that's different. A singleton is allocated on the heap rather than in the static data segment the way a global is, so you're much more likely to overwrite a singleton's data with bullshit when you screw up clever pointer tricks than you are an ordinary global.

    That makes it much more bettar, right?

    Also, a singleton requires much more boilerplate code than a global, increasing your SLOC metrics that the process team is looking at!

  • anonymous (unregistered) in reply to Esse
    Esse:
    I am indeed an IT professional. That is why I wrote a PHP script that does the work for me.
    That seems like a lot of work. I just launched a command prompt window and ran this in debug:

    MOV AX, CS MOV DS, AX XOR DL, DL MOV AH, 08 XOR BH, BH INT 10 MOV BL, AL MOV AH, 08 INT 21 CMP AL, 1B JZ 0174 CMP AL, 1A JZ 0174 MOV AH, 0A MOV CX, 0001 INT 10 CMP AL, 41 JB 0133 CMP AL, 7A JA 0133 CMP AL, 5A JBE 0131 CMP AL, 61 JB 0133 AND AL, DF MOV DI, 01A6 MOV CX, 0010 REPNZ SCASB JZ 0146 MOV AL, 20 MOV CX, 0001 INT 10 JMP 010E SUB DI, 01A7 MOV AX, DI XOR DL, 01 JZ 0159 MOV CL, 04 SHL AL, CL MOV DH, AL JMP 010E MOV AH, 0A XCHG AL, BL MOV CX, 0001 INT 10 OR BL, DH MOV AH, 02 MOV DL, BL INT 21 XOR DL, DL MOV AH, 08 INT 10 MOV BL, AL JMP 010E XOR DL, 01 JNZ 0182 MOV AH, 0A MOV AL, BL MOV CX, 0001 INT 10 MOV AH, 03 INT 10 MOV AH, 08 INT 10 MOV AH, 02 MOV BL, AL MOV CX, DX MOV DL, 1A INT 21 MOV DX, CX INT 10 MOV AH, 0A MOV AL, BL MOV CX, 0001 INT 10 MOV AX, 4C01 INT 21 DB "0123456789ABCDEF"

  • Mike C (unregistered)

    (Fires up LINQPad)

    string code = "506C6561736520646F6E277420626C616D65206D652E20436F6465207772697474656E2062656C6F77206973206E6F74206D696E652E497420776173207772697474656E20616761696E7374206D652E";
    string decoded = System.Text.Encoding.ASCII.GetString(Enumerable.Range(0, code.Length / 2).Select(i => Convert.ToByte(code.Substring(i * 2, 2), 16)).ToArray());
    decoded.Dump();
  • voidptr (unregistered)
    $ perl -e 'print pack("H*", "506C6561736520646F6E277420626C616D65206D652E20436F6465207772697474656E2062656C6F77206973206E6F74206D696E652E497420776173207772697474656E20616761696E7374206D652E") . "\n";'
    Please don't blame me. Code written below is not mine.It was written against me.
    $
    
  • GlitchMr (unregistered)

    Oh, great. You guys make it too complex. Simple Perl one-liner can make decoding that very easy.

    ~ $ perl -nE'y/0-9A-F//cd; say pack "H*", $_'
     * 506C6561736520646F6E277420626C616D65206D652E20436F64
    Please don't blame me. Cod
     * 65207772697474656E2062656C6F77206973206E6F74206D696E
    e written below is not min
     * 652E497420776173207772697474656E20616761696E7374206D
    e.It was written against m
     * 652E
    e.
  • GlitchMr (unregistered)

    Oh, and great. I was by beaten by voidptr in terms of speed. WTF?

  • ThinkFast (unregistered) in reply to voidptr

    Why is everyone writing programs when tools already exist to do this? Just paste the comment as input to "xxd -r -p" to get the answer. Real IT professionals know their tools!

  • o11c (unregistered) in reply to Esse
    Esse:
    I am indeed an IT professional. That is why I wrote a PHP script that does the work for me.

    There is more unix nature in one line of shell script than there is in ten thousand lines of PHP.

    xxd -r -p
    
  • (cs)

    Here it is in the Lua interpreter console (very handy to keep open in a terminal for such quick calculations):

    s = [[/*

    • 506C6561736520646F6E277420626C616D65206D652E20436F64
    • 65207772697474656E2062656C6F77206973206E6F74206D696E
    • 652E497420776173207772697474656E20616761696E7374206D
    • 652E */]] o = '' s:gsub('(%x%x)', function(c) o = o .. string.char(tonumber(c, 16)) end) print(o) Please don't blame me. Code written below is not mine.It was written against me.
  • (cs) in reply to ThinkFast
    ThinkFast:
    Why is everyone writing programs when tools already exist to do this? Just paste the comment as input to "xxd -r -p" to get the answer. Real IT professionals know their tools!
    TRWTF is `xxd --help` does not explain what it actually does, nor mention the -p option:
    $ xxd --help Usage: xxd [options] [infile [outfile]] or xxd -r [-s [-]offset] [-c cols] [-ps] [infile [outfile]] Options: -a toggle autoskip: A single '*' replaces nul-lines. Default off. -b binary digit dump (incompatible with -ps,-i,-r). Default hex. -c cols format <cols> octets per line. Default 16 (-i: 12, -ps: 30). -E show characters in EBCDIC. Default ASCII. -g number of octets per group in normal output. Default 2. -h print this summary. -i output in C include file style. -l len stop after <len> octets. -ps output in postscript plain hexdump style. -r reverse operation: convert (or patch) hexdump into binary. -r -s off revert with <off> added to file positions found in hexdump. -s [+][-]seek start at <seek> bytes abs. (or +: rel.) infile offset. -u use upper case hex letters. -v show version: "xxd V1.10 27oct98 by Juergen Weigert".

    Poor documentation is a crime.

  • (cs) in reply to synp
    synp:
    I haven't been in the comments section for a couple of weeks ago, and everything has gone to hell.
    This comment section has seen worse in the past, down to 4chan levels.

    ... and even worse: Zunesis!

  • foo (unregistered) in reply to faoileag
    faoileag:
    Esse:
    I am indeed an IT professional.
    There are people who think that the highlighted terms are mutually exclusive, you know.
    FTFY
  • (cs) in reply to lolwtf
    lolwtf:
    TRWTF is `xxd --help` does not explain what it actually does, nor mention the -p option:
    Don't be so whiny. Do what every other Unix user does: Get used to (be a) man!
    man xxd
    
  • foo (unregistered) in reply to JamesCurran
    JamesCurran:
    DoNothingWithDate (validDate); // Make compiler happy

    Functions like that are used in functions which are called by a framework, and hence the framework defines the called methods signature. So, we may have something like:

        void MyCallBack(int someNumber, aDate validDate)
        {
            SomeImportantFunction(someNumber);
        }
    

    Now, most compilers will give a warning, saying validDate is unused and can be removed. However, it can't be removed, as the framework is going to pass it when it call MyCallBack. So, they add the DoNothing function, just to keep the compiler thinking both parameters were used.

    But the DoNothing function doesn't actually use the parameter, so the compiler will give a warning, saying it is unused and can be removed. So, they add the DoNothing2 function, just to keep the compiler thinking the parameter was used.

  • (cs) in reply to lolwtf
    lolwtf:
    TRWTF is `xxd --help` does not explain what it actually does, nor mention the -p option:

    If only there was some sort of manual which could be the correct place to put documentation. Perhaps it could look something like this:

    $ man xxd

    NAME xxd - make a hexdump or do the reverse

    SYNOPSIS xxd -h[elp] xxd [options] [infile [outfile]] xxd -r[evert] [options] [infile [outfile]]

    DESCRIPTION xxd creates a hex dump of a given file or standard input. It can also convert a hex dump back to its original binary form. Like uuencode(1) and uudecode(1) it allows the transmission of binary data in a `mail-safe' ASCII representation, but has the advantage of decoding to standard output. Moreover, it can be used to perform binary file patching.

    Nah, it would never work. People would complain that the command name was sexist.

  • Jeremy (unregistered)

    BASH anyone?

    #!/bin/bash
    
    INPUT="506C6561736520646F6E277420626C616D65206D652E20436F6465207772697474656E2062656C6F77206973206E6F74206D696E652E497420776173207772697474656E20616761696E7374206D652E"
    
    let "LEN = ${#INPUT} - 2"
    for i in $(seq 0 2 $LEN)
    do
        echo -n -e "\x"${INPUT:$i:2}
    done
    echo
    

    (why is this automatically double-spaced?)

  • moz (unregistered) in reply to eVil
    eVil:
    In B4 grammar people succeed in not being funny, yet again.
    Damn, and there I was hoping to find out what "Craig was looking through an older project that he hadn't been in for a couple of years ago..." is supposed to mean.

    Now I'll just have to assume it means that the add-in mentioned isn't ready for production use.

  • (cs) in reply to DCRoss
    DCRoss:
    Nah, it would never work. People would complain that the command name was sexist.
    A german linux manual replaced all occurences of root (even in examples of ls output) with ruth, because, well, root was considered sexist.

    Leftist Linuxhandbuch (PDF)

    The word root does not even exist in german language.

  • eVil (unregistered) in reply to moz

    Fair enough moz... that sentence is really odd.

  • netmunky (unregistered)

    most people don't seem to realize PHP has a pack function...

    php -r 'print pack("H*", "506C6561736520646F6E277420626C616D65206D652E20436F6465207772697474656E2062656C6F77206973206E6F74206D696E652E497420776173207772697474656E20616761696E7374206D652E");'

  • (cs) in reply to JamesCurran
    JamesCurran:
    DoNothingWithDate (validDate); // Make compiler happy

    Functions like that are used in functions which are called by a framework, and hence the framework defines the called methods signature. So, we may have something like:

        void MyCallBack(int someNumber, aDate validDate)
        {
            SomeImportantFunction(someNumber);
        }
    

    Now, most compilers will give a warning, saying validDate is unused and can be removed. However, it can't be removed, as the framework is going to pass it when it call MyCallBack. So, they add the DoNothing function, just to keep the compiler thinking both parameters were used.

    I suppose it depends on the language used. C has a simple mechanism for this:

        void MyCallBack(int someNumber, aDate validDate)
        {
            (void)validDate;
            SomeImportantFunction(someNumber);
        }
    

    You shouldn't need to create a dummy function. (I've actually had to do this in some of our code. Yay MISRA compiler rules.)

  • Jay (unregistered) in reply to faoileag
    faoileag:
    But you can have OO and globals! No problem at all, the technique is called the "Singleton Pattern". It's in the book, so it must be ok to use ist! :-)

    Oh, here we go again.

    There seems to be a regular cycle in the IT business. We regularly go through conversations like this:

    Astute person: Hey, X is being used in ways that cause trouble. We should think carefully before using X, and make sure that we only use it in those cases where it is appropriate and helpful.

    Simplistic person: You should never use X.

    Authoritarian person; As the experts agree that X is bad, we have established a standard that we will not allow the use of X in programs written by this company.

    Frustrated person: I can think of many cases where X is good. This is a stupid rule. There are some things that are very difficult to do WITHOUT using X.

    Other simplistic person: Yeah, Frustrated has shown that X isn't bad at all. We should use it for everything.

Leave a comment on “Comments, Errors, and Log Messages...OH MY!”

Log In or post as a guest

Replying to comment #:

« Return to Article