Re: [fpc-pascal] Methods for autoupdating fpc programs?
On 10/03/2015 05:40 PM, Bo Berglund wrote: On Sat, 3 Oct 2015 15:04:31 -0400, waldo kitty <wkitt...@windstream.net> wrote: On 10/03/2015 02:30 PM, Bo Berglund wrote: The program will probably be started by cron every minute to check if it has anything to do and if so execute its data collection task and quit. Otherwise just quit, but here maybe also check for an update on the web? But how could one exchange a running program on the pi from within itself? off the top of my head: since you're running from cron and exiting, this could be pretty simple... 1. at start up, check if self is named known temp name. if yes, copy self to normal name, spawn normal name and die. 2. at start up pull md5 checksum file from server and compare with own md5 checksum. 3. if md5 sums are different, download new version to known temp name. Would this not compare equal for the exact same version? All others including old and newer would fail and thus trigger an update. if the md5 on the server is the same as the md5 of the currently running program, there should not be an update made... BTW, how does one get the md5 value of ones own executable file? there's a command line tool known as md5sum... it is also possible to calculate the same in your own code... what i tried to propose is that when you create the new binary, you run md5sum on it and place both on the server... you would also have a md5 file beside the current binary... then you only need to pull the md5 file from the server and compare it with the local one... 4. at end of execution, see if known temp name exists. if it does, spawn it and die. maybe something like that... of course, somewhere in there you'll still do your required processing... the end of execution will wait for everything to be done before doing step 4... one might also use a special command line parameter to tell the known temp name to copy itself over to the normal name in step 1. Interesting ideas, will have to think about it. as i noted at the beginning, this was off the top of my head and likely how i would start if i were to do something similar... it may look and act completely different in the end as each set of bugs and problems is worked out ;) I have not programmed in Linux before so I have no idea if programs for Linux carry a version resource that can be checked for the version number. Is this the case or is that only a Windows thingie? the version resource can be done, sure... but how can you check that when querying the server other than remembering to manually update it each time? yeah, the md5 file needs to be done and uploaded so it is almost the same type of thing... If not then the MD5 checksum seems to be a good way... it is actually pretty common... i do a lot of work with IDS/IPS stuff and we use md5 files on the server with each set of rules archives... we pull the 30someodd byte md5 file and compare it with the one we have locally before considering to download the XXsomeodd Meg files... I just tested on Lazarus inside the Pi2B and it was simple to do a MD5 sum of one's own executable: strMD5 := MD5Print(MD5File(Application.Exename)); The only problem is that it seems to take quite some time to do (several seconds) is that normal? depending on the size of the binary, it could... so if you save that to a file to put with that binary on the server, then you could pull the md5 file and compare it with the output of the above when checking if there's an update... is several seconds execution too long? if so, then write it to a local md5 file to compare with the server's md5... -- NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Methods for autoupdating fpc programs?
On 10/03/2015 02:30 PM, Bo Berglund wrote: The program will probably be started by cron every minute to check if it has anything to do and if so execute its data collection task and quit. Otherwise just quit, but here maybe also check for an update on the web? But how could one exchange a running program on the pi from within itself? off the top of my head: since you're running from cron and exiting, this could be pretty simple... 1. at start up, check if self is named known temp name. if yes, copy self to normal name, spawn normal name and die. 2. at start up pull md5 checksum file from server and compare with own md5 checksum. 3. if md5 sums are different, download new version to known temp name. 4. at end of execution, see if known temp name exists. if it does, spawn it and die. maybe something like that... of course, somewhere in there you'll still do your required processing... the end of execution will wait for everything to be done before doing step 4... one might also use a special command line parameter to tell the known temp name to copy itself over to the normal name in step 1. -- NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to compile Lazarus program using only FPC?
On 09/24/2015 10:03 AM, Marco van de Voort wrote: In our previous episode, Graeme Geldenhuys said: No, FPC knows nothing about Lazarus project files. In Lazarus IDE you can go to Project Options, and then click on the "Show Options" button and the bottom of that dialog. Copy and paste that into a shell script which you can then run. You would obviously have to adjust some paths. Maximus IDE and MSEide makes this slightly easier than Lazarus. They both have a similar "show options" button, but don't use "packages". So the results they generate include every single Unit Path and Include Path and other compiler settings you need to compile your project. Lazarus has lazbuild to simply compile a project from the commandline. but you have to have lazarus which is not available for all environments... eg: OS/2 -- NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to compile Lazarus program using only FPC?
On 09/24/2015 09:48 AM, Bo Berglund wrote: I want to check my options regarding Lazarus and FPC. If I develop a program on Windows Lazarus, move it to Debian Lazarus (x86) and then finally want to compile on ARM on for example Raspberry Pi but outside of Lazarus, how is that done? the lpr file contains the initial pascal code for the project... Does FPC recognize the Lazarus project file such that paths etc are observed? do you mean those in the lpi xml file? not as far as i know... it is extraneous outside of lazarus... Or is thare a separate file for FPC I have to prepare in order to set the unit paths? i specify them on the command line or add them to the "local to the project" fpc.cfg file... i have a few projects that i copy from winwhatever and *nix lazarus to OS/2 for compiling in that environment so i'm familiar with the situation because lazarus is not available for OS/2... i copy the lpr and any other code files... then possibly adjust a local fpc.cfg unless the system-wide one works for this project, and finally compile... fpc -B myproject.lpr i actually have a script that i build with so as to get a log if/when i need it... = 4OS2 cmd script = @echo off if exist *.o del /q *.o if exist *.ppu del /q *.ppu set fpcopts=-vehinw -B -CF64 -Fulibs\neededlib -omyprojectp.exe iff '%1' eq '' .or. %@lower['%1'] eq 'debug' then set fpcopts=%fpcopts -ghl -dDEBUG else set fpcopts=%fpcopts -dRELEASE endiff rem echo compiling command line to log file... '^' is escape in 4OS2 for literal chars echo fpc %fpcopts myproject.lpr ^|^& tee /a builditp.log | tee builditp.log echo. | tee /a builditp.log echo on rem execute compiling command line fpc %fpcopts myproject.lpr |& tee /a builditp.log @unset fpcopts = /4OS2 cmd script = -- NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to compile Lazarus program using only FPC?
On 09/24/2015 11:14 AM, Michael Van Canneyt wrote: On Thu, 24 Sep 2015, waldo kitty wrote: On 09/24/2015 10:03 AM, Marco van de Voort wrote: Lazarus has lazbuild to simply compile a project from the commandline. but you have to have lazarus which is not available for all environments... eg: OS/2 Since the projects in question are lazarus projects to begin with, this is a non-issue. one might think that but it is not always the case... i generally start a project in lazarus on winwhatever or *nix... even when it is destined solely for the OS/2 environment... are my projects started this way not "lazarus projects"? ;) -- NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] shift right operation with variables
On 08/16/2015 09:38 PM, Xiangrong Fang wrote: The output is: 00FF 00FF Why they are different? How can I ensure the result is like SHR with constant. being curious, i tried your program with the same results... then i changed the var name from res to foo with the same results... i thought maybe there was some type conversion going on so i changed foo from integer to QWord and still got the same results... there appears to be a problem at play... Free Pascal Compiler version 3.1.1 [2015/06/13] for x86_64 -- NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] which GUI (noob)
On 08/06/2015 12:30 PM, Graeme Geldenhuys wrote: On 2015-08-06 15:43, Graeme Geldenhuys wrote: 1. Run Lazarus and open the fpgui_toolkit.lpk package found in the fpGUI code: fpgui/src/corelib/[x11|gdi]/fpgui_toolkit.lpk Click Compile. It was brought to my attention that the above is somewhat ambiguous. I meant for the text [x11|gdi] to mean x11 or gdi depending on your platform. i found that out ;) thanks for the clarification! -- NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Basic Sockets in FreePascal
On 07/26/2015 09:14 PM, Coyo wrote: How do you import a unit/library in FPC? Is there a .deb package or something that I install? hunh?? is there something wrong with the standard uses foo, bar; clause?? -- NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Please trim your quotes
On 07/22/2015 03:59 PM, Bart wrote: On 7/22/15, Frederic Da Vitoria davito...@gmail.com wrote: Strange. In Settings, go to the Labs tab, the setting should be named something like what Graeme wrote, There simply is nosuch tab. are you using the plain html interface or the fancier one? i have the fancy one... i click on the gear under my name in the far right top corner... from there i select settings... then across the top of the resulting page is a blue set of links right beside the red compose link... the 8th one over is Labs... 3rd from the right end... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] loadlibrary() unsafe ?
On 06/20/2015 11:11 AM, fredvs wrote: Re-re-re-Hello. This one does not work too ;-( = - AProcess.Environment.Text := 'LD_PRELOAD=/home/fred/sak/sak/sakit/liblinux64/libportaudio.so' ; how many sak are there really? you have two plus sakit... this is the first you've posted anything of your directory structure... perhaps you can modify your script to echo the data so you can compare it? #!/bin/sh LIBPORTAUDIO=libportaudio.so #portaudio library ESPEAKBIN=espeak #espeak binary CALLDIR=${0%/*}/# directory where is ESPEAKBIN echo export LD_PRELOAD=$CALLDIR$LIBPORTAUDIO export LD_PRELOAD=$CALLDIR$LIBPORTAUDIO echo $CALLDIR/$ESPEAKBIN $CALLDIR/$ESPEAKBIN ___ note the two echo lines i added... you should be able to see or retrieve them to see/know the live data so you can make your direct attempts work with the same... -- NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TFPHashList and nil pointers
On 05/20/2015 07:11 AM, Michael Van Canneyt wrote: On Tue, 19 May 2015, Serguei TARASSOV wrote: Hello, Is it normal that TFPHashList cannot find an item by name if the pointer is nil? However, the item is stored in the list. FPC 2.6.4, both Windows and Linux versions. program project1; uses Contnrs; var List: TFPHashList; begin List := TFPHashList.Create; List.Add('Name1', List); List.Add('Name2', nil); writeln('List count: ', List.Count); writeln('Index of Name1: ', List.FindIndexOf('Name1')); writeln('Index of Name2: ', List.FindIndexOf('Name2')); List.Free; end. Output: List count: 2 Index of Name1: 0 Index of Name2: -1 It is by design. how do you find and update that item and its pointer? -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Reinier Olislagers
On 2/1/2015 6:38 AM, Bart wrote: On 2/1/15, waldo kitty wkitt...@windstream.net wrote: someone please tell me that BigChimp on the forums is not Reinier Olislagers in RL... Unfortunately in fact he is. thank you... i just found out about his passing on 2014 Dec 04... i was looking on the forums for some assistance with fpcup... is anyone going to take over that project? it works very well and should not be lost with his passing... he did an excellent job with it and it is a valuable resource... -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Reinier Olislagers
someone please tell me that BigChimp on the forums is not Reinier Olislagers in RL... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cannot reuse TFPHTTPClient object for 2 different POST requests
On 1/17/2015 12:42 PM, leledumbo wrote: you don't have to clear the inbound buffer to prevent constipation? ;) Which inbound buffer? i was thinking that there's some sort of inbound traffic that may be filling a buffer that needs to be emptied... i don't know or have any other ideas to offer... -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Cannot reuse TFPHTTPClient object for 2 different POST requests
On 1/16/2015 12:57 PM, leledumbo wrote: Consider the following program (it's a real program with real parameters, nothing hidden, so you can really just try it out because the target server is public): you don't have to clear the inbound buffer to prevent constipation? ;) -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] multi-platform and filesystem case sensitivity
what is the recommended way of handling filesystem case sensitivity when users can provide a filename mask for use in processing? i'm not sure what the best or recommended way is and i'm not sure how i would want to handle it... i do know that i need to handle it, though... one of my testing systems has a case sensitive filesystem and of the 50 or so test files with mixed case names, only 1/3 to 1/2 are being processed... eg: t1.txt t2.TXT T3.TXT t4.TxT -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] findfirst wildcards...
On 12/3/2014 3:41 AM, Jonas Maebe wrote: On 03 Dec 2014, at 06:05, waldo kitty wrote: can you help me understand the differences in the output of the below program? given these three filenames: t.txt t1.txt t11.txt with mask t?.txt why does MatchesMaskList not show t.txt and t11.txt like plain findfirst? ? means a single arbitrary character. findfirst with t?.txt should not match t.txt nor t11.txt either. yes, i wrote t11.txt when i should have written t1.txt... my bad... however on OS/2 native OS/2 with 4OS2 command interpreter replacement OS/2 DOS native OS/2 DOS with 4DOS command interpreter replacement Vista (32bit) t?.txt returns both t.txt and t1.txt... C:\freepascal\projects\miscdir t?.txt Volume in drive C is SQ004512V04 Volume Serial Number is DC02-9142 Directory of C:\freepascal\projects\misc 12/02/2014 11:31 PM 2 t.txt 12/02/2014 11:31 PM 2 t1.txt 2 File(s) 4 bytes 0 Dir(s) 51,111,350,272 bytes free C:\freepascal\projects\miscfilemask t?.txt looking for files that match t?.txt *FindFirst only - multiple masks capable* ff1(t?.txt); t.txt t1.txt *FindFirst w/ MatchesMaskList* ff2(t?.txt); t1.txt *FindFirst w/ RegExpr - multiple masks capable* ff3(t?.txt); t.txt t1.txt t11.txt new filemask demo program follows... = snip filemask.lpr = Program Filemask; Uses SysUtils, StrUtils, Classes, Masks, RegExpr; var dirSR : TSearchRec; flist : TStringList; fmask : String; lcnt : Integer; procedure ff(tstr : String); begin if FindFirst(tstr,faAnyFile,dirSR) = 0 then begin repeat flist.Add(dirSR.Name); until FindNext(dirSR) 0; {$IFDEF FPC} FindClose(dirSR); {$ENDIF} end; end; procedure ff1(tstr : String); var tcnt : Integer = 0; fmcnt : Integer = 0; begin fmcnt := WordCount(tstr,[';']); if fmcnt = 0 then ff(tstr) else for tcnt := 1 to fmcnt do begin ff(ExtractWord(tcnt,tstr,[';'])); end; end; procedure ff2(tstr : String); begin if FindFirst('*',faAnyFile,dirSR) = 0 then begin repeat if MatchesMaskList(dirSR.Name,tstr) then flist.Add(dirSR.Name); until FindNext(dirSR) 0; {$IFDEF FPC} FindClose(dirSR); {$ENDIF} end; end; procedure ffregex(tstr : String); var RegexObj: TRegExpr; begin RegexObj := TRegExpr.Create; RegexObj.Expression := tstr; if FindFirst('*',faAnyFile,dirSR) = 0 then begin repeat if RegexObj.Exec(dirSR.Name) then flist.Add(dirSR.Name); until FindNext(dirSR) 0; {$IFDEF FPC} FindClose(dirSR); {$ENDIF} end; RegexObj.Free; end; procedure ff3(tstr : String); var tcnt : Integer = 0; fmcnt : Integer = 0; begin fmcnt := WordCount(tstr,[';']); if fmcnt = 0 then ffregex(tstr) else for tcnt := 1 to fmcnt do begin ffregex(ExtractWord(tcnt,tstr,[';'])); end; end; begin if ParamStr(1) = '' then WriteLn('please specify a file mask - eg: *.foo') else begin fmask := ParamStr(1); WriteLn; WriteLn('looking for files that match '+fmask+''); WriteLn; flist := TStringList.Create; flist.Sorted := True; flist.Duplicates := dupIgnore; flist.CaseSensitive := False; try WriteLn('*FindFirst only - multiple masks capable*'); WriteLn; WriteLn(' ff1('+fmask+');'); ff1(fmask); for lcnt := 1 to flist.Count do WriteLn(''+flist.Strings[lcnt-1]); WriteLn; WriteLn; flist.Clear; WriteLn('*FindFirst w/ MatchesMaskList*'); WriteLn; WriteLn(' ff2('+fmask+');'); ff2(fmask); for lcnt := 1 to flist.Count do WriteLn(''+flist.Strings[lcnt-1]); WriteLn; WriteLn; flist.Clear; WriteLn('*FindFirst w/ RegExpr - multiple masks capable*'); WriteLn; WriteLn(' ff3('+fmask+');'); ff3(fmask); for lcnt := 1 to flist.Count do WriteLn(''+flist.Strings[lcnt-1]); WriteLn; WriteLn; finally if Assigned(flist) then FreeAndNil(flist); end; end; end. = snip = -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] findfirst wildcards...
On 12/3/2014 6:16 AM, Tomas Hajny wrote: Given the fact that OS/2 appeared in your listing, I can clarify the difference. It comes from the fact that in case of FindFirst/FindNext, the interpretation of wildcards is performed by the underlying operating system whereas the routine mentioned by Bart performs this interpretation inside the Pascal code. Equally to DOS (and actually implemented that way in an attempt to make OS/2 as compatible to DOS as possible), OS/2 is somewhat more relaxed in interpretation of question marks at the end of the file name (i.e. before the file extension) in the sense of evaluating question marks at that position (but not elsewhere) as either 1 _or_ no character. right... i see this everywhere /except/ on native linux... even DOSEMU and similar that i have tested all see '?' as 0 or 1 character... even REGEX takes that approach :) You get the same behaviour under DOS (either compiled with TP/BP or FPC) and also e.g. under DosEmu under Linux, etc. I believe that the MS Windows NTVDM implementation would not behave that way (i.e. I believe that the DOS window simply passes the request to MS Windows which perform the evaluation differently), but I haven't tried it. cmd and command both see '?' as 0 or 1 character... C:\freepascal\projects\misccommand C:\FREEPA~1\PROJECTS\MISCver Microsoft Windows [Version 6.0.6002] C:\FREEPA~1\PROJECTS\MISCdir t?.txt Volume in drive C is SQ004512V04 Volume Serial Number is DC02-9142 Directory of C:\FREEPA~1\projects\misc 12/02/2014 11:31 PM 2 t.txt 12/02/2014 11:31 PM 2 t1.txt 2 File(s) 4 bytes 0 Dir(s) 51,110,965,248 bytes free C:\FREEPA~1\PROJECTS\MISCexit C:\FREEPA~1\projects\misccmd Microsoft Windows [Version 6.0.6002] Copyright (c) 2006 Microsoft Corporation. All rights reserved. C:\FREEPA~1\projects\miscdir t?.txt Volume in drive C is SQ004512V04 Volume Serial Number is DC02-9142 Directory of C:\FREEPA~1\projects\misc 12/02/2014 11:31 PM 2 t.txt 12/02/2014 11:31 PM 2 t1.txt 2 File(s) 4 bytes 0 Dir(s) 51,111,006,208 bytes free C:\FREEPA~1\projects\miscexit Now regarding your original question - I don't think that you can ask the operating system to search for multiple masks at the same time (and thus the RTL does not provide such functionality directly either). understood... Scanning through all the files as suggested by Bart is the standard solution for that. i didn't realize that that would be how it was done until after i started finding and reading relevant pages... when i started looking, i found nothing for plain FPC... everything was for delphi or lazarus... However, _if_ you have reasons to be concerned about the performance of scanning through all the files (e.g. if running over a slow network drive and having to work with directories containing _many_ files - read: thousands of files at least), it is possible to reduce the number of operating system calls and network transfers by using the OS/2 API directly and providing it with a buffer sufficient for returning information about many files at once (e.g. one hundred of them, or whatever). the most i've had to wade through was ~4 files but i don't think that that will be much of a problem... it wasn't a problem with my previous simplistic finding and processing methods but i've recently removed the artificial file limits i had when using arrays... now i'm loading matching filenames into stringlists and then processing from there ;) Obviously, your code would still need to go through all of them one by another, but it would decrease the overall time needed for processing this scan. Still, as already mentioned, this solution should not be necessary under normal conditions (and it would imply necessity of changing the implementation for other operating systems - unlike to using standard RTL functionality). yeah, i'm looking for easy and simplistic cross-platform capability if i can get it... one of my projects is targetted at OS/2, winwhatever, and linux... they're all i can compile natively for... with that and the lack of lazarus on OS/2, i think the demo program i posted in my reply to jonas shows me the yellow brick road to follow to the emerald city... the hint came from bart and/or some older messages i found where it was stated that calling findfirst multiple times was a possibility... i think that (ff1) and/or the regex one i came up with (ff3) will work best for my needs... i do also greatly appreciate bart's initial post and the subsequent ones from others... they got me started thinking clearer when i was blind and stuck before ;) -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted.
Re: [fpc-pascal] findfirst wildcards...
On 12/3/2014 3:02 PM, Ralf Quint wrote: On 12/3/2014 8:30 AM, waldo kitty wrote: yes, i wrote t11.txt when i should have written t1.txt... my bad... however on OS/2 native OS/2 with 4OS2 command interpreter replacement OS/2 DOS native OS/2 DOS with 4DOS command interpreter replacement Vista (32bit) t?.txt returns both t.txt and t1.txt... On any DOS based OS (that includes OS/2 and Windows), the ? wildcard character will find any character, including no character at all in that position. So in your example, t?.txt will find t.txt and tx.txt but not txy.txt. It will not return any filename longer than your search mask, but return shorter filenames. This is (should be) a functionality of the underlying system calls. On *ix based systems, the filenames are evaluated by the shell, not the OS, and your search result will be different in a lot of cases... yep... that's exactly been my findings... my main goal, in this case, is/was to find a way of having multiple masks... messing with MatchesMaskList showed me the difference which i was trying to figure out as it was not what was expected... now i have three choices and don't yet know which i'll choose... most likely the plain findfirst with multiple masks one... it works and its operation is as expected from ~30 years messing with computers... the regex one will definitely stay in the stack as it offers an easy method to go both ways and that may be desirable in some cases... i just have to test it on OS/2 and see if i can compile it... i can't do that with MatchesMaskList because the unit that contains it is not available on OS/2... -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] findfirst wildcards...
On 12/3/2014 3:27 PM, Bart wrote: On 12/3/14, Ralf Quint freedos...@gmail.com wrote: On any DOS based OS (that includes OS/2 and Windows), the ? wildcard character will find any character, including no character at all in that position. So in your example, t?.txt will find t.txt and tx.txt but not txy.txt. It will not return any filename longer than your search mask, but return shorter filenames. This is (should be) a functionality of the underlying system calls. Windows.FindFirstFile however treats ? as exactly 1 character AFAIK. And is I'm not mistake this was also the case with TP in the old days. my command line testing shows otherwise... are you speaking of GUI related code? i'm working only with the command line... no GUI stuffs at all... C:\freepascal\projects\misccmd Microsoft Windows [Version 6.0.6002] Copyright (c) 2006 Microsoft Corporation. All rights reserved. C:\freepascal\projects\miscdir t*.txt Volume in drive C is SQ004512V04 Volume Serial Number is DC02-9142 Directory of C:\freepascal\projects\misc 12/02/2014 11:31 PM 2 t.txt 12/02/2014 11:31 PM 2 t1.txt 12/02/2014 11:31 PM 2 t11.txt 3 File(s) 6 bytes 0 Dir(s) 50,785,431,552 bytes free C:\freepascal\projects\miscdir t?.txt Volume in drive C is SQ004512V04 Volume Serial Number is DC02-9142 Directory of C:\freepascal\projects\misc 12/02/2014 11:31 PM 2 t.txt 12/02/2014 11:31 PM 2 t1.txt 2 File(s) 4 bytes 0 Dir(s) 50,785,431,552 bytes free C:\freepascal\projects\misccommand Microsoft(R) Windows DOS (C)Copyright Microsoft Corp 1990-2001. C:\FREEPA~1\PROJECTS\MISCdir t?.txt Volume in drive C is SQ004512V04 Volume Serial Number is DC02-9142 Directory of C:\FREEPA~1\projects\misc 12/02/2014 11:31 PM 2 t.txt 12/02/2014 11:31 PM 2 t1.txt 2 File(s) 4 bytes 0 Dir(s) 50,785,423,360 bytes free C:\FREEPA~1\PROJECTS\MISC -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] findfirst wildcards...
On 12/3/2014 5:09 PM, Bart wrote: On 12/3/14, Ralf Quint freedos...@gmail.com wrote: On 12/3/2014 12:27 PM, Bart wrote: Windows.FindFirstFile however treats ? as exactly 1 character AFAIK. And is I'm not mistake this was also the case with TP in the old days. A quick test in a Windows 8.1 command prompt: I don't dispute teh way cmd/command treats ? in dir, I merely stated that the OS function FindFirstFile des not do it like that. (And so we should not change FindFirst/FidNext behaviour.) you are confusing me, now... is not the OS function the same as what the command interpreters use?? shouldn't the results be the same? as a ~30 year veteran with computers, i surely expect them to be the same... perhaps i'm just fscking old? ;) -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] findfirst wildcards...
On 12/3/2014 5:48 PM, Tomas Hajny wrote: On Wed, December 3, 2014 23:18, waldo kitty wrote: . . desirable in some cases... i just have to test it on OS/2 and see if i can compile it... i can't do that with MatchesMaskList because the unit that contains it is not available on OS/2... Which unit is it, btw? Have you tried compiling that unit for OS/2? The fact that it hasn't been included with releases for OS/2 means just that noone tested it there so far, not necessarily that it might not work there... MatchesMaskList and its friends are in the Lazarus MASKS unit... since lazarus is not available for OS/2, i'm not looking for it to happen... then there's the difference in the way it operates compared to what is expected... -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] findfirst wildcards...
On 12/3/2014 8:10 PM, waldo kitty wrote: MatchesMaskList and its friends are in the Lazarus MASKS unit... since lazarus is not available for OS/2, i'm not looking for it to happen... then there's the difference in the way it operates compared to what is expected... not the way it operates... that should say its output... then there's the difference in its output compared to what is expected... -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] findfirst wildcards...
how do you process for multiple filemasks? eg: find ts??.sel and t???.sel for the same processing run == snip filemask.pas == Program Filemasks; Uses SysUtils, StrUtils, Classes; var dirSR : TSearchRec; flist : TStringList; fmask : string; begin if paramstr(1) '' then begin fmask := paramstr(1); writeln('looking for files that match '+fmask+''); writeln; flist := TStringList.Create; // try flist.Sorted := False; flist.Duplicates := dupIgnore; flist.CaseSensitive := False; if FindFirst(fmask,faAnyFile,dirSR) = 0 then begin repeat flist.Add(dirSR.name); writeln(PadRight(IntToStr(flist.count),6) + ' ' + flist.Strings[flist.count-1]); until FindNext(dirSR) 0; {$IFDEF FPC} findclose(dirSR); {$ENDIF} end; writeln; writeln(PadRight('found ' + IntToStr(flist.count),5) + ' files matching '+fmask+''); // finally //if assigned(flist) then // freeandnil(flist); // end; end else writeln('please specify a file mask - eg: *.foo'); end. == snip == as seen above, i also attempted to use try...finally in the above but fpc always complained about the next line... Free Pascal Compiler version 2.6.4 [2014/03/02] for i386 Copyright (c) 1993-2014 by Florian Klaempfl and others Target OS: OS/2 Compiling filemask.pas filemask.pas(19,9) Error: Identifier not found try filemask.pas(19,9) Fatal: Syntax error, ; expected but identifier FLIST found Fatal: Compilation aborted Error: X:\FP\2.6.4\BIN\OS2\ppc386.exe returned an error exitcode (normal if you did not specify a source file to be compiled) what am i missing?? i've never really used this capability before... -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] findfirst wildcards...
On 12/2/2014 5:12 PM, Bart wrote: On 12/2/14, waldo kitty wkitt...@windstream.net wrote: how do you process for multiple filemasks? eg: find ts??.sel and t???.sel for the same processing run Maybe I misunderstand the question but: Use '*' as mask for FindFirst/FindNext then use MatchesMaskList()? in the above masks, any '*' returns too many unwanted files... after some hours of experimenting i finally figured out that using '?' works better but in some cases, it can also return unwanted files (shorter filenames) than desired... i'm not aware of MatchesMaskList but i will hunt it down and see if it helps... thanks! ;) -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] findfirst wildcards...
On 12/2/2014 5:12 PM, Bart wrote: On 12/2/14, waldo kitty wkitt...@windstream.net wrote: how do you process for multiple filemasks? eg: find ts??.sel and t???.sel for the same processing run Maybe I misunderstand the question but: Use '*' as mask for FindFirst/FindNext then use MatchesMaskList()? i can't find anything that is relevant or easy to understand... everything i've found seems to be pointing to lazarus code but i don't have lazarus code available on all systems this code will be compiled on :/ -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] findfirst wildcards...
On 12/2/2014 5:12 PM, Bart wrote: On 12/2/14, waldo kitty wkitt...@windstream.net wrote: how do you process for multiple filemasks? eg: find ts??.sel and t???.sel for the same processing run Maybe I misunderstand the question but: Use '*' as mask for FindFirst/FindNext then use MatchesMaskList()? can you help me understand the differences in the output of the below program? given these three filenames: t.txt t1.txt t11.txt with mask t?.txt why does MatchesMaskList not show t.txt and t11.txt like plain findfirst? with mask t??.txt why does MatchesMaskList not show t.txt and t1.txt like plain findfirst? am i wrong to expect the output to be the same? is there a way to have MatchesMaskList work like plain FindFirst routine with the addition of handling multiple masks? i think i'm really only wanting something like MatchesMaskList simply for handling multiple masks... i'm undecided on the additional restrictiveness of MatchesMaskList but i can see where it could be desirable in some cases... = snip = Program Filemask; Uses SysUtils, StrUtils, Classes, Masks; var dirSR : TSearchRec; flist : TStringList; fmask : string; begin if paramstr(1) = '' then writeln('please specify a file mask - eg: *.foo') else begin fmask := paramstr(1); writeln('looking for files that match '+fmask+''); writeln; flist := TStringList.Create; try flist.Sorted := False; flist.Duplicates := dupIgnore; flist.CaseSensitive := False; writeln('*using FindFirst(fmask,faAnyFile,dirSR)'); if FindFirst(fmask,faAnyFile,dirSR) = 0 then begin repeat flist.Add(dirSR.Name); writeln(PadRight(IntToStr(flist.count),6) + ' ' + flist.Strings[flist.count-1]); until FindNext(dirSR) 0; {$IFDEF FPC} findclose(dirSR); {$ENDIF} end; writeln; writeln(PadRight('found ' + IntToStr(flist.count),5) + ' files matching '+fmask+''); flist.Clear; writeln; writeln('*using FindFirst(''*'',faAnyFile,dirSR) with MatchesMaskList'); if FindFirst('*',faAnyFile,dirSR) = 0 then begin repeat if MatchesMaskList(dirSR.Name,fmask) then begin flist.Add(dirSR.Name); writeln(PadRight(IntToStr(flist.count),6) + ' ' + flist.Strings[flist.count-1]); end; until FindNext(dirSR) 0; {$IFDEF FPC} findclose(dirSR); {$ENDIF} end; writeln; writeln(PadRight('found ' + IntToStr(flist.count),5) + ' files matching '+fmask+''); finally if assigned(flist) then freeandnil(flist); end; end; end. = snip = -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] date formating dificulty
On 11/19/2014 9:17 AM, Philippe wrote: I still don't know how to use at the same time formatStr and FormatSettings in FormatDateTime. i'm not sure i understand your delima... perhaps you are trying to determine how the FormatSettings work and how you can force the same output format on different OSes? i found the following (slightly modified by me for CLI) delphi code that might help... the original code resides at http://www.delphibasics.co.uk/RTL.asp?Name=FormatDateTime in the code, we output the results of the various FormatDateTime usages... then we change the values of the date and time formatting variables and run the same outputs again... I´ll like very much to find a tutorial or some example about the good practice to manage dates and be sure it will do the same thing on different machines in some cases, you can fall back to delphi tutorials... it can be troublesome in some cases where things are slightly different between FPC/Lazarus and Delphi... the biggest problem i personally run into is that so much example code is GUI oriented and i still code for CLI... anyway, here is the output of the following code... *NOTE:* i think we've found a bug in (fpc?) trunk or perhaps it is just an unexpected side effect due to the system's settings... the day and month are reversed in the first separators line... as the comments in the code note, we're trying to work with 5 Jun 49... but this output was done on a US winwhatever (vista) system... it might be getting in the way by forcing mm/dd/yy format from the dd/mm/yy work string... someone else will have to speak to that as i would expect it to do the same in the second output set but it doesn't... System formatting: Working with date string = 05/06/49 01:02:03.004 Separators dd/mm/yy hh:nn:ss = 06/05/49 01:02:03 ShortMonths mmm = May LongMonths = May ShortDaysddd = Thu LongDays = Thursday ShortDate d = 5/6/2049 LongDate dd = Thursday, May 06, 2049 AMPM hhampm = 01AM ShortTime t = 1:02 LongTime tt = 1:02:03 2DigitCentury dd/mm/ = 06/05/2049 Modified formatting: Working with date string = 05-06-49 01_02_03.004 Separators dd/mm/yy hh:nn:ss = 05-06-49 01_02_03 ShortMonths mmm = JUN LongMonths = JUNE ShortDaysddd = SUN LongDays = SUNDAY ShortDate d = 05-JUN-49 LongDate dd = SUNDAY 05 of JUNE of 1949 AMPM hhampm = 01morning ShortTime t = 01_02_03 LongTime tt = 01 _ 02 _ 03 . 004 2DigitCentury dd/mm/ = 05-06-1949 = snip = program DTFormatting; uses SysUtils; var DateStr : String; myDate : TDateTime; begin // Set up our TDateTime variable with a full date and time : // 5th of June 2049 at 01:02:03.004 (.004 milli-seconds) // // Note that 49 is treated as 2049 as follows : // TwoDigitYearCenturyWindow = 50 //Current year = 2008 (at time of writing) // Subtract TwoDigitYearCenturyWindow = 1958 //2 digit year to be converted = 49 // Compare with the last 2 digits of 1958 = Less // So the year is in the next century = 2049 // (58 would be converted to 1958) WriteLn('System formatting:'); DateStr := '05/06/49 01:02:03.004'; WriteLn(' Working with date string = '+DateStr); myDate := StrToDateTime(DateStr); // Demonstrate default locale settings // Use the DateSeparator and TimeSeparator values WriteLn(' Separators dd/mm/yy hh:nn:ss = '+FormatDateTime('dd/mm/yy hh:nn:ss', myDate)); // Use ShortMonthNames WriteLn(' ShortMonths mmm = '+FormatDateTime('mmm', myDate)); // Use LongMonthNames WriteLn(' LongMonths = '+FormatDateTime('', myDate)); // Use ShortDayNames WriteLn(' ShortDaysddd = '+FormatDateTime('ddd', myDate)); // Use LongDayNames WriteLn(' LongDays = '+FormatDateTime('', myDate)); // Use the ShortDateFormat string WriteLn(' ShortDate d = '+FormatDateTime('d', myDate)); // Use the LongDateFormat string WriteLn(' LongDate dd = '+FormatDateTime('dd', myDate)); // Use the TimeAmString WriteLn(' AMPM hhampm = '+FormatDateTime('hhampm', myDate)); // Use the ShortTimeFormat string WriteLn(' ShortTime t = '+FormatDateTime('t', myDate)); // Use the LongTimeFormat string WriteLn(' LongTime tt = '+FormatDateTime('tt', myDate)); // Use the TwoDigitCenturyWindow WriteLn(' 2DigitCentury dd/mm/ = '+FormatDateTime('dd/mm/', myDate)); WriteLn(''); WriteLn('Modified formatting:'); // Now change
Re: [fpc-pascal] Catching Exceptions in Library
On 11/6/2014 7:39 PM, Steve Gatenby wrote: Could anybody tell me why the following error is caught by the try except in an Application, but not in a Library ? I am needing to find out where try except doesn't do what I think, not fix this code. are you seeing a different error than what you are expecting? if so, it is possible that it is triggered elsewhere in your code and not caught there... -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] any generic List class other than those in fgl unit?
On 10/24/2014 11:18 AM, Reinier Olislagers wrote: On 24/10/2014 17:15, Dennis Poon wrote: Can you give me a link to report this bug? I have not done this before. Is it really so hard to find? E.g. forum.lazarus.freepascal.org/ top left under free pascal, bugtracker link. Thanks. who uses forums when there are much preferred(??) mailing lists? ;) ;) ;) -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Is it possible to use top directory of subtree with -Fu -Fi -Fl options?
On 9/29/2014 5:00 AM, Tony Papadimitriou wrote: OK, I think I realized what the problem is. The * will apparently search in all subdirectories but (apparently again) one level deep. So, if you have something like: \progs\pascal\units\a \progs\pascal\units\a\b and you give -Fu\progs\pascal\units\* it will look in \progs\pascal\units\a but not in \progs\pascal\units\a\b So, is there a way to do this, i.e., specify the 'root' director for your units/includes and have it look at all files underneath regardless of nesting level? perhaps -Fu\progs\pascal\units\* -Fu\progs\pascal\units\*\* -Fu\progs\pascal\units\*\*\* -Fu\progs\pascal\units\*\*\*\* -Fu\progs\pascal\units\*\*\*\*\* -Fu\progs\pascal\units\*\*\*\*\*\* yeah, that's not regardless of nesting level because you have to manually add the next level... but i just also had a thought that the last line at your maximum level may be all that's needed if each directory represented by a * is searched for unit files... -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Internal error 200706094
On 9/29/2014 5:48 AM, Victor Matuzenko wrote: IMO the problem is the transformation -1 into an unsigned value. (Unsigned(-1) Max(Signed).) How can I rewrite this code to make it correct? I want to use constants to calculate offsets from untyped pointer. have you tried using a typed const? const C : int64 = -1; -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] best? safest? fastest?
On 8/7/2014 4:35 AM, Mark Morgan Lloyd wrote: waldo kitty wrote: On 8/6/2014 4:08 AM, Mark Morgan Lloyd wrote: I'd be inclined to start off using your method 1, i.e. text manipulation until the format is consistent. i don't understand until the format is consistent... the format has been in use since the 60s at least (AFAIK) ;) What I mean is, while you're doing the initial processing to e.g. add century digits to the date and possibly to check number of decimal places etc. oh, ok... yeah, that's all done before we reach this stage... as i posted previously, the format is already laid out so the string spacing is already a known factor... it is only a couple of places where one might run into historical TLE records that are space filled instead of zero filled in the mathematical number areas... the NORAD, COSPAR and Epoch areas are the only ones that one might find FWIW: i have taken some time and reworked things to be math based while still taking the required text format into account... i've seen a very nice increase in processing speed and now need to just make sure that i don't run into any of the basic and well known flaws that math processing of date strings seem to have ;) Flatten the original record and save it in a database, create a new flat text this appears that you are speaking of a sql database or similar? that may be a later feature but for now, everything is/has to be done with the raw TLE files... Databases, even for plain-text records, can be incredibly useful. agreed very much... however, in this case, with the old convoluted string stuffings that were being done, processing 8+ records takes only a minute or two whereas the previous tool was limited by the old 64k memory limit and processing the same files took over 45 minutes and resulted in only 10% of the total output of the new tool i've written... it is very late and my math may be off but output file sizes of 274K compared to 2.5Meg is 10%, right? but as previously noted, a real database is a possibility for the future... currently, my personal processing uses a text file containing all the latest TLEs that i have been able to accumulate... granted, the historical ones are not available in this format but then again, i don't have room for 9million records like other systems ;) i'm not sure what you mean by flatten, either... currently i break down the TLEs into their major records for storage in the in-memory database... the processing i posted is done before that storage takes place... I was thinking that the first thing you could do was convert the two lines into a single one for processing, but on reflection it would be better to save the original with as little modification as possible- possibly with any accession info you had (i.e. what body had provided that particular TLE). when i move to incorporate real database capabilities, something like this will be being done... that's an understood :) the reason i hesitate to do this now is due to the processing speed which has been achieved compared to the old tool written by someone else... adding database support will really slow all the processing down compared to what has been achieved at this point... granted, flat file text processing is slow and ugly but in this case, it is a major GoodThingtm :) the goal of the program is to build the in-memory database from all specified TLE files and then to write out new TLE files which may be filtered on a selection property so that only certain matching TLE records are saved... The problem there being that once the program stops you've then got to rebuild the next time. that's not really a problem in this case... when i allow others to use the tool (which is still considered by myself as alpha but may be beta or gamma level by others), they may choose to use it the same way that i do... or not... as noted above, i maintain a master database file which is loaded first and then the latest live data and finally all the just in update files... from these are built the desired output files... every once in a while i output an updated master database... out of over 4 possible records, i think i'm missing only a thousand or so and those are unlikely to ever be filled due to their military aspect and the lack of publicly available data on their orbital activities... so back to your statement above, i guess i'm already maintaining a fairly up-to-date master database which is quickly loaded and then updated by the other files being processed... What I normally do when handling large bodies of tabular info is to either have a series of database tables or a series of text files, where ideally the text files are absolutely predictable (all fields a known length and appropriately padded). i guess that's what i'm doing as described above ;) What I'm normally looking for is rate-of-change over multiple records with irregular timestamps, which is an awkward job
Re: [fpc-pascal] best? safest? fastest?
On 8/6/2014 4:08 AM, Mark Morgan Lloyd wrote: waldo kitty wrote: i suspect this is going to be like the long-standing joke of cheap, fast, stable: choose two over the years, i've seen two schools of code for dealing with dates... years, specifically... one school is string based and the other is math based... both have their faults and pluses... eg: string based fault : prepend '19' to single digit year value math based fault : 2003 - 1900 = 103 (3 is intended result) I'd be inclined to start off using your method 1, i.e. text manipulation until the format is consistent. i don't understand until the format is consistent... the format has been in use since the 60s at least (AFAIK) ;) FWIW: i have taken some time and reworked things to be math based while still taking the required text format into account... i've seen a very nice increase in processing speed and now need to just make sure that i don't run into any of the basic and well known flaws that math processing of date strings seem to have ;) Flatten the original record and save it in a database, create a new flat text this appears that you are speaking of a sql database or similar? that may be a later feature but for now, everything is/has to be done with the raw TLE files... i'm not sure what you mean by flatten, either... currently i break down the TLEs into their major records for storage in the in-memory database... the processing i posted is done before that storage takes place... the goal of the program is to build the in-memory database from all specified TLE files and then to write out new TLE files which may be filtered on a selection property so that only certain matching TLE records are saved... eg: take 100 TLE files and build one new TLE file containing only geosynch objects record starting with a database reference and then comprising slightly-massaged text. Run consistency checks on the new records until everything looks good (e.g. no non-numeric garbage resulting from a failed EBCDIC or GOST conversion), and only then parse it into numeric fields. yeah, we don't have to worry about EBCDIC or similar because all that's done when those tools generate the TLE files they output... FORTRAN was used originally but these days, there's numerous languages used... the format is plain old 7bit ASCII characters of 0-9... if there's a 0th line with the object's name in it, it is only (IME) A-Z0-9... for my purposes, lowercase letters are no problem, though ;) Out of curiosity, I presume that times are GMT/UTC but does a day start at midnight or noon (civil and astronomers' convention respectively)? i'm not sure on this either... i just know that my calculations return the same results as all the other programs and web sites i've validated against... i'm pretty sure that UTC is the base and i assume that the day starts at midnight... again, this because my calculations return the same results and projections as other programs and web sites i've validated against... more information on the TLE format is available in numerous places on the web... one well known one is http://celestrak.com/columns/v04n03/ Do the coordinates have to take into account changed ephemeris changes as the equinox precesses? i presume so but am not sure... each TLE record stands on its own and can be used to create tracking forward and backward in time for X period of time... as time progresses from the epoch, the certainty of the calculations falls off for numerous reasons... solar flux, perturbations, atmospheric drag, boosting the orbit, etc... -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] http://free-pascal-develop.nabble.com/ ?
On 8/6/2014 4:41 AM, leledumbo wrote: Does it exist a nabble web page for fpc-develop (with all fpc-devel archives) ? Nope. I'm the one who registered FPC general to Nabble a couple of years ago. You might want to register FPC develop as well. i assume that fpc-general is this list, fpc-pascal?? -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] exitproc?
On 8/5/2014 3:29 AM, Tomas Hajny wrote: On Tue, August 5, 2014 02:00, waldo kitty wrote: back in the [g]?olden days of TP6, i used to be able to set an exitproc procedure that would be executed any time my program exited for any reason... something like exitproc := @myexitproc; is this still able to be done easily? does it work even if there's an untrapped exception? Yes. Yes, as long as the exception is handled (caught) by the RTL. do you mean that it cannot be a unhandled exception with ''crash'' and heaptrace dumping the thousands of left-behind memory blocks that weren't deallocated?? that's what i'm trying to get past... i want to see the error and unhandled exceptions but i really want to properly deallocate the 4+ * 5 records on the heap instead of having to either wait for heaptrace to finish dumping them or forcibly closing the task or (in the worst cases) rebooting the entire machine... this is a console app based on tapplication (mainly for parameter parsing capability) and i have no clue (yet) how to catch exceptions and deal with them properly... additionally, this last time i had to deal with this, fpc 2.6.4 release for OS/2 was dieing with unknown error 110 (IIRC) during runtime... i finally determined this to be from trying to reset a file that didn't exist where the path was pointing to... goofy error on my part that i fixed by fsplitting the pattern and adding the directory portion back to the initial directory path being used... in any case, i thought i should also mention this so that it can be corrected so it is not unknown any more ;) -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] exitproc?
On 8/5/2014 12:51 PM, leledumbo wrote: is this still able to be done easily? No difference I guess: http://www.freepascal.org/docs-html/rtl/system/exitproc.html However, this is better: http://www.freepascal.org/docs-html/rtl/system/addexitproc.html thanks for the pointers! i was extremely tired when i wrote my original post... 16 hours editing (reformatting) a wikipedia table and researching the hundreds of entries in it can really make one's eyes cross :/ does it work even if there's an untrapped exception? Just try it i will try... hopefully i won't have to do anything to execute my existing procedures and i'll be able to stop manually executing them in my code as they should be executed automatically by using this method... -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] best? safest? fastest?
i suspect this is going to be like the long-standing joke of cheap, fast, stable: choose two over the years, i've seen two schools of code for dealing with dates... years, specifically... one school is string based and the other is math based... both have their faults and pluses... eg: string based fault : prepend '19' to single digit year value math based fault : 2003 - 1900 = 103 (3 is intended result) so what i have is satellite tracking two line element files... these files contain an epoch for the numbers contained in the TLE... the epoch is laid out as YYdoy.frac-doy == 14211.03356282 where YY : 1 or 2 digit year without century ('62' or ' 3' or '05') doy : day of year, 1, 2 or 3 digits, jan 1 is day 0 (' 0' or ' 15' or '020') frac-doy : 8 digit fractional day of the year what i'm needing to do is to choose a route to make the year portion four digits so that historical TLEs can be used... the program makes a comparison of the epoch to determine which of two is newer... the newer one is placed into the in-memory database for later usage... working with historical TLEs from 1957 to 1999 mandates four digit years be used or historical TLEs will override TLEs from 2000 to 2056 since 00 thru 56 are less than 57 (1957 first launch)... previous to any processing, the epoch taken from the TLE in the file is processed so that leading blanks in the epoch are replaced with zeros... today's epochs don't really need this as creation and processing methods have evloved over the years... this is done as a precaution for those times when processing historical TLEs which have not been converted to having leading zeros instead of blanks (aka spaces)... we've launched over 4 objects and there are possibly hundreds or thousands of TLEs for each one... at least one site is known to have over 9 million TLEs in their database... these routines are executed for each and every TLE loaded as we fill our in-memory database... finally (yeah i know, but i thought the history and methodology was important) my questions, as the subject alludes to, are which of the following methods would you choose? why? would you choose another method? why? all input is greatly welcomed! as always, thanks for your time and attention! :) {**} {**} // make sure we have the full four digit year for the epoch! // eg: 14211.03356282 becomes 2014211.03356282 which is 2014-07-30 00:48:19.827 // method 1 (string manipulation) if (Integer_Value(MyEpochStr,1,2) 57) then // first launch in 1957 MyEpochStr := FloatToStrF('20'+MyEpochStr,ffFixed,16,8)// value 57 so year is 21st century (2000 thru 2056) else MyEpochStr := FloatToStrF('19'+MyEpochStr,ffFixed,16,8); // value is = 57 so year is 20th century (1957 thru 1999) MyEpoch:= Real_Value(MyEpochStr,1,Length(MyEpochStr)); // convert to real for mathmatical comparison {**} // method 2 (combination string and math??) if (Integer_Value(MyEpochStr,1,2) 57) then // first launch in 1957 MyEpochStr := FloatToStrF(Real_Value(MyEpochStr,1,Length(MyEpochStr)) + 200,ffFixed,16,8) else MyEpochStr := FloatToStrF(Real_Value(MyEpochStr,1,Length(MyEpochStr)) + 190,ffFixed,16,8); MyEpoch:= Real_Value(MyEpochStr,1,Length(MyEpochStr)); // convert to real for mathmatical comparison {**} // method 3 (math manipulation) MyEpoch:= Real_Value(MyEpochStr,1,Length(MyEpochStr)); // convert to real for mathmatical comparison if (int(MyEpoch / 1000) 57) then // first launch in 1957 MyEpoch := (MyEpoch / 1000 + 2000) * 1000 // value 57 so year is 21st century (2000 thru 2056) else MyEpoch := (MyEpoch / 1000 + 1900) * 1000; // value is = 57 so year is 20th century (1957 thru 1999) MyEpochStr := FloatToStrF(MyEpoch,ffFixed,16,8); // store to MyEpochStr for later use (16 characters!) {**} {**} support routines for the above: Function Integer_Value(buffer : string; start, length : integer) : integer; var MyResult : integer = 0; answer : integer - 0; begin buffer := Copy(buffer,start,length); Convert_Blanks(buffer); if buffer = '' then buffer := '0'; Val(buffer,answer,MyResult); if MyResult = 0 then Integer_Value := answer else Integer_Value := 0; end; // Function Integer_Value Function Real_Value(buffer
[fpc-pascal] exitproc?
back in the [g]?olden days of TP6, i used to be able to set an exitproc procedure that would be executed any time my program exited for any reason... something like exitproc := @myexitproc; is this still able to be done easily? does it work even if there's an untrapped exception? -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Wikipedia article about fcl-web
On 7/31/2014 5:08 PM, Fabrício Srdic wrote: Thanks a lot! About the web server implemented by the unit fphttpserver, is it recommended for high load environments? please define high load environments... 2014-07-31 17:54 GMT-03:00 leledumbo leledumbo_c...@yahoo.co.id: Hi everyone, Today I just started https://en.wikipedia.org/wiki/FCL-Web to start wikipedia-ing FPC supporting web frameworks. Please help expanding correcting the article, especially secondary/tertiary sources. -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] replacement of MemAvail and MaxAvail
On 5/30/2014 5:37 AM, mokashe.ram wrote: Thanks For Your This Prompt Reply... but in promgram these functions are already used in my applcation developed in TP7, sonow i am migration this applcation to free pascal. how can i replace using free pascal? take them out... what do you need them for? ;) -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Ping problems - OS/X
On 5/21/2014 7:00 AM, Peter Brooks wrote: AStringList.LoadFromStream(Aprocess.Output); AStringList.LoadFromStream(AProcess.Stderr); AStringList.LoadFromStream(AProcess.Output); [quote] LoadFromStream loads the contents of Stream into the stringlist. Each line in the stream (as marked by the end-of-line marker of the particular OS the application runs on) becomes one string in the stringlist. This action replaces the contents of the stringlist, it does not append the strings to the current content. [/quote] those LoadFromStream calls are overwriting the contents of your stringlist... note the last sentence in the above quote from http://www.freepascal.org/docs-html/rtl/classes/tstrings.loadfromstream.html you need to figure out how to run through your streams and AStringList.Add() the entries to your stringlist *OR* you need to have another set of stringlists for those process outputs and then use AStringList.AddStrings() *OR* you need to AStringList.Assign() another string list, print/save it, AStringList.Assign() the next string list, print/save it and so on... as LoadFromStream, Assign replaces the current contents of AStringList with the new contents... FWIW: if you are using the improved example on http://wiki.freepascal.org/Executing_External_Programs then you should note that it does state that it is flawed and that you should use the code in the next example reading large output which waits till the end and then loads the stream into the stringlist and then you can manipulate it from there... -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to disable case sensitivity for file names on *nix?
On 5/11/2014 3:29 AM, Sven Barth wrote: You could add the option -vut to see which files the compiler tries to use (t) and which it does then finally use (u). Be aware though that this might get noisy ;) i thought i had replied back in this thread that i had found the problem... i used -vav and finally saw that i had a typo in the -Fu and -Fi entries... one character too many or lacking can make all the difference :/ -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] how to disable case sensitivity for file names on *nix?
i'm using git to pull a project from sourceforge to a windows box and to a linux box... on windows, the project compiles fine... on linux, though, all of the files' names are lowercase but the sources have upper and CaMeL cased file names in the uses and include statements... i have no control over the project or the git repository it originates from... i surely don't want to have to edit the sources to lowercase all the uses and includes statements every time i update my local repositories... how can i get it to compile on linux no matter what case the names are? is there anything i can do on my side of the fence to tell fpc to operate case insensitive? hopefully a simple command line option i can easily add to my build script? -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to disable case sensitivity for file names on *nix?
On 5/10/2014 2:18 PM, Michael Van Canneyt wrote: On Sat, 10 May 2014, waldo kitty wrote: i surely don't want to have to edit the sources to lowercase all the uses and includes statements every time i update my local repositories... how can i get it to compile on linux no matter what case the names are? is there anything i can do on my side of the fence to tell fpc to operate case insensitive? hopefully a simple command line option i can easily add to my build script? Normally, it should compile if all filenames are lowercase. interesting... -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to disable case sensitivity for file names on *nix?
On 5/10/2014 5:14 PM, Sven Barth wrote: On 10.05.2014 20:09, waldo kitty wrote: i'm using git to pull a project from sourceforge to a windows box and to a linux box... on windows, the project compiles fine... on linux, though, all of the files' names are lowercase but the sources have upper and CaMeL cased file names in the uses and include statements... i have no control over the project or the git repository it originates from... FPC will look for each unit and include file (including directory names) in lowercase, UPPERCASE and AsWritten (AFAIK even in that order) maybe this is not the problem i'm facing, then... i'll have to dig deeper into the build script... it is a very simple build script but there may be a bug in it with an environment variable it sets for the library files... i surely don't want to have to edit the sources to lowercase all the uses and includes statements every time i update my local repositories... how can i get it to compile on linux no matter what case the names are? is there anything i can do on my side of the fence to tell fpc to operate case insensitive? hopefully a simple command line option i can easily add to my build script? You can't tell FPC to operate in a totally case insensitive way, because then the compiler would need to check for ANY possible spelling of the filename (plus extension), because if an underlying filesystem is case sensitive then a.pas would be different from A.PAS which would also be different from a.PAS as well as A.pas and so on... yes, i remember the discussion some time (several years?) back... i spent some time rereading over it before making my post, too... thank you to you and michael van canneyt for your responses... -- NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] how to use macros on linux?
when i try to compile a program on my non-GUI linux, it tells me that it can't find the programs... hunh? fpc -FUlib/$(TargetCPU)-$(TargetOS) foo.pas fpc is trunk installed via fpcup... [quote] user@machine:~/development/projects/misc$ ~/fpc -FUlib/$(TargetCPU)-$(TargetOS) foo.pas TargetCPU: command not found TargetOS: command not found Free Pascal Compiler version 2.6.5 [2014/04/08] for i386 Copyright (c) 1993-2012 by Florian Klaempfl and others Target OS: Linux for i386 Compiling foo.pas foo.pas(23,1) Error: Can't create object file: lib/-/project1.o foo.pas(23,1) Fatal: Can't create object lib/-/project1.o Fatal: Compilation aborted Error: /home/user/development/fpc/bin/i386-linux/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled) user@machine:~/development/projects/misc$ [/quote] so how do i use macros to tell fpc where to place the unit libraries on linux like i do for winwhatever?? -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to use macros on linux?
On 4/14/2014 12:54 PM, Mattias Gaertner wrote: On Mon, 14 Apr 2014 12:29:00 -0400 waldo kitty wkitt...@windstream.net wrote: when i try to compile a program on my non-GUI linux, it tells me that it can't find the programs... hunh? fpc -FUlib/$(TargetCPU)-$(TargetOS) foo.pas These are Lazarus macros. oh! hummm... so how do i use macros to tell fpc where to place the unit libraries on linux like i do for winwhatever?? fpc macro example: fpc -FUlib/\$fpctarget foo.pas i believe i tried that... i'll give it another go, though... and yes, i do note the \$ escape to prevent the shell from attempting to frak it up for me :lol: i did try that on the above, too, and also escaping the parens but came here out of frustration when nothing i was doing was working properly... [time passes] yes! thanks! :) this also tells me what i need to do for a couple of other projects O:) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Processing passwords etc.
On 4/12/2014 8:24 AM, Michael Van Canneyt wrote: Attached is an implementation that allows you to specify: What to do when allocating memory (zero out, randomize, nothing) What to do when freeing memory (zero out, randomize, nothing). very nice! thank you sir! i'm still learning FPC and all its fancy (to me compared to TP/BP) features :) Careful, it does not play well with the heaptrc unit. why is that? is there a way to fix it? i do use the heaptrc unit to try to ensure that i'm not leaving stuff behind... If there is an interest in such thing, we can add it to the RTL. as miniscule as it is compared with others', here's my vote in the positive ;) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Processing passwords etc.
On 4/11/2014 5:03 AM, Michael Van Canneyt wrote: The main point is that in FPC you can install a memory manager that wipes out any memory when getting or releasing it, if you want to make your software more secure that way. how would one go about doing this? i learned in my TP3/6 days to use fillchar on everything to ensure that it was filled with 0x00... especially my data files... when looking at them with a hex editor, my OCD would hit strongly because the data file was not clean and holding only my data... i don't know how one would go about cleaning released memory as someone else asked about (eg: extending an array or string or etc)... once the memory is released, it is no longer accessible, right? -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Processing passwords etc.
On 4/11/2014 4:10 AM, Mark Morgan Lloyd wrote: Using a memory manager would reliably wipe strings etc. when reallocated (i.e rather than when an assignment didn't trigger reallocation). On the other hand it would have the overhead of also overwriting blocks that the user knew were being freed and could audit first, as well as stuff that was being freed as part of the RTL operation. It's that latter case- where the RTL is copying something without the user being aware- that I think is significant. agreed... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Watching for file change
On 4/11/2014 3:06 PM, Krzysztof wrote: Hi, Does FPC have some file watching solution? I need this only for linux. I need notifications: - File/folder changed / removed / added in watched directory. I have idea how to do this in thread loop but maybe FPC has OS solution i'm interested in this, as well... i have an app in perl that i'm considering rewriting in FPC... in that app, i had to specifically grab the attributes of the files the app watches and compare those values to previously stored values... in perl: if ($check_file eq $alert_file) {# If we're testing the alert file and ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat($check_file); if ($size $prev_alert_size) { # the filesize is less than last we checked, write_log (2,Alert filename changed. Reopening $alert_file); close (ALERT); # we need to close and open (ALERT, $alert_file); # reopen it. $prev_alert_size = $size; } else { $prev_alert_size = $size; } } hopefully there is something similar to perl's stat() routine... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] lazarus not reachable
On 4/6/2014 5:40 PM, m...@rpzdesign.com wrote: Jim: Are you able to web surf to the lazarus.freepascal.org web site? yes, i can and i do not normally visit that site... FWIW: icmp may not be being allowed by the destination site or the router saying that the destination host is unreachable... that last address (below), when searched in google, shows as the first link named Remote Access Control but does not respond, AFAICT, to http connections... at least not from my current address... central NC, USA Tracing route to lazarus.freepascal.org [80.123.225.56] over a maximum of 30 hops: 11 ms1 ms1 ms www.xxx.yyy.zzz 216 ms16 ms16 ms 71.30.80.1 316 ms15 ms21 ms 40.130.34.250 420 ms20 ms18 ms 173.190.207.34 524 ms19 ms19 ms 173.190.207.14 619 ms20 ms19 ms 4.71.124.53 720 ms21 ms45 ms 4.69.200.217 8 207 ms 278 ms 212 ms 4.69.200.206 9 303 ms 422 ms 334 ms 4.69.200.214 10 136 ms 129 ms 130 ms 4.69.134.134 11 141 ms 160 ms 133 ms 4.69.134.149 12 142 ms 151 ms 129 ms 4.69.137.53 13 130 ms 128 ms 128 ms 4.69.143.137 14 128 ms 128 ms 127 ms 4.69.140.14 15 127 ms 128 ms 127 ms 4.69.163.13 16 127 ms 127 ms 127 ms 4.69.153.145 17 128 ms 135 ms 128 ms 4.69.153.150 18 127 ms 127 ms 126 ms 212.73.203.138 19 136 ms 136 ms 136 ms 195.3.68.137 20 152 ms 149 ms 149 ms 195.3.118.22 21 147 ms 149 ms 147 ms 80.120.208.116 22 *** Request timed out. 23 ** 80.120.208.116 reports: Destination host unreachable. Trace complete. -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] updating an old DOS tool using PChar strings
On 2/19/2014 8:30 PM, Paul Breneman wrote: On 02/19/2014 03:06 PM, waldo kitty wrote: ... any help is appreciated and thanks for reading this quite possibly rambling post emanating from my scrambled brain cells... FPC DOS is pretty easy for a console program, but it is 32-bit (whereas DOS is 16-bit) so it isn't as simple as Turbo Pascal. yes, that's what i'm seeing, too... i mean, the coding isn't a real problem... but trying to handle data from old 16bit applications can be problematic in some cases... I think my most enjoyable work ever was during the past 3.5 years, using Turbo Pascal on expensive real-time embedded equipment. i still get a lot of enjoyment with what i do with my old TP6 and BP7 installations... but i stay very basic in them for the most part... only rarely have i used PChar (for example) or similar constructions... i have been having fun with a new app i've been playing with for several years that's written completely with FPC... lots of pointer suff for strings and lists being used there... switching gears between the two styles is rough at times :) There is a 5 MB zip here that should make it easy to get started with FPC for DOS: http://www.turbocontrol.com/helloworld.htm thank you, sir! i shall take a look :) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] updating an old DOS tool using PChar strings
i have an old DOS tool written in BP7 that i'm needing to fix a couple of problems with... the main problem is that it is using an old CStr unit written by a Todd Holmes back in 1993... this unit was written to suppliment the reading and writing of C strings to/from streams and converting C strings (aka null terminated strings) to/from PASCAL strings... i started using this unit because i did not understand pointers and PChar all that well back then... it was the first thing i attempted to use that worked for the task at hand... now i'm needing to switch it to using BP7 native routines so that i can add a few capabilities that are sorely missing... the main one being to replace (sub)strings within a PChar string... i've looked for a replacestr or strreplace or stringreplace function but have not had any success... what i have found seems to be targeted at methods and uses quite unnecessary for this plain old DOS command line tool... definitely no turbo vision or anything so elaborate... so... does anyone have a freely usable BP7 compatible routine that will perform this (sub)string replacement task with standard BP7 PChar strings? further clarification: i would like to convert this tool to FPC but, as noted, it is a plain old DOS command line tool... IIRC, the DOS FPC requires some sort of memory manager to be used but that would seem to be a lot of overkill for this simple tool... quite simply, the tool pulls preformatted null terminated strings from a proprietary data file and creates an ascii text file with the contents... the final result is that this text file is displayed via html so certain characters '', '', and '' (at least) need to be replaced with their html entities... that's what the stringreplace routine i'm looking for will be used for... i just need to get away from the currently used CStr unit and switch to using BP7's native PChar routines to be able to do so... any help is appreciated and thanks for reading this quite possibly rambling post emanating from my scrambled brain cells... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] updating an old DOS tool using PChar strings
On 2/19/2014 5:58 PM, leledumbo wrote: Well, if you're not using FPC, then asking for non-FPC code here isn't the right way. It's useless to point yout o FPC units that BP7 doesn't have. this is rather true and i forgot to prefix my subject line with OT... my apologies for that... but i'm not really asking for non-FPC code to do this, though... at least, i don't think i am... just code that will work with BP7 until i can convert this to FPC DOS code... i certainly don't need access to huge amounts of memory... 64k in the heap is more than enough for this tool and the way it functions... the KIS principle at work :) As you've experienced, ReplaceStr (from StrUtils), StringReplace (from SysUtils) are FPC and Delphi routines, and BP7 doesn't have those units AFAIK. They don't work with PChar anyway. true but i'm hoping that someone still has their old libraries available and code to do this that they are willing to share... not to mention that BP7 is only one step away from delphi 1, unless i misunderstand things... in any case, how is a PChar string that much different than FPC's current use of pointer based null terminated strings on the heap? -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] updating an old DOS tool using PChar strings
On 2/19/2014 6:10 PM, Tomas Hajny wrote: On Wed, February 19, 2014 23:58, leledumbo wrote: Well, if you're not using FPC, then asking for non-FPC code here isn't the right way. It's useless to point yout o FPC units that BP7 doesn't have. As you've experienced, ReplaceStr (from StrUtils), StringReplace (from SysUtils) are FPC and Delphi routines, and BP7 doesn't have those units AFAIK. They don't work with PChar anyway. I'd add: - It is not clear to me why FPC should be more problematic than BP7 (I assume that you do not talk about a 286 PC; correct for the most part... even if you do, trunk with the plain 16-bit msdos support might still do it for you). i've pulled DOS262 with the GO memory extender but have not yet installed it on the system due to other questions not yet posed... i'm not sure what trunk with 16 bit support you speak of... i think it may be the recent work being done on 8086 support... is this right? if so, then trunk /may/ be where i want to go /but/ my OS/2 box doesn't have the ability to pull trunk and compile the DOS version... at least, not as far as i know... so far, i'm been relegated to pulling and installing the release snapshots on my OS/2 box... my winwhatever boxen, on the other hand, do pull and use trunk... at some point i hope to figure out how to perform cross compiling on so that i can work on a project on any platform and compile it for any other environment... this is part of the above mentioned questions not yet posed ;) i don't really think that this particular tool (or numerous others i have at hand) need a DOS extender since they all currently operate in an old school plain jane DOS environment without need of XMS or EMS... 64k heap is more than enough for the PChar strings this tool has to work with... What is the exact execution environment where you intend to use the compiled program (operating system, CPU type)? basically, it will be the (4)DOS environment on my eCS machine but the program may also be released to others for use on their DOS environments... whether that's DOS4 up to DOS6 native or in a VM device of some sort, i don't know... if it is using a command interpreter replacement like 4DOS, i don't know... my personal environment does use 4DOS... especially for my BBS controls ;) i have been asked about releasing this tool so that others can use it which is why i want/need to fix the few problems it has that i know about and why i don't know what DOS environment it will be running under... it is not so far out of the realm of possibility that a vintage 286 might be employed by a BBS sysop wanting a truly retro environment for their setup... - It is not completely clear what is the goal/task (e.g. whether it is necessary to modify the PChar string in place, or whether it is OK to convert PChar to a Pascal string first, the data pulled from the database file is not of a format that can be converted to pascal strings... it can easily be longer than 255 characters and may also have embedded EoL sequences... i did actually try (yesterday) to do this conversion to pascal strings and perform the replacements but it was using a mix of BP7's PChar functions and those of the CStr unit previously mentioned... needless to say, they are obviously not directly compatible and all attempts were met with 204 runtime errors which, even after stopping this work and the execution of that flavor of the tool, resulted in the system totally locking up and requiring the use of the big red switch followed by a chkdsk over all of the 6 drives/partitions used :/ incompatibility between the CStr unit routines and the native BP7 routines is the best explanation i have at this time since the CStr unit sets up its own buffer and similar operating capabilities... considering the age of the unit, i think it could also be used with TP/BP6 but i never tried since they didn't do PChar stuff in TP^/BP6 TTBOMM... overall, the goal is to simply pull the null terminated data from the data files and writeln it to a plain ascii text file... this part currently works but there is the additional goal of converting the tool so as to be able to change certain substrings within the PChar strings and writeln the final result as is currently being done... perform all the necessary operations on it and then pass a pointer to the string data as a PChar for some other processing expecting a PChar parameter). currently, the only thing done with the PChar strings is to pull them and writeln them to the output file... previous attempts at reformatting them failed... since they just worked as they were, i took the easy way out and didn't worry about dealing what i'm looking at now after 10 years or so... as far as passing pointers and processing in place or passing a copy to be returned goes, that's really of no concern to me as long as it is possible that the data can have substrings altered to their html entities so as to be
Re: [fpc-pascal] TSortedCollection dupes ordering
On 2/7/2014 4:06 AM, Frederic Da Vitoria wrote: 2014-02-07 waldo kitty wkitt...@windstream.net mailto:wkitt...@windstream.net: [...] so now i'm a bit confused but it has been a long day... again... :/ This makes sense... at least in your previous version: I guess catnbr is a string. yes... Compare uses whatever KeyOf returns, and since KeyOf returns the address of a string, Compare handles the keys as such. To compare more than 1 field, the simplest way would be for KeyOf to return the address of the TLERec, which is the behavior of TSortedCollection.KeyOf http://lazarus-ccr.sourceforge.net/docs/rtl/objects/tsortedcollection.keyof.html . i've read that numerous times but... So IMO you should simply remove your implementation of KeyOf and edit Compare so that it receives PTLERec and uses the relevant fields instead of a simple string. seriously? [/rhetorical] son of squidly! i don't know why but i've always overridden keyof as well as compare and at least one other that i can't think of at the moment... now that i've completed converting my decision tree to using two bits per option instead of the three-state format i was using (the exe was reduced by a few 10's of k's) i will see about working on this aspect... while my app is in production and operating 24x7 on my systems, i still consider it to be no more than beta stage... personally, alpha but then again, i have pretty high testing standards for my code... while it might work, there's no way that i would allow it out in a commercial operation without a lot more testing and evaluation... anecdote: some years back i wrote a messaging app to the specs for the use it was to be placed in... those specs stated that a message identifier would not be used within a three year period... testing of that code took just over three years to ensure that it was to spec... running mathematical algorithms showed that the code was up to spec but i preferred to use actual testing to make sure... i'm my own worst critic ;) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TSortedCollection dupes ordering
On 2/5/2014 7:48 PM, Jim Leonard wrote: On 2/5/2014 5:24 PM, waldo kitty wrote: i'm unsure what to do or how to handle this so that there is a secondary (sub) sorting order so that the main key is the master sort and then a secondary key is used when duplicates are allowed... You put both key comparisons in the same .Compare function. interesting... In one of my Turbo Pascal projects, I used this: PSystems=^TSystems; TSystems=object(TSortedCollection) function Compare(Key1, Key2: Pointer): Integer; virtual; function GetSize:longint; end; ... Function TSystems.Compare; begin if PSystem(Key1)^.score PSystem(Key2)^.score then Compare := -1 ahh... i see what you are doing... you are passing the pointer to the whole record instead of just the needed key... hummm... i'll have to think about that and how to do it in my app... right now i'm only passing the necessary key because the record is 'large'... but then again... some thought and meditation is necessary ;) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TSortedCollection dupes ordering
On 2/6/2014 4:23 AM, Frederic Da Vitoria wrote: Then my trick does not work for you because it hides the fact that the records are identical. actually, the problem comes when referencing the IndexOf() the record... IndexOf(Item) is passed (unmodified) thru a couple of routines to finally end up here as 'idx'... IndexOf() being the TSortedCollection IndexOf() routine... Procedure LogTLEPerApo(tleRecord: PTLERec; idx: sw_integer; var oFile: text); begin WriteLogLine(AppLogFile,0, PadLeft(IntToStr(idx),5) + ' ' + PadRight(tleRecord^.catnbr^,5) + ' ' + PadRight(tleRecord^.cospar^,8) + ' ' + PadRight(tleRecord^.satname^,27) + ' ' + PadRight(AddChar('0',FloatToStrF(tleRecord^.epoch,ffFixed,15,8),14),15) + PadRight(displayEpochString(tleRecord^.epoch),19) + ' ' + PadLeft(FloatToStrF(tleRecord^.Perigee,ffFixed,15,8),16) + ' x ' + PadLeft(FloatToStrF(tleRecord^.Apogee,ffFixed,15,8),16) + ' x ' + PadLeft(FloatToStrF(tleRecord^.Inclination,ffFixed,15,8),16) + ' ' + PadLeft(FloatToStrF(tleRecord^.SMajAxisKM,ffFixed,15,8),16) + ' ' + PadLeft(FloatToStrF(tleRecord^.MMPeriod,ffFixed,15,8),16) + ' ' + PadLeft(FloatToStrF(tleRecord^.SMAPeriodC,ffFixed,15,8),16) + ' ' + PadLeft(FloatToStrF(tleRecord^.SMAPeriodP,ffFixed,15,8),16) ); WriteOUTFile(tleRecord,oFile); inc(tot_TLEs_written); end; You need to give to someone the responsibility of giving the secondary key. that's not going to happen... anyone can generate these records and make them available to others for use... i'm aware of at least 5 different groups and several owners of the objects who are generating these... If I understand what you wrote correctly, there is already something which could be used as a tertiary key, but it doesn't really work because the way it is filled is not consistent across the different sources. right... for the same reason as above... If I were you, I'd keep this tertiary key data (I guess it is meaningful, so you can't remove it), right... it is part of the format... some records don't even have this tertiary key filled in... and I'd create my own secondary key inside the TSortedCollection descendant. hummm... one group does something similar but i currently don't have any method of doing this... in all actuality i should probably be doing this in a sql database but the overhead of processing speed and storage space is more than i want to deal with... especially since a full processing run using all options takes less than a minute for ~4 records and a previous tool (limited to 64k) takes almost 30 minutes... I'd use 2 compare functions, - one which works as your current one but wouldn't be declared as a compare function (you could call it CheckPrimaryExists) and which would return 0 if the primary key already exists - and one which uses both the primary and the secondary key as Jim suggested. The algo (when duplicates are allowed) would be something like: if primary key exists then set secondary key to a number insert the data definitely something for me to contemplate on... Note that depending on the total number of rows, you could use a general counter for the secondary key, no need to fetch the value of the last secondary key for the same primary key. You'd get something like (primary key / secondary key) A / 0 B / 0 B / 1 (duplicate detected, first secondary key generated) C / 0 C / 2 (duplicate detected, second secondary key generated, note that there is no C1) ... ... and now that I think of it, you don't need 2 compare functions, the second one should work for both usages. this is one of the things i like about talking about problems... while others may not be fully aware of the data, they can still come up with ideas on how to handle situations... one of the things i used to do was to talk to a mechanic friend... i'd convert my tasks and problems to something vehicle related so that he could see it from his mechanic's point of view and then he'd ask about doing it like this in vehical mechanic terms which i'd convert back to programming and suddenly have a workable solution... he helped me solve more problems in this way than i can count and he barely knew where the big red switch was on the computers ;) ;) ;) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] freepascal community and USB printing
On 2/6/2014 9:24 AM, Philippe wrote: searching for raw printing to usb printer ... I found that some stuff has been posted in the community forum ... which looks to be out of order ... is there a way to get the informations posted ... and you did it (hijacked the same thread with another topic) again :/ -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] windows title
On 2/6/2014 9:16 AM, Philippe wrote: compiling for targets win32 and win64, I´ld like to change the window title, the window opened by cmd.exe please do not hijack other people's topics to ask an unrelated question... use your 'write' or 'new message' button instead of 'reply' to start a your new topic... thanks! -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TSortedCollection dupes ordering
On 2/6/2014 1:47 PM, Jim Leonard wrote: On 2/6/2014 11:04 AM, waldo kitty wrote: ahh... i see what you are doing... you are passing the pointer to the whole record instead of just the needed key... hummm... i'll have to think about that and how to do it in my app... right now i'm only passing the necessary key because the record is 'large'... but then again... some thought and meditation is necessary ;) Not much thought required -- a pointer to the record is 4 bytes, no matter how large the record is. yep! i realized this when i was going back thru the code cleaning it up and letting the other side of my brain wander about in its own world ;) In fact, it's probably faster than what you're doing, and more flexible. i was sending the pointer to field's contents ;) [time passes] well, i thought i was... my KeyOf routine does a cast using PTLERec(Item)^.catnbr but my (TLE) compare is apparently only sending the pointer to the catnbr string because the cast there is simply PString(Key1)^ and PString(Key2)^ the only place i understand that my (TTLEColl) compare is in play is in If NOT Search(KeyOf(Item), I) OR Duplicates Then // Item valid from the TTLEColl.Insert routine override that i posted previously... that Insert routine is taking a pointer to an entire record... so now i'm a bit confused but it has been a long day... again... :/ -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TSortedCollection dupes ordering
On 2/5/2014 3:57 AM, Frederic Da Vitoria wrote: [...] Once again I did not test this, but it seems to me that if Compare returned -1 instead of 0, any duplicate would be inserted after because it would never be considered as equal to any other. But since you still want your collection to be able to choose between skipping duplicates or keeping them, the Compare modification would have to be slightly more subtle, something like: if result = 0 and Duplicates then result := -1 at the end of the Compare function. i tried this and it kinda works... it keeps the entries in their original order but... 1. the final logging of each item's record number (position in the collection) is -1 2. it doesn't help to sort them in order by a different field i'm unsure what to do or how to handle this so that there is a secondary (sub) sorting order so that the main key is the master sort and then a secondary key is used when duplicates are allowed... ideally, the secondary key would retain the original order in the case that the secondary key is exactly the same as a previous secondary key... but this is also problematic... to try to clarify: sometimes there are records released with exactly the same time stamp (epoch in my code i posted) but slightly different data within the record... there is another field that might be used to differentiate those BUT the records come from numerous locations... they may or may not use this tertiary key and if they do, their numbering in this tertiary key may not be the same as any other system's count for this tertiary key... this is a problem i don't know how to solve as there is no coordination between locations and no master coordinator for this tertiary key... it becomes even more apparent because my flow doesn't take any certain record containers before any others... they are read and processed as they appear (OS ordering actually) which may cause newer records with an identical time stamp to be processed after others... in my current design, i'm using first come, first served meaning that the first record processed is the one that is retained... with dupes, this doesn't matter so much but it does all still come into play... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] TSortedCollection dupes ordering
i have a TSortedCollection that i'm allowing duplicate keys to be inserted in... the problem that i'm having is that the duplicate keys are in reverse order from how they were inserted... i am overriding MyCollection^.Insert because i have additional tasks that need to be done at the time of insertion... without duplicate keys, everything works perfectly so that lesser keys do have a lower index than higher keys... with duplicate keys, though, the lesser keys are right but the duplicate lesser keys are in reverse order within their grouping... MyCollection^.Insert uses AtInsert to insert the new record... i switched this to Insert after i read the documentation statement that AtInsert should not be used... when i did this, my program crashed with an unknown runtime error 202 (stack overflow???)... at a guess, i would say that i ended up calling MyCollection^.Insert recursively... perhaps instead of just AtInsert i should use something_else.Insert inside my Insert?? anyway, how can i fix this problem where duplicates are inserted in the proper order while still retaining the existing proper key ordering? -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] DefaultFormatSettings usage
On 2/4/2014 8:54 AM, silvioprog wrote: t := StrToDate('2013-02-04 11:39:54'); // to format -mm-dd hh:nn:ss the above is StrToDate but you are also sending the time... you would see similar if you were sending the above string to StrToTime... StrToDate only accepts date formats as StrToTime only accepts time formats... if you want to send both, you have to use StrToDateTime ;) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TSortedCollection dupes ordering
On 2/4/2014 3:28 PM, Jim Leonard wrote: On 2/4/2014 1:40 PM, waldo kitty wrote: i have a TSortedCollection that i'm allowing duplicate keys to be inserted in... the problem that i'm having is that the duplicate keys are in reverse order from how they were inserted... Sounds like your TSortedCollection.Compare() needs additional logic. It isn't doing enough comparisons internally to order things properly. possibly... i dunno... currently it compares the (pstring) keys only... i thought about trying to also include a second field (a double) which is used for the time stamp but i don't know how to do that without having to use the key and this time stamp field every time i do anything with the records... i am overriding MyCollection^.Insert because i have additional tasks that need to be done at the time of insertion... without duplicate keys, Wouldn't it be better to perform your additional tasks before the insertion, then call a normal .Insert? Why overload something if there isn't really a need to? i kinda thought about that earlier when i was digging thru the code... IIRC, insert was overridden because there are cases where the existing record needs to be replaced (because the new record is newer) using AtPut and the non-added records must be logged and their reason for not being added (older or same)... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TSortedCollection dupes ordering
On 2/4/2014 5:16 PM, Frederic Da Vitoria wrote: 2014-02-04 waldo kitty wkitt...@windstream.net mailto:wkitt...@windstream.net: [...] i kinda thought about that earlier when i was digging thru the code... IIRC, insert was overridden because there are cases where the existing record needs to be replaced (because the new record is newer) using AtPut and the non-added records must be logged and their reason for not being added (older or same)... Just a quick idea which could be completely wrong, but wouldn't it solve your issue if Compare always returned -1 instead of 0? no, because i lose (at least) the logging of why the record was tossed out... see below... it wouldn't help with the duplicate keys being inserted in reverse order... Procedure TTLEColl.Insert(Item: Pointer); var I : Sw_Integer = 0; old : Pointer; foo : integer = 0; begin I := 0; If NOT Search(KeyOf(Item), I) OR Duplicates Then // Item valid begin logTLEEntryType('M'); // MERGE this TLE AtInsert(I, Item);// Insert the item // Insert(Item); // Insert the item inc(cur_TLEs_added); // increment the add counter end else // otherwise begin foo := CompareReal(PTLERec(At(i))^.epoch,PTLERec(Item)^.epoch); // compare the epochs case foo of -1 : begin // replace existing record logTLEEntryType('U');// UPDATE this entry old := At(i);// save existing pointer first! AtPut(i, Item); // now put in the new record dispose(PTLERec(old),done); // dispose old one inc(cur_TLEs_updtd); // increment the updated counter end; 0 : begin // we're tossing this one out logTLEEntryType('S');// this entry is the SAME dispose(PTLERec(Item),done); // dispose the item inc(cur_TLEs_same); // increment the same counter end; 1 : begin // we're tossing this one out logTLEEntryType('N');// the existing entry is NEWER dispose(PTLERec(Item),done); // dispose the item inc(cur_TLEs_old); // increment the old counter end; end; // case end; end; -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] best method: multiple three state options in a decision tree
On 1/27/2014 4:57 AM, Lukasz Sokol wrote: On 24/01/14 16:20, waldo kitty wrote: with the above epiphany and some other information i have acquired, i'm now in the process of rewriting the app... i suspect it will take me a day or two to get to the point i was at previously with the operational and in-use code but i still wanted to say thanks to you and others who provided ideas, insights and information ;) :) Glad to hear that not all I thought of is a brain fart ;) definitely not a brain fart... it was very helpful ;) However I'm still curious : why use bits directly, when you can have a set/'enum' of possible choice(s), guaranteed to be distinct - so you can't physically set OptionA twice, by definition, and then make the Options be an array of the options? well, i can't set any option more than once, anyway... not unless i make a code error and set or clear the wrong bit but that will be noticed very quickly during testing ;) for readability, i find setting the bits and then running down a simple CASE statement much easier to follow... especially since i wrote my code generator tool that creates the CASE statement and all of its valid selections ;) Yes it may be using Sizeof(set) x num options (1 byte per option?) yeah, i don't know... i'm very old school and like to keep things as tight as possible... being able to store all the options we've been discussing in one 16bit device is a good thing... that i can also simply use that device as a decimal number for the selectors in a CASE statement is a major good thing... no matter what i do, i can't get away from the CASE statement... well, i could by using a use tree of if/then/else but that's what i started with and it was not readable at all... the CASE statement decision tree is nice but i can't see how to use it with the sets of enums in an easy way... but then it's not for you to worry any more about the bits - the compiler will care for that and you can go rethink the logic ;) and also readability and maintainability +100 ;) once i get finished, this will be pretty much done and then i can move on to the larger application that this will eventually be a part of... i'm debating as to whether to keep this part as a separate binary or to build it all into one large monolithic app with the other parts... eventually i will be doing something with graphics which is going to be a whole new world for me to make mistakes in... and it is planned for all of this to by multi-platform, was well... data retrieval built-in along with the current merging and list output capabilities and then actually drawing the output on one of two graphical screens... one looking down at earth and the other looking up from earth... i should probably quit while i'm a head :LOL: But IMHO of course and YMMV ;) very true :) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Pure FPC ?
On 1/26/2014 4:00 PM, fredvs wrote: Hello. Does it exist a option to compile fpc without Delphi compatibility ? does {$mode objpfc} not suit your needs? ;) or whatever the default is? O:) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] best method: multiple three state options in a decision tree
On 1/23/2014 5:01 AM, Lukasz Sokol wrote: Maybe Something like: (but this is with type TOptionMinMax = [mmNone, mmMin,mmMinMax, mmMax]) i wanted to thank you, lukasz, for your input... it has made me take another look while rewriting to implement your ideas... during this process i had an epiphany... that being that i don't need three individual states for each option since one of those states is ANDing two of those states... since i'm ANDing all valid possibilities anyway, this will free up 5 'bits' or 'scores' leaving room for more options if needed in the future... it will also lessen the complexity of the CASE decision tree but not by very much... with the above epiphany and some other information i have acquired, i'm now in the process of rewriting the app... i suspect it will take me a day or two to get to the point i was at previously with the operational and in-use code but i still wanted to say thanks to you and others who provided ideas, insights and information ;) :) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to pass a procedure address and execute it?
On 1/23/2014 2:18 PM, waldo kitty wrote: following up on this, how do i pass parameters to doThis and doThat?? do i have to use an intermediate pre_doThis and pre_doThat which handles the calls from centralControl and then calls doThis and doThat with the necessary parameters? type TProc = Procedure; procedure doThis(aRecord : somerec;); begin addRecord(aRecord); end; procedure doThat(outFile : textfile; aRecord : somerec;); begin writefile(outFile,aRecord); end; procedure pre_doThis; begin doThis(theRecord); end; procedure pre_doThat; begin doThat(oFile,theRecord); end; procedure centralControl(var aValue : word; theRecord : somerec; whichProc : TProc); begin case aValue of 0 : begin whichProc; end; 1 : begin if theRecord^.aValue = something then whichProc; end; end; procedure inputThis; begin centralControl(foo,thisRecord,@pre_doThis); end; procedure outputThat; begin centralControl(foo,thisRecord,@pre_doThat); end; -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to pass a procedure address and execute it?
On 1/24/2014 3:18 PM, Ewald wrote: On 24 Jan 2014, at 21:20, waldo kitty wrote: On 1/23/2014 2:18 PM, waldo kitty wrote: following up on this, how do i pass parameters to doThis and doThat?? do i have to use an intermediate pre_doThis and pre_doThat which handles the calls from centralControl and then calls doThis and doThat with the necessary parameters? Simply change the type: Type TProc = Procedure(aRecord: somerec); Then you can call whichProc (in centralControl) with your argument of choice. ahhh! that helps to explain what the compiler error was that i was seeing... so i may need two different types if each procedure called from centralControl has different parameters? won't that cause a conflict if the parameters are not the same or are in different ordering or even if some procedure doesn't have parameters at all? -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] how to pass a procedure address and execute it?
i'm trying to use one routine (centralControl) to process data from two different routines (inputThis and outputThat)... the one routine (centralControl) needs to call one of two other routines (doThis or doThat)... how? :( procedure doThis; begin end; procedure doThat; begin end; procedure centralControl(var aValue : word; theRecord : somerec; var whichProc); begin case aValue of 0 : begin whichProc; -- compiler says illegal expression end; 1 : begin if theRecord^.aValue = something then whichProc; end; end; procedure inputThis; begin centralControl(foo,thisRecord,@doThis); end; procedure outputThat; begin centralControl(foo,thisRecord,@doThat); end; -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to pass a procedure address and execute it?
On 1/23/2014 2:22 PM, Ewald wrote: On 23 Jan 2014, at 20:18, waldo kitty wrote: i'm trying to use one routine (centralControl) to process data from two different routines (inputThis and outputThat)... the one routine (centralControl) needs to call one of two other routines (doThis or doThat)... how? :( First define a type to make your like easier: Type TProcType: Procedure; Next, adjust contralContol's prototype: procedure centralControl(var aValue : word; theRecord : somerec; whichProc: TProcType); And you're done:-) damn! i was so close so many times! i did try using pointer as the type with and without 'var' for whichProc... this will be a huge savings in time and code size! thanks! -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to pass a procedure address and execute it?
On 1/23/2014 2:27 PM, Marco van de Voort wrote: In our previous episode, waldo kitty said: i'm trying to use one routine (centralControl) to process data from two different routines (inputThis and outputThat)... the one routine (centralControl) needs to call one of two other routines whichproc is typeless and thus roughly equal to a pointer to a byte (though semantically different, and add another pointer indirection for the VAR). So the compiler doesn't know what to do with it. how? :( Define a procedure type that matches both procedures, in your example Type TProc = procedure ; // which is predefined in system afaik. and change whichproc to that type. The VAR is not necessary in this case. excellent! as noted in a previous post, i was so close several times ;) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to pass a procedure address and execute it?
On 1/23/2014 2:32 PM, Jim Leonard wrote: On 1/23/2014 1:27 PM, Marco van de Voort wrote: Define a procedure type that matches both procedures, in your example Type TProc = procedure ; // which is predefined in system afaik. and change whichproc to that type. The VAR is not necessary in this case. Alternately, switch to an OOP model, whose entire model (inheritance) addresses this sort of thing. interesting... i do use customapplication for the main program so i can take advantage of getoption and friends... i wonder... hummm... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] best method: multiple three state options in a decision tree
On 1/22/2014 3:52 AM, Lukasz Sokol wrote: [...] ^and this... looks like a (good?) use for a dynamic array of TMinMaxState = [mmNone, mmMin, mmMinMax, mmMax]; (then var Options = array[static or dynamic] of TMinMaxState;) This assumes options have a fixed position in the array however... but the bitwise code was assuming this anyway. ok so basically converting 16 bits storage into an array? currently only 15 bits are being used and i don't know that any more will be added... but i'm not seeing how to add (logical AND) them together for optionA:mmMin AND optionC:mmMinMax and similar up to all five basic ones as A:mmMin AND B:mmMax AND C:mmMinMax AND D:mmMax AND E:mmMin And yes, 4 states - one of them being mmNone - for the case when you don't want to use certain option. yes, i've basically been ignoring mmNone because all the bits are off so we just skip over it in the ANDing code If there is a lot of options, but not always consecutive - so there would be a lot more of mmNone's than significant states (IOW the data is sparse) - yes, with what i have done, there are 1023 valid combination... 1024 if we count all options off (or mmNone)... that's out of 32767 combinations where the majority are invalid... it is no wonder, with 1023 combinations, that i got lost/confused with my first attempt using if/then/else and while trying to manually implement the bitmap CASE code... maybe do TOption = record Index : [whatever type would suffice here]; State : TMinMaxState; // [which could then be 3 state not 4] end; and use a dynamic array to hold the TOption(s). as above, i'm not seeing how to AND each valid set together for later use in the filtering code :? Excuse my lameness please :) as I am not a programmer by trade. no problems... i'm looking for ideas and input for handling items like this... i appreciate any input on this... it would seem that things like this would come up a lot and that there would already be a class or possibly an object that one could feed the settings array to with the options that hold each array and then to be able to walk thru like one can do with TStringsList eg: fooList:TStringsList; [...] fooList[i]:='blah'; [...] writeln(fooList[i]); i actually did look at the TBits class but didn't see an easy way of walking it like one can do with TStringsList... my finding and looking at TBits was after some 12+ hours of manually coding if/then/else, getting lost in the details and starting over numerous times... what i finally did with my current attempt using a bitmapped word was to write a tool to generate all the code for the case statement... with this i was able to 1] find out how many valid combinations there are (1023) 2] have the ANDs all written in the proper order for each valid bitmask 3] generate a file that is easily included {$I bitcase.inc} any changes to the ordering need only a small rewrite to the generating tool to create the new CASE code for the filter... the resulting include file is only (!) 392353 bytes at 7932 lines with no comment lines... that's ~3x the size of the program's .pas file of 119151 bytes at 3157 lines with a few hundred comment lines... this current implementation is used for output filtering... there's going to be an exact duplicate used for input selection with the only difference between the two CASE code blocks being the routine called on a match... eg: case FilterBits of 0 : writeoutput; 1 : begin if (rec^.optionA = optionA_min) and (rec^.optionA = optionA_max) then writeoutput; end; 2 : begin if (rec^.optionA = optionA_min) then writeoutput; end; 3 : begin {invalid} end; 4 : begin if (rec^.optionA = optionA_max) then writeoutput; end; [...] case SelectBits of 0 : addItem; 1 : begin if (rec^.optionA = optionA_min) and (rec^.optionA = optionA_max) then addItem; end; 2 : begin if (rec^.optionA = optionA_min) then addItem; end; 3 : begin {invalid} end; 4 : begin if (rec^.optionA = optionA_max) then addItem; end; [...] i think i should be able to use one routine for both input selection and output filtering... done by pass the bitmap and the routine to be used... that'll save having to worry about editing in more than one place when things change... i just gotta figure out how to pass the routine to use... would something like: procedure runCase(var bitMap:word; whichProcedure: pointer); called with runCase(SelectBits,@addItem); runCase(FilterBits,@writeoutput); be the way to do this?? sometimes my linear procedural mind really gets in the way :/ -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___
Re: [fpc-pascal] best method: multiple three state options in a decision tree
On 1/22/2014 12:12 PM, Lukasz Sokol wrote: [...] If you insist on using bits define them: it isn't that i'm insisting on using them... more the way that my linear mind sees them... i'm trying to change this if it affords me better code that is easier to read, understand and modify... const OptionAmmMin = $0001; OptionAmmMinMax = $0002; OptionAmmMax = $0004; // and so on this is pretty much already being done by the code using SetBIT and GetBIT then do if Options and (OptionAmmMin and ... ) then this is where the CASE decision tree comes in with each CASE having the necessary if/then filtering of the data record at hand... I would have thought, that having an array of TOption like I wrote, would ensure the exclusivity. And having the array dynamic, you can check for its size, then write some clever code to use it ;) it may very well but as i wrote, i cannot visualize it in my mind's eye :( yes, i've basically been ignoring mmNone because all the bits are off so we just skip over it in the ANDing code If there is a lot of options, but not always consecutive - so there would be a lot more of mmNone's than significant states (IOW the data is sparse) - yes, with what i have done, there are 1023 valid combination... 1024 if we count all options off (or mmNone)... that's out of 32767 combinations where the majority are invalid... it is no wonder, with 1023 combinations, that i got lost/confused with my first attempt using if/then/else and while trying to manually implement the bitmap CASE code... If you count permutations (so combinations not repeating) you'd have 120 valid ones...? http://easycalculation.com/statistics/permutation-combination.php do I understand that correctly? there are 1023 permutations of the 32767 possible... that means that i have to have 1023 (1024 counting no options set) case selectors... each with their specific if/then to check the current data record for a match... [...] i think i should be able to use one routine for both input selection and output filtering... done by pass the bitmap and the routine to be used... that'll save having to worry about editing in more than one place when things change... i just gotta figure out how to pass the routine to use... would something like: procedure runCase(var bitMap:word; whichProcedure: pointer); called with runCase(SelectBits,@addItem); runCase(FilterBits,@writeoutput); be the way to do this?? sometimes my linear procedural mind really gets in the way :/ Huh, well a lot of micro-management goes on here; possibly ;) but i don't know... What if you did it like: - define the valid bit masks (permutations?) at the start, dynamically humm... my tool that generates the CASE statement does something like this... i might be able to adapt it... /BUT/ i still have to match the data records with the current permutation selected when the program is executed... don't i?? eg: myprogram --optionA=-1,145 --optionD=30,40 on execution, GetOption('optionA') loads the values from the optionA command line parameter... any value less than zero means to ignore that slot... all other numbers are valid... the above --optionA=-1,145 results in the optionA_MAX bit being set ( 0010) and storing the value of 145 in optA_MAX... the above --optionD=30,40 results in the optionD_MINMAX bit (0010 ), storing the value of 30 in optD_MIN, and storing the value of 40 in optD_MAX... ANDing the bitmasks together we have 0010 0010 which is 514 in decimal... this is the case selector value used later for output filtering (and future input selecting)... then the program loads all of the data records it finds in all of the default files... currently this is some 3 records from some 80+ files updated nightly... as the data is loaded, it is merged and updated so there are no duplicates records and all records have the most current, by date and time, information in them... after all the merging and updating, we start with the first record and run through all of them writing them to the output file... if there are no options specified on the command line, then all the records are written... in this example, only the records matching the values given for the two options will be written to the output file... currently, that's 514 : begin // 0010 0010 if (Rec^.optA = optA_MAX) and (Rec^.optD = optD_MIN) and (Rec^.optD = optD_MAX) then writeoutput; end; if you can explain to me how using the arrays would work so that i can visualize it like the above, then i can try to implement it... however, i can't see any way to bypass the huge CASE statement and its IF comparisons of the data in each record... how would using the arrays allow me to do that? - associate the procedures (their pointers) to jump to with the valid bit masks in a new data type (- do you REALLY have that many
Re: [fpc-pascal] best method: multiple three state options in a decision tree
On 1/18/2014 7:40 PM, waldo kitty wrote: what is the best method of coding a decision tree with options that have three states and all options are additive? clarification: i have a situation with 5 (at this time) options and all 5 are three state... each option can be paired with all other options' states but may NOT be paired with its own other states... [...] no one has any ideas or thoughts on this? i can be contacted offlist about this if one prefers ;) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] best method: multiple three state options in a decision tree
On 1/21/2014 10:21 AM, Mattias Gaertner wrote: On Tue, 21 Jan 2014 09:51:38 -0500 waldo kitty wkitt...@windstream.net wrote: On 1/18/2014 7:40 PM, waldo kitty wrote: what is the best method of coding a decision tree with options that have three states and all options are additive? clarification: i have a situation with 5 (at this time) options and all 5 are three state... each option can be paired with all other options' states but may NOT be paired with its own other states... [...] no one has any ideas or thoughts on this? Maybe I don't understand the question. that's quite possible... it took me a while to write it the way i did after starting over numerous times... i may have also used the wrong terms for what i was trying to describe as well as not giving enough examples but the example list was getting too large at that point anyway ;) The 5 options with each 3 states sounds like an array[1..5] of TRedGreenBlue. a lot of stuff i googled up related to 3states came up with similar... to me that reads as to be used for graphics and this is a console app with no graphics involved... i'm only using the bits to denote the combinations available... they select which IF statement is used in the actual filter code described below... originally i had thought of using an array but i didn't know the size of it and each grouping varies with the number of options... What do you mean with additive logical AND with some combinations being invalid... eg: optionA:min/max {solitary} optionB:max only AND optionE:min only {two ANDed together} optionA:min only AND optionB:min/max AND optionC:max only {three ANDed together} optionA:min/max AND optionA:min only {invalid} optionA:min/max AND optionA:max only {invalid} optionA:min only AND optionA:max only {invalid} and why a decision tree? because it is used as the (right now) output filter (tree of decisions to be made) determining what gets written to the resulting file from the (currently) 3+ entries loaded in a sorted, no-dupes collection... there are also plans to implement the exact same thing as an input filter to limit the data being loaded into the collection... eg: case foo of 0 : writeoutput; 1 : begin if (rec^.optionA = optionA_min) and (rec^.optionA = optionA_max) then writeoutput; end; 2 : begin if (rec^.optionA = optionA_min) then writeoutput; end; 3 : begin {invalid} end; 4 : begin if (rec^.optionA = optionA_max) then writeoutput; end; [...] 1316 : begin if (rec^.optionA = optionA_min) AND (rec^.optionB = optionB_min) AND (rec^.optionC = optionC_min) AND {optionD not used in this one} (rec^.optionE = optionE_min) then writeoutput; end; [...] 18506 : begin if (rec^.optionA = optionA_max) AND (rec^.optionB = optionB_min) and (rec^.optionB = optionB_max) AND (rec^.optionC = optionC_min) and (rec^.optionC = optionC_max) AND (rec^.optionD = optionD_min) AND (rec^.optionE = optionE_min) then writeoutput; end; the current idea is to use a bit for each state and then use a case statement for the decision tree (as shown above) so as to simply walk thru the integers that the bit patterns make for the valid combinations... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Adding files to a tar file
On 1/21/2014 7:45 PM, luciano de souza wrote: The program compiles, but I got an error. The message says that the first file of the directory can't be opened. What is wrong? your code uses faAnyfile... perhaps you need to be more restrictive? is your problem caused by a sub-directory with the directory of files you are trying to archive? or perhaps there's a soft/hard-link? i also do not see a findclose call after you finish with findfirst/findnext... granted, it may not be needed since you are exiting the program but it is more proper, IMHO... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] best method: multiple three state options in a decision tree
what is the best method of coding a decision tree with options that have three states and all options are additive? clarification: i have a situation with 5 (at this time) options and all 5 are three state... each option can be paired with all other options' states but may NOT be paired with its own other states... eg: optionA : min/max, min, max optionB : min/max, min, max optionC : min/max, min, max optionD : min/max, min, max optionE : min/max, min, max optionA can be used as : optionA:min/max optionA:min only optionA:max only optionA:min/max AND optionB:min/max optionA:min/max AND optionB:min only optionA:min/max AND optionB:max only optionA:min only AND optionB:min/max optionA:min only AND optionB:min only optionA:min only AND optionB:max only optionA:max only AND optionB:min/max optionA:max only AND optionB:min only optionA:max only AND optionB:max only optionA:min/max AND optionC:min/max optionA:min/max AND optionC:min only optionA:min/max AND optionC:max only optionA:min only AND optionC:min/max optionA:min only AND optionC:min only optionA:min only AND optionC:max only optionA:max only AND optionC:min/max optionA:max only AND optionC:min only optionA:max only AND optionC:max only optionA:min/max AND optionD:min/max optionA:min/max AND optionD:min only optionA:min/max AND optionD:max only optionA:min only AND optionD:min/max optionA:min only AND optionD:min only optionA:min only AND optionD:max only optionA:max only AND optionD:min/max optionA:max only AND optionD:min only optionA:max only AND optionD:max only optionA:min/max AND optionE:min/max optionA:min/max AND optionE:min only optionA:min/max AND optionE:max only optionA:min only AND optionE:min/max optionA:min only AND optionE:min only optionA:min only AND optionE:max only optionA:max only AND optionE:min/max optionA:max only AND optionE:min only optionA:max only AND optionE:max only and so on with each additional options and its three states... as you can see, the sheer number of combinations is huge! in my original attempt i started with if/then/else but that got very hard to follow very fast... so i decided to implement all the options in a bitmap so i could more easily use a case statement and simply list the decimal value of the valid bit patterns as the selection option... that is much easier to follow but can easily get confused... it has been many years since i've had to code such a decision tree and my (20+ year) old code is not available for me to dig out and (try to) follow... so i'm asking how you would handle this situation so as to make it easy to implement, easy to grok, easy to follow when reading the code AND easy to expand or shrink if/when necessary... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] windows.GetProcAddress() vs DynLibs.GetProcAddress()
fred, can you please adjust your quoting to use the standard '' for previous responses and then add your response below? you do add your response below but the quote is the exact of the previous and it is very hard to read only your responses when the previous is not prefixed by ''... thanks! ;) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to initialize a SearchRec var?
On 1/2/2014 6:31 PM, waldo kitty wrote: On 1/2/2014 2:52 PM, Sven Barth wrote: Beginning with 2.7.1 you can use the new Default() intrinsic which takes a type name as first and only argument (it returns a 0 initialized value of that type): 2.7.1 which means that we still have to respond to queries with older versions... ok, i think we can deal with that... following up on this... this is what i came up with... is it right/proper? {$IF (FPC_FULLVERSION = 20701)} {$INFO initializing dirinfo with Default(SearchRec)} dirinfo := default(searchrec); {$ELSE} {$PUSH} {$HINTS OFF} {$INFO initializing dirinfo with fillchar(dirinfo,sizeof(dirinfo),$00)} fillchar(dirinfo,sizeof(dirinfo),$00); {$POP} {$ENDIF} -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to initialize a SearchRec var?
On 1/5/2014 6:26 PM, Sven Barth wrote: On 05.01.2014 19:24, waldo kitty wrote: following up on this... this is what i came up with... is it right/proper? {$IF (FPC_FULLVERSION = 20701)} {$INFO initializing dirinfo with Default(SearchRec)} dirinfo := default(searchrec); {$ELSE} {$PUSH} {$HINTS OFF} {$INFO initializing dirinfo with fillchar(dirinfo,sizeof(dirinfo),$00)} fillchar(dirinfo,sizeof(dirinfo),$00); {$POP} {$ENDIF} Should be correct. thanks! it seems to work on the few systems where i tested it... we have to ensure that we get it placed into our existing code base ;) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] how to initialize a SearchRec var?
understanding that SearchRec has different formats for different OS targets, we've tried to use fillchar to initialize it to an empty record... unfortunately that does not remove the hint... instead the hint points to the fillchar line... we do not want to turn off hints so how can we initialize dirinfo and make fpc happy? [quote=os/2 ecs] Hint: Start of reading config file fpc.cfg Hint: End of reading config file fpc.cfg Free Pascal Compiler version 2.6.2 [2013/02/09] for i386 Copyright (c) 1993-2012 by Florian Klaempfl and others Target OS: OS/2 Compiling dirinfo.pas dirinfo.pas(13,19) Hint: Variable dirinfo does not seem to be initialized Assembling test_searchrec Linking dirinfo.exe emxbind 0.9d -- Copyright (c) 1991-1997 by Eberhard Mattes Deleting *path*\projects\satsort\dirinfo.out 1 file deleted 335,872 bytes freed 16 lines compiled, 3.9 sec 3 hint(s) issued [/quote] [quote]=vista] C:\freepascal\projects\misc_projectsfpc -vhinw dirinfo.pas Hint: Start of reading config file fpc.cfg Hint: End of reading config file fpc.cfg Free Pascal Compiler version 2.7.1 [2013/12/05] for i386 Copyright (c) 1993-2013 by Florian Klaempfl and others Target OS: Win32 for i386 Compiling dirinfo.pas dirinfo.pas(13,19) Hint: Variable dirinfo does not seem to be initialized Linking dirinfo.exe 16 lines compiled, 0.8 sec, 28304 bytes code, 1524 bytes data 3 hint(s) issued [/quote] [quote=dirinfo.pas] program test_SearchRec; uses Dos; const pattern : string = '*.pas'; var dirinfo : SearchRec; begin fillchar(dirinfo,sizeof(dirinfo),$00); FindFirst(pattern,AnyFile,dirinfo); findclose(dirinfo); end. [/quote] -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to initialize a SearchRec var?
On 1/2/2014 2:52 PM, Sven Barth wrote: Beginning with 2.7.1 you can use the new Default() intrinsic which takes a type name as first and only argument (it returns a 0 initialized value of that type): 2.7.1 which means that we still have to respond to queries with older versions... ok, i think we can deal with that... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] how to initialize a SearchRec var?
On 1/2/2014 4:27 PM, Mark Morgan Lloyd wrote: Sven Barth wrote: === code begin === var dirinfo: SearchRec; begin dirinfo := Default(SearchRec); Out of curiosity, does this work: var dirinfo: SearchRec= Default(SearchRec); +1 ;) what i run into is porting old code and trying to possbly also make it multi-platform... the biggest gotcha we've run into is those typed constants that are used to hold values between executions of a routine... those should be initialized to a zero/empty value before first execution but then retain their values afterward... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Free Pascal 2.6.4-rc1 released!
On 12/25/2013 6:33 PM, Gerhard Scholz wrote: I downloaded ftp://freepascal.stack.nl/pub/fpc/beta/2.6.4-rc1/i386-win32/fpc-2.6.4rc1.i386-win32.exe The setup the said: The setup files are corrupted. Please obtain a new copy of the program. I did that; the second copy also didn't work. let me guess... these are MSI installer packages and you didn't verify the MD5 of the files? maybe? -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Announcing PUMA Repository
On 12/15/2013 8:41 AM, Jonas Maebe wrote: On 14 Dec 2013, at 21:52, waldo kitty wrote: On 12/14/2013 8:00 AM, Jonas Maebe wrote: [...] No, because the MIME header seems to be invalid. thunderbird had no problem decoding the post... As mentioned, that's because your copy probably wasn't base64-encoded in the first place. i must have missed that part about /my copy/ in the original statement :? how can my copy be different from your copy if everyone in the list gets a copy of the same message via the same originating source from the same originating writer's software? yes, i know that news groups are also fed from the list which simply adds another hop in the path... It seems more like that there's a buggy mail server in the path (there was no base64-encoded part in the message I received). ummm... that strange block that you quoted was exactly that base64 encoded part! i copied it exactly as you sent it and pasted it into the site i pointed you to... Jonas Maebe Johannes W. Dietrich. :oops: please accept my apologies for the mix up :oops: i tend to concentrate on the content and don't always pay attention to who wrote the message... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Announcing PUMA Repository (Ralf Quint)
On 12/15/2013 3:06 PM, Johannes W. Dietrich wrote: A proper email client (instead of Apple Mail) would be a good start... ;-) Ralf Apple Mail doesn't seem to be the only software that doesn't know what to do with this type of encoded data. The problem seem to affect the list processor, too. See http://lists.freepascal.org/lists/fpc-pascal/2013-December/040336.html in the archive for reference. FWIW: the displayed block at the URL given decodes perfectly with the MIME decoding URL i gave previously... i have a sneaking suspicion that some are expecting certain control lines to be in use when they are not required for the given context... but then i'm still learning this MIME stuff and have only some tools at hand to work with and base my understanding on... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Announcing PUMA Repository
On 12/14/2013 8:00 AM, Jonas Maebe wrote: On 13 Dec 2013, at 21:33, waldo kitty wrote: On 12/13/2013 3:12 PM, Johannes W. Dietrich wrote: Sorry, I cannot understand your message. Which software do I need to decode it? what you quoted is a MIME encoded block... the message headers should give you the information needed to decode it... your mail software should have decoded it for you... No, because the MIME header seems to be invalid. thunderbird had no problem decoding the post... It should at least contain something like Content-Transfer-Encoding: base64, i haven't found where this is required but i've not tried to dig into the RFCs either... most of them give me massive headaches :( otherwise the mail client doesn't know it has to decode it. see above... thunderbird had no problems with it... perhaps thunderbird analyzes the info? i dunno but i showed the three content-* lines from the post... It seems more like that there's a buggy mail server in the path (there was no base64-encoded part in the message I received). ummm... that strange block that you quoted was exactly that base64 encoded part! i copied it exactly as you sent it and pasted it into the site i pointed you to... some slight editing to remove the leading ' ' and then a li'l click on their decode button and the text was shown exactly as thunderbird had decoded it from the original message... the poster quoted your message and prefixed each line with ' ', wrapped each line to ~75 characters, and then added their message text below your quoted text... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Announcing PUMA Repository (waldo kitty)
On 12/14/2013 9:28 AM, Johannes W. Dietrich wrote: Thanks again! assuming you are thanking me for pointing you to the mime decoding site, you are welcome... if that's not what you are thanking me for, i don't have any idea but you are welcome (still) ;) J. W. D. Am 14.12.2013 um 12:00 schrieb fpc-pascal-requ...@lists.freepascal.org mailto:fpc-pascal-requ...@lists.freepascal.org: Re: Announcing PUMA Repository (waldo kitty) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Announcing PUMA Repository
On 12/13/2013 3:12 PM, Johannes W. Dietrich wrote: Sorry, I cannot understand your message. Which software do I need to decode it? what you quoted is a MIME encoded block... the message headers should give you the information needed to decode it... your mail software should have decoded it for you... FWIW: the first two below are in the message header... the others are in the message body... i've prefixed each line with : in an effort to prevent software from interpreting and acting on them... : Content-Type: multipart/mixed; boundary3530028006232746402== : Mime-version: 1.0 : --===3530028006232746402== : Content-Type: multipart/alternative; boundary=047d7bd6bc445184c604ed65c37f : --047d7bd6bc445184c604ed65c37f : Content-Type: text/plain; charset=UTF-8 : [mime block here] FWIW@: you can visit http://www.base64decode.org/ and paste the block in to decode it... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Announcing PUMA Repository
On 12/13/2013 5:41 PM, Vincent Snijders wrote: 2013/12/13 Johannes W. Dietrich j.w.dietr...@medizinische-kybernetik.de mailto:j.w.dietr...@medizinische-kybernetik.de Sorry, I cannot understand your message. Which software do I need to decode it? I have no idea what went wrong. nothing went wrong... it appears that someone's reader can't or couldn't decode your MIME post... i saw it plainly (in my t-bird) without having to do anything special but was able to fully decode it from the poster's quoted block of it... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Problem building fixes_2_6
On 11/18/2013 2:01 AM, Reinier Olislagers wrote: On 18/11/2013 00:48, waldo kitty wrote: On 11/17/2013 12:41 PM, Reinier Olislagers wrote: On 17/11/2013 18:38, Marco van de Voort wrote: In our previous episode, Reinier Olislagers said: [...] Is it me, fpcup or should something be fixed in... ehrm fixes?[1] I noticed the Jenkins build server seems to build fixes ok... IIRC this means you are not using 2.6.2 issued make, but 3.82? Yes, of course slaps forehead - of course this is coming back to bite me... Thanks a lot, guys. how has fpcup been able to build 2.6.x if fpc 2.6.x cannot be made with make 3.82? By downloading and using make, as usual. seems my question was misunderstood... the previous conversations seem to indicate that make 3.82 was being (downloaded and??) used instead of 3.80... that's why i asked how fpc 2.8.x had been being built with make 3.82... You haven't ever used fpcup, have you? not yet... it is on the list but i also don't want to crash my current working setup where fpc and lazarus are installed in their checkout directories (as described in the wiki)... it works and i'm used to it but it did take me some time to understand it ;) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] any workable synapse https server (SSL) sample available?
On 11/8/2013 9:59 AM, Dennis Poon wrote: I downloaded the synapse4.0 but the sample project httpSserver inside does not work. When I pointed the Chrome and Firefox browser to http://192.168.1.4/ is that url accurate? firefox reported: Secure Connection Failed An error occurred during a connection to 192.168.1.4. SSL received a record that exceeded the maximum permissible length. this is talking about a secure connection but your url above is for plain http (port 80) not https (port 443)... Also, the httpserver program had Access Violations when terminated. (seems it forgets to call Terminate of all threads created). i can't help with that as all my synapse coding is done in console mode with no GUI mess at all... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] any workable synapse https server (SSL) sample available?
On 11/8/2013 11:17 AM, Dennis Poon wrote: waldo kitty wrote: On 11/8/2013 9:59 AM, Dennis Poon wrote: I downloaded the synapse4.0 but the sample project httpSserver inside does not work. When I pointed the Chrome and Firefox browser to http://192.168.1.4/ is that url accurate? i can't help with that as all my synapse coding is done in console mode with no GUI mess at all... Non GUI console mode sample will be great! please share. :lol: i don't have one of those, either, sorry... currently i've only got a partially working https client for a REST project and an email conversion tool that converts email parts to CP437 for posting to another network... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: SqlDB fails under Windows to create a newFirebird database
On 10/30/2013 10:34 AM, Graeme Geldenhuys wrote: On Wednesday 30/10/2013 at 15:37, Michael Van Canneyt wrote: AFAIK: Windows doesn't know single quotes, you need to use double quotes. Thanks Michael, you are correct. When using double quotes Windows was happy. Even if the path had spaces in, using double quotes still worked. can't help but to wonder if it still works as desired in linux... i know that quotes have different meanings and uses over there... -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal