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. Other Discussions
  3. The Weird and The Wonderful
  4. Found this little gem in one of the applications

Found this little gem in one of the applications

Scheduled Pinned Locked Moved The Weird and The Wonderful
rubyasp-netoraclecomquestion
14 Posts 9 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.
  • D dan sh

    private long _remainder = long.parse("0");

    I wish I knew who wrote this. I would have recommended TryParse to him. ;)

    "Bastards encourage idiots to use Oracle Forms, Web Forms, Access and a number of other dinky web publishing tolls.", Mycroft Holmes[^]

    OriginalGriffO Offline
    OriginalGriffO Offline
    OriginalGriff
    wrote on last edited by
    #2

    What's the problem? He didn't use a Magic Number! ;)

    If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.

    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

    1 Reply Last reply
    0
    • D dan sh

      private long _remainder = long.parse("0");

      I wish I knew who wrote this. I would have recommended TryParse to him. ;)

      "Bastards encourage idiots to use Oracle Forms, Web Forms, Access and a number of other dinky web publishing tolls.", Mycroft Holmes[^]

      R Offline
      R Offline
      RugbyLeague
      wrote on last edited by
      #3

      private long _remainder = long.parse(0.ToString());

      Would have been better

      D T 2 Replies Last reply
      0
      • D dan sh

        private long _remainder = long.parse("0");

        I wish I knew who wrote this. I would have recommended TryParse to him. ;)

        "Bastards encourage idiots to use Oracle Forms, Web Forms, Access and a number of other dinky web publishing tolls.", Mycroft Holmes[^]

        B Offline
        B Offline
        Brisingr Aerowing
        wrote on last edited by
        #4

        :doh:

        public void WriteCode(ICodeContext ctx)
        {
        throw new BrainNotFoundException();
        }

        Bob Dole

        The internet is a great way to get on the net.

        :doh: 2.0.82.7292 SP6a

        1 Reply Last reply
        0
        • R RugbyLeague

          private long _remainder = long.parse(0.ToString());

          Would have been better

          D Offline
          D Offline
          dan sh
          wrote on last edited by
          #5

          This is correct implementation:

          int tryCounter = 0; // I hope this will work
          x:
          if(!long.TryParse("0", out _remainder) && (tryCounter < 100)) {
          tryCounter++;
          goto x;
          }
          else if(!long.TryParse("0", out _remainder) && (tryCounter > 100)){
          _remainder = 0;
          }
          else{
          // Oh my God, what should I do now?
          }

          "Bastards encourage idiots to use Oracle Forms, Web Forms, Access and a number of other dinky web publishing tolls.", Mycroft Holmes[^]

          S 1 Reply Last reply
          0
          • D dan sh

            private long _remainder = long.parse("0");

            I wish I knew who wrote this. I would have recommended TryParse to him. ;)

            "Bastards encourage idiots to use Oracle Forms, Web Forms, Access and a number of other dinky web publishing tolls.", Mycroft Holmes[^]

            D Offline
            D Offline
            DrABELL
            wrote on last edited by
            #6

            Nice! :)

            1 Reply Last reply
            0
            • R RugbyLeague

              private long _remainder = long.parse(0.ToString());

              Would have been better

              T Offline
              T Offline
              Thomas Daniels
              wrote on last edited by
              #7

              RugbyLeague wrote:

              Would have been better

              What do you think about this?

              private long _remainder = long.parse(((long)0).ToString());

              ProgramFOX

              1 Reply Last reply
              0
              • D dan sh

                private long _remainder = long.parse("0");

                I wish I knew who wrote this. I would have recommended TryParse to him. ;)

                "Bastards encourage idiots to use Oracle Forms, Web Forms, Access and a number of other dinky web publishing tolls.", Mycroft Holmes[^]

                D Offline
                D Offline
                Dr Walt Fair PE
                wrote on last edited by
                #8

                I would suggest the following:

                private long _remainder = (long)int.parse((0).ToString());

                CQ de W5ALT

                Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

                1 Reply Last reply
                0
                • D dan sh

                  This is correct implementation:

                  int tryCounter = 0; // I hope this will work
                  x:
                  if(!long.TryParse("0", out _remainder) && (tryCounter < 100)) {
                  tryCounter++;
                  goto x;
                  }
                  else if(!long.TryParse("0", out _remainder) && (tryCounter > 100)){
                  _remainder = 0;
                  }
                  else{
                  // Oh my God, what should I do now?
                  }

                  "Bastards encourage idiots to use Oracle Forms, Web Forms, Access and a number of other dinky web publishing tolls.", Mycroft Holmes[^]

                  S Offline
                  S Offline
                  Super Lloyd
                  wrote on last edited by
                  #9

                  Finally someone using TryParse correctly! ;P

                  A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                  1 Reply Last reply
                  0
                  • D dan sh

                    private long _remainder = long.parse("0");

                    I wish I knew who wrote this. I would have recommended TryParse to him. ;)

                    "Bastards encourage idiots to use Oracle Forms, Web Forms, Access and a number of other dinky web publishing tolls.", Mycroft Holmes[^]

                    S Offline
                    S Offline
                    Super Lloyd
                    wrote on last edited by
                    #10

                    I got the same kind of code a few lines earlier! ;p Extract from the code I'm working on[^]

                    A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                    K 1 Reply Last reply
                    0
                    • S Super Lloyd

                      I got the same kind of code a few lines earlier! ;p Extract from the code I'm working on[^]

                      A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                      K Offline
                      K Offline
                      KP Lee
                      wrote on last edited by
                      #11

                      Never underestimate the idiocy of the programmer who came before you. Otherwise, you'll always be surprised by how stupid they can be.

                      S 1 Reply Last reply
                      0
                      • K KP Lee

                        Never underestimate the idiocy of the programmer who came before you. Otherwise, you'll always be surprised by how stupid they can be.

                        S Offline
                        S Offline
                        Super Lloyd
                        wrote on last edited by
                        #12

                        I will not underestimate it again!! ^^

                        A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                        K 1 Reply Last reply
                        0
                        • S Super Lloyd

                          I will not underestimate it again!! ^^

                          A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                          K Offline
                          K Offline
                          KP Lee
                          wrote on last edited by
                          #13

                          Super Lloyd wrote:

                          I will not underestimate it again

                          OK, I fess up. I have been surprised by the stupid programmer before me when that programmer was me. :)

                          S 1 Reply Last reply
                          0
                          • K KP Lee

                            Super Lloyd wrote:

                            I will not underestimate it again

                            OK, I fess up. I have been surprised by the stupid programmer before me when that programmer was me. :)

                            S Offline
                            S Offline
                            Super Lloyd
                            wrote on last edited by
                            #14

                            Haha.. I should be wary of that one too indeed!! ^^

                            A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                            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