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. Factor this.

Factor this.

Scheduled Pinned Locked Moved The Lounge
databasecom
19 Posts 9 Posters 3 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.
  • A Offline
    A Offline
    Andy Brummer
    wrote on last edited by
    #1

    The system that I work on has a sql table that encodes a hierarchy with 2 columns. The first has prime numbers and the second has the value from the first column multiplied by all the keys of the parents for that row. To get all the children for a row you get all records where the current key divides the value for the second column. :|

    Curvature of the Mind

    R M L G L 6 Replies Last reply
    0
    • A Andy Brummer

      The system that I work on has a sql table that encodes a hierarchy with 2 columns. The first has prime numbers and the second has the value from the first column multiplied by all the keys of the parents for that row. To get all the children for a row you get all records where the current key divides the value for the second column. :|

      Curvature of the Mind

      R Offline
      R Offline
      realJSOP
      wrote on last edited by
      #2

      You want to borrow one of my pistols?

      ".45 ACP - because shooting twice is just silly" - JSOP, 2010
      -----
      You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
      -----
      "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

      A 1 Reply Last reply
      0
      • A Andy Brummer

        The system that I work on has a sql table that encodes a hierarchy with 2 columns. The first has prime numbers and the second has the value from the first column multiplied by all the keys of the parents for that row. To get all the children for a row you get all records where the current key divides the value for the second column. :|

        Curvature of the Mind

        M Offline
        M Offline
        Mark_Wallace
        wrote on last edited by
        #3

        I think that's actually quite cute. Was it originally written in Fortran?

        I wanna be a eunuchs developer! Pass me a bread knife!

        A 1 Reply Last reply
        0
        • R realJSOP

          You want to borrow one of my pistols?

          ".45 ACP - because shooting twice is just silly" - JSOP, 2010
          -----
          You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
          -----
          "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

          A Offline
          A Offline
          Andy Brummer
          wrote on last edited by
          #4

          I think that would be justified in this case. :-D

          Curvature of the Mind

          1 Reply Last reply
          0
          • M Mark_Wallace

            I think that's actually quite cute. Was it originally written in Fortran?

            I wanna be a eunuchs developer! Pass me a bread knife!

            A Offline
            A Offline
            Andy Brummer
            wrote on last edited by
            #5

            Cool, hey can you write me a prime number generator in sql? ;P

            Mark Wallace wrote:

            Was it originally written in Fortran?

            That wouldn't surprise me.

            Curvature of the Mind

            M S 2 Replies Last reply
            0
            • A Andy Brummer

              Cool, hey can you write me a prime number generator in sql? ;P

              Mark Wallace wrote:

              Was it originally written in Fortran?

              That wouldn't surprise me.

              Curvature of the Mind

              M Offline
              M Offline
              Mark_Wallace
              wrote on last edited by
              #6

              Andy Brummer wrote:

              hey can you write me a prime number generator in sql?

              Aah, you're thinking's all wrong for business programming! What you should have asked is "Do you have a prime_numbers table I can use?"

              I wanna be a eunuchs developer! Pass me a bread knife!

              A 1 Reply Last reply
              0
              • A Andy Brummer

                Cool, hey can you write me a prime number generator in sql? ;P

                Mark Wallace wrote:

                Was it originally written in Fortran?

                That wouldn't surprise me.

                Curvature of the Mind

                S Offline
                S Offline
                Stefan de Zeeuw
                wrote on last edited by
                #7

                Andy Brummer wrote:

                Cool, hey can you write me a prime number generator in sql?

                Here you go (google was my friend) http://www.mail-archive.com/mysql@lists.mysql.com/msg103529.html[^]

                A 1 Reply Last reply
                0
                • M Mark_Wallace

                  Andy Brummer wrote:

                  hey can you write me a prime number generator in sql?

                  Aah, you're thinking's all wrong for business programming! What you should have asked is "Do you have a prime_numbers table I can use?"

                  I wanna be a eunuchs developer! Pass me a bread knife!

                  A Offline
                  A Offline
                  Andy Brummer
                  wrote on last edited by
                  #8

                  Or the enterprise numbers table with a number type column and reference table for prime, not prime, the associated entities, wcf service methods and all the unit tests IsXXXXXPrime. :-D

                  Curvature of the Mind

                  M D 2 Replies Last reply
                  0
                  • A Andy Brummer

                    Or the enterprise numbers table with a number type column and reference table for prime, not prime, the associated entities, wcf service methods and all the unit tests IsXXXXXPrime. :-D

                    Curvature of the Mind

                    M Offline
                    M Offline
                    Mark_Wallace
                    wrote on last edited by
                    #9

                    Andy Brummer wrote:

                    Or the enterprise numbers table with a number type column and reference table for prime, not prime, the associated entities, wcf service methods and all the unit tests IsXXXXXPrime.

                    My Boy, you not only keep your job, but I'm giving you seniority!

                    I wanna be a eunuchs developer! Pass me a bread knife!

                    1 Reply Last reply
                    0
                    • S Stefan de Zeeuw

                      Andy Brummer wrote:

                      Cool, hey can you write me a prime number generator in sql?

                      Here you go (google was my friend) http://www.mail-archive.com/mysql@lists.mysql.com/msg103529.html[^]

                      A Offline
                      A Offline
                      Andy Brummer
                      wrote on last edited by
                      #10

                      Awesome!

                      Curvature of the Mind

                      1 Reply Last reply
                      0
                      • A Andy Brummer

                        The system that I work on has a sql table that encodes a hierarchy with 2 columns. The first has prime numbers and the second has the value from the first column multiplied by all the keys of the parents for that row. To get all the children for a row you get all records where the current key divides the value for the second column. :|

                        Curvature of the Mind

                        L Offline
                        L Offline
                        leckey 0
                        wrote on last edited by
                        #11

                        After working with Oracle that has been overcustomized for 10 months, I think this may be an improvement.

                        Soon...very soon...http://CraptasticNation.blogspot.com/[^]

                        A 1 Reply Last reply
                        0
                        • A Andy Brummer

                          Or the enterprise numbers table with a number type column and reference table for prime, not prime, the associated entities, wcf service methods and all the unit tests IsXXXXXPrime. :-D

                          Curvature of the Mind

                          D Offline
                          D Offline
                          Dan Neely
                          wrote on last edited by
                          #12

                          enum Bool { True, False, FileNotFoundNeither };

                          3x12=36 2x12=24 1x12=12 0x12=18

                          1 Reply Last reply
                          0
                          • A Andy Brummer

                            The system that I work on has a sql table that encodes a hierarchy with 2 columns. The first has prime numbers and the second has the value from the first column multiplied by all the keys of the parents for that row. To get all the children for a row you get all records where the current key divides the value for the second column. :|

                            Curvature of the Mind

                            G Offline
                            G Offline
                            Gary R Wheeler
                            wrote on last edited by
                            #13

                            That's so unbelievably wrong. You must need to keep the number of entries in the table fairly small, considering what a complete hash of things would happen in the event of an overflow in the second column value.

                            Software Zen: delete this;
                            Fold With Us![^]

                            A 1 Reply Last reply
                            0
                            • A Andy Brummer

                              The system that I work on has a sql table that encodes a hierarchy with 2 columns. The first has prime numbers and the second has the value from the first column multiplied by all the keys of the parents for that row. To get all the children for a row you get all records where the current key divides the value for the second column. :|

                              Curvature of the Mind

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

                              erm, why? At least it makes my MS Access application, that contains a table with a single dateTime column containing the dates of the last day of the month seem somehow quite technically sound!

                              ___________________________________________ .\\axxx (That's an 'M')

                              A 1 Reply Last reply
                              0
                              • G Gary R Wheeler

                                That's so unbelievably wrong. You must need to keep the number of entries in the table fairly small, considering what a complete hash of things would happen in the event of an overflow in the second column value.

                                Software Zen: delete this;
                                Fold With Us![^]

                                A Offline
                                A Offline
                                Andy Brummer
                                wrote on last edited by
                                #15

                                I know, not to mention a table scan with every lookup. The primes I saw were in the 900 range at least, so there would definitely be the potential for overflow. Good thing the hierarchy is only a few levels deep. The only other anti-pattern like that was doing bit fields for security lookups on some web site I'm not going to mention.

                                Curvature of the Mind

                                1 Reply Last reply
                                0
                                • L Lost User

                                  erm, why? At least it makes my MS Access application, that contains a table with a single dateTime column containing the dates of the last day of the month seem somehow quite technically sound!

                                  ___________________________________________ .\\axxx (That's an 'M')

                                  A Offline
                                  A Offline
                                  Andy Brummer
                                  wrote on last edited by
                                  #16

                                  It is definitely inventive, and it does work, so I can't fault anyone on that. However, I think it will be "refactored" sometime soon.

                                  Curvature of the Mind

                                  1 Reply Last reply
                                  0
                                  • L leckey 0

                                    After working with Oracle that has been overcustomized for 10 months, I think this may be an improvement.

                                    Soon...very soon...http://CraptasticNation.blogspot.com/[^]

                                    A Offline
                                    A Offline
                                    Andy Brummer
                                    wrote on last edited by
                                    #17

                                    Holy crap, that must be beastly.

                                    Curvature of the Mind

                                    L 1 Reply Last reply
                                    0
                                    • A Andy Brummer

                                      Holy crap, that must be beastly.

                                      Curvature of the Mind

                                      L Offline
                                      L Offline
                                      leckey 0
                                      wrote on last edited by
                                      #18

                                      It's a nightmare. All this customization so when you change one thing, something else breaks, but heaven forbit we DOCUMENT anything so we know that ahead of time. X|

                                      Soon...very soon...http://CraptasticNation.blogspot.com/[^]

                                      1 Reply Last reply
                                      0
                                      • A Andy Brummer

                                        The system that I work on has a sql table that encodes a hierarchy with 2 columns. The first has prime numbers and the second has the value from the first column multiplied by all the keys of the parents for that row. To get all the children for a row you get all records where the current key divides the value for the second column. :|

                                        Curvature of the Mind

                                        L Offline
                                        L Offline
                                        lognormal
                                        wrote on last edited by
                                        #19

                                        A geeky remark: This prime number multiplication game is the essence of the "Godel numbering scheme" invented in the 1930's by the mathematician Kurt Godel and used by him to prove that all formal systems are either inconsistent or incomplete - very cool if you are a mathematician. The "problem" with this approach is that it quickly produces huge (vast) numbers if your tree is big and deep. But good idea! :)

                                        Why make life more difficult than it is?

                                        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