int64 method from COM into javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Guy Jacubovs

    int64 method from COM into javascript

    Hi

    i have a property on a COM which returns int64:

    var Milliseconds=Fo rm1.Player.Abso lutePosition;


    however for somereason the typeof(Millisec onds) isn't number but unknown....

    I can't make any use of this.

    Does any one knows how can I transfer it to number?

    10x
    Guy.
  • Thomas 'PointedEars' Lahn

    #2
    Re: int64 method from COM into javascript

    Guy Jacubovs wrote:[color=blue]
    > i have a property on a COM which returns int64:[/color]

    Which COM _object_? Which user agent?
    [color=blue]
    > var Milliseconds=Fo rm1.Player.Abso lutePosition;
    >
    >
    > however for somereason the typeof(Millisec onds) isn't number but unknown....[/color]

    There is no "unknown" type and, consequently, the typeof _operator_ (no
    parantheses required) does not return an "unknown" string, only
    "number", "string", "boolean", "object" and "function". Please specify.
    [color=blue]
    > I can't make any use of this.[/color]

    With that little information I can't either and I doubt anyone else can.
    [color=blue]
    > Does any one knows how can I transfer it to number?[/color]

    Provided that the property is a 64 bit integer value it should be
    converted into a IEEE-754 double-precision floating-point number
    as this is the only number format J(ava)Script supports.


    PointedEars

    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: int64 method from COM into javascript

      Guy Jacubovs wrote:[color=blue]
      > i have a property on a COM which returns int64:[/color]

      Which COM _object_? Which user agent?
      [color=blue]
      > var Milliseconds=Fo rm1.Player.Abso lutePosition;
      >
      >
      > however for somereason the typeof(Millisec onds) isn't number but
      > unknown....[/color]

      There is no "unknown" type and, consequently, the typeof _operator_
      (no parantheses required) does not return an "unknown" string, only
      "number", "string", "boolean", "object", "function" and "undefined" .
      Please specify.
      [color=blue]
      > I can't make any use of this.[/color]

      With that little information I can't either and I doubt anyone else can.
      [color=blue]
      > Does any one knows how can I transfer it to number?[/color]

      Provided that the property is a 64 bit integer value it should be
      converted into a IEEE-754 double-precision floating-point number
      as this is the only number format J(ava)Script supports.


      PointedEars

      Comment

      • Richard Cornford

        #4
        Re: int64 method from COM into javascript

        Thomas 'PointedEars' Lahn wrote:[color=blue]
        > Guy Jacubovs wrote:[color=green]
        >> i have a property on a COM which returns int64:[/color]
        >
        > Which COM _object_? Which user agent?
        >[color=green]
        >> var Milliseconds=Fo rm1.Player.Abso lutePosition;
        >>
        >>
        >> however for somereason the typeof(Millisec onds) isn't number but
        >> unknown....[/color]
        >
        > There is no "unknown" type and, consequently, the typeof _operator_
        > (no parantheses required) does not return an "unknown" string, only
        > "number", "string", "boolean", "object", "function" and "undefined" .[/color]

        <quote cite="ECMA 262 3rd edition">
        11.4.3 The typeof Operator
        The production UnaryExpression : typeof UnaryExpression is
        evaluated as follows:

        1. Evaluate UnaryExpression .
        2. If Type(Result(1)) is not Reference, go to step 4.
        3. If GetBase(Result( 1)) is null, return "undefined" .
        4. Call GetValue(Result (1)).
        5. Return a string determined by Type(Result(4)) according to
        the following table:

        Type | Result
        -------------------------------------------------
        Undefined | "undefined"
        -------------------------------------------------
        Null | "object"
        -------------------------------------------------
        Boolean | "boolean"
        -------------------------------------------------
        Number | "number"
        -------------------------------------------------
        String | "string"
        -------------------------------------------------
        Object (native and |
        doesn't implement |
        [[Call]]) | "object"
        -------------------------------------------------
        Object (native and |
        implements [[Call]]) | "function"
        -------------------------------------------------
        Object (host) | Implementation-dependent
        </quote>

        That final "Implementa tion-dependent" means that an alien primitive
        wrapped in a host object has every right to return "unknown" if it feels
        like it (and on IE some of them do).

        Richard.


        Comment

        • Guy Jacubovs

          #5
          Re: int64 method from COM into javascript

          Hello All

          you are all missing the point,

          i don't care what typeof returns.... ;)


          Here is the definition of AbsolutePositio n in the idl:

          [propget, id(12), helpstring("pro perty AbsolutePositio n")] HRESULT
          AbsolutePositio n([out, retval] __int64 * pVal);



          All I want to is use this value in jscript.
          Every time I want to access this value as a number (of example
          division) jscript gives me an error



          10x for the replies

          Guy.

          Comment

          • Grant Wagner

            #6
            Re: int64 method from COM into javascript

            Guy Jacubovs wrote:
            [color=blue]
            > Hi
            >
            > i have a property on a COM which returns int64:
            >
            > var Milliseconds=Fo rm1.Player.Abso lutePosition;
            >
            > however for somereason the typeof(Millisec onds) isn't number but unknown....
            >
            > I can't make any use of this.
            >
            > Does any one knows how can I transfer it to number?
            >
            > 10x
            > Guy.[/color]

            typeof Milliseconds can't be "transferre d" to a number, since there doesn't
            appear to be any "AbsolutePositi on" property for the "Player" object on "Form1".

            You can _try_ something like:

            var obj = Form1.Player;
            for (var prop in obj) {
            document.write(
            prop + ' = ' + obj[prop] +
            ' (' + typeof obj[prop] + ')' +
            '<br>'
            );
            }

            to see if it lists an "absolutePositi on" or "AbsolutePositi on" property.

            --
            | Grant Wagner <gwagner@agrico reunited.com>

            * Client-side Javascript and Netscape 4 DOM Reference available at:
            *


            * Internet Explorer DOM Reference available at:
            *
            Find official documentation, practical know-how, and expert guidance for builders working and troubleshooting in Microsoft products.


            * Netscape 6/7 DOM Reference available at:
            * http://www.mozilla.org/docs/dom/domref/
            * Tips for upgrading JavaScript for Netscape 7 / Mozilla
            * http://www.mozilla.org/docs/web-deve...upgrade_2.html


            Comment

            • Thomas 'PointedEars' Lahn

              #7
              Re: int64 method from COM into javascript

              Guy Jacubovs wrote:[color=blue]
              > you are all missing the point,[/color]

              I think in fact *you* do. Since ECMAScript and implementations use
              IEEE-754 doubles only, there is no exact representation of a 64 bit
              integer value in these languages. Proof: The largest value a signed
              64 bit integer can hold is (2^63)-1 (1 MSB + 63 bits) which is
              922337203685477 5807. However, JavaScript (v1.5 in Mozilla Firefox)
              returns 922337203685477 6000 for Math.pow(2, 63)-1 because of the 64
              bits available for the floating-point number some bits are required
              for the exponent (the stored value is 9.2233720368547 760E18):

              <http://www.minet.uni-jena.de/~sack/SS04/download/IEEE-754.html>
              [color=blue]
              > i don't care what typeof returns.... ;)[/color]

              If you would have bothered to read about J(ava)Script numbers as I
              recommended previously, you would have recognized that "typeof" is
              not really your problem.
              [color=blue]
              > Here is the definition of AbsolutePositio n in the idl:
              >
              > [propget, id(12), helpstring("pro perty AbsolutePositio n")] HRESULT
              > AbsolutePositio n([out, retval] __int64 * pVal);
              >
              >
              >
              > All I want to is use this value in jscript.[/color]

              You can use only a rounded representation of it.
              [color=blue]
              > Every time I want to access this value as a number (of example
              > division) jscript gives me an error[/color]

              We are not truthsayers. Show the source and the other information
              requested previously.


              PointedEars

              Comment

              • Lasse Reichstein Nielsen

                #8
                Re: int64 method from COM into javascript

                jacubovs@yahoo. com (Guy Jacubovs) writes:
                [color=blue]
                > i have a property on a COM which returns int64:
                >
                > var Milliseconds=Fo rm1.Player.Abso lutePosition;[/color]
                [color=blue]
                > however for somereason the typeof(Millisec onds) isn't number but unknown....[/color]

                I assume you are speaking about a COM object used in Internet
                Explorer. Your best chance of getting advice about
                IE/JScript-specific programming like this (or just to finde people who
                knows what you are talking about) is the newsgroup
                <URL: news:microsoft. public.scriptin g.jscript >
                [color=blue]
                > Does any one knows how can I transfer it to number?[/color]

                My, completely unfounded, guess would be to do either
                Milliseconds.to Double()
                or
                Number(Millisec onds)

                Good luck
                /L
                --
                Lasse Reichstein Nielsen - lrn@hotpop.com
                DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
                'Faith without judgement merely degrades the spirit divine.'

                Comment

                • Dr John Stockton

                  #9
                  Re: int64 method from COM into javascript

                  JRS: In article <40D325FB.90805 00@PointedEars. de>, seen in
                  news:comp.lang. javascript, Thomas 'PointedEars' Lahn
                  <PointedEars@nu rfuerspam.de> posted at Fri, 18 Jun 2004 19:27:23 :[color=blue]
                  >
                  >We are not truthsayers.[/color]

                  You are entitled to describe yourself thusly; but not to so describe the
                  rest of us, forsooth.

                  Those who are not British are warned not to emulate Pointy-Head's misuse
                  of the English language. Others should not need the warning.

                  --
                  © John Stockton, Surrey, UK. ???@merlyn.demo n.co.uk Turnpike v4.00 MIME. ©
                  Web <URL:http://www.merlyn.demo n.co.uk/> - FAQish topics, acronyms, & links.
                  Check boilerplate spelling -- error is a public sign of incompetence.
                  Never fully trust an article from a poster who gives no full real name.

                  Comment

                  • Thomas 'PointedEars' Lahn

                    #10
                    Re: int64 method from COM into javascript

                    Oh my, I just have set up another OS and did not copy my killfile.
                    And now this again.

                    Dr John Stockton wrote:[color=blue]
                    > JRS: In article <40D325FB.90805 00@PointedEars. de>, seen in
                    > news:comp.lang. javascript, Thomas 'PointedEars' Lahn
                    > <PointedEars@nu rfuerspam.de> posted at Fri, 18 Jun 2004 19:27:23 :
                    >[color=green]
                    >> We are not truthsayers.[/color]
                    >
                    > You are entitled to describe yourself thusly; but not to so describe
                    > the rest of us, forsooth.[/color]
                    ^^^^^^^^^^^^^^
                    And you are entitled to speak for everyone else (but me)?
                    I am afraid that your arrogance grows (is?) beyond imagination.
                    [color=blue]
                    > Those who are not British[/color]

                    There are other countries on this planet that have the English language
                    as official and/or native language. The above statement of yours is
                    only another proof of your arrogant attitude.
                    [color=blue]
                    > are warned not to emulate Pointy-Head's[/color]
                    ^^^^^^^^^^^^^[color=blue]
                    > misuse of the English language. Others should not need the warning.[/color]

                    I read the term "truthsayer " in some of the "Dune" novels by Frank
                    Herbert, a great American science-fiction writer and, as I have recently
                    found out, I was simply mislead by my linguistic intuition. Of course
                    I meant a different thing; a person with prescience -- a *soothsayer*.
                    It sometimes happens that a translation that is inspired by intuition
                    is not the correct one (in German, "soothsayer " is "Wahrsager" --
                    "truth-sayer"). But it happens more often to me that my linguistic
                    intuition leads to an appropriate translation. So far for *my* use of
                    the English language.

                    And what about *yours*? There are far better ways than this to tell
                    people that they have made a mistake (and people /make/ mistakes, that
                    is how they learn to better themselves). Especially for off-topic
                    notes, there is private e-mail. Do you really think your *continuing
                    completely off-topic personal attacks* here will do (you, this
                    newsgroup, me) anything good? I wonder how and why an university
                    graduate like you continues to display such a behavior in public.
                    If I were in your place, I would be very much ashamed of it.


                    PointedEars, Score adjusted (again)

                    Comment

                    • Dr John Stockton

                      #11
                      Re: int64 method from COM into javascript

                      JRS: In article <40D4BEF0.10108 05@PointedEars. de>, seen in
                      news:comp.lang. javascript, Thomas 'PointedEars' Lahn
                      <PointedEars@nu rfuerspam.de> posted at Sun, 20 Jun 2004 00:32:16 :[color=blue]
                      >Oh my, I just have set up another OS and did not copy my killfile.
                      >And now this again.[/color]

                      If you are afraid of personal criticism, you should not post to Usenet.
                      Sticking your head in the sand by kill-filing your critics is cowardly,
                      and leaves you exposed as an arse. A better approach would be to
                      refrain from deserving such criticism - in particular, to terminate your
                      dictatorial attitude to those whose postings, while compatible with
                      Usenet custom, are in breach of some irrelevant German document.
                      [color=blue]
                      >Dr John Stockton wrote:[color=green]
                      >> JRS: In article <40D325FB.90805 00@PointedEars. de>, seen in
                      >> news:comp.lang. javascript, Thomas 'PointedEars' Lahn
                      >> <PointedEars@nu rfuerspam.de> posted at Fri, 18 Jun 2004 19:27:23 :
                      >>[color=darkred]
                      >>> We are not truthsayers.[/color]
                      >>
                      >> You are entitled to describe yourself thusly; but not to so describe
                      >> the rest of us, forsooth.[/color]
                      > ^^^^^^^^^^^^^^
                      >And you are entitled to speak for everyone else (but me)?
                      >I am afraid that your arrogance grows (is?) beyond imagination.[/color]

                      You are not entitled to describe us all as liars; there must be here at
                      least some posters who have never, intentionally or otherwise, written
                      anything but the perfect truth.

                      [color=blue][color=green]
                      >> Those who are not British[/color]
                      >
                      >There are other countries on this planet that have the English language
                      >as official and/or native language.[/color]

                      It is true that many call one of their official languages English. In
                      many of the Commonwealth countries, many inhabitants use English as good
                      as that used by the English. But in many countries where it is an
                      official language, it is sadly mistreated by the less well-educated
                      natives. That is why I wrote what I did; it expressed my meaning.

                      [color=blue]
                      > The above statement of yours is
                      >only another proof of your arrogant attitude.
                      >[color=green]
                      >> are warned not to emulate Pointy-Head's[/color]
                      > ^^^^^^^^^^^^^[color=green]
                      >> misuse of the English language. Others should not need the warning.[/color]
                      >
                      >I read the term "truthsayer " in some of the "Dune" novels by Frank
                      >Herbert, a great American science-fiction writer[/color]

                      Rather long-winded; typically Murrican. In my youth, I thought that he
                      was moderately entertaining. You, too, should grow out of that,
                      eventually. But it is never wise to presume that a term used by an SF
                      writer is a current term in the language.

                      [color=blue]
                      >and, as I have recently
                      >found out, I was simply mislead by my linguistic intuition. Of course
                      >I meant a different thing; a person with prescience -- a *soothsayer*.[/color]

                      That's right. You used a pretentious word in ignorance of its meaning.
                      It would not be good for others to mis-learn from you.

                      [color=blue]
                      >And what about *yours*? There are far better ways than this to tell
                      >people that they have made a mistake (and people /make/ mistakes, that
                      >is how they learn to better themselves). Especially for off-topic
                      >notes, there is private e-mail.[/color]

                      Irrelevant; I have no interest in educating you, a person of noxious
                      disposition; only in preventing those (a large majority) who have more
                      pleasant personalities than yours from being misinformed.

                      P.S. Also, 'borken' is not an English word. Use, as is proper,
                      'broken'.

                      --
                      © John Stockton, Surrey, UK. ???@merlyn.demo n.co.uk Turnpike v4.00 MIME. ©
                      Web <URL:http://www.merlyn.demo n.co.uk/> - FAQish topics, acronyms, & links.
                      Check boilerplate spelling -- error is a public sign of incompetence.
                      Never fully trust an article from a poster who gives no full real name.

                      Comment

                      • rh

                        #12
                        Re: int64 method from COM into javascript

                        Dr John Stockton wrote:
                        <snip>[color=blue]
                        > P.S. Also, 'borken' is not an English word. Use, as is proper,
                        > 'broken'.[/color]

                        Actually, even some of the "less well educated natives" (more often
                        referred to by the English as those "dumb colonials") know that
                        "borken" is 'net clique-speak. And, as it is apparently intended to
                        do, draws response from those suffering the rasp.

                        However, neither to my knowledge, is "Murrican" an English word. Nor
                        is (capitalized) "Merkin". Both seem to enjoy a certain amount of
                        boilerplate exposure in postings under your name. It seems then,
                        readers should be entitled to draw appropriate conclusions (beyond not
                        fully trusting this posting) based upon your signature, wouldn't you
                        say? ;)

                        ../rh

                        Comment

                        Working...