Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Worst Peice of Code in the World

Worst Peice of Code in the World

Scheduled Pinned Locked Moved The Lounge
27 Posts 23 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Joe Q

    Come on! Haven’t you ever pounded out code while drinking heavily? :laugh: Well, may some hallucinogenic drugs were involved, too.

    F Offline
    F Offline
    Frank Kerrigan
    wrote on last edited by
    #6

    Not while someone else was paying for my code. -- modified at 9:18 Monday 21st August, 2006


    Look where you want to go not where you don't want to crash. Bikers Bible

    N 1 Reply Last reply
    0
    • F Frank Kerrigan

      I found this small nugget of code buried in a sea obsurity. I was speachless and could not figure out why someone would ever write such a piece nonsense. Whats worse :omg: is this is currently running live. ########################### string text1 = string.Concat(new object[] { "INSERT INTO Policy \r\n\t\t\t\t(\r\n\t\t\t\t\tProductID, \r\n\t\t\t\t\tschemeGroupID, \r\n\t\t\t\t\tCreatedBy\r\n\t\t\t\t) \r\n\t\t\t\tVALUES \r\n\t\t\t\t(\r\n\t\t\t\t\t", num1, ", \r\n\t\t\t\t\t", this.QuoteSelected.SchemeGroupID, ", \r\n\t\t\t\t\t'", this.CreatedBy, "'\r\n\t\t\t\t);\r\n\t\t\t\tSELECT @@IDENTITY;" }); text1 = text1.Replace("\n", ""); text1 = text1.Replace("\t", ""); text1 = text1.Replace("\r", ""); SqlConnection connection1 = new SqlConnection(Config.ConnectionString); SqlCommand command1 = new SqlCommand(text1, connection1); ###########################


      Look where you want to go not where you don't want to crash. Bikers Bible

      P Offline
      P Offline
      peterchen
      wrote on last edited by
      #7

      typical pre-release fix. Not that I'd ever do such a thing!


      We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
      Linkify! || Fold With Us! || sighist

      1 Reply Last reply
      0
      • F Frank Kerrigan

        I found this small nugget of code buried in a sea obsurity. I was speachless and could not figure out why someone would ever write such a piece nonsense. Whats worse :omg: is this is currently running live. ########################### string text1 = string.Concat(new object[] { "INSERT INTO Policy \r\n\t\t\t\t(\r\n\t\t\t\t\tProductID, \r\n\t\t\t\t\tschemeGroupID, \r\n\t\t\t\t\tCreatedBy\r\n\t\t\t\t) \r\n\t\t\t\tVALUES \r\n\t\t\t\t(\r\n\t\t\t\t\t", num1, ", \r\n\t\t\t\t\t", this.QuoteSelected.SchemeGroupID, ", \r\n\t\t\t\t\t'", this.CreatedBy, "'\r\n\t\t\t\t);\r\n\t\t\t\tSELECT @@IDENTITY;" }); text1 = text1.Replace("\n", ""); text1 = text1.Replace("\t", ""); text1 = text1.Replace("\r", ""); SqlConnection connection1 = new SqlConnection(Config.ConnectionString); SqlCommand command1 = new SqlCommand(text1, connection1); ###########################


        Look where you want to go not where you don't want to crash. Bikers Bible

        R Offline
        R Offline
        Rage
        wrote on last edited by
        #8

        I bet there was some more code between

        string text1 = string.Concat(new object[] { "INSERT INTO (...) ENTITY;" });

        and

        text1 = text1.Replace("\n", "");

        This looks like formatted for some debugging output. Anyway, it is ugly. Do you have source control so you can force the culprit to write 200 pages of documentation ? (could not think of any better punishment on the moment)...

        ~RaGE();

        I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus

        F 1 Reply Last reply
        0
        • R Rage

          I bet there was some more code between

          string text1 = string.Concat(new object[] { "INSERT INTO (...) ENTITY;" });

          and

          text1 = text1.Replace("\n", "");

          This looks like formatted for some debugging output. Anyway, it is ugly. Do you have source control so you can force the culprit to write 200 pages of documentation ? (could not think of any better punishment on the moment)...

          ~RaGE();

          I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus

          F Offline
          F Offline
          Frank Kerrigan
          wrote on last edited by
          #9

          I believe the culprit has been deleted.


          Look where you want to go not where you don't want to crash. Bikers Bible

          1 Reply Last reply
          0
          • F Frank Kerrigan

            I found this small nugget of code buried in a sea obsurity. I was speachless and could not figure out why someone would ever write such a piece nonsense. Whats worse :omg: is this is currently running live. ########################### string text1 = string.Concat(new object[] { "INSERT INTO Policy \r\n\t\t\t\t(\r\n\t\t\t\t\tProductID, \r\n\t\t\t\t\tschemeGroupID, \r\n\t\t\t\t\tCreatedBy\r\n\t\t\t\t) \r\n\t\t\t\tVALUES \r\n\t\t\t\t(\r\n\t\t\t\t\t", num1, ", \r\n\t\t\t\t\t", this.QuoteSelected.SchemeGroupID, ", \r\n\t\t\t\t\t'", this.CreatedBy, "'\r\n\t\t\t\t);\r\n\t\t\t\tSELECT @@IDENTITY;" }); text1 = text1.Replace("\n", ""); text1 = text1.Replace("\t", ""); text1 = text1.Replace("\r", ""); SqlConnection connection1 = new SqlConnection(Config.ConnectionString); SqlCommand command1 = new SqlCommand(text1, connection1); ###########################


            Look where you want to go not where you don't want to crash. Bikers Bible

            E Offline
            E Offline
            Ennis Ray Lynch Jr
            wrote on last edited by
            #10

            Not even close. If I had some snippets from when I was a TA in Java your eyes would leap from your skulls and run to the nearest pit of lava.

            On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. - Charles Babbage

            P 1 Reply Last reply
            0
            • C Colin Angus Mackay

              Just to get this round my head, the WTFs are: * there is are a bunch of string literals that contains lots of newline, line feed and tab characters in escaped form that would have been eventually sent to a SQL parser which will just ignore them. * The tab, line feed and carriage return values are stripped out of the fully concatenated string. (Which begs the question: Why put them in there in the first place?) * The SQL String has values injected into it. * The items are placed inside an object array before being concatenated, this is redundant as the params modifier is used in the method signature so creating an object array is a waste of time. * The variables do not have reasonable names. text1, connection1, command1 are not suitable names. * The SQL uses SELECT @@IDENTITY which is not thread safe and may return the identity value of a completely different table if two or more INSERTs are being processed by SQL Server at the same time. SCOPE_IDENTITY() would be a better alternative. Have I missed anything? All I can say is that I'm glad I'm not maintaining that code. And, if I ever come into the office one morning and look at the code I wrote the night before and think to myself "What was I doing?" I can just remember the code here and be glad that even while coding drunk I have never produced anything that bad. -- modified at 10:07 Monday 21st August, 2006 -- modified at 10:10 Monday 21st August, 2006


              Upcoming Scottish Developers events: * UK Security Evangelists On Tour (2nd November, Edinburgh) * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

              B Offline
              B Offline
              benjymous
              wrote on last edited by
              #11

              Colin Angus Mackay wrote:

              * there is are a bunch of string literals that contains lots of newline, line feed and tab characters in escaped form that will eventaully be sent to a SQL parser which will just ignore them.

              It replaces those with empty strings. I can only presume this was generated with some sort of SQL generator, and the original developer wasn't capable of manually removing all the escape chars himself :~

              -- Help me! I'm turning into a grapefruit! Buzzwords!

              C A 2 Replies Last reply
              0
              • B benjymous

                Colin Angus Mackay wrote:

                * there is are a bunch of string literals that contains lots of newline, line feed and tab characters in escaped form that will eventaully be sent to a SQL parser which will just ignore them.

                It replaces those with empty strings. I can only presume this was generated with some sort of SQL generator, and the original developer wasn't capable of manually removing all the escape chars himself :~

                -- Help me! I'm turning into a grapefruit! Buzzwords!

                C Offline
                C Offline
                Colin Angus Mackay
                wrote on last edited by
                #12

                benjymous wrote:

                Colin Angus Mackay wrote: * there is are a bunch of string literals that contains lots of newline, line feed and tab characters in escaped form that will eventaully be sent to a SQL parser which will just ignore them. It replaces those with empty strings.

                Ah... I've replaced it with the subjunctive. It makes more sense now.


                Upcoming Scottish Developers events: * UK Security Evangelists On Tour (2nd November, Edinburgh) * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

                1 Reply Last reply
                0
                • F Frank Kerrigan

                  I found this small nugget of code buried in a sea obsurity. I was speachless and could not figure out why someone would ever write such a piece nonsense. Whats worse :omg: is this is currently running live. ########################### string text1 = string.Concat(new object[] { "INSERT INTO Policy \r\n\t\t\t\t(\r\n\t\t\t\t\tProductID, \r\n\t\t\t\t\tschemeGroupID, \r\n\t\t\t\t\tCreatedBy\r\n\t\t\t\t) \r\n\t\t\t\tVALUES \r\n\t\t\t\t(\r\n\t\t\t\t\t", num1, ", \r\n\t\t\t\t\t", this.QuoteSelected.SchemeGroupID, ", \r\n\t\t\t\t\t'", this.CreatedBy, "'\r\n\t\t\t\t);\r\n\t\t\t\tSELECT @@IDENTITY;" }); text1 = text1.Replace("\n", ""); text1 = text1.Replace("\t", ""); text1 = text1.Replace("\r", ""); SqlConnection connection1 = new SqlConnection(Config.ConnectionString); SqlCommand command1 = new SqlCommand(text1, connection1); ###########################


                  Look where you want to go not where you don't want to crash. Bikers Bible

                  K Offline
                  K Offline
                  Kyudos
                  wrote on last edited by
                  #13

                  You know what to do with this.... The Daily WTF[^]

                  1 Reply Last reply
                  0
                  • F Frank Kerrigan

                    I found this small nugget of code buried in a sea obsurity. I was speachless and could not figure out why someone would ever write such a piece nonsense. Whats worse :omg: is this is currently running live. ########################### string text1 = string.Concat(new object[] { "INSERT INTO Policy \r\n\t\t\t\t(\r\n\t\t\t\t\tProductID, \r\n\t\t\t\t\tschemeGroupID, \r\n\t\t\t\t\tCreatedBy\r\n\t\t\t\t) \r\n\t\t\t\tVALUES \r\n\t\t\t\t(\r\n\t\t\t\t\t", num1, ", \r\n\t\t\t\t\t", this.QuoteSelected.SchemeGroupID, ", \r\n\t\t\t\t\t'", this.CreatedBy, "'\r\n\t\t\t\t);\r\n\t\t\t\tSELECT @@IDENTITY;" }); text1 = text1.Replace("\n", ""); text1 = text1.Replace("\t", ""); text1 = text1.Replace("\r", ""); SqlConnection connection1 = new SqlConnection(Config.ConnectionString); SqlCommand command1 = new SqlCommand(text1, connection1); ###########################


                    Look where you want to go not where you don't want to crash. Bikers Bible

                    P Offline
                    P Offline
                    Phil Martin
                    wrote on last edited by
                    #14

                    That looks icky all right. But I have seen worse. Much worse. Ever had to maintain C code that was converted from really really old fortran? Space padded fixed length strings to null terminated strings - fun! Generated code is so pretty. Not. :) - Phil

                    1 Reply Last reply
                    0
                    • F Frank Kerrigan

                      I found this small nugget of code buried in a sea obsurity. I was speachless and could not figure out why someone would ever write such a piece nonsense. Whats worse :omg: is this is currently running live. ########################### string text1 = string.Concat(new object[] { "INSERT INTO Policy \r\n\t\t\t\t(\r\n\t\t\t\t\tProductID, \r\n\t\t\t\t\tschemeGroupID, \r\n\t\t\t\t\tCreatedBy\r\n\t\t\t\t) \r\n\t\t\t\tVALUES \r\n\t\t\t\t(\r\n\t\t\t\t\t", num1, ", \r\n\t\t\t\t\t", this.QuoteSelected.SchemeGroupID, ", \r\n\t\t\t\t\t'", this.CreatedBy, "'\r\n\t\t\t\t);\r\n\t\t\t\tSELECT @@IDENTITY;" }); text1 = text1.Replace("\n", ""); text1 = text1.Replace("\t", ""); text1 = text1.Replace("\r", ""); SqlConnection connection1 = new SqlConnection(Config.ConnectionString); SqlCommand command1 = new SqlCommand(text1, connection1); ###########################


                      Look where you want to go not where you don't want to crash. Bikers Bible

                      M Offline
                      M Offline
                      Member 96
                      wrote on last edited by
                      #15

                      Hmmm at first glance it's madness, but at second glance perhaps they were debugging or something and looking at it in a debugger ....ahh forget it, no excuse. Probably copied out of a visual designer of some kind.

                      S 1 Reply Last reply
                      0
                      • M Member 96

                        Hmmm at first glance it's madness, but at second glance perhaps they were debugging or something and looking at it in a debugger ....ahh forget it, no excuse. Probably copied out of a visual designer of some kind.

                        S Offline
                        S Offline
                        sgorozco
                        wrote on last edited by
                        #16

                        Hi! Yes I agree with your assumptions, I bet the programmer copied the string from a sql editor and used an utility akin to the StringBuilder add-in to produce a formatted string from the clipboard contents... :~ Anyways, I really wouldn't like to be the one maintaining such code! ;P

                        An interesting form of object-oriented programming: You suggest a novel approach, and watch as the rest of your team objects!

                        1 Reply Last reply
                        0
                        • E Ennis Ray Lynch Jr

                          Not even close. If I had some snippets from when I was a TA in Java your eyes would leap from your skulls and run to the nearest pit of lava.

                          On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. - Charles Babbage

                          P Offline
                          P Offline
                          prst123
                          wrote on last edited by
                          #17

                          If Babbage was alive today, he would have died again, looking at that code :) lol.

                          1 Reply Last reply
                          0
                          • F Frank Kerrigan

                            I found this small nugget of code buried in a sea obsurity. I was speachless and could not figure out why someone would ever write such a piece nonsense. Whats worse :omg: is this is currently running live. ########################### string text1 = string.Concat(new object[] { "INSERT INTO Policy \r\n\t\t\t\t(\r\n\t\t\t\t\tProductID, \r\n\t\t\t\t\tschemeGroupID, \r\n\t\t\t\t\tCreatedBy\r\n\t\t\t\t) \r\n\t\t\t\tVALUES \r\n\t\t\t\t(\r\n\t\t\t\t\t", num1, ", \r\n\t\t\t\t\t", this.QuoteSelected.SchemeGroupID, ", \r\n\t\t\t\t\t'", this.CreatedBy, "'\r\n\t\t\t\t);\r\n\t\t\t\tSELECT @@IDENTITY;" }); text1 = text1.Replace("\n", ""); text1 = text1.Replace("\t", ""); text1 = text1.Replace("\r", ""); SqlConnection connection1 = new SqlConnection(Config.ConnectionString); SqlCommand command1 = new SqlCommand(text1, connection1); ###########################


                            Look where you want to go not where you don't want to crash. Bikers Bible

                            M Offline
                            M Offline
                            Marco Turrini
                            wrote on last edited by
                            #18

                            A few years ago I had the pleasure X| to read a legacy Cobol source code; after many, many pages of interesting code :zzz: :zzz: :zzz: I found this masterpiece: IF PIPPO = 8 OR PIPPO = 8 PERFOM R-A. Looks like it is more obscure and clearer than your SQL code, at the same time! Of course the programmer who wrote this was not in the firm anymore (I'm not sure he was even in this life anymore): after a short briefing we decided the programmer was an insecure guy and wanted to be REALLY sure the variable equalled 8 (of course this code had been in production for several years when I read it). It's been my first experience with fuzzy logic. A few pages later I found another masterpiece IF X = ZERO PERFORM R-CALC ELSE IF X = 1 PERFORM R-CALC ELSE IF X = 2 PERFORM R-CALC ELSE IF X = 3 PERFORM R-CALC ... ELSE IF X = 50 PERFORM R-CALC ENDIF. Variable X could assume only values from 1 (default) to 50, but code tested for value ZERO, and in any case, tested each value and for each value performed routine R-CALC. I thought the programmer was paid by lines of code, but I don't understand why she/he didn't write fifty identical routines R-CALC00, R-CALC01... R-CALC50 to call: I hope she/he had been fired before having the time to do this.

                            Marco Turrini

                            1 Reply Last reply
                            0
                            • B benjymous

                              Colin Angus Mackay wrote:

                              * there is are a bunch of string literals that contains lots of newline, line feed and tab characters in escaped form that will eventaully be sent to a SQL parser which will just ignore them.

                              It replaces those with empty strings. I can only presume this was generated with some sort of SQL generator, and the original developer wasn't capable of manually removing all the escape chars himself :~

                              -- Help me! I'm turning into a grapefruit! Buzzwords!

                              A Offline
                              A Offline
                              Atli Davidsson
                              wrote on last edited by
                              #19

                              Uhm... guys... It's calld to Obfuscate... taken from website: "converts the JavaScript source code into scrambled and completely unreadable form, preventing it from analysing and theft" www.javascipt-source.com Have no idea about the SQL injections.. Don't have any experience on obfuscating, but i'd expect the source before obfuscation used injection. Atli:)

                              1 Reply Last reply
                              0
                              • F Frank Kerrigan

                                I found this small nugget of code buried in a sea obsurity. I was speachless and could not figure out why someone would ever write such a piece nonsense. Whats worse :omg: is this is currently running live. ########################### string text1 = string.Concat(new object[] { "INSERT INTO Policy \r\n\t\t\t\t(\r\n\t\t\t\t\tProductID, \r\n\t\t\t\t\tschemeGroupID, \r\n\t\t\t\t\tCreatedBy\r\n\t\t\t\t) \r\n\t\t\t\tVALUES \r\n\t\t\t\t(\r\n\t\t\t\t\t", num1, ", \r\n\t\t\t\t\t", this.QuoteSelected.SchemeGroupID, ", \r\n\t\t\t\t\t'", this.CreatedBy, "'\r\n\t\t\t\t);\r\n\t\t\t\tSELECT @@IDENTITY;" }); text1 = text1.Replace("\n", ""); text1 = text1.Replace("\t", ""); text1 = text1.Replace("\r", ""); SqlConnection connection1 = new SqlConnection(Config.ConnectionString); SqlCommand command1 = new SqlCommand(text1, connection1); ###########################


                                Look where you want to go not where you don't want to crash. Bikers Bible

                                R Offline
                                R Offline
                                RichardLH
                                wrote on last edited by
                                #20

                                Hmmm, If you replace the CR/LF/TAB as required you get INSERT INTO Policy ( ProductID, schemeGroupID, CreatedBy ) VALUES ( ", num1, ", ", this.QuoteSelected.SchemeGroupID, ", '", this.CreatedBy, "' ); SELECT @@IDENTITY;" which means it is just an unusual form of 'cut and paste' from a nicely formatted screen layout and applied in a creative way that I had not imagined before (and then compacted in code to make the string simpler for the parser to handle)! Some times the shorter way to do things actually takes longer in its final form.

                                R 1 Reply Last reply
                                0
                                • R RichardLH

                                  Hmmm, If you replace the CR/LF/TAB as required you get INSERT INTO Policy ( ProductID, schemeGroupID, CreatedBy ) VALUES ( ", num1, ", ", this.QuoteSelected.SchemeGroupID, ", '", this.CreatedBy, "' ); SELECT @@IDENTITY;" which means it is just an unusual form of 'cut and paste' from a nicely formatted screen layout and applied in a creative way that I had not imagined before (and then compacted in code to make the string simpler for the parser to handle)! Some times the shorter way to do things actually takes longer in its final form.

                                  R Offline
                                  R Offline
                                  RichardLH
                                  wrote on last edited by
                                  #21

                                  OK - so the 4 spaces I put in place of the tabs got stripped out by the post form - but you get the idea.

                                  1 Reply Last reply
                                  0
                                  • F Frank Kerrigan

                                    Not while someone else was paying for my code. -- modified at 9:18 Monday 21st August, 2006


                                    Look where you want to go not where you don't want to crash. Bikers Bible

                                    N Offline
                                    N Offline
                                    NiteOne
                                    wrote on last edited by
                                    #22

                                    You are forget the best one of all . Microsoft Windows ME. it was hard to code for and support. NiteOne

                                    1 Reply Last reply
                                    0
                                    • F Frank Kerrigan

                                      I found this small nugget of code buried in a sea obsurity. I was speachless and could not figure out why someone would ever write such a piece nonsense. Whats worse :omg: is this is currently running live. ########################### string text1 = string.Concat(new object[] { "INSERT INTO Policy \r\n\t\t\t\t(\r\n\t\t\t\t\tProductID, \r\n\t\t\t\t\tschemeGroupID, \r\n\t\t\t\t\tCreatedBy\r\n\t\t\t\t) \r\n\t\t\t\tVALUES \r\n\t\t\t\t(\r\n\t\t\t\t\t", num1, ", \r\n\t\t\t\t\t", this.QuoteSelected.SchemeGroupID, ", \r\n\t\t\t\t\t'", this.CreatedBy, "'\r\n\t\t\t\t);\r\n\t\t\t\tSELECT @@IDENTITY;" }); text1 = text1.Replace("\n", ""); text1 = text1.Replace("\t", ""); text1 = text1.Replace("\r", ""); SqlConnection connection1 = new SqlConnection(Config.ConnectionString); SqlCommand command1 = new SqlCommand(text1, connection1); ###########################


                                      Look where you want to go not where you don't want to crash. Bikers Bible

                                      N Offline
                                      N Offline
                                      NoCake
                                      wrote on last edited by
                                      #23

                                      That's pretty awful. My gold standard for vomit-inducing code was a render function written for a game (no names). It was a single function, 3000 lines long, and had "goto" statements jumping into loop and if statement bodies. Nobody but the writer understood it. The game shipped and was moderately successfully, but I could never look at it without thinking of the festering cancer of code lurking at it's heart. -- modified at 11:39 Tuesday 22nd August, 2006: Emphasis added to 'into'. I still can't believe that. I can understand (but not condone) jumping -out- of a loop or if statement... but into one? beggared belief, that did.

                                      1 Reply Last reply
                                      0
                                      • F Frank Kerrigan

                                        I found this small nugget of code buried in a sea obsurity. I was speachless and could not figure out why someone would ever write such a piece nonsense. Whats worse :omg: is this is currently running live. ########################### string text1 = string.Concat(new object[] { "INSERT INTO Policy \r\n\t\t\t\t(\r\n\t\t\t\t\tProductID, \r\n\t\t\t\t\tschemeGroupID, \r\n\t\t\t\t\tCreatedBy\r\n\t\t\t\t) \r\n\t\t\t\tVALUES \r\n\t\t\t\t(\r\n\t\t\t\t\t", num1, ", \r\n\t\t\t\t\t", this.QuoteSelected.SchemeGroupID, ", \r\n\t\t\t\t\t'", this.CreatedBy, "'\r\n\t\t\t\t);\r\n\t\t\t\tSELECT @@IDENTITY;" }); text1 = text1.Replace("\n", ""); text1 = text1.Replace("\t", ""); text1 = text1.Replace("\r", ""); SqlConnection connection1 = new SqlConnection(Config.ConnectionString); SqlCommand command1 = new SqlCommand(text1, connection1); ###########################


                                        Look where you want to go not where you don't want to crash. Bikers Bible

                                        B Offline
                                        B Offline
                                        billrad
                                        wrote on last edited by
                                        #24

                                        Nothing beats C for obfuscation. See link (I hope.) below. http://www0.us.ioccc.org/main.html[^] Bill Raddatz Something wise (hmmm) You can't push on a rope.

                                        1 Reply Last reply
                                        0
                                        • F Frank Kerrigan

                                          I found this small nugget of code buried in a sea obsurity. I was speachless and could not figure out why someone would ever write such a piece nonsense. Whats worse :omg: is this is currently running live. ########################### string text1 = string.Concat(new object[] { "INSERT INTO Policy \r\n\t\t\t\t(\r\n\t\t\t\t\tProductID, \r\n\t\t\t\t\tschemeGroupID, \r\n\t\t\t\t\tCreatedBy\r\n\t\t\t\t) \r\n\t\t\t\tVALUES \r\n\t\t\t\t(\r\n\t\t\t\t\t", num1, ", \r\n\t\t\t\t\t", this.QuoteSelected.SchemeGroupID, ", \r\n\t\t\t\t\t'", this.CreatedBy, "'\r\n\t\t\t\t);\r\n\t\t\t\tSELECT @@IDENTITY;" }); text1 = text1.Replace("\n", ""); text1 = text1.Replace("\t", ""); text1 = text1.Replace("\r", ""); SqlConnection connection1 = new SqlConnection(Config.ConnectionString); SqlCommand command1 = new SqlCommand(text1, connection1); ###########################


                                          Look where you want to go not where you don't want to crash. Bikers Bible

                                          J Offline
                                          J Offline
                                          jstaque
                                          wrote on last edited by
                                          #25

                                          The only really bad thing about this code is using the incorrect insert ID...everything else can be rationally explained (e.g., debug output (as mentioned above)). Generally, those variable names aren't that bad, as they are rarely, if ever, used much after their initial declaration. But I guess it's pretty l33t to make fun of other people's code! I dare say I've seen much worse code...hell, I've written worse myself. :) :sigh:

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups