Re: [api-dev] Array - max elements number
Laurent Godard ha scritto: HI bart Hi Laurent, ..and sounds fine in more little help well, early morning and not tested 'be carefull, will erase myFile open myFile for output as #1 for i= 1 to 13 print #1, myArray(i) next i close #1 Thank you kindly, problems about end mounth deadline... :-) But I will work on this... Bart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Array - max elements number
Christoph Jopp ha scritto: Hi Bart, Hi Cristophe, don't know what you are exactly trying to do, but I assume that yoou would not need an array at all. The LoadDataFromFile function opens a file as input stream an reads line by line into an array. As you wrote that you want to iterate over the array and do something with each element, I guess you could do that also directly on the single line given back from 'oInputStream.ReadLine'. Interestig... I have tried... but I do not find the way... Can you suggest me several lines code or an example? So a possibility would be to rip off the parts related to assigning the lines to the array and fill in your content manipulation code. Sorry...I am not able in wich way I can make it... BTW, making a back step, my problem is: I have a quirky DB in txt format, one field in each line. In each line the firsts caracters are codes to identify the tipe field, and a precise code (@V) identify the lines where begin a new record. (They are 15 fields per Record) The first operation is to remove the Carriage Return in all the lines, except the lines that become with code @V (In this way the file (130'000 line) is reduced (rougly) at 8'000 lines.) At last to remove (partially) alls codes, in manner to obtaine fields separatar. i.e. The fields identifiers are: @A, @B, @C, ... @Y A possible separator for final file.csv may be only @ This is an (simplified) example: -- original file.txt @A field1 @B field2 @C field3 @... field... @V field15 - final File.csv @[EMAIL PROTECTED]@field3field15 The final File.csv will may easly imported (manually) in calc. thanks for the help Bart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Array - max elements number
Christoph Jopp ha scritto: Maybe the overflow comes from the rest of your code. I have not still write the rest of the code... :-) May will be a further problem in Overflow... Do you use Calc? Yes... There is a limit of 65536 lines - if you perhaps split your 13+ lines into two columns you would be quite near at this limit. Before to load the file in calc I must reduce the line number... as I have write in my previus message... May be that OOo and basic are not the better tools for manipulate a file.txt. thanks Bart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Array - max elements number
Hi May be that OOo and basic are not the better tools for manipulate a file.txt. it works i have no problem with the following coding did not test the tools - loadfromfile helper Laurent sub createFile open /home/lgodard/bigfile.txt for output as #1 for i = 1 to 13 print #1, line number cstr(i) string(100,-) next i print file created end sub this ends with a around 15 Mb file with lines like line number 1 line number 2 then reading it (i removed redim preserve for performances) sub readFile redim myArray(13) counter = 0 open /home/lgodard/bigfile.txt for input as #1 while not eof(1) line input #1, aLine counter = counter + 1 myArray(counter) = aLine wend close #1 print ok cstr(counter) end sub -- Laurent Godard [EMAIL PROTECTED] - Ingénierie OpenOffice.org - http://www.indesko.com Nuxeo Enterprise Content Management http://www.nuxeo.com - http://www.nuxeo.org Livre Programmation OpenOffice.org, Eyrolles 2004-2006 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Array - max elements number
Hi did not test the tools - loadfromfile helper i just test and encounter the problem it is due to the defintion of MaxIndex as integer (limited to 65535 then) Function LoadDataFromFile(FilePath as String, DataList()) as Boolean Dim i as Integer ... Dim MaxIndex as Integer changing to Dim i as Long Dim MaxIndex as Long is ok (the limit is then 2.147.483.647) Laurent -- Laurent Godard [EMAIL PROTECTED] - Ingénierie OpenOffice.org - http://www.indesko.com Nuxeo Enterprise Content Management http://www.nuxeo.com - http://www.nuxeo.org Livre Programmation OpenOffice.org, Eyrolles 2004-2006 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] Array - max elements number
The target is to convert a large file.txt in file.csv (in the source file the fields are in different lines... ) The idea is to store the entire file in array, and after iterate the elements (to manipulate the contents). But this (symple) code: Sub Main dim contenutofile(121000)' as array dim pathfile as string pathfile = c:\Basilicata.txt converttourl(pathfile) loaddatafromfile(pathfile, pippo()) for i = 0 to 12000 msgbox pippo(i) next i End Sub seems to work only for wide file... In large files (130.000 lines) the function loaddatafromfile return Overflow error... There is a max element nunber for the array, or the limits depend from machine resource? Any idea or suggest to resolv my problem in OO? thanks for the answers Bart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Array - max elements number
Sorry... Errata: wide Corrige: little Bart Aimar ha scritto: The target is to convert a large file.txt in file.csv (in the source file the fields are in different lines... ) The idea is to store the entire file in array, and after iterate the elements (to manipulate the contents). But this (symple) code: Sub Main dim contenutofile(121000)' as array dim pathfile as string pathfile = c:\Basilicata.txt converttourl(pathfile) loaddatafromfile(pathfile, pippo()) for i = 0 to 12000 msgbox pippo(i) next i End Sub seems to work only for little file... In large files (130.000 lines) the function loaddatafromfile return Overflow error... There is a max element nunber for the array, or the limits depend from machine resource? Any idea or suggest to resolv my problem in OO? thanks for the answers Bart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Array - max elements number
Hi Bart, I checked whether there is a general limit for arrays, but had no problems assigning 24 (long) strings to an array on my system. In your code your using LoadDataFromFile from the Tools library? In this library 'Redim Preserve' is used to expand the array and in my opinion this copies the array to a temporary array and thus uses lots of system resources. So I think system resources is what limits the reading of lines in this case. If I'm wrong somebody might correct me? Hope this helps Christoph Bart Aimar schrieb: The target is to convert a large file.txt in file.csv (in the source file the fields are in different lines... ) The idea is to store the entire file in array, and after iterate the elements (to manipulate the contents). But this (symple) code: Sub Main dim contenutofile(121000)' as array dim pathfile as string pathfile = c:\Basilicata.txt converttourl(pathfile) loaddatafromfile(pathfile, pippo()) for i = 0 to 12000 msgbox pippo(i) next i End Sub seems to work only for wide file... In large files (130.000 lines) the function loaddatafromfile return Overflow error... There is a max element nunber for the array, or the limits depend from machine resource? Any idea or suggest to resolv my problem in OO? thanks for the answers Bart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Array - max elements number
Btw, did you click 12001 times on the MsgBox? ;-) Christoph Jopp schrieb: Hi Bart, I checked whether there is a general limit for arrays, but had no problems assigning 24 (long) strings to an array on my system. In your code your using LoadDataFromFile from the Tools library? In this library 'Redim Preserve' is used to expand the array and in my opinion this copies the array to a temporary array and thus uses lots of system resources. So I think system resources is what limits the reading of lines in this case. If I'm wrong somebody might correct me? Hope this helps Christoph Bart Aimar schrieb: The target is to convert a large file.txt in file.csv (in the source file the fields are in different lines... ) The idea is to store the entire file in array, and after iterate the elements (to manipulate the contents). But this (symple) code: Sub Main dim contenutofile(121000)' as array dim pathfile as string pathfile = c:\Basilicata.txt converttourl(pathfile) loaddatafromfile(pathfile, pippo()) for i = 0 to 12000 msgbox pippo(i) next i End Sub seems to work only for wide file... In large files (130.000 lines) the function loaddatafromfile return Overflow error... There is a max element nunber for the array, or the limits depend from machine resource? Any idea or suggest to resolv my problem in OO? thanks for the answers Bart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Array - max elements number
Christoph Jopp ha scritto: Btw, did you click 12001 times on the MsgBox? ;-) :-) bart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Array - max elements number
Christoph Jopp ha scritto: Hi Bart, Hi Christoph, and thank for your answer I checked whether there is a general limit for arrays, but had no problems assigning 24 (long) strings to an array on my system. In your code your using LoadDataFromFile from the Tools library? In this library 'Redim Preserve' is used to expand the array and in my opinion this copies the array to a temporary array and thus uses lots of system resources. So I think system resources is what limits the reading of lines in this case. You are right... I read on the web that Redim Preserve may be a performace trap... but I am not a programmer and I have a big problems on understand the matter... As yet I used sometime the array, but always as a low level user... (copy/paste is my preferred style... :-) ) BTW I have tried (quiet very naive) to modifie LoadDataFromFile function on comment the lines with Preserve Modifie. In this way I obtaneid the Overflow in five seconds (instead 2 minutes)... :-( reagards Bart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Array - max elements number
Hi Bart, don't know what you are exactly trying to do, but I assume that yoou would not need an array at all. The LoadDataFromFile function opens a file as input stream an reads line by line into an array. As you wrote that you want to iterate over the array and do something with each element, I guess you could do that also directly on the single line given back from 'oInputStream.ReadLine'. So a possibility would be to rip off the parts related to assigning the lines to the array and fill in your content manipulation code. Just an idea Christoph Bart Aimar schrieb: Christoph Jopp ha scritto: Hi Bart, Hi Christoph, and thank for your answer I checked whether there is a general limit for arrays, but had no problems assigning 24 (long) strings to an array on my system. In your code your using LoadDataFromFile from the Tools library? In this library 'Redim Preserve' is used to expand the array and in my opinion this copies the array to a temporary array and thus uses lots of system resources. So I think system resources is what limits the reading of lines in this case. You are right... I read on the web that Redim Preserve may be a performace trap... but I am not a programmer and I have a big problems on understand the matter... As yet I used sometime the array, but always as a low level user... (copy/paste is my preferred style... :-) ) BTW I have tried (quiet very naive) to modifie LoadDataFromFile function on comment the lines with Preserve Modifie. In this way I obtaneid the Overflow in five seconds (instead 2 minutes)... :-( reagards Bart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Array - max elements number
Maybe the overflow comes from the rest of your code. Do you use Calc? There is a limit of 65536 lines - if you perhaps split your 13+ lines into two columns you would be quite near at this limit. Bart Aimar schrieb: Christoph Jopp ha scritto: Hi Bart, Hi Christoph, and thank for your answer I checked whether there is a general limit for arrays, but had no problems assigning 24 (long) strings to an array on my system. In your code your using LoadDataFromFile from the Tools library? In this library 'Redim Preserve' is used to expand the array and in my opinion this copies the array to a temporary array and thus uses lots of system resources. So I think system resources is what limits the reading of lines in this case. You are right... I read on the web that Redim Preserve may be a performace trap... but I am not a programmer and I have a big problems on understand the matter... As yet I used sometime the array, but always as a low level user... (copy/paste is my preferred style... :-) ) BTW I have tried (quiet very naive) to modifie LoadDataFromFile function on comment the lines with Preserve Modifie. In this way I obtaneid the Overflow in five seconds (instead 2 minutes)... :-( reagards Bart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]