array question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Barrows [MVP]

    #16
    Re: array question

    Anthony Jones wrote:
    For that reason I don't think the "ASP is not VBScript" rebuke is ever
    justified. We need to remember that a lot of people developing with
    ASP aren't hardened 'classically' trained programmers.
    >
    We're here to educate aren't we (Well ... I am. I try very hard not to just
    give the quick fix)? People who talk about writing ASP code need to be
    informed that their terminology is incorrect. I really do not consider that
    to be a rebuke.


    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Comment

    • Bob Barrows [MVP]

      #17
      Re: array question

      Dave Anderson wrote:
      Evertjan. wrote:
      >>>Like when using the Split function but the actual number
      ^^^^^^^^^^^^^^
      >>
      >Only if vbs is assumed, not in jscript.
      >
      In principle, I agree that VBScript questions posing as ASP questions
      deserve the "ASP is not VBScript" rebuke,
      Wait a minute, you seem to be implying that vbscript or jscript syntax
      questions are not really on-topic here. Am I reading too much into this
      statement?
      --
      Microsoft MVP - ASP/ASP.NET
      Please reply to the newsgroup. This email account is my spam trap so I
      don't check it very often. If you must reply off-line, then remove the
      "NO SPAM"


      Comment

      • Bob Barrows [MVP]

        #18
        Re: array question

        Mike Brind wrote:
        Dave Anderson wrote:
        >Anthony Jones wrote:
        >>If you are working on an ASP page and have a problem with
        >>syntax the human thing to do is ask other developers in
        >>your community. In this case the community is this NG.
        >>
        >I do not agree. If you have a problem with syntax, then you are
        >likely to be posting here for the first time (or thereabout). This
        >forum was not already "your community" because you would have been
        >reading it for some time, and would know the difference between
        >microsoft.publ ic.scripting.vb script and
        >microsoft.publ ic.inetserver.a sp.general. If it were "your
        >community", you would have an interest in keeping it tidy.
        >>
        >
        Interesting....
        >
        If you took out all the server-side scripting questions from this
        group, and all the db-related ones (which obviously belong in other
        groups), not to mention all the IIS related questions, this group
        would
        be an ex-group. It would cease to be. It will have shuffled off this
        mortal coil. It would be dead.
        Why would anyone want to to that? Who said we should be doing that?
        Everything you've mentioned is on-topic (well ... maybe not db, but even
        those)...

        Let me go back and read this thread. I though the discussion was about
        whether or not it was correct to assume a poster was asking a vbscript
        question as opposed to jscript ....

        OK, I think I see what you are talking about in Dave's post. I will reply to
        that.

        --
        Microsoft MVP - ASP/ASP.NET
        Please reply to the newsgroup. This email account is my spam trap so I
        don't check it very often. If you must reply off-line, then remove the
        "NO SPAM"


        Comment

        • Bob Barrows [MVP]

          #19
          Re: array question

          Bob Barrows [MVP] wrote:
          the other john wrote:
          >Yikes. what happened here? didn't count on all of this...
          >>
          >so the moral of the story is you don't want me posting VB questions
          >in here?
          >
          Actually, since VB is not used in ASP (except as an external component) we
          really would rather not address VB questions here. VBScript questions, when
          they involve server-side code, are certainly welcome.


          --
          Microsoft MVP - ASP/ASP.NET
          Please reply to the newsgroup. This email account is my spam trap so I
          don't check it very often. If you must reply off-line, then remove the
          "NO SPAM"


          Comment

          • Anthony Jones

            #20
            Re: array question


            "Bob Barrows [MVP]" <reb01501@NOyah oo.SPAMcomwrote in message
            news:eHg%23udWv GHA.4160@TK2MSF TNGP06.phx.gbl. ..
            Anthony Jones wrote:
            >
            For that reason I don't think the "ASP is not VBScript" rebuke is ever
            justified. We need to remember that a lot of people developing with
            ASP aren't hardened 'classically' trained programmers.
            >
            We're here to educate aren't we (Well ... I am. I try very hard not to
            just
            give the quick fix)? People who talk about writing ASP code need to be
            informed that their terminology is incorrect. I really do not consider
            that
            to be a rebuke.
            >
            Your point is well made. I retract. I guess I'm easily irked by the
            pendantic amongst us and that can cloud my judgement. I still think it as
            you do that the OP was reasonably placed here.
            >
            --
            Microsoft MVP - ASP/ASP.NET
            Please reply to the newsgroup. This email account is my spam trap so I
            don't check it very often. If you must reply off-line, then remove the
            "NO SPAM"
            >
            >

            Comment

            • Evertjan.

              #21
              Re: array question

              Mike Brind wrote on 11 aug 2006 in
              microsoft.publi c.inetserver.as p.general:
              >
              Evertjan. wrote:
              >Mike Brind wrote on 10 aug 2006 in
              >microsoft.publ ic.inetserver.a sp.general:
              >>
              the other john wrote:
              >Is there a way or a property that can tell me how many items are
              >in an array? Like when using the Split function but the actual
              >number of created array items is unknown? I need to be able to
              >dynamically count the number of items that are created as a result
              >of using Split().
              >>
              >
              Ubound()
              >
              >>
              >Only if vbs is assumed, not in jscript.
              >>
              >
              I _always_ assume vbscript. Users of jscript/javascript or perl tend
              to announce themselves (in a tone of voice that varies between proud,
              or aggressively defensive ).
              [skipping a lot of following and diverging thread lines resulting from
              here]

              You can see the OP asked a Q that can be answered
              with a vbscript answer or an jscript answer,
              if the word "function" can be extended to "method",
              which is a function in the broader sence too.

              My one row addition, which is only a rebuke in the most suspicious of
              minds, and I know Mike's mind is not, is just that _I_ would have
              answered:

              "Ubound() in vbscript"

              I cannot agree with Mike it is a good thing to assume vbs in an anwer
              where vbs is not stipulated in the question in his ASP NG.
              The "asp = vbscript" concept does not aggree with me.

              =============

              I would have added that the number of terms
              of a jscript array is not as easily defined:

              var a = new Array();
              a[0] = 5;
              a[999] = 'Hi';
              a['saved'] = 4;

              is the last one part of the array, and the number of terms 3?
              or is the number 1001?

              Let us try a.length:

              var a = new Array();
              a[0] = 5;
              a[999] = 'Hi';
              response.write( a.length+'<br>' ) // writes 1000
              a['saved'] = 4;
              response.write( a.length) // writes 1000 again

              I think length does not return the actual number of terms,
              so a count is necessary:

              var a = new Array();
              a[0] = 5;
              a[999] = 'Hi';
              a['saved'] = 4;
              var n = 0;
              for (t in a)n++;
              response.write( n); // 3

              That is the right jscript answer, methinks,
              depending on definition of "array" and "terms".

              --
              Evertjan.
              The Netherlands.
              (Please change the x'es to dots in my emailaddress)

              Comment

              • Anthony Jones

                #22
                Re: array question


                "Dave Anderson" <NYRUMTPELVWH@s pammotel.comwro te in message
                news:%233wIkkUv GHA.4756@TK2MSF TNGP02.phx.gbl. ..
                Anthony Jones wrote:
                If you are working on an ASP page and have a problem with
                syntax the human thing to do is ask other developers in
                your community. In this case the community is this NG.
                >
                I do not agree. If you have a problem with syntax, then you are likely to
                be
                posting here for the first time (or thereabout). This forum was not
                already
                "your community" because you would have been reading it for some time, and
                would know the difference between microsoft.publi c.scripting.vbs cript and
                microsoft.publi c.inetserver.as p.general. If it were "your community", you
                would have an interest in keeping it tidy.
                >
                Nah, I like the idea of people who doing similar things talking to each
                other in same place about the various things they have to do. You're right
                of course it would keep things tidy.
                >
                >
                For that reason I don't think the "ASP is not VBScript" rebuke
                is ever justified. We need to remember that a lot of people
                developing with ASP aren't hardened 'classically' trained
                programmers.
                >
                By that reasoning, none of these are justified:
                >
                JavaScript is not Java
                ASP.NET is not ASP
                Client-side is not server-side
                (D)HTML is not ASP
                >
                Yep right again.
                >
                >
                My point, if you read it carefully, is that the rebuke need not be rude,
                and
                ought to be instructive. There *is* value in asking people to use
                appropriate groups.
                Within reason but a purely VBScript question is IMO appropriately asked
                here. Whether it's right or wrong and whether you like it or not the NGs
                _have_ become communities of people doing similar things. The original
                technical sectioning of the NGs has been usurped by the what those technical
                things are generally used for.
                >The last thng we need is a bunch of posts about the
                conflict Lebanon.
                >
                >
                >
                If you were to look at the posts in VBScript and Javascript
                groups without knowing the names of the groups you might
                concluded the VBScript = Automated Administration and
                Javascript = DHTML. It's hardly fair then to complain when
                someone posts a VBScript question in the ASP group.
                >
                Who complained? I advocated instructive examples that make the point.
                >
                Ok compliant was too strong a word. I don't even think it makes sense to
                try to encourage someone to use what is technically the correct group if the
                question is reasonable relevant to the community. An ASPer can take a one
                look at the set of subjects in VBscript and reasonable conclude they are in
                the wrong place.
                >
                >
                JScript/Javascript/ECMAScript (seen rebukes about use of
                these terms as well) is simply a more elegant and ultimately
                a more powerfull language.
                >
                I can't agree that JScript is more powerful than VBScript. I cannot think
                of
                a single task that JScript can solve, but that VBScript cannot.
                Well that statement is true for pretty much anything that can assign
                variables and branch. It's a matter of how quickly you can build the code
                and how understandable it is when you've built it.
                >I don't
                consider it *convenient* to use the Class Statement (or 4*atn(1) in place
                of
                Math.PI), but I don't deny that there are routes to solutions in VBScript.
                >
                And let's face it, VBScript often runs faster than JScript on the server.
                >
                >
                >
                --
                Dave Anderson
                >
                Unsolicited commercial email will be read at a cost of $500 per message.
                Use
                of this email address implies consent to these terms.
                >
                >

                Comment

                • Dave Anderson

                  #23
                  Re: array question

                  Evertjan. wrote:
                  var a = new Array();
                  a[0] = 5;
                  a[999] = 'Hi';
                  response.write( a.length+'<br>' ) // writes 1000
                  a['saved'] = 4;
                  response.write( a.length) // writes 1000 again
                  >
                  I think length does not return the actual number of terms,
                  so a count is necessary:
                  ECMA-262v3, 15.4.5.2 length
                  The length property of this Array object is always
                  numerically greater than the name of every property
                  whose name is an array index.


                  --
                  Dave Anderson

                  Unsolicited commercial email will be read at a cost of $500 per message. Use
                  of this email address implies consent to these terms.


                  Comment

                  • Evertjan.

                    #24
                    Re: array question

                    Dave Anderson wrote on 11 aug 2006 in
                    microsoft.publi c.inetserver.as p.general:
                    Evertjan. wrote:
                    >var a = new Array();
                    >a[0] = 5;
                    >a[999] = 'Hi';
                    >response.write (a.length+'<br> ') // writes 1000
                    >a['saved'] = 4;
                    >response.write (a.length) // writes 1000 again
                    >>
                    >I think length does not return the actual number of terms,
                    >so a count is necessary:
                    >
                    ECMA-262v3, 15.4.5.2 length
                    The length property of this Array object is always
                    numerically greater than the name of every property
                    whose name is an array index.
                    Sorry, I do not understand this ECMA sentence.

                    A property is a value? Or has a value?

                    How can something be greater than the name?
                    [Meaning no insult to the Jewish faith]

                    Wat would be the name of the length property? "length"?

                    Is a name not an array index if it is enumerated?

                    What where thos ECMA boys and girls doing
                    the day they concocted this ruling?

                    Anyway, I thought we were talking JScript? ;-)

                    --
                    Evertjan.
                    The Netherlands.
                    (Please change the x'es to dots in my emailaddress)

                    Comment

                    • Dave Anderson

                      #25
                      Re: array question

                      Bob Barrows [MVP] wrote:
                      Wait a minute, you seem to be implying that vbscript or
                      jscript syntax questions are not really on-topic here.
                      Am I reading too much into this statement?
                      I think so. I don't personally mind that questions are off-topic when they
                      are clearly *related* to ASP. I think it is often reasonable to ask ADO,
                      CDO, SQL, VBScript, JScript, DOM and HTML questions here. You can observe
                      for yourself that I answer questions on a broad range of topics.

                      I intended to say that posters should be made aware when their questions are
                      unnecessarily vague[1]. It is in their interests to narrow their questions,
                      after all.

                      Your observation to Anthony echoes my belief. People SHOULD be taught to use
                      correct terminology. Some of us are just less personable in our writing
                      style.




                      [1] "Rebuke" was a poor word choice -- a bit harsher to read than I
                      intended. It is no help that communicating in plain text adds to the
                      perception of pointless pedantry on my part.

                      --
                      Dave Anderson

                      Unsolicited commercial email will be read at a cost of $500 per message. Use
                      of this email address implies consent to these terms.


                      Comment

                      • Dave Anderson

                        #26
                        Re: array question

                        Evertjan. wrote:
                        > ECMA-262v3, 15.4.5.2 length
                        > The length property of this Array object is always
                        > numerically greater than the name of every property
                        > whose name is an array index.
                        >
                        Sorry, I do not understand this ECMA sentence.
                        It means that when you enumerate the properties of an array object, some of
                        them are nonnegative integers, which are treated by the array as index
                        values:

                        a[0] = 5;
                        a[999] = 'Hi';
                        a['saved'] = 4;
                        for (var x in a) output(x) // "0", "999", "saved"
                        for (x in a) output(typeof x) // "string", "string", "string"

                        In this example, there is a property named "0", another named "999" and a
                        third named "saved". Two coerce to nonnegative integers, so they are treated
                        like index values.
                        Wat would be the name of the length property? "length"?
                        I assume so.


                        Is a name not an array index if it is enumerated?
                        I'm not sure what you mean here. Hopefully, my above answer clears it up.


                        Anyway, I thought we were talking JScript? ;-)
                        Forget I said anything.



                        --
                        Dave Anderson

                        Unsolicited commercial email will be read at a cost of $500 per message. Use
                        of this email address implies consent to these terms.


                        Comment

                        • Mike Brind

                          #27
                          Re: array question


                          Evertjan. wrote:
                          Mike Brind wrote on 11 aug 2006 in
                          microsoft.publi c.inetserver.as p.general:
                          >

                          Evertjan. wrote:
                          Mike Brind wrote on 10 aug 2006 in
                          microsoft.publi c.inetserver.as p.general:
                          >
                          the other john wrote:
                          Is there a way or a property that can tell me how many items are
                          in an array? Like when using the Split function but the actual
                          number of created array items is unknown? I need to be able to
                          dynamically count the number of items that are created as a result
                          of using Split().
                          >

                          Ubound()

                          >
                          Only if vbs is assumed, not in jscript.
                          >
                          I _always_ assume vbscript. Users of jscript/javascript or perl tend
                          to announce themselves (in a tone of voice that varies between proud,
                          or aggressively defensive ).
                          >
                          [skipping a lot of following and diverging thread lines resulting from
                          here]
                          >
                          You can see the OP asked a Q that can be answered
                          with a vbscript answer or an jscript answer,
                          if the word "function" can be extended to "method",
                          which is a function in the broader sence too.
                          >
                          My one row addition, which is only a rebuke in the most suspicious of
                          minds, and I know Mike's mind is not, is just that _I_ would have
                          answered:
                          You're right. I didn't see it as a rebuke. I'm well used to your
                          style now.
                          >
                          "Ubound() in vbscript"
                          >
                          I cannot agree with Mike it is a good thing to assume vbs in an anwer
                          where vbs is not stipulated in the question in his ASP NG.
                          To be fair, there were a number of clues in this case that the OP uses
                          vbs, not the least of which is that his previous questions have
                          stipulated vbs. And as Dave Anderson pointed out, vbs was implied in
                          the question. Nevertheless, it isn't going to cause me any problems to
                          add the bit of clarification you suggest in future.
                          The "asp = vbscript" concept does not aggree with me.
                          I go back to what I said earlier. The vast majority of questioners
                          here use vbscript, and it is the default language. The small number of
                          jscript/perlscript users do tend to clarify the language they are
                          using. I have yet to see anyone here ask a general scripting question,
                          be given an answer in vbs, then announce that actually, they are using
                          javascript.

                          That explains my thought processes. Whether it is a *good* thing to
                          assume vbs in an question, I can't answer, but I think it is a
                          reasonably *safe* thing to do. Nevertheless, I see the merit in your
                          suggestion regarding the added clarification of language in answers in
                          the future.

                          --
                          Mike Brind

                          Comment

                          • Dave Anderson

                            #28
                            Re: array question

                            Mike Brind wrote:
                            I have yet to see anyone here ask a general scripting
                            question, be given an answer in vbs, then announce that
                            actually, they are using javascript.
                            >
                            That explains my thought processes. Whether it is a *good*
                            thing to assume vbs in an question, I can't answer, but I
                            think it is a reasonably *safe* thing to do.
                            It's a little bit if a chicken & egg problem, isn't it? Since Microsoft
                            documentation provides essentially *zero* ASP examples written in JScript,
                            (a) many people are unaware that JScript is an option, and (b) people
                            searching for JScript solutions usually announce their language.

                            This is further compounded by the fact that ASP/VBScript examples (whether
                            on msdn or elsewhere) almost always lack the details needed to do the job in
                            JScript. The JScript author needs to learn, for example, that these two are
                            equivalent:

                            VBScript ----
                            request("abc")

                            JScript -----
                            Request.QuerySt ring("abc").Ite m ||
                            Request.Form("a bc").Item ||
                            Request.Cookies ("abc").Item ||
                            Request.ClientC ertificates("ab c").Item ||
                            Request.ServerV ariables("abc") .Item

                            That is a lot of conditional assignment, and the kind of knowledge that has
                            to be *sought*, due to the poor quality of VBScript (and by implication,
                            ALL) ASP examples.

                            All of these conspire against the individal who wants to use JScript to
                            write ASP. So only the determined do. It's a shame, too. I think ASP in
                            JScript is a marvelously flexible and powerful thing.

                            So yes, I agree that it is safe to assume VBScript in almost all cases.



                            --
                            Dave Anderson

                            Unsolicited commercial email will be read at a cost of $500 per message. Use
                            of this email address implies consent to these terms.


                            Comment

                            Working...