<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Putting Your Own Hex On Your VBScript</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/08/30/222760.aspx</link><description>Here's a fragment of an email I received last week: bigValue = 4294967295 Wscript.Echo Hex(bigValue) I would like this to display FFFFFFFF, but instead get the error "Overflow: bigValue What's up with that? The Hex function only works on numbers which</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Putting Your Own Hex On Your VBScript</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/08/30/222760.aspx#9881376</link><pubDate>Sun, 23 Aug 2009 09:05:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9881376</guid><dc:creator>francis d</dc:creator><description>&lt;p&gt;Is there some reason why you didn't use &amp;quot;mod&amp;quot; and &amp;quot;\&amp;quot;?&lt;/p&gt;
&lt;p&gt;Also, I always thought that the function name was used like a return statement, until I tried putting my own hex on my vbscript and got some unexpected results.&lt;/p&gt;
&lt;p&gt;I guess I'll just have to read six years worth of blogs. :-)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9881376" width="1" height="1"&gt;</description></item><item><title>re: Putting Your Own Hex On Your VBScript</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/08/30/222760.aspx#2208693</link><pubDate>Fri, 20 Apr 2007 19:06:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2208693</guid><dc:creator>Eric Lippert</dc:creator><description>&lt;p&gt;That number is too big to fit into an integer, so it automatically goes into a double. &amp;nbsp;It is too big to fit into a double without rounding.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2208693" width="1" height="1"&gt;</description></item><item><title>re: Putting Your Own Hex On Your VBScript</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/08/30/222760.aspx#2208584</link><pubDate>Fri, 20 Apr 2007 18:52:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2208584</guid><dc:creator>SgtRedline</dc:creator><description>&lt;p&gt;Just a quick note to anyone who might come across this, it's not always correct. &amp;nbsp;I haven't figured out where it is going wrong yet, but:&lt;/p&gt;
&lt;p&gt;MyHex(144616027440256497) returns 201C782C0679600 which is incorrect. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;It should be 201C782C06795F1&lt;/p&gt;
&lt;p&gt;My best guess is that it is a matter of rounding. &amp;nbsp;I came across it when trying to work with MS Fax job ids.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2208584" width="1" height="1"&gt;</description></item><item><title>re: Putting Your Own Hex On Your VBScript</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/08/30/222760.aspx#225194</link><pubDate>Fri, 03 Sep 2004 12:31:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:225194</guid><dc:creator>zwetan</dc:creator><description>in the philosophy to make JScript.NET a more richer language and from its ECMAScript nature&lt;br&gt;why not allow at least to extend the build-in class ?&lt;br&gt;&lt;br&gt;like it has been discussed here:&lt;br&gt;&lt;a target="_new" href="http://blogs.msdn.com/ericgu/archive/2004/07/01/171149.aspx"&gt;http://blogs.msdn.com/ericgu/archive/2004/07/01/171149.aspx&lt;/a&gt;&lt;br&gt;&lt;br&gt;this kind of feature is a good candidate for JScript.NET no ?&lt;br&gt;&lt;br&gt;modifying or adding to build-in objects in ECMAScript is an old problem&lt;br&gt;&lt;a target="_new" href="http://groups.google.fr/groups?hl=fr&amp;amp;lr=&amp;amp;ie=UTF-8&amp;amp;c2coff=1&amp;amp;threadm=7b717m%24ag71%40secnews.netscape.com&amp;amp;rnum=9&amp;amp;prev=/groups%3Fq%3Dprototypes%2Bgroup:netscape.public.mozilla.jseng%26hl%3Dfr%26lr%3D%26ie%3DUTF-8%26c2coff%3D1%26selm%3D7b717m%2524ag71%2540secnews.netscape.com%26rnum%3D9"&gt;http://groups.google.fr/groups?hl=fr&amp;amp;lr=&amp;amp;ie=UTF-8&amp;amp;c2coff=1&amp;amp;threadm=7b717m%24ag71%40secnews.netscape.com&amp;amp;rnum=9&amp;amp;prev=/groups%3Fq%3Dprototypes%2Bgroup:netscape.public.mozilla.jseng%26hl%3Dfr%26lr%3D%26ie%3DUTF-8%26c2coff%3D1%26selm%3D7b717m%2524ag71%2540secnews.netscape.com%26rnum%3D9&lt;/a&gt;&lt;br&gt;&lt;br&gt;sorry to have added so much Off Topic ot the original post but it's hard to refrain oneself to talk about such interesting JScript subject :)&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=225194" width="1" height="1"&gt;</description></item><item><title>re: Putting Your Own Hex On Your VBScript</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/08/30/222760.aspx#224933</link><pubDate>Thu, 02 Sep 2004 21:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:224933</guid><dc:creator>Eric Lippert</dc:creator><description>You mean, is there a reason why overriding a built-in function is legal in the first place?   &lt;br&gt;&lt;br&gt;Not any good one as far as I know.  AFAIK, that was an accident of how the name table was built.  Probably the built-in functions should have been marked as non-assignable when the table is constructed.&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=224933" width="1" height="1"&gt;</description></item><item><title>re: Putting Your Own Hex On Your VBScript</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/08/30/222760.aspx#224728</link><pubDate>Thu, 02 Sep 2004 15:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:224728</guid><dc:creator>Alex Angelopoulos</dc:creator><description>I wish we could do this as a threaded newsgroup... microsoft.public.ericlippert.moderated, anyone? ;)&lt;br&gt;Sidetracking from the hex issue...&lt;br&gt;&lt;br&gt;We discussed overriding internal functions in the newsgroups a few months ago and did come up with some unusual uses. Obviously not very useful ones since I don't recall any now. :)&lt;br&gt;I do recall noting some more granular details, no doubt due to how the engine loads. For example, you CANNOT redefine a named function to be a Const without throwing an error. You CAN define it as a variable, but you have to explicitly dimension it first:&lt;br&gt;&lt;br&gt;Dim Mid: Mid = 95&lt;br&gt;WScript.Echo Mid&lt;br&gt;&lt;br&gt;Out of curiosity, is there a reason for this? Or is it merely a side effect of Active Scripting language structure?  I've seen people get themselves into trouble with this, but it's never been earth-shattering...&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=224728" width="1" height="1"&gt;</description></item><item><title>re: Putting Your Own Hex On Your VBScript</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/08/30/222760.aspx#224666</link><pubDate>Thu, 02 Sep 2004 13:54:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:224666</guid><dc:creator>Mat Hall</dc:creator><description>I'm with Eric K on this.  Sure, FFFFFFFF as a long is -1, but if you're converting hex to dec or dec to hex, you're almost certainly not interested in signs.  Perhaps an optional parameter to the Hex() function may have helped:  Hex(Value As Long[, Signed As Boolean])&lt;br&gt;&lt;br&gt;I ran across a related aspect of this recently -- I was writing an simple encryption utility (in VBA of all things -- my company apparently can't afford to buy me VB) and wanted to work on QWords.  However, all the built in math functions treat them as longs so they're signed, and a problem arises if there are four FFs in a row in the source file.  In the end I had to do calculations on the individual bytes, as apparently FFFFFFFF - 1 is -2...&lt;br&gt;&lt;br&gt;So, either &amp;quot;fix&amp;quot; the Hex operations, or give me unsingned QWords!  (On the other hand, I learnt an awful lot about optimising math routines which I would never have known beforehand. :)&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=224666" width="1" height="1"&gt;</description></item><item><title>re: Putting Your Own Hex On Your VBScript</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/08/30/222760.aspx#224082</link><pubDate>Wed, 01 Sep 2004 17:19:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:224082</guid><dc:creator>Eric Lippert</dc:creator><description>Zwetan:&lt;br&gt;&lt;br&gt;The reason we need classes in JScript .NET to work with ASP.NET is because ASP.NETs very programming model is to generate a page class that extends and is extended by other page classes.  It requires an inheritance model, not a prototype model.&lt;br&gt;&lt;br&gt;More generally though, we wanted to make JScript .NET a much richer language than C#.  It has class-based and prototype based inheritance, first-class functions, closures, etc.  But at the same time, we wanted to enable the programming-in-the-large features of languages like C# so that developers could have the best of both worlds -- leveraging their JScript skills while still being able to write large, typesafe programs.&lt;br&gt;&lt;br&gt;&amp;gt; What I found flawed with JScript.NET AND ECMAScript4 proposal is the change of nature to class-based, this is simply not logic for me. &lt;br&gt;&lt;br&gt;You can still use prototypes.  We're adding stuff, not taking it away.  Very few features don't work in fast mode.&lt;br&gt;&lt;br&gt;&amp;gt; for example when writing JScript.NET in fast mode you got theses modifiers: public, private, protected, internal. for me the logic way to add modifiers to JScript would have been to follow ECMA-262 and use these: readonly, dontenum, dontdelete, internal. &lt;br&gt;&lt;br&gt;You are misunderstanding the spec.  You're confusing the metalanguage of the spec with the ECMAScript language it describes.  (This is a very common mistake which I made myself on many occasions when first reading the spec!)&lt;br&gt;&lt;br&gt;dontenum, etc, are not modifiers for developers to put on objects; they are simply shorthand descriptions of how conforming implementations behave.  &lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=224082" width="1" height="1"&gt;</description></item><item><title>re: Putting Your Own Hex On Your VBScript</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/08/30/222760.aspx#224075</link><pubDate>Wed, 01 Sep 2004 17:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:224075</guid><dc:creator>Eric Lippert</dc:creator><description>Eric K: Nowhere in your rant do you give any justification for the behaviour you desire other than &amp;quot;it's correct&amp;quot;.  &lt;br&gt;&lt;br&gt;We can have that argument if you'd like, but first we should have arguments like &amp;quot;if I calculate 2^54 + 1, I end up with 2^54, which is clearly incorrect&amp;quot;, and &amp;quot;if I divide 1000000 / 3 I end up with an answer that is incorrect by several millionths&amp;quot;, etc.  &lt;br&gt;&lt;br&gt;After you have those arguments a few dozen times you realize that strict mathematical correctness is a whole lot harder to implement, and has very little practical efficacy for the majority of problems faced by typical programmers.&lt;br&gt;&lt;br&gt;Hex was implemented to show the underlying bits in an integer encoded as hex text simply because that's the most common usage case for developers.  The vast majority of the time you're using the Hex function, you're doing it to, say, display an HRESULT.  HRESULTs are never displayed as negative hex numbers, even though when interpreted as signed integers, they are.  &lt;br&gt;&lt;br&gt;Is &amp;quot;FFFFFFFF&amp;quot; the correct answer?  Who cares?  It's the BY DESIGN answer.   If you don't like that design because it doesn't meet your needs, well, you should have lobbied for that change when the function was first implemented back in, uh, 1992 or so.  It's been like this for a decade.&lt;br&gt;&lt;br&gt;The real rant should be &amp;quot;why doesn't the documentation say all this?&amp;quot;  And indeed, I'm irked that it doesn't.  But that's why I'm here -- to get this stuff out on the internet.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=224075" width="1" height="1"&gt;</description></item><item><title>re: Putting Your Own Hex On Your VBScript</title><link>http://blogs.msdn.com/b/ericlippert/archive/2004/08/30/222760.aspx#224068</link><pubDate>Wed, 01 Sep 2004 17:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:224068</guid><dc:creator>zwetan</dc:creator><description>&lt;br&gt;ok let's take this challenge :)&lt;br&gt;&lt;br&gt;in ASP.NET with JScript.NET fast mode&lt;br&gt;as you explain in &amp;quot;Global State On Servers Considered Harmful&amp;quot;&lt;br&gt;&lt;br&gt;the class page are run in the same application domain, humm.. better rephrase that, the class astract page generate instances that may be run in the same application domain.&lt;br&gt;&lt;br&gt;on the contrary in ASP.NET with comptability mode or simply in ASP (not .NET), each JScript page are instance created in independant space.&lt;br&gt;(kind of the same behaviour of WSF job package with WSH)&lt;br&gt;&lt;br&gt;I don't say that the actual ASP.NET model is flawed, on the contrary I found it great especially the code-behind feature, I'm just worried that this model force people to think class-based and when it comes to JSCript.NET I will choose C# and simply dump JScript.NET, just because C# is more suited in my opinion for class-based organization (and the fastest).&lt;br&gt;&lt;br&gt;What I found flawed with JScript.NET AND ECMAScript4 proposal is the change of nature to class-based, this is simply not logic for me.&lt;br&gt;&lt;br&gt;for example when writing JScript.NET in fast mode you got theses modifiers: public, private, protected, internal.&lt;br&gt;&lt;br&gt;for me the logic way to add modifiers to JScript would have been to follow ECMA-262 and use these: readonly, dontenum, dontdelete, internal.&lt;br&gt;&lt;br&gt;and now another challenge, do you see how these ECMA-262 inspired modifiers (readonly, dontenum ...) could have been used in JSCript.NET to add new method to build-in object prototype and in ASP.NET without generating race condition ?&lt;br&gt;&lt;br&gt;note: I don't say that to attack you, I have much respect for all the knowledge you share on your blog and sorry if my english bring confusion but it's not my natural language.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=224068" width="1" height="1"&gt;</description></item></channel></rss>