Page 1 of 2 12>
Topic Options
#53878 - 2001-02-14 06:47 PM limits on arrays
Paul_Berquam Offline
Hey THIS is FUN

Registered: 2000-08-02
Posts: 310
Loc: Sacramento, CA USA
Does anyone know what the upper limit on array sizes within KiX is? I need to do a recursive searchs through a bunch of files to look for duplicate entries and want to be able to dump the results into an array.

Thanks

------------------

"He was a good little monkey and always very curious..."

_________________________
He was a good little monkey and always very curious...

Top
#53879 - 2001-02-14 07:05 PM Re: limits on arrays
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
The sky is the limit.... or actually memory is.

a dim $array[1000000] will use 30megs of ram on a NT computer. As long as you have enough ram, and don't dip into the swap file to much..... kix will run just fine.

Bryce

Top
#53880 - 2001-02-14 07:07 PM Re: limits on arrays
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I think the upper limit is 2,147,483,647 !

I ran out of physical memory at 8,000,000.

What a pig this workstation is !

Shawn.

Top
#53881 - 2001-02-14 07:10 PM Re: limits on arrays
Paul_Berquam Offline
Hey THIS is FUN

Registered: 2000-08-02
Posts: 310
Loc: Sacramento, CA USA
Sweet. Thanks. Now I just need to write a little routine to parse the array for dups.
_________________________
He was a good little monkey and always very curious...

Top
#53882 - 2001-02-14 07:12 PM Re: limits on arrays
Paul_Berquam Offline
Hey THIS is FUN

Registered: 2000-08-02
Posts: 310
Loc: Sacramento, CA USA
OK got another one. I must be blind or something but I can't find it.... I used the val() statement to convert a string to a value, now how do I convert it back to a string?
_________________________
He was a good little monkey and always very curious...

Top
#53883 - 2001-02-14 07:13 PM Re: limits on arrays
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Paul

Don't forget - there's a limit on recursion as well - kix will "blow it's stack" after around 256 recursive calls (not that you would have folders (or whatever) that go that deep) !

Shawn.

Top
#53884 - 2001-02-14 07:19 PM Re: limits on arrays
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
$val=val($string)

$string="$val"

------------------
Greetz,

Roger the Young
------------------------
The code is out there...
------------------------

_________________________
The Code is out there

Top
#53885 - 2001-02-14 07:20 PM Re: limits on arrays
Paul_Berquam Offline
Hey THIS is FUN

Registered: 2000-08-02
Posts: 310
Loc: Sacramento, CA USA
damn.... I have like 15k records to search. I guess I'll just have to dump it to a CSV and search that. I would rather search for dups within the script. suggestions?
_________________________
He was a good little monkey and always very curious...

Top
#53886 - 2001-02-14 07:22 PM Re: limits on arrays
Paul_Berquam Offline
Hey THIS is FUN

Registered: 2000-08-02
Posts: 310
Loc: Sacramento, CA USA
Nevermind my second question. I forgot the " Need more sleep

------------------

"He was a good little monkey and always very curious..."

_________________________
He was a good little monkey and always very curious...

Top
#53887 - 2001-02-14 07:24 PM Re: limits on arrays
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
well, we all love a good challenge here...

Could you post some examples of the records and the results that you want to see?

------------------
Greetz,

Roger the Young
------------------------
The code is out there...
------------------------

_________________________
The Code is out there

Top
#53888 - 2001-02-14 07:26 PM Re: limits on arrays
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
Wow, this thread is starting to look like a chatbox
_________________________
The Code is out there

Top
#53889 - 2001-02-14 07:39 PM Re: limits on arrays
Paul_Berquam Offline
Hey THIS is FUN

Registered: 2000-08-02
Posts: 310
Loc: Sacramento, CA USA
The input doesn't matter. I wanted to take input (string from a file, stdin, whatever) and dump in into an array and then search for duplicates. As soon as it find a dup it just returns the value.

------------------

"He was a good little monkey and always very curious..."

_________________________
He was a good little monkey and always very curious...

Top
#53890 - 2001-02-14 07:52 PM Re: limits on arrays
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
If we're talking about files here - why not just "dir" to a file - sort it with "sort" - then write an kix algorithm that reads the file back in and checks for dups ? sorting it first makes the algorithm easier to code.

Bryce - didn't you do something like this in that "delete c:\temp" thread awhile back ? (one of my favorite threads of all time!)

Shawn.

[This message has been edited by Shawn (edited 14 February 2001).]

Top
#53891 - 2001-02-14 07:59 PM Re: limits on arrays
Paul_Berquam Offline
Hey THIS is FUN

Registered: 2000-08-02
Posts: 310
Loc: Sacramento, CA USA
It's the contents of an array that I'm looking for dups in. In this particular case, the records each come from separate files.

I was thinking of doing something like the following

code:

i = 0
j = 0
last = 0

while i < last
j = i
while j < last
if array[i] = array[j]
exit loop
endif
j = j + 1
loop
i = i + 1
loop


_________________________
He was a good little monkey and always very curious...

Top
#53892 - 2001-02-14 08:07 PM Re: limits on arrays
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Well if it helps - I've got a script that does a straight selection sort of a kix array (integers) - wouldn't be too hard to modify for strings I imagine.

Shawn.

Top
#53893 - 2001-02-14 08:10 PM Re: limits on arrays
Paul_Berquam Offline
Hey THIS is FUN

Registered: 2000-08-02
Posts: 310
Loc: Sacramento, CA USA
That works. Could you Email it to me?

Thanks

_________________________
He was a good little monkey and always very curious...

Top
#53894 - 2001-02-14 08:25 PM Re: limits on arrays
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Quickly adapted for strings...

code:

break on


; Sorts an array in reverse order ...


$elements = 10
dim $array[$elements]
$array[0] = "Paul"
$array[1] = "Bryce"
$array[2] = "CeeJay"
$array[3] = "Roger"
$array[4] = "Erik"
$array[5] = "Jack"
$array[6] = "Radimus"
$array[7] = "Ruud"
$array[8] = "Henri"
$array[9] = "Ursula"


; Straight selection sort ...


$i = 0
while $i < $elements - 1
$k = $i
$min = $array[$k]
$j = $i + 1
while $j < $elements
if $array[$j] > $min
$k = $j
$min = $array[$k]
$array[$k] = $array[$i]
$array[$i] = $min
endif
$j = $j + 1
loop
$i = $i + 1
loop


; Print it out ...


$i = 0
while $i < $elements
?"array[$i] = " $array[$i]
$i = $i + 1
loop


exit



Shawn.

[This message has been edited by Shawn (edited 14 February 2001).]

Top
#53895 - 2001-02-14 09:13 PM Re: limits on arrays
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
Regarding file sizes, I RTFM and it said that OPEN() is for small text files only.

I tested a file 1.3MB with 30447 lines and it took 3:24 minutes to parse without errors. The FM says that the whole file is put into memory.

filename=1300.txt
06:03:23
00 <-- this is the OPEN and then the CLOSE
06:06:47
30447 lines

cj

P.S. yes, I wrote a script that opens and reads every line of a file, recording the start and stop times and number of lines.

P.P.S. The 1.3MB text file is from Office 2000 and starts "REDISTRIBUTABLE CODE - Limited Use:"

Top
#53896 - 2001-02-14 09:42 PM Re: limits on arrays
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
CeeJay - I'd be curious to know how long it would take for WSH/VBScript to read and parse that exact same file ?


[or do we really want to know that ?]


[This message has been edited by Shawn (edited 14 February 2001).]

Top
#53897 - 2001-02-14 11:01 PM Re: limits on arrays
Paul_Berquam Offline
Hey THIS is FUN

Registered: 2000-08-02
Posts: 310
Loc: Sacramento, CA USA
What I ended up doing is having it dump the information to a CSV and I used Access to sort/find the duplicate records.

I didn't feel like waiting for it to parse through 16k records with recursion

------------------

"He was a good little monkey and always very curious..."

_________________________
He was a good little monkey and always very curious...

Top
Page 1 of 2 12>


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 847 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.072 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org