Bug of the Day
-
string objectRefGuid = objectRef.ObjectTypeId.ToString() + PartDivider + objectRef.ObjectId;
if (objectRef.VersionNumber > 0)
objectRefGuid += PartDivider + objectRef.VersionNumber;ObjectTypeId
is 1,ObjectId
is 2, andVersionNumber
is 3.PartDivider
is '_'. The expected result was 1_2_3. The output was 1_298. :doh:cheers Chris Maunder
-
string objectRefGuid = objectRef.ObjectTypeId.ToString() + PartDivider + objectRef.ObjectId;
if (objectRef.VersionNumber > 0)
objectRefGuid += PartDivider + objectRef.VersionNumber;ObjectTypeId
is 1,ObjectId
is 2, andVersionNumber
is 3.PartDivider
is '_'. The expected result was 1_2_3. The output was 1_298. :doh:cheers Chris Maunder
Implicit conversions are always a pain. :) More importantly, why is it called
objectRef**Guid**
when it doesn't contain aGuid
?
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
string objectRefGuid = objectRef.ObjectTypeId.ToString() + PartDivider + objectRef.ObjectId;
if (objectRef.VersionNumber > 0)
objectRefGuid += PartDivider + objectRef.VersionNumber;ObjectTypeId
is 1,ObjectId
is 2, andVersionNumber
is 3.PartDivider
is '_'. The expected result was 1_2_3. The output was 1_298. :doh:cheers Chris Maunder
-
Implicit conversions are always a pain. :) More importantly, why is it called
objectRef**Guid**
when it doesn't contain aGuid
?
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Guid = globally unique identifier. In our case it's globally unique where we define "global" as being in the scope of the application. (It's kinda like the World Series ;))
cheers Chris Maunder
-
Now assume you are really in a production Environment... Sorry to say that, but a lot what happens here is never allowed in production. Bruno
Enlighten us.
cheers Chris Maunder
-
Enlighten us.
cheers Chris Maunder
-
string objectRefGuid = objectRef.ObjectTypeId.ToString() + PartDivider + objectRef.ObjectId;
if (objectRef.VersionNumber > 0)
objectRefGuid += PartDivider + objectRef.VersionNumber;ObjectTypeId
is 1,ObjectId
is 2, andVersionNumber
is 3.PartDivider
is '_'. The expected result was 1_2_3. The output was 1_298. :doh:cheers Chris Maunder
Care to explain for those (me) who do not C# ? Someone say it is related to "Implicit conversions" ? Thanks.
I'd rather be phishing!
-
Enlighten us.
cheers Chris Maunder
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
-
string objectRefGuid = objectRef.ObjectTypeId.ToString() + PartDivider + objectRef.ObjectId;
if (objectRef.VersionNumber > 0)
objectRefGuid += PartDivider + objectRef.VersionNumber;ObjectTypeId
is 1,ObjectId
is 2, andVersionNumber
is 3.PartDivider
is '_'. The expected result was 1_2_3. The output was 1_298. :doh:cheers Chris Maunder
-
string objectRefGuid = objectRef.ObjectTypeId.ToString() + PartDivider + objectRef.ObjectId;
if (objectRef.VersionNumber > 0)
objectRefGuid += PartDivider + objectRef.VersionNumber;ObjectTypeId
is 1,ObjectId
is 2, andVersionNumber
is 3.PartDivider
is '_'. The expected result was 1_2_3. The output was 1_298. :doh:cheers Chris Maunder
-
string objectRefGuid = objectRef.ObjectTypeId.ToString() + PartDivider + objectRef.ObjectId;
if (objectRef.VersionNumber > 0)
objectRefGuid += PartDivider + objectRef.VersionNumber;ObjectTypeId
is 1,ObjectId
is 2, andVersionNumber
is 3.PartDivider
is '_'. The expected result was 1_2_3. The output was 1_298. :doh:cheers Chris Maunder
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 !~
-
Care to explain for those (me) who do not C# ? Someone say it is related to "Implicit conversions" ? Thanks.
I'd rather be phishing!
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) -
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 !~
-
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) -
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 !~
-
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 !~
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)
-
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 !~
-
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
-
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)Cute. Thanks.
I'd rather be phishing!
-
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
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