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. Am I a bad person for doing this?

Am I a bad person for doing this?

Scheduled Pinned Locked Moved The Lounge
c++windows-admintoolstutorialquestion
21 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.
  • D dawmail333

    I'm writing myself a small C++ utility. Now, I've justified this by telling myself it's a small utility, but the thing is, I probably will make this available to the internet, particularly to a small niche... Anyway, I've been bumping my head into walls with C++, particularly pointers, and type malleability, but I finally got my program running the way I wanted. Then I updated it, so the end user could configure a float the program uses extensively. I was going to throw it into an ini, but I noticed MSDN said that the registry should be used. So off I went and used that. Except I couldn't be bothered working out how to store a float in the registry, so I just stored a numerator and denominator, and divide them once they're loaded into the app. Aside from the fact I just remembered that I'd better 0-proof it, does this make me a bad person at all? Is that TOO hacky? :-O

    Don't forget to rate my post if it helped! ;) "He has no enemies, but is intensely disliked by his friends." "His mother should have thrown him away, and kept the stork." "There's nothing wrong with you that reincarnation won't cure." "He loves nature, in spite of what it did to him."

    P Offline
    P Offline
    Pablo Aliskevicius
    wrote on last edited by
    #7

    Whenever I write a 'small C++ utility', I don't use the registry: I either use a .config file, or a custom "document" (an XML file with a custom extension, saved in the user's 'Documents' folder). This is because your user may not have permissions to write to the registry, a By the way, whenever you are saving a double to an INI file, a CONFIG file, or any other XML file you are serializing it as a string, so saving a string to the registry is not necessarily a bad idea. Hope this helps,

    Pablo. "Accident: An inevitable occurrence due to the action of immutable natural laws." (Ambrose Bierce, circa 1899).

    D 1 Reply Last reply
    0
    • D dawmail333

      I'm writing myself a small C++ utility. Now, I've justified this by telling myself it's a small utility, but the thing is, I probably will make this available to the internet, particularly to a small niche... Anyway, I've been bumping my head into walls with C++, particularly pointers, and type malleability, but I finally got my program running the way I wanted. Then I updated it, so the end user could configure a float the program uses extensively. I was going to throw it into an ini, but I noticed MSDN said that the registry should be used. So off I went and used that. Except I couldn't be bothered working out how to store a float in the registry, so I just stored a numerator and denominator, and divide them once they're loaded into the app. Aside from the fact I just remembered that I'd better 0-proof it, does this make me a bad person at all? Is that TOO hacky? :-O

      Don't forget to rate my post if it helped! ;) "He has no enemies, but is intensely disliked by his friends." "His mother should have thrown him away, and kept the stork." "There's nothing wrong with you that reincarnation won't cure." "He loves nature, in spite of what it did to him."

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #8

      Just because Microsoft say you shouldn't do something doesn't necessarily mean they are right.

      Forgive your enemies - it messes with their heads

      "Mind bleach! Send me mind bleach!" - Nagy Vilmos

      My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

      J L D P 4 Replies Last reply
      0
      • P Pete OHanlon

        Just because Microsoft say you shouldn't do something doesn't necessarily mean they are right.

        Forgive your enemies - it messes with their heads

        "Mind bleach! Send me mind bleach!" - Nagy Vilmos

        My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

        J Offline
        J Offline
        Jan Steyn
        wrote on last edited by
        #9

        So true!

        1 Reply Last reply
        0
        • L Lost User

          dawmail333 wrote:

          I couldn't be bothered working out how to store a float in the registry

          Not too difficult if you use an appropriate type[^]. Hmm, I just answered a programming question in the lounge! :omg:

          Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

          S Offline
          S Offline
          SCraw2855
          wrote on last edited by
          #10

          Blasphemy... :doh:

          Something worth reading, albeit it's invincible!

          1 Reply Last reply
          0
          • D dawmail333

            I'm writing myself a small C++ utility. Now, I've justified this by telling myself it's a small utility, but the thing is, I probably will make this available to the internet, particularly to a small niche... Anyway, I've been bumping my head into walls with C++, particularly pointers, and type malleability, but I finally got my program running the way I wanted. Then I updated it, so the end user could configure a float the program uses extensively. I was going to throw it into an ini, but I noticed MSDN said that the registry should be used. So off I went and used that. Except I couldn't be bothered working out how to store a float in the registry, so I just stored a numerator and denominator, and divide them once they're loaded into the app. Aside from the fact I just remembered that I'd better 0-proof it, does this make me a bad person at all? Is that TOO hacky? :-O

            Don't forget to rate my post if it helped! ;) "He has no enemies, but is intensely disliked by his friends." "His mother should have thrown him away, and kept the stork." "There's nothing wrong with you that reincarnation won't cure." "He loves nature, in spite of what it did to him."

            H Offline
            H Offline
            Henry Minute
            wrote on last edited by
            #11

            Programming questions in the appropriate forum, if you please. :)

            Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.

            D 1 Reply Last reply
            0
            • P Pete OHanlon

              Just because Microsoft say you shouldn't do something doesn't necessarily mean they are right.

              Forgive your enemies - it messes with their heads

              "Mind bleach! Send me mind bleach!" - Nagy Vilmos

              My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

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

              goto FTW!!!

              IronScheme
              ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))

              1 Reply Last reply
              0
              • L Lost User

                dawmail333 wrote:

                I couldn't be bothered working out how to store a float in the registry

                Not too difficult if you use an appropriate type[^]. Hmm, I just answered a programming question in the lounge! :omg:

                Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

                D Offline
                D Offline
                dawmail333
                wrote on last edited by
                #13

                Nerd Sniping[^]

                Don't forget to rate my post if it helped! ;) "He has no enemies, but is intensely disliked by his friends." "His mother should have thrown him away, and kept the stork." "There's nothing wrong with you that reincarnation won't cure." "He loves nature, in spite of what it did to him."

                L 1 Reply Last reply
                0
                • P Pablo Aliskevicius

                  Whenever I write a 'small C++ utility', I don't use the registry: I either use a .config file, or a custom "document" (an XML file with a custom extension, saved in the user's 'Documents' folder). This is because your user may not have permissions to write to the registry, a By the way, whenever you are saving a double to an INI file, a CONFIG file, or any other XML file you are serializing it as a string, so saving a string to the registry is not necessarily a bad idea. Hope this helps,

                  Pablo. "Accident: An inevitable occurrence due to the action of immutable natural laws." (Ambrose Bierce, circa 1899).

                  D Offline
                  D Offline
                  dawmail333
                  wrote on last edited by
                  #14

                  Good point! It's just that I personally use this utility by dumping it in my 'startup' folder, so putting a config file in the same folder would try and launch it on every startup. Also, each user might want their own volume step settings, so that's the other consideration I prepared for.

                  Don't forget to rate my post if it helped! ;) "He has no enemies, but is intensely disliked by his friends." "His mother should have thrown him away, and kept the stork." "There's nothing wrong with you that reincarnation won't cure." "He loves nature, in spite of what it did to him."

                  1 Reply Last reply
                  0
                  • P Pete OHanlon

                    Just because Microsoft say you shouldn't do something doesn't necessarily mean they are right.

                    Forgive your enemies - it messes with their heads

                    "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                    My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                    D Offline
                    D Offline
                    dawmail333
                    wrote on last edited by
                    #15

                    This IS the company that defined ERROR_SUCCESS I suppose. Nah, I find the registry is an appropriate fit in this situation, it wasn't just blind acceptance.

                    Don't forget to rate my post if it helped! ;) "He has no enemies, but is intensely disliked by his friends." "His mother should have thrown him away, and kept the stork." "There's nothing wrong with you that reincarnation won't cure." "He loves nature, in spite of what it did to him."

                    1 Reply Last reply
                    0
                    • H Henry Minute

                      Programming questions in the appropriate forum, if you please. :)

                      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.

                      D Offline
                      D Offline
                      dawmail333
                      wrote on last edited by
                      #16

                      Aha! I wasn't actually asking a programming question in that I wanted help or advice on it. I just wanted to know if people though my solution to something was TOO hacky. The fact I managed to trick someone into answering an unasked programming question is just a cool bonus. :laugh: If you REALLY still think this should be shifted, then ok.

                      Don't forget to rate my post if it helped! ;) "He has no enemies, but is intensely disliked by his friends." "His mother should have thrown him away, and kept the stork." "There's nothing wrong with you that reincarnation won't cure." "He loves nature, in spite of what it did to him."

                      1 Reply Last reply
                      0
                      • D dawmail333

                        Nerd Sniping[^]

                        Don't forget to rate my post if it helped! ;) "He has no enemies, but is intensely disliked by his friends." "His mother should have thrown him away, and kept the stork." "There's nothing wrong with you that reincarnation won't cure." "He loves nature, in spite of what it did to him."

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

                        dawmail333 wrote:

                        Don't forget to rate my post if it helped!

                        OK, I gave it a 1 as it's really a programming question!

                        Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

                        D 1 Reply Last reply
                        0
                        • P Pete OHanlon

                          Just because Microsoft say you shouldn't do something doesn't necessarily mean they are right.

                          Forgive your enemies - it messes with their heads

                          "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                          My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

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

                          20!

                          1 Reply Last reply
                          0
                          • D dawmail333

                            I'm writing myself a small C++ utility. Now, I've justified this by telling myself it's a small utility, but the thing is, I probably will make this available to the internet, particularly to a small niche... Anyway, I've been bumping my head into walls with C++, particularly pointers, and type malleability, but I finally got my program running the way I wanted. Then I updated it, so the end user could configure a float the program uses extensively. I was going to throw it into an ini, but I noticed MSDN said that the registry should be used. So off I went and used that. Except I couldn't be bothered working out how to store a float in the registry, so I just stored a numerator and denominator, and divide them once they're loaded into the app. Aside from the fact I just remembered that I'd better 0-proof it, does this make me a bad person at all? Is that TOO hacky? :-O

                            Don't forget to rate my post if it helped! ;) "He has no enemies, but is intensely disliked by his friends." "His mother should have thrown him away, and kept the stork." "There's nothing wrong with you that reincarnation won't cure." "He loves nature, in spite of what it did to him."

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

                            dawmail333 wrote:

                            MSDN said that the registry should be used

                            Never use the registry. And don't do what Microsoft says.

                            dawmail333 wrote:

                            Is that TOO hacky?

                            Yes.

                            D 1 Reply Last reply
                            0
                            • P PIEBALDconsult

                              dawmail333 wrote:

                              MSDN said that the registry should be used

                              Never use the registry. And don't do what Microsoft says.

                              dawmail333 wrote:

                              Is that TOO hacky?

                              Yes.

                              D Offline
                              D Offline
                              dawmail333
                              wrote on last edited by
                              #20

                              I didn't blindly follow MS, it actually seemed to be a good fit for the project. :-\

                              Don't forget to rate my post if it helped! ;) "He has no enemies, but is intensely disliked by his friends." "His mother should have thrown him away, and kept the stork." "There's nothing wrong with you that reincarnation won't cure." "He loves nature, in spite of what it did to him."

                              1 Reply Last reply
                              0
                              • L Lost User

                                dawmail333 wrote:

                                Don't forget to rate my post if it helped!

                                OK, I gave it a 1 as it's really a programming question!

                                Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

                                D Offline
                                D Offline
                                dawmail333
                                wrote on last edited by
                                #21

                                Thank you for your most helpful, thoughtful and useful reply. :)

                                Don't forget to rate my post if it helped! ;) "He has no enemies, but is intensely disliked by his friends." "His mother should have thrown him away, and kept the stork." "There's nothing wrong with you that reincarnation won't cure." "He loves nature, in spite of what it did to him."

                                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