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. Clever Code
  4. The Blind Spot

The Blind Spot

Scheduled Pinned Locked Moved Clever Code
c++databasecomdebuggingarchitecture
13 Posts 11 Posters 6 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.
  • C Chris Maunder

    I was trying to debug some horrible VBScript and just wanted to be done with it so I could get back to the world of compiled languages but for the life of me could not get past this:

    Set Connection = CreateOpenConnection
    if not Connection is nothing Then Exit Function
    DoSomeWork

    The database connection was being created correctly, it was opening the connection, it could see the tables and read the data. But the call to DoSomeWork was never happening. And then I realised that when you copy code from

    if not Connection is nothing Then
    ...Do some work

    then you may, just may want to remove the not. There's 45 mins of my life I'll never get back :doh: I think the quality of my code is inversely proportional to my distaste of the language.

    cheers, Chris Maunder

    CodeProject.com : C++ MVP

    B Offline
    B Offline
    Baconbutty
    wrote on last edited by
    #2

    Always best to try to explain problems like this to someone who has no idea what you are trying to achieve. That way you HAVE to explain what the code is doing and usually the light switches on :)

    I still remember having to write your own code in FORTRAN rather than be a cut and paste merchant being pampered by colour coded Intellisense - ahh proper programming - those were the days :)

    realJSOPR 1 Reply Last reply
    0
    • B Baconbutty

      Always best to try to explain problems like this to someone who has no idea what you are trying to achieve. That way you HAVE to explain what the code is doing and usually the light switches on :)

      I still remember having to write your own code in FORTRAN rather than be a cut and paste merchant being pampered by colour coded Intellisense - ahh proper programming - those were the days :)

      realJSOPR Offline
      realJSOPR Offline
      realJSOP
      wrote on last edited by
      #3

      Yep. I use my dogs for that at home. Of course, they're blinded by the possibility that they'll get a cookie after my speech, but vocalizing the problem to someone else almost always helps me solve the issue.

      "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
      -----
      "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

      M 1 Reply Last reply
      0
      • realJSOPR realJSOP

        Yep. I use my dogs for that at home. Of course, they're blinded by the possibility that they'll get a cookie after my speech, but vocalizing the problem to someone else almost always helps me solve the issue.

        "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
        -----
        "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

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

        Dogs! What a brilliant idea! Really. :) I dunno how many times I have asked a work-mate a "stupid" question, and immediately seen the answer myself. Perhaps I should put a pot of flowers on my desk for that purpose, of course if I talk to much to my flowers my mates will start to regard me as potty. Arf Arf

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

        N 1 Reply Last reply
        0
        • C Chris Maunder

          I was trying to debug some horrible VBScript and just wanted to be done with it so I could get back to the world of compiled languages but for the life of me could not get past this:

          Set Connection = CreateOpenConnection
          if not Connection is nothing Then Exit Function
          DoSomeWork

          The database connection was being created correctly, it was opening the connection, it could see the tables and read the data. But the call to DoSomeWork was never happening. And then I realised that when you copy code from

          if not Connection is nothing Then
          ...Do some work

          then you may, just may want to remove the not. There's 45 mins of my life I'll never get back :doh: I think the quality of my code is inversely proportional to my distaste of the language.

          cheers, Chris Maunder

          CodeProject.com : C++ MVP

          M Offline
          M Offline
          Michael Sync
          wrote on last edited by
          #5

          Chris Maunder wrote:

          Set Connection = CreateOpenConnection if not Connection is nothing Then Exit Function DoSomeWork

          You should write like that. right? Set Connection = CreateOpenConnection if Connection is nothing Then Exit Function DoSomeWork

          Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

          C 1 Reply Last reply
          0
          • M Michael Sync

            Chris Maunder wrote:

            Set Connection = CreateOpenConnection if not Connection is nothing Then Exit Function DoSomeWork

            You should write like that. right? Set Connection = CreateOpenConnection if Connection is nothing Then Exit Function DoSomeWork

            Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

            C Offline
            C Offline
            Chris Maunder
            wrote on last edited by
            #6

            Actually it would be better to do:

            Set Connection = CreateOpenConnection
            if Not Connection is nothing Then
            DoSomeWork
            End If

            Actually it would be better to completely ditch all our legacy VBScript entirely. We're workin' on it ;)

            cheers, Chris Maunder

            CodeProject.com : C++ MVP

            X 1 Reply Last reply
            0
            • C Chris Maunder

              I was trying to debug some horrible VBScript and just wanted to be done with it so I could get back to the world of compiled languages but for the life of me could not get past this:

              Set Connection = CreateOpenConnection
              if not Connection is nothing Then Exit Function
              DoSomeWork

              The database connection was being created correctly, it was opening the connection, it could see the tables and read the data. But the call to DoSomeWork was never happening. And then I realised that when you copy code from

              if not Connection is nothing Then
              ...Do some work

              then you may, just may want to remove the not. There's 45 mins of my life I'll never get back :doh: I think the quality of my code is inversely proportional to my distaste of the language.

              cheers, Chris Maunder

              CodeProject.com : C++ MVP

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

              Of course seeing Exit Function should have been the first clue :p When I haven't had a lot of sleep I do manage to write a lot more logic inversion errors.


              File Not Found

              1 Reply Last reply
              0
              • C Chris Maunder

                I was trying to debug some horrible VBScript and just wanted to be done with it so I could get back to the world of compiled languages but for the life of me could not get past this:

                Set Connection = CreateOpenConnection
                if not Connection is nothing Then Exit Function
                DoSomeWork

                The database connection was being created correctly, it was opening the connection, it could see the tables and read the data. But the call to DoSomeWork was never happening. And then I realised that when you copy code from

                if not Connection is nothing Then
                ...Do some work

                then you may, just may want to remove the not. There's 45 mins of my life I'll never get back :doh: I think the quality of my code is inversely proportional to my distaste of the language.

                cheers, Chris Maunder

                CodeProject.com : C++ MVP

                E Offline
                E Offline
                endian675
                wrote on last edited by
                #8

                :-) This is a great example "trying to do too much in one line". Splitting the code out into statements that perform a single task will often throw up the answer. It also makes debugging simpler.

                1 Reply Last reply
                0
                • C Chris Maunder

                  Actually it would be better to do:

                  Set Connection = CreateOpenConnection
                  if Not Connection is nothing Then
                  DoSomeWork
                  End If

                  Actually it would be better to completely ditch all our legacy VBScript entirely. We're workin' on it ;)

                  cheers, Chris Maunder

                  CodeProject.com : C++ MVP

                  X Offline
                  X Offline
                  Xiangyang Liu
                  wrote on last edited by
                  #9

                  Chris Maunder wrote:

                  Actually it would be better to completely ditch all our legacy VBScript entirely.

                  One of the things I like in VB/VBScript is late-binding. Do you also like it or you use it but hate it? Just wondering.

                  My .NET Business Application Framework My Home Page

                  1 Reply Last reply
                  0
                  • M megaadam

                    Dogs! What a brilliant idea! Really. :) I dunno how many times I have asked a work-mate a "stupid" question, and immediately seen the answer myself. Perhaps I should put a pot of flowers on my desk for that purpose, of course if I talk to much to my flowers my mates will start to regard me as potty. Arf Arf

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

                    N Offline
                    N Offline
                    NormDroid
                    wrote on last edited by
                    #10

                    megaadam wrote:

                    regard me as po

                    Or even gay, for having flowers on your desk in the first place:)

                    Roger Irrelevant "he's completely hatstand"

                    G R 2 Replies Last reply
                    0
                    • N NormDroid

                      megaadam wrote:

                      regard me as po

                      Or even gay, for having flowers on your desk in the first place:)

                      Roger Irrelevant "he's completely hatstand"

                      G Offline
                      G Offline
                      GuyThiebaut
                      wrote on last edited by
                      #11

                      Good point after all us tough, manly, emotionally positive programmers would not want others to think we are gay or have any appreciation for beauty!:laugh:

                      You always pass failure on the way to success.

                      1 Reply Last reply
                      0
                      • N NormDroid

                        megaadam wrote:

                        regard me as po

                        Or even gay, for having flowers on your desk in the first place:)

                        Roger Irrelevant "he's completely hatstand"

                        R Offline
                        R Offline
                        Rob Graham
                        wrote on last edited by
                        #12

                        norm .net wrote:

                        r even gay, for having flowers on your desk in the first place:)

                        Na, make it a Venus Fly Trap. Call it Butch. No one will think you're gay. A little off maybe, but not gay...

                        N 1 Reply Last reply
                        0
                        • R Rob Graham

                          norm .net wrote:

                          r even gay, for having flowers on your desk in the first place:)

                          Na, make it a Venus Fly Trap. Call it Butch. No one will think you're gay. A little off maybe, but not gay...

                          N Offline
                          N Offline
                          NormDroid
                          wrote on last edited by
                          #13

                          ;)

                          If you're struggling developing software, then I'd recommend gardening.

                          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