Re: Getting count of rows in a text file -- best approach?

2017-05-02 Thread Thierry Nivelet
I answered to 'not documented' Of course filetostr() works as it does not go through a variable. Question vastly discussed on AtoutFox. Var = "16 MB string" Var = m.var + 'n' && bingo Thierry Nivelet http://foxincloud.com/ Give your VFP app a second life in the cloud > Le 2 mai 2017 à 12:43,

Re: Getting count of rows in a text file -- best approach?

2017-05-02 Thread mbsoftwaresolutions
On 2017-05-02 10:23, Stephen Russell wrote: Ok, who else chuckled when the database guy doesn't use data to get a count but is going to count text file lines instead? Seriously I found that funny. It's all a matter of where you're doing the processing! Up front BEFORE you load it,

Re: Getting count of rows in a text file -- best approach?

2017-05-02 Thread mbsoftwaresolutions
On 2017-05-02 06:43, Ted Roche wrote: It is true and yet it is not. Rick Strahl wrote an article showing there are things you can do (and not do) with HUUGE files read in using FileToStr(): https://www.west-wind.com/wconnect/weblog/ShowEntry.blog?id=882 Since the Original Poster (anyone

Re: Getting count of rows in a text file -- best approach?

2017-05-02 Thread Stephen Russell
Ok, who else chuckled when the database guy doesn't use data to get a count but is going to count text file lines instead? Seriously I found that funny. On Tue, May 2, 2017 at 9:18 AM, wrote: > On 2017-05-02 05:57, Thierry Nivelet wrote: > >>

Re: Getting count of rows in a text file -- best approach?

2017-05-02 Thread mbsoftwaresolutions
On 2017-05-02 05:57, Thierry Nivelet wrote: Mentioned in "Visual Foxpro system capacities" Yes but as Fred said, it looks like you can load greater than 16 MB. I could swear I did. ___ Post Messages to: ProFox@leafe.com Subscription Maintenance:

Re: Getting count of rows in a text file -- best approach?

2017-05-02 Thread Ted Roche
It is true and yet it is not. Rick Strahl wrote an article showing there are things you can do (and not do) with HUUGE files read in using FileToStr(): https://www.west-wind.com/wconnect/weblog/ShowEntry.blog?id=882 Since the Original Poster (anyone remember him :)?) was only performing

Re: Getting count of rows in a text file -- best approach?

2017-05-02 Thread Thierry Nivelet
Mentioned in "Visual Foxpro system capacities" Thierry Nivelet http://foxincloud.com/ Give your VFP app a second life in the cloud Le 1 mai 2017 à 23:20, mbsoftwaresoluti...@mbsoftwaresolutions.com a écrit : >> the help file does >> say a 16MB limit on memory variables

Re: Getting count of rows in a text file -- best approach?

2017-05-01 Thread mbsoftwaresolutions
On 2017-04-26 16:05, Fred Taylor wrote: Sure looks like you can load larger than 16MB. Though the help file does say a 16MB limit on memory variables. Fred Perhaps the Help file is outdated? That guy from the Fox team must have been let go before he could update it.

Re: Getting count of rows in a text file -- best approach?

2017-05-01 Thread mbsoftwaresolutions
On 2017-04-29 06:50, Laurie Alvey wrote: Hi All, This is all very ingenious, but I am curious to know why you would want to know the number of lines. Laurie As the original poster, I'll answer: we want to compare the # of records sent this year compared to what they sent us last year.

Re: Getting count of rows in a text file -- best approach?

2017-05-01 Thread Stephen Russell
VFP9\apps\c#\Utilities\Utilities\bin\Release\ > > Utilities.tlb’, > > and the type library was registered successfully > > > > C:\Windows\Microsoft.NET\Framework\v4.0.30319> > > > > 10. Then to use it in VFP .. > > > > oUtil = CREATEOBJECT("Utilities

Re: Getting count of rows in a text file -- best approach?

2017-05-01 Thread Michael Madigan
2017 10:45 AM Subject: Getting count of rows in a text file -- best approach? VF9SP2 Currently, I'm simply doing this for now: RowCount = OCCURS(CHR(13),FILETOSTR(m.Filename)) Is there a better (read: FASTER) way?  These are tab delimited text files so I can't really use FSEEK or FSIZE(m.Filename

RE: Getting count of rows in a text file -- best approach?

2017-04-29 Thread Darren
...@leafe.com] On Behalf Of Laurie Alvey Sent: Saturday, 29 April 2017 8:51 PM To: profoxt...@leafe.com Subject: Re: Getting count of rows in a text file -- best approach? Hi All, This is all very ingenious, but I am curious to know why you would want to know the number of lines. Laurie On 29 April

Re: Getting count of rows in a text file -- best approach?

2017-04-29 Thread Laurie Alvey
gt; Utilities.tlb’, > and the type library was registered successfully > > C:\Windows\Microsoft.NET\Framework\v4.0.30319> > > 10. Then to use it in VFP .. > > oUtil = CREATEOBJECT("Utilities.FileInfo") > nLines = oUtil.LineCount() > > -Original Me

RE: Getting count of rows in a text file -- best approach?

2017-04-28 Thread Darren
ies.FileInfo") nLines = oUtil.LineCount() -Original Message- From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Gianni Turri Sent: Saturday, 29 April 2017 2:24 AM To: profoxt...@leafe.com Subject: Re: Getting count of rows in a text file -- best approach? Test file of 1.67 G

RE: Getting count of rows in a text file -- best approach?

2017-04-28 Thread Darren
nni Turri Sent: Saturday, 29 April 2017 2:24 AM To: profoxt...@leafe.com Subject: Re: Getting count of rows in a text file -- best approach? Test file of 1.67 GB correctly managed by FSO but not by VFP9 SP2 that gives Error 43 (There is not enough memory to complete this operation). Test f

Re: Getting count of rows in a text file -- best approach?

2017-04-28 Thread Malcolm Greene
Gianni, When working with large files like you are you may want to consider using Python. This need pushed me to explore Python and I've never looked back. Working with text files is a great way to dip your toes into Python without feeling you need to learn the full language. Python has no

Re: Getting count of rows in a text file -- best approach?

2017-04-28 Thread Gianni Turri
From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Gianni Turri Sent: Friday, 28 April 2017 11:39 PM To: profoxt...@leafe.com Subject: Re: Getting count of rows in a text file -- best approach? Ok. Anyway this is the slower method: loFSO = createobject("Scripting.FileS

RE: Getting count of rows in a text file -- best approach?

2017-04-28 Thread Darren
[mailto:profoxtech-boun...@leafe.com] On Behalf Of Darren Sent: Saturday, 29 April 2017 1:15 AM To: profoxt...@leafe.com Subject: RE: Getting count of rows in a text file -- best approach? Many ways to do this. I've compared 3. With a text file 350Mb | 5.3Million lines . Each method reported same # of lines

RE: Getting count of rows in a text file -- best approach?

2017-04-28 Thread Darren
: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Gianni Turri Sent: Friday, 28 April 2017 11:39 PM To: profoxt...@leafe.com Subject: Re: Getting count of rows in a text file -- best approach? Ok. Anyway this is the slower method: loFSO = createobject("Scripting.FileSystemO

Re: Getting count of rows in a text file -- best approach?

2017-04-28 Thread Gianni Turri
Ok. Anyway this is the slower method: loFSO = createobject("Scripting.FileSystemObject") loFile = loFSO.OpenTextFile(m.filename, 1) do while ! loFile.AtEndOfStream() loFile.SkipLine() enddo ? loFile.Line -1 Gianni On Fri, 28 Apr 2017 15:29:48 +0200, "Fernando D. Bozzo"

Re: Getting count of rows in a text file -- best approach?

2017-04-28 Thread Gianni Turri
No, in the call to OpenTextFile 8 means "append" and .f. means don't create if the file don't exist. loFile = loFSO.OpenTextFile(m.filename, 8, .f.) So: ? loFile.Line -1 gives the correct result. Try it! Gianni On Fri, 28 Apr 2017 15:24:17 +0200, "Fernando D. Bozzo"

Re: Getting count of rows in a text file -- best approach?

2017-04-28 Thread Fernando D. Bozzo
Forget my comment, I've tested it and works beautifully :) 2017-04-28 15:24 GMT+02:00 Fernando D. Bozzo : > Gianni, you skipped something very important, the part that skip the lines > so the Line property is updated: > > 'Skip lines one by one Do While

Re: Getting count of rows in a text file -- best approach?

2017-04-28 Thread Fernando D. Bozzo
Gianni, you skipped something very important, the part that skip the lines so the Line property is updated: 'Skip lines one by one Do While txsInput.AtEndOfStream <> True txsInput.SkipLine ' or strTemp = txsInput.ReadLineLoop 2017-04-28 15:08 GMT+02:00 Gianni Turri :

Re: Getting count of rows in a text file -- best approach?

2017-04-28 Thread Gianni Turri
On Thu, 27 Apr 2017 17:12:49 +0200, "Fernando D. Bozzo" wrote: >Hi Mike: > >A very fast method is using the FileSystemObject: > >loFSO = CREATEOBJECT("Scripting.FileSystemObject") >loFile1 = loFSO.OpenTextFile(lcArchivo1, 1) > >Look at the syntax on Microsoft web site for the

Re: Getting count of rows in a text file -- best approach?

2017-04-28 Thread Ted Roche
"One of the great things about FoxPro," a wise man (or was it a wise guy?) said, a couple of decades ago, "is that there's three ways to do anything in FoxPro. Or no way at all." This thread is a great illustration of this. Every three days, someone else drifts through the forum and suggests

Re: Getting count of rows in a text file -- best approach?

2017-04-28 Thread Fernando D. Bozzo
Yeah, and did you try reading a +1GiB txt file? ;-) El 28/4/2017 12:22, "Laurie Alvey" escribió: > Have you thought about the ALINES() function? > > Laurie > > On 27 April 2017 at 16:12, Fernando D. Bozzo wrote: > > > Hi Mike: > > > > A very fast

Re: Getting count of rows in a text file -- best approach?

2017-04-28 Thread Laurie Alvey
Have you thought about the ALINES() function? Laurie On 27 April 2017 at 16:12, Fernando D. Bozzo wrote: > Hi Mike: > > A very fast method is using the FileSystemObject: > > loFSO = CREATEOBJECT("Scripting.FileSystemObject") > loFile1 = loFSO.OpenTextFile(lcArchivo1, 1) > >

Re: Getting count of rows in a text file -- best approach?

2017-04-27 Thread Fernando D. Bozzo
Hi Mike: A very fast method is using the FileSystemObject: loFSO = CREATEOBJECT("Scripting.FileSystemObject") loFile1 = loFSO.OpenTextFile(lcArchivo1, 1) Look at the syntax on Microsoft web site for the read method. It does not have the limitation of VFP's fread/fgets Regards El 21/4/2017

Re: Getting count of rows in a text file -- best approach?

2017-04-27 Thread Gianni Turri
On Thu, 27 Apr 2017 19:02:39 +0800, Man-wai Chang wrote: >Sorry, memlines() not mline() The returned count can be wrong due to the 8192 characters max line lenght limit. Only the method that counts the carriage return characters give the correct result. -- Gianni

Re: Getting count of rows in a text file -- best approach?

2017-04-27 Thread Man-wai Chang
Sorry, memlines() not mline() On Fri, Apr 21, 2017 at 10:44 PM, wrote: > VF9SP2 > > Currently, I'm simply doing this for now: > > RowCount = OCCURS(CHR(13),FILETOSTR(m.Filename)) > > Is there a better (read: FASTER) way? These are tab delimited text

Re: Getting count of rows in a text file -- best approach?

2017-04-27 Thread Man-wai Chang
How about an old functions like MLINE()? On Fri, Apr 21, 2017 at 10:44 PM, wrote: > VF9SP2 > > Currently, I'm simply doing this for now: > > RowCount = OCCURS(CHR(13),FILETOSTR(m.Filename)) -- .~. Might, Courage, Vision. SINCERITY! / v \ 64-bit

RE: Getting count of rows in a text file -- best approach?

2017-04-26 Thread Brant E. Layton
|My experience was moving PDF files in and out of SQLServer tables - found an abrupt truncation at the 16,777,184 mark... Brant Layton| |480.964.1316| On 4/26/2017 12:57 PM, profoxtech-requ...@leafe.com wrote: RE: Getting count of rows in a text file -- best approach? --- StripMime Report

Re: Getting count of rows in a text file -- best approach?

2017-04-26 Thread Fred Taylor
Sure looks like you can load larger than 16MB. Though the help file does say a 16MB limit on memory variables. Fred On Wed, Apr 26, 2017 at 11:44 AM, < mbsoftwaresoluti...@mbsoftwaresolutions.com> wrote: > On 2017-04-26 12:31, Brant E. Layton wrote: > >> Just a reminder - STRTOFILE and

RE: Getting count of rows in a text file -- best approach?

2017-04-26 Thread mbsoftwaresolutions
On 2017-04-26 12:31, Brant E. Layton wrote: Just a reminder - STRTOFILE and FILETOSTR are limited by the size of a memory variable - 16,384K bytes (16,777.184 bytes). Had to fix some software that was truncating PDF files at 16 MB... || Looked up the Visual Foxpro System Capabilities:

RE: Getting count of rows in a text file -- best approach?

2017-04-26 Thread Brant E. Layton
count of rows in a text file -- best approach? --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://mail.leafe.com

RE: Getting count of rows in a text file -- best approach?

2017-04-21 Thread Richard Kaye
ns.com Sent: Friday, April 21, 2017 4:50 PM To: profoxt...@leafe.com Subject: Re: Getting count of rows in a text file -- best approach? On 2017-04-21 16:47, Ted Roche wrote: > On Fri, Apr 21, 2017 at 4:37 PM, > <mbsoftwaresoluti...@mbsoftwaresolutions.com> wrote: > >> Test

Re: Getting count of rows in a text file -- best approach?

2017-04-21 Thread mbsoftwaresolutions
On 2017-04-21 16:47, Ted Roche wrote: On Fri, Apr 21, 2017 at 4:37 PM, wrote: Testing showed these two pretty much a dead heat: RowCount = OCCURS(CHR(13),FILETOSTR(m.Filename)) RowCount = ALINES(aCrap,FILETOSTR(m.Filename)) But on the

Re: Getting count of rows in a text file -- best approach?

2017-04-21 Thread Ted Roche
On Fri, Apr 21, 2017 at 4:37 PM, wrote: > Testing showed these two pretty much a dead heat: > > RowCount = OCCURS(CHR(13),FILETOSTR(m.Filename)) > RowCount = ALINES(aCrap,FILETOSTR(m.Filename)) > But on the bright side, with Richard's one-liner,

RE: Getting count of rows in a text file -- best approach?

2017-04-21 Thread Richard Kaye
Thanks. I was curious. :-) -- rk -Original Message- From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of mbsoftwaresoluti...@mbsoftwaresolutions.com Sent: Friday, April 21, 2017 4:38 PM To: profoxt...@leafe.com Subject: RE: Getting count of rows in a text file -- best

RE: Getting count of rows in a text file -- best approach?

2017-04-21 Thread mbsoftwaresolutions
On 2017-04-21 11:24, Richard Kaye wrote: Only when it fits the situation. :-) Dirty? Really? One line of code returns the number of rows in your string. Which was your original question. My solution was 1 line too: RowCount = OCCURS(CHR(13),FILETOSTR(m.Filename)) Benchmark it and

RE: Getting count of rows in a text file -- best approach?

2017-04-21 Thread Richard Kaye
Did you benchmark with ALINES? :-) -- rk -Original Message- From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of mbsoftwaresoluti...@mbsoftwaresolutions.com Sent: Friday, April 21, 2017 2:34 PM To: profoxt...@leafe.com Subject: Re: Getting count of rows in a text file

Re: Getting count of rows in a text file -- best approach?

2017-04-21 Thread mbsoftwaresolutions
On 2017-04-21 11:27, Gianni Turri wrote: On Fri, 21 Apr 2017 17:02:23 +0200, Gianni Turri wrote: On Fri, 21 Apr 2017 10:44:34 -0400, mbsoftwaresoluti...@mbsoftwaresolutions.com wrote: VF9SP2 Currently, I'm simply doing this for now: RowCount =

Re: Getting count of rows in a text file -- best approach?

2017-04-21 Thread Gianni Turri
On Fri, 21 Apr 2017 17:02:23 +0200, Gianni Turri wrote: >On Fri, 21 Apr 2017 10:44:34 -0400, >mbsoftwaresoluti...@mbsoftwaresolutions.com wrote: > >>VF9SP2 >> >>Currently, I'm simply doing this for now: >> >>RowCount = OCCURS(CHR(13),FILETOSTR(m.Filename)) >> >>Is there a

RE: Getting count of rows in a text file -- best approach?

2017-04-21 Thread Richard Kaye
-Original Message- From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of mbsoftwaresoluti...@mbsoftwaresolutions.com Sent: Friday, April 21, 2017 11:20 AM To: profoxt...@leafe.com Subject: RE: Getting count of rows in a text file -- best approach? On 2017-04-21 10:47, Richard Kaye wrote

RE: Getting count of rows in a text file -- best approach?

2017-04-21 Thread mbsoftwaresolutions
On 2017-04-21 10:47, Richard Kaye wrote: ALINES()? Is that your answer for everything today? lol Nah, that feels no less dirty than my approach. My bet is that would require as many (if not more) processing cycles, but of course only testing would show conclusively if at all. Thanks

Re: Getting count of rows in a text file -- best approach?

2017-04-21 Thread Gianni Turri
On Fri, 21 Apr 2017 10:44:34 -0400, mbsoftwaresoluti...@mbsoftwaresolutions.com wrote: >VF9SP2 > >Currently, I'm simply doing this for now: > >RowCount = OCCURS(CHR(13),FILETOSTR(m.Filename)) > >Is there a better (read: FASTER) way? These are tab delimited text >files so I can't really use

RE: Getting count of rows in a text file -- best approach?

2017-04-21 Thread Richard Kaye
ALINES()? -- rk -Original Message- From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of mbsoftwaresoluti...@mbsoftwaresolutions.com Sent: Friday, April 21, 2017 10:45 AM To: profoxt...@leafe.com Subject: Getting count of rows in a text file -- best approach? VF9SP2

Getting count of rows in a text file -- best approach?

2017-04-21 Thread mbsoftwaresolutions
VF9SP2 Currently, I'm simply doing this for now: RowCount = OCCURS(CHR(13),FILETOSTR(m.Filename)) Is there a better (read: FASTER) way? These are tab delimited text files so I can't really use FSEEK or FSIZE(m.Filename) (which requires SET COMPATIBLE ON) because I can't be sure of each