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. Bug of the Day

Bug of the Day

Scheduled Pinned Locked Moved The Lounge
help
47 Posts 17 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.
  • C Chris Maunder

    string objectRefGuid = objectRef.ObjectTypeId.ToString() + PartDivider + objectRef.ObjectId;

    if (objectRef.VersionNumber > 0)
    objectRefGuid += PartDivider + objectRef.VersionNumber;

    ObjectTypeId is 1, ObjectId is 2, and VersionNumber is 3. PartDivider is '_'. The expected result was 1_2_3. The output was 1_298. :doh:

    cheers Chris Maunder

    M Offline
    M Offline
    Maximilien
    wrote on last edited by
    #7

    Care to explain for those (me) who do not C# ? Someone say it is related to "Implicit conversions" ? Thanks.

    I'd rather be phishing!

    I 1 Reply Last reply
    0
    • C Chris Maunder

      Enlighten us.

      cheers Chris Maunder

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

      What's wrong is the developer asking "why" questions about their own production code - wrong role. In production the customers/users ask the "why" questions, to which developers are supposed to say "that's what you/they said you wanted/needed." The customer is king, but in their presence the developer is never wrong.

      Sin tack ear lol Pressing the any key may be continuate

      1 Reply Last reply
      0
      • C Chris Maunder

        string objectRefGuid = objectRef.ObjectTypeId.ToString() + PartDivider + objectRef.ObjectId;

        if (objectRef.VersionNumber > 0)
        objectRefGuid += PartDivider + objectRef.VersionNumber;

        ObjectTypeId is 1, ObjectId is 2, and VersionNumber is 3. PartDivider is '_'. The expected result was 1_2_3. The output was 1_298. :doh:

        cheers Chris Maunder

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

        PartDivider is a char?

        Sin tack ear lol Pressing the any key may be continuate

        C 1 Reply Last reply
        0
        • C Chris Maunder

          string objectRefGuid = objectRef.ObjectTypeId.ToString() + PartDivider + objectRef.ObjectId;

          if (objectRef.VersionNumber > 0)
          objectRefGuid += PartDivider + objectRef.VersionNumber;

          ObjectTypeId is 1, ObjectId is 2, and VersionNumber is 3. PartDivider is '_'. The expected result was 1_2_3. The output was 1_298. :doh:

          cheers Chris Maunder

          Z Offline
          Z Offline
          ZurdoDev
          wrote on last edited by
          #10

          Is that what caused the CSS to go wack-a-doodle? :-D

          There are two kinds of people in the world: those who can extrapolate from incomplete data. There are only 10 types of people in the world, those who understand binary and those who don't.

          C 1 Reply Last reply
          0
          • C Chris Maunder

            string objectRefGuid = objectRef.ObjectTypeId.ToString() + PartDivider + objectRef.ObjectId;

            if (objectRef.VersionNumber > 0)
            objectRefGuid += PartDivider + objectRef.VersionNumber;

            ObjectTypeId is 1, ObjectId is 2, and VersionNumber is 3. PartDivider is '_'. The expected result was 1_2_3. The output was 1_298. :doh:

            cheers Chris Maunder

            A Offline
            A Offline
            Afzaal Ahmad Zeeshan
            wrote on last edited by
            #11

            Oh, you mean this output[^]? I am sure the aftermath of that bug was really very graphical. See the layout.

            The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

            L F 2 Replies Last reply
            0
            • M Maximilien

              Care to explain for those (me) who do not C# ? Someone say it is related to "Implicit conversions" ? Thanks.

              I'd rather be phishing!

              I Offline
              I Offline
              Ian Shlasko
              wrote on last edited by
              #12

              He's basically doing this:

              "1_2" + '_' + 3

              Note that the underscore is a character, not a string (Single quotes = char, Double quotes = string). So instead of both parts being converted to strings to form "_3", it's treating the character as a number (ASCII code 95), adding 3 to it, THEN converting it to a string... So it becomes "1_2" + "98" Very subtle. I like it.

              Proud to have finally moved to the A-Ark. Which one are you in?
              Author of the Guardians Saga (Sci-Fi/Fantasy novels)

              J M B 3 Replies Last reply
              0
              • A Afzaal Ahmad Zeeshan

                Oh, you mean this output[^]? I am sure the aftermath of that bug was really very graphical. See the layout.

                The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

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

                Connect your cable, you're low on battery.

                Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                A 1 Reply Last reply
                0
                • I Ian Shlasko

                  He's basically doing this:

                  "1_2" + '_' + 3

                  Note that the underscore is a character, not a string (Single quotes = char, Double quotes = string). So instead of both parts being converted to strings to form "_3", it's treating the character as a number (ASCII code 95), adding 3 to it, THEN converting it to a string... So it becomes "1_2" + "98" Very subtle. I like it.

                  Proud to have finally moved to the A-Ark. Which one are you in?
                  Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                  J Offline
                  J Offline
                  Jeremy Falcon
                  wrote on last edited by
                  #14

                  You know... point one for loosely typed languages. I submit this... JSFiddle[^] Not that I have anything against strongly typed languages, I just smile at those that think it's the answer to everything including poverty and cancer.

                  Jeremy Falcon

                  Sander RosselS 1 Reply Last reply
                  0
                  • L Lost User

                    Connect your cable, you're low on battery.

                    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                    A Offline
                    A Offline
                    Afzaal Ahmad Zeeshan
                    wrote on last edited by
                    #15

                    So, the pixels flattened due to the empty space, I guess?

                    The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

                    L 1 Reply Last reply
                    0
                    • A Afzaal Ahmad Zeeshan

                      So, the pixels flattened due to the empty space, I guess?

                      The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

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

                      Afzaal Ahmad Zeeshan wrote:

                      So, the pixels flattened due to the empty space, I guess?

                      No, just forgot to run my Bit Recycler[^]. It is like defragmenting, but for the bits. :rolleyes:

                      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                      1 Reply Last reply
                      0
                      • A Afzaal Ahmad Zeeshan

                        Oh, you mean this output[^]? I am sure the aftermath of that bug was really very graphical. See the layout.

                        The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

                        F Offline
                        F Offline
                        Foothill
                        wrote on last edited by
                        #17

                        I thought that I was the only one who still uses GIMP. ;)

                        if (Object.DividedByZero == true) { Universe.Implode(); } Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016

                        J B B 3 Replies Last reply
                        0
                        • J Jeremy Falcon

                          You know... point one for loosely typed languages. I submit this... JSFiddle[^] Not that I have anything against strongly typed languages, I just smile at those that think it's the answer to everything including poverty and cancer.

                          Jeremy Falcon

                          Sander RosselS Offline
                          Sander RosselS Offline
                          Sander Rossel
                          wrote on last edited by
                          #18

                          That has nothing to do with the fact that JS is loosely typed, but the fact that JS doesn't have a char type. So '_' is just a string, equivalent to "_", and thus 3 is concatenated as though it was a string. C# would have done the same if '_' was a string and not a char. Basically, it's not loosely typed, but poorly typed :)

                          Best, Sander arrgh.js - Bringing LINQ to JavaScript SQL Server for C# Developers Succinctly Object-Oriented Programming in C# Succinctly

                          J 2 Replies Last reply
                          0
                          • I Ian Shlasko

                            He's basically doing this:

                            "1_2" + '_' + 3

                            Note that the underscore is a character, not a string (Single quotes = char, Double quotes = string). So instead of both parts being converted to strings to form "_3", it's treating the character as a number (ASCII code 95), adding 3 to it, THEN converting it to a string... So it becomes "1_2" + "98" Very subtle. I like it.

                            Proud to have finally moved to the A-Ark. Which one are you in?
                            Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                            M Offline
                            M Offline
                            Maximilien
                            wrote on last edited by
                            #19

                            Cute. Thanks.

                            I'd rather be phishing!

                            1 Reply Last reply
                            0
                            • Sander RosselS Sander Rossel

                              That has nothing to do with the fact that JS is loosely typed, but the fact that JS doesn't have a char type. So '_' is just a string, equivalent to "_", and thus 3 is concatenated as though it was a string. C# would have done the same if '_' was a string and not a char. Basically, it's not loosely typed, but poorly typed :)

                              Best, Sander arrgh.js - Bringing LINQ to JavaScript SQL Server for C# Developers Succinctly Object-Oriented Programming in C# Succinctly

                              J Offline
                              J Offline
                              Jeremy Falcon
                              wrote on last edited by
                              #20

                              It has everything to do with it bro, there is no char type in JS.... because it's loosely typed. Btw, the sky is blue. ;)

                              Jeremy Falcon

                              1 Reply Last reply
                              0
                              • Sander RosselS Sander Rossel

                                That has nothing to do with the fact that JS is loosely typed, but the fact that JS doesn't have a char type. So '_' is just a string, equivalent to "_", and thus 3 is concatenated as though it was a string. C# would have done the same if '_' was a string and not a char. Basically, it's not loosely typed, but poorly typed :)

                                Best, Sander arrgh.js - Bringing LINQ to JavaScript SQL Server for C# Developers Succinctly Object-Oriented Programming in C# Succinctly

                                J Offline
                                J Offline
                                Jeremy Falcon
                                wrote on last edited by
                                #21

                                This the part where you say, oh but it has some types... go on... do it. ;P

                                Jeremy Falcon

                                Sander RosselS 1 Reply Last reply
                                0
                                • Z ZurdoDev

                                  Is that what caused the CSS to go wack-a-doodle? :-D

                                  There are two kinds of people in the world: those who can extrapolate from incomplete data. There are only 10 types of people in the world, those who understand binary and those who don't.

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

                                  Which CSS?

                                  cheers Chris Maunder

                                  J Z 2 Replies Last reply
                                  0
                                  • L Lost User

                                    PartDivider is a char?

                                    Sin tack ear lol Pressing the any key may be continuate

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

                                    It is.

                                    cheers Chris Maunder

                                    1 Reply Last reply
                                    0
                                    • C Chris Maunder

                                      Which CSS?

                                      cheers Chris Maunder

                                      J Offline
                                      J Offline
                                      Jeremy Falcon
                                      wrote on last edited by
                                      #24

                                      Dunno for him, but for me it keeps on resetting the layout like I'm not logged in... going to compact view, back to fixed from fluid, etc. On a Mac in Chrome if that helps.

                                      Jeremy Falcon

                                      1 Reply Last reply
                                      0
                                      • F Foothill

                                        I thought that I was the only one who still uses GIMP. ;)

                                        if (Object.DividedByZero == true) { Universe.Implode(); } Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016

                                        J Offline
                                        J Offline
                                        Jeremy Falcon
                                        wrote on last edited by
                                        #25

                                        Well, now there's two of you. ;P

                                        Jeremy Falcon

                                        1 Reply Last reply
                                        0
                                        • J Jeremy Falcon

                                          This the part where you say, oh but it has some types... go on... do it. ;P

                                          Jeremy Falcon

                                          Sander RosselS Offline
                                          Sander RosselS Offline
                                          Sander Rossel
                                          wrote on last edited by
                                          #26

                                          Must... Not... Give... In... Oh crap. JavaScript DOES have some types though! It even has a typeof operator and makes use of prototypes. I'm not usually the type to correct people on the internet, but this was typically a situation that needed some clearing up. Sadly, JavaScript is the type of language I like to avoid. I'm done typing now.

                                          Best, Sander arrgh.js - Bringing LINQ to JavaScript SQL Server for C# Developers Succinctly Object-Oriented Programming in C# Succinctly

                                          J 2 Replies 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