[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: searching this archive



PureBytes Links

Trading Reference Links

Ah, Thats what sparse means. Thanks for the info TJ.

         KR
          Michael.


At 10:40 PM 16/03/2004, you wrote:
>Michael,
>
>JScript arrays ARE dynamic and sparse.
>Dynamic means that their size can change at run time (you can grow array 
>without problem
>just by setting the element array[ array.length ] = value )
>
>Sparse means that the elements do not need to be consecutively counted;
>In other words array in JScript can have indexes numbers of
>0,3,7,8,9,12,20
>
>(note missing 1,2, 4, 5, 6....) - this is allowed in jscript but not in 
>most other languages.
>
>JScript arrays are "objects with dynamically added properties" thats why 
>it is possible
>
>Best regards,
>Tomasz Janeczko
>amibroker.com
>----- Original Message -----
>From: "Michael.S.G." <OzFalcon@xxxxxxxx>
>To: <amibroker@xxxxxxxxxxxxxxx>
>Sent: Tuesday, March 16, 2004 12:28 PM
>Subject: Re: [amibroker] Re: JScript equivalent of 'push' of PERL.
>
>
> > I always thought they were dynamic, what does sparse mean?
> >
> >          KR
> >           Michael.
> >
> >
> > At 02:13 PM 16/03/2004, you wrote:
> > >Michael,
> > >
> > >No ... I guess not.
> > >
> > >But I found the following link ===>
> > >
> > >http://msdn.microsoft.com/library/en-us/jscript7/html/UsingArr.asp?
> > >frame=true
> > >
> > >So looks like JScript arrays are sparse and the size need not be
> > >known at the time of declaration.  This is, what I think, I wanted ...
> > >
> > >Regards,
> > >- Salil V Gangal
> > >
> > >--- In amibroker@xxxxxxxxxxxxxxx, "Michael.S.G." <OzFalcon@xxxx>
> > >wrote:
> > > > Salil,
> > > > I believe there is an example in the "cleanup.js" file written by
> > >TJ.
> > > >
> > > > ie
> > > > oStocksToDelete[ oStocksToDelete.length ] = oStock.Ticker;
> > > >
> > > > Is this what you mean?
> > > >
> > > >          KR
> > > >           Michael.
> > > >
> > > >
> > > >
> > > >
> > > > At 01:13 AM 16/03/2004, you wrote:
> > > > >Michael,
> > > > >
> > > > >Thanks.  A quick question.  In PERL one can keep adding elements to
> > > > >an array by statements such as
> > > > >
> > > > >push( @arrayOfTickers, $ticker1 );
> > > > >push( @arrayOfTickers, $ticker2 );
> > > > >push( @arrayOfTickers, $ticker3 );
> > > > >...
> > > > >...
> > > > >...
> > > > >
> > > > >Beauty is that one need not know beforehand how many elements are
> > >to
> > > > >be added.  (Therefore it's not necessary to know how many tickers
> > >are
> > > > >there in Spread-Sheet beforehand.)
> > > > >
> > > > >What's equivalent in JScript ?
> > > > >
> > > > >Regards,
> > > > >- Salil V Gangal
> > > > >
> > > > >
> > > > >--- In amibroker@xxxxxxxxxxxxxxx, "Michael.S.G." <OzFalcon@xxxx>
> > > > >wrote:
> > > > > > Opps, Big bug in that code.
> > > > > >
> > > > > > I forgot to close the file in the function.......... I do sugest
> > > > >you fix
> > > > > > this before trying this code.
> > > > > >
> > > > > > Here is new code, Untested.
> > > > > >
> > > > > >
> > > > > >
> > > > > > /*
> > > > > > ** AmiBroker/Win32 script.
> > > > > > **
> > > > > > ** File:
> > > > > > ** Updated:   January 18th, 2004
> > > > > > ** Purpose:
> > > > > > ** Language:  JavaScript (Windows Scripting Host)
> > > > > > **
> > > > > > ** The data is stored in lines with following format
> > > > > > **
> > > > > > **
> > > > > > */
> > > > > >
> > > > > > /* change this line according to your data file name */
> > > > > > base = "am200401/am200401";
> > > > > > STicker = "GOLD";
> > > > > > /* Output file is STicker.csv */
> > > > > >
> > > > > >
> > > > > > WScript.Echo( "Ticker Find Started" );
> > > > > >
> > > > > > var fso, fw, f, r;
> > > > > > var FName, outfile;
> > > > > > var ForReading = 1;
> > > > > > var ForWriting = 2;
> > > > > > var ForAppending = 8;
> > > > > >
> > > > > > /* Create file system object */
> > > > > > fso = new ActiveXObject( "Scripting.FileSystemObject" );
> > > > > >
> > > > > > outfile = STicker + ".csv";
> > > > > > fw = fso.OpenTextFile( outfile, ForAppending, false);
> > > > > >
> > > > > > for( L1 = 1; L1 < 34; L1++ )
> > > > > > {
> > > > > > basename = base;
> > > > > > if (L1 < 10)
> > > > > >       {
> > > > > >       basename = basename + "0";
> > > > > >       }
> > > > > > FName = basename + (L1)+".prn";
> > > > > > ImportStocks(FName);
> > > > > > }
> > > > > > fw.Close();
> > > > > >
> > > > > > WScript.Echo( "Ticker Find Finished" );
> > > > > >
> > > > > >
> > > > > > function ImportStocks( filename )
> > > > > > {
> > > > > >       var fields;
> > > > > >       var ticker;
> > > > > >
> > > > > >       try
> > > > > >       {
> > > > > >
> > > > > >       /* open ASCII file */
> > > > > >       f = fso.OpenTextFile( filename, ForReading);
> > > > > >
> > > > > >       /* read the file line by line */
> > > > > >       while ( !f.AtEndOfStream )
> > > > > >               {
> > > > > >               r = f.ReadLine();
> > > > > >
> > > > > >               /* split the lines using comma as a separator */
> > > > > >               fields = r.split(",");
> > > > > >
> > > > > >               ticker = fields[0];
> > > > > >               if (ticker == STicker)
> > > > > >                       {
> > > > > >                       fw.WriteLine( r );
> > > > > >                       }
> > > > > >               }
> > > > > >       }
> > > > > >       catch ( e )
> > > > > >       {
> > > > > >
> > > > > >   WScript.echo( "There is a problem in file no." + L1 + ".\n"+
> > > > >filename +
> > > > > > "\nIt will be skipped and next file will be processed as
> > >normal" );
> > > > > >
> > > > > >       }
> > > > > > f.close()
> > > > > > }
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >Send BUG REPORTS to bugs@xxxx
> > > > >Send SUGGESTIONS to suggest@xxxx
> > > > >-----------------------------------------
> > > > >Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > > > >(Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > > >--------------------------------------------
> > > > >Check group FAQ at:
> > > > >http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > > >Yahoo! Groups Links
> > > > >
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >
> > >Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> > >Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> > >-----------------------------------------
> > >Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > >(Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > >--------------------------------------------
> > >Check group FAQ at:
> > >http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > >Yahoo! Groups Links
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> > Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> > Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> > -----------------------------------------
> > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > --------------------------------------------
> > Check group FAQ at: 
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
>
>
>Send BUG REPORTS to bugs@xxxxxxxxxxxxx
>Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
>-----------------------------------------
>Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
>(Web page: http://groups.yahoo.com/group/amiquote/messages/)
>--------------------------------------------
>Check group FAQ at: 
>http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>Yahoo! Groups Links
>
>
>
>




Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
     amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/