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. Huh... that's odd...

Huh... that's odd...

Scheduled Pinned Locked Moved The Weird and The Wonderful
17 Posts 11 Posters 9 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.
  • CPalliniC CPallini

    Indeed (and program output confirms [^])! And also Visual Basic sample is consistently wrong. :)

    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

    L Offline
    L Offline
    leppie
    wrote on last edited by
    #3

    I have now warned all unsuspecting prey. I wonder how many times that CodeDom definition is being used throughout the documentation? ;P

    xacc.ide - now with TabsToSpaces support
    IronScheme - 1.0 alpha 4a out now (29 May 2008)

    1 Reply Last reply
    0
    • CPalliniC CPallini

      Indeed (and program output confirms [^])! And also Visual Basic sample is consistently wrong. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

      Y Offline
      Y Offline
      Yusuf
      wrote on last edited by
      #4

      No wonder why we are getting so many crappy programmers....

      Yusuf

      L 1 Reply Last reply
      0
      • P PIEBALDconsult

        This is from the documentation of HashSet<T>.Contains

        private static bool isEven(int i)
        {
        return ((i % 2) == 1);
        }

        M Offline
        M Offline
        megaadam
        wrote on last edited by
        #5

        PIEBALDconsult wrote:

        : Huh... that's odd...

        Clever! Even I can see that.

        _____________________________________ Action without thought is not action Action without emotion is not life

        CPalliniC 1 Reply Last reply
        0
        • P PIEBALDconsult

          This is from the documentation of HashSet<T>.Contains

          private static bool isEven(int i)
          {
          return ((i % 2) == 1);
          }

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #6

          In this case I would suggest renaming it to IsNotEven :)

          A while ago he asked me what he should have printed on my business cards. I said 'Wizard'. I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.

          CPalliniC P 2 Replies Last reply
          0
          • M megaadam

            PIEBALDconsult wrote:

            : Huh... that's odd...

            Clever! Even I can see that.

            _____________________________________ Action without thought is not action Action without emotion is not life

            CPalliniC Offline
            CPalliniC Offline
            CPallini
            wrote on last edited by
            #7

            megaadam wrote:

            PIEBALDconsult wrote: : Huh... that's odd... Clever! Even I can see that.

            That's better that even odds! :-D

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

            In testa che avete, signor di Ceprano?

            1 Reply Last reply
            0
            • L Lost User

              In this case I would suggest renaming it to IsNotEven :)

              A while ago he asked me what he should have printed on my business cards. I said 'Wizard'. I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.

              CPalliniC Offline
              CPalliniC Offline
              CPallini
              wrote on last edited by
              #8

              CDP1802 wrote:

              In this case I would suggest renaming it to IsNotEven

              Or IsNotEleven! :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

              In testa che avete, signor di Ceprano?

              1 Reply Last reply
              0
              • Y Yusuf

                No wonder why we are getting so many crappy programmers....

                Yusuf

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #9

                Actually not. For a beginner something like this is not easy to spot. Once they do, they will have learned that you may never go on assumptions and always must check even the simplest things to make certain that they work as they should. Crappy programmers are those who are totally resistant to learning from their mistakes.

                A while ago he asked me what he should have printed on my business cards. I said 'Wizard'. I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.

                Y M 2 Replies Last reply
                0
                • L Lost User

                  Actually not. For a beginner something like this is not easy to spot. Once they do, they will have learned that you may never go on assumptions and always must check even the simplest things to make certain that they work as they should. Crappy programmers are those who are totally resistant to learning from their mistakes.

                  A while ago he asked me what he should have printed on my business cards. I said 'Wizard'. I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.

                  Y Offline
                  Y Offline
                  Yusuf
                  wrote on last edited by
                  #10

                  I think you did not notice the joke icon, oh well..... :-O

                  Yusuf

                  1 Reply Last reply
                  0
                  • L Lost User

                    In this case I would suggest renaming it to IsNotEven :)

                    A while ago he asked me what he should have printed on my business cards. I said 'Wizard'. I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.

                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote on last edited by
                    #11

                    Or Mod2Equals1. Better that the method remain anonymous.

                    1 Reply Last reply
                    0
                    • P PIEBALDconsult

                      This is from the documentation of HashSet<T>.Contains

                      private static bool isEven(int i)
                      {
                      return ((i % 2) == 1);
                      }

                      R Offline
                      R Offline
                      Ri Qen Sin
                      wrote on last edited by
                      #12

                      I use this:

                      private bool IsEven(int value)
                      {
                      return (value & 1) == 0;
                      }

                      So the creationist says: Everything must have a designer. God designed everything. I say: Why is God the only exception? Why not make the "designs" (like man) exceptions and make God a creation of man?

                      P 1 Reply Last reply
                      0
                      • R Ri Qen Sin

                        I use this:

                        private bool IsEven(int value)
                        {
                        return (value & 1) == 0;
                        }

                        So the creationist says: Everything must have a designer. God designed everything. I say: Why is God the only exception? Why not make the "designs" (like man) exceptions and make God a creation of man?

                        P Offline
                        P Offline
                        PIEBALDconsult
                        wrote on last edited by
                        #13

                        Exactly.

                        1 Reply Last reply
                        0
                        • L Lost User

                          Actually not. For a beginner something like this is not easy to spot. Once they do, they will have learned that you may never go on assumptions and always must check even the simplest things to make certain that they work as they should. Crappy programmers are those who are totally resistant to learning from their mistakes.

                          A while ago he asked me what he should have printed on my business cards. I said 'Wizard'. I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.

                          M Offline
                          M Offline
                          MarkB777
                          wrote on last edited by
                          #14

                          CDP1802 wrote:

                          Crappy programmers are those who are totally resistant to learning from their mistakes.

                          I completely agree. Mistakes are just hurdles on the path to excellence. The people who will eventually achieve exellence will learn how to jump the hurdles, all the others will simply say to themselves... "f!ck this" and go get a beer... :).

                          Mark Brock Click here to view my blog

                          N 1 Reply Last reply
                          0
                          • M MarkB777

                            CDP1802 wrote:

                            Crappy programmers are those who are totally resistant to learning from their mistakes.

                            I completely agree. Mistakes are just hurdles on the path to excellence. The people who will eventually achieve exellence will learn how to jump the hurdles, all the others will simply say to themselves... "f!ck this" and go get a beer... :).

                            Mark Brock Click here to view my blog

                            N Offline
                            N Offline
                            Nelek
                            wrote on last edited by
                            #15

                            MarkBrock wrote:

                            "f!ck this" and go get a beer...

                            If it is just a pause to get distant and turn back afterwards to continue facing the problem from other perspective is not a bad issue. But if it is the last action... then I am agree with you :P

                            Regards. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson Rating helpfull answers is nice, but saying thanks can be even nicer.

                            1 Reply Last reply
                            0
                            • P PIEBALDconsult

                              This is from the documentation of HashSet<T>.Contains

                              private static bool isEven(int i)
                              {
                              return ((i % 2) == 1);
                              }

                              J Offline
                              J Offline
                              JackBradford
                              wrote on last edited by
                              #16

                              I did this for months after I started teaching myself visual basic, I would compare boolean object properties to TRUE.

                              If (checkbox1.checked = true) then

                              Needless to say how stupid I felt when I realised what I was doing :|

                              1 Reply Last reply
                              0
                              • P PIEBALDconsult

                                This is from the documentation of HashSet<T>.Contains

                                private static bool isEven(int i)
                                {
                                return ((i % 2) == 1);
                                }

                                P Offline
                                P Offline
                                Paul Conrad
                                wrote on last edited by
                                #17

                                Hmmm, I always thought it should be along the lines of:

                                private static bool isEven(int i)
                                {
                                     return ((i % 1) == 0);
                                }
                                

                                "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

                                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