I'm building an application with a react.js front-end (although I'm fairly sure that's not relevant to the issue) and an asp.net back-end (targeting net5.0, not sure if that's relevant). When I call to the back-end API, I get back an object that includes, in part, an ID it generated based on the data passed in, that is of type long in C# (a 64 bit int). The behavior that I'm seeing is that the variable in C# and the variable read from the response on the front end are different. They appear to drift after about 16-17 digits. Is this expected? Is there any way to get around it? Code to reproduce / Pictures of what I see: C# [HttpPost] [Route(&quot;test&quot;)] public object TestPassingLongInObject() {     /* actual logic omitted for brevity */      var rv = new     {         DataReadIn = new { /* omitted */ },         ValidationResult = new ValidationResult(),         GeneratedID =  long.Parse($&quot;922337203{new Random().Next(int.MaxValue):0000000000}&quot;) // close to long.MaxValue     };      Console.WriteLine($&quot;ID in C# controller method: {rv.GeneratedID}&quot;);      return rv; }  Console output: ID in C# controller method: 9223372030653055062 Chrome Dev Tools:  When I try to access the ID on the front-end I get the incorrect ID ending in 000 instead of 062. Edit 1: It's been suggested that this is because JavaScript's Number.MAX_SAFE_INTEGER is less than the value I'm passing. I don't believe that is the reason, but perhaps I'm wrong and someone can enlighten me. On the JS side, I'm using BigInt, precisely because the number I'm passing is too large for Number. The issue is before I'm parsing the result to a JS object though (unless Chrome is doing that automatically, leading to the picture referenced in the issue). Edit 2: Based on the answers below, it looks like perhaps JS is parsing the value to a number before I'm parsing it to a BigInt, so I'm still losing precision. Can someone more familiar with the web confirm this?
1072
Is this defined by the language? Is there a defined maximum? Is it different in different browsers?
102464
I suffer from a problem of      value does not fall within the expected range   from below code.           string webUrl = "/_layouts/15/wfcourrierdep/ArticlesList.aspx";                 string fullpath = SPUtility.GetFullUrl(SPContext.Current.Site,                    webUrl);          SPFile file = web.GetFile(fullpath);   What can the cause be?
80556
What's going on?! Subtraction works fine until I get to 0.1 - 0.1. I'm in visual c# 2008 using the nonoba.com API.  Console.WriteLine("hit! " + Users[targetNum].character.health + " : " + player.character.profile.attackPower);  Users[targetNum].character.health -= player.character.profile.attackPower;  Console.WriteLine("health! " + Users[targetNum].character.health);   output:  hit! 0.1 : 0.1 health! 1.490116E-08   Thanks all - I might use the decimal type, as I'm normally adding/subtracting nice "round" numbers. For now I'll just go with:  if (Users[targetNum].character.health &lt;= 0.00001)   By the way I knew this wasn't really going to be a "bug" in c# - I thought it would either by a bug in my code or some lack of understanding, which it was.  Having read all the recommended reading, I'm going to conclude that my folly was due to normally using the ActionScript Number type, which maybe has a decimal rather than binary floating point - anyway, it would never give this output.
22068
Why is Array.Length an int, and not a uint. This bothers me (just a bit) because a length value can never be negative.   This also forced me to use an int for a length-property on my own class, because when you  specify an int-value, this needs to be cast explicitly...  So the ultimate question is: is there any use for an unsigned int (uint)? Even Microsoft seems not to use them.
25568
How is parseInt() different from valueOf() ?   They appear to do exactly the same thing to me (also goes for parseFloat(), parseDouble(), parseLong() etc, how are they different from Long.valueOf(string) ?  Also, which one of these is preferable and used more often by convention?
97242
An HTML text input has an attribute called "maxlength", implemented by browsers, which if set blocks user input after a certain number of characters.  An HTML textarea element, on the other hand, does not have this attribute. My goal is to emulate the behavior of maxlength on an HTML textarea. Requirements:   At a minimum, show (CSS change) that the user typed in too many characters. Ideally, block the user from typing more characters, as happens on an HTML input.   It is understood that server-side validation should check the length again. Here I am focusing on the client-side part only.  My question is: what is the cleanest client-side way of emulating maxlength on an HTML textarea? Ideally, point to a proven, open source, piece of JavaScript that you have used.
67748
I have a simple html block like:  &lt;span id="replies"&gt;8&lt;/span&gt;   Using jquery I'm trying to add a 1 to the value (8).  var currentValue = $("#replies").text(); var newValue = currentValue + 1; $("replies").text(newValue);   What's happening is it is appearing like:  81  then  811  not 9, which would be the correct answer.  What am I doing wrong?
78162
I collect a few corner cases and  and would always like to hear more. The page only really covers C# language bits and bobs, but I also find core .NET things interesting too. For example, here's one which isn't on the page, but which I find incredible:  string x = new string(new char[0]); string y = new string(new char[0]); Console.WriteLine(object.ReferenceEquals(x, y));   I'd expect that to print False - after all, "new" (with a reference type) always creates a new object, doesn't it? The specs for both C# and the CLI indicate that it should.  Well, not in this particular case. It prints True, and has done on every version of the framework I've tested it with. (I haven't tried it on Mono, admittedly...)  Just to be clear, this is only an example of the kind of thing I'm looking for - I wasn't particularly looking for discussion/explanation of this oddity. (It's not the same as normal string interning; in particular, string interning doesn't normally happen when a constructor is called.) I was really asking for similar odd behaviour.  Any other gems lurking out there?
107627
Is it the same convention as those used in known programming languages such as Java and C? I'm trying to create a lot of variables and I want it to start with a number, but I'm not sure if it's okay.
12285
Why would the following query return "Error converting data type varchar to bigint"?  Doesn't IsNumeric make the CAST safe?  I've tried every numeric datatype in the cast and get the same "Error converting..." error.  I don't believe the size of the resulting number is a problem because overflow is a different error.  The interesting thing is, in management studio, the results actually show up in the results pane for a split second before the error comes back.  SELECT CAST(myVarcharColumn AS bigint)   FROM myTable   WHERE IsNumeric(myVarcharColumn) = 1 AND myVarcharColumn IS NOT NULL   GROUP BY myVarcharColumn   Any thoughts?
90792
I have a couple tables in which I created an object ID as either an Int or Bigint, and in both cases, they seem to autoincrement by 10 (ie, the first insert is object ID 1, the second is object ID 11, the third is object ID 21, etc).  Two questions:   Why does it do that? Is that a problem?
48201
Environment I'm logging in using the OpenID from  and using Chrome 31.0.1650.57 m if that matters. Steps to reproduce: Log in to  and , for example, like: DECLARE @MyUserID INT = ##UserID:int##  SELECT TOP 1     Id AS [Post Link],     Score AS [Score],     CreationDate AS [Creation Date] FROM     Posts WHERE     OwnerUserId = @MyUserID AND     PostTypeId IN (2, 3) ORDER BY     CreationDate DESC  Then press the Run Query button and see if the UserID field is filled with your own user ID like shown in the below screenshot:  Question: Did something changed on the ##UserID## parameter (for example, that it's not supported anymore)?  If so, then there is an outdated  paragraph about it (What's the point of logging in). If not, it is a bug which is there about three days (I've been waiting since I noticed that you were going to do some changes to Data Explorer, but it remains there, hence my question).
107776
For the following URL, JavaScript breaks:  https://stackoverflow.com/questions/16356382/splitting-a-braces-grouped-string-in-python/16356421?noredirect=1#comment23433042_16356421   This is a link to a , the answer I can see as a 10K+ user (although users &lt;10k ).  With Chrome (26, Mac OS X) the console sez:  Uncaught TypeError: Cannot call method 'replace' of undefined   for line 83 of full.js.  Firefox (20, Mac still), the web console spits out:  [12:48:28.459] TypeError: c.attr(...) is undefined @ http://cdn.sstatic.net/js/full.js?v=c9131e40e3fb:83   Safari (6.0.4 on, you guessed it, Mac OS X) has this to complain about:  TypeError: 'undefined' is not an object (evaluating 'c.attr("id").replace')   for line 83 of full.js.  Because of this, the Answer text box on Stack Overflow is lacking all niceties such as an actual WMD editor.  If you remove the hash reference #comment23433042_16356421 from the end of the URL, things work again. Removing the ?noredirect=1 query parameter makes no difference.
6181
Something very odd is happening here.   I have a query that looks like this.  SELECT CAST(FT.DOP AS SMALLINT) FROM TRACKING_DATA WHERE date &gt; @mydate and identifier = 0000000000   When run as a raw query it returns data just fine.  When i place it in a stored procedure that alters the where clause it throws this error.  Msg 244, Level 16, State 2, Procedure myprocedure, Line 107 [Batch Start Line 2] The conversion of the varchar value '58629' overflowed an INT2 column. Use a larger integer column.   So here is the oddity. I go through all the possible data for that where clause with a query like this.  SELECT DISTINCT DOP FROM TRACKING_DATA where identifier = 000000000000   and  SELECT DISTINCT CAST(DOP AS smallint) FROM TRACKING_DATA where identifier = 000000000000   And this is what i get back.  17 12 9 19 8 14 6 16 11 13 7 10 0 18 5 15 4   Nowhere does it have anything remotely too large for a SMALLINT. So i thought, ok maybe its a non-printable ASCII character. But i can't find any.  I'm a little perplexed at the moment. It runs find as a raw query, explodes as a procedure and all possible data based on the where is valid. My only suspicion is that the query plan is doing something odd with filtering or maybe runs with different validation when run as a procedure.
18604
I've been trying out React for a couple of days and I tried to build a button component with some conditionals. Everything works but I feel like I am not doing it the right way. Could anyone review my code and give me some advice and tell me what I am doing wrong or what i could do better. I think I am using too many return statements. I use Typescript for type checking. Would appreciate any help! import { Link } from &quot;gatsby&quot;;  interface Props {   content: string,   color: string,   path?: string,   type?: string }  export default function Button(props: Props): JSX.Element {   let elementType;    const checkProps = () =&gt; {     const availableColors = ['blue', 'grey', 'dark-grey', 'white'];     const borderColors = [''];     let buttonStyle;      // Check if props.color exists in availableColors     if(!availableColors.includes(props.color)) {       console.error(`&quot;${props.color} color key not available for button style`);       return;     }          buttonStyle = buttonStyles[`button--${props.color}`];      // Check if props.content is valid     if(!props.content) {       console.error(`&quot;${props.content} is not valid as content`);       return;     }      // Check if props.type exists     if(!props.type) {       elementType = &lt;button className={ buttonStyle }&gt;{ props.content }&lt;/button&gt;       return;     }      if(props.type !== 'link') {       console.error(`&quot;${props.type} is not a valid type, use 'link' instead or use nothing for default button`);       return;     } else {         elementType = &lt;Link to={ props.path } className={ buttonStyle }&gt;{ props.content }&lt;/Link&gt;     }   }    checkProps();    return (     &lt;React.Fragment&gt;       { elementType }     &lt;/React.Fragment&gt;   ); }```
26736
Is there any way of doing something like,  &lt;script runat=server&gt;     Platform.Load("core","1");     //initialize DE     var _Sent = DataExtension.Init("_Sent");     //retrieve data     var _Sent_data = _Sent.Rows.Retrieve();     Write("Length: " + _Sent_data.length); //returns 0 &lt;/script&gt;   What would the external key for a system dataview be?
100781
When using an Int- or FloatProperty, is there any way of changing their min and max values dynamically?  I'm currently loading images on the fly and would like to limit a frame property to run from 0 to len(loaded_images) every time I call the loading operator. However, the property seems to be read-only and re-assigning gives the following error:  bpy.context.scene.project_props.bl_rna.properties['myIntProp'] = bpy.props.IntProperty(...) TypeError: bpy_prop_collection[key] = value: invalid, expected a StructRNA type or None, not a tuple   I understand the bpy.props constructor uses an intermediary tuple, but I'm not sure how to proceed. Is there any way around this?