Recent

Author Topic: DataProblems Maybe  (Read 29335 times)

Thausand

  • Sr. Member
  • ****
  • Posts: 292
Re: DataProblems Maybe
« Reply #105 on: May 07, 2019, 07:39:12 pm »
Attached 3 Screen Shots.
I sorry. i no see screenshot.... maybe you forget attach ?

Quote
In procedure RunCommandLine it goes from Line 13 to 23 no matter what I enter.

I can't figure out what the line is doing.
Is what write user lucamar.

Other place in source make commandlist:
Code: Pascal  [Select][+][-]
  1. procedure TTermiForm.FormCreate(Sender: TObject);
  2. begin
  3.   // make setup
  4.   .. have remove for write forum look in zip for see.
  5.  
  6.   // have command list
  7.   CommandList := TStringList.Create;
  8.   CommandList.AddObject('flyby', TObject(@flyby));
  9. end;
  10.  
That mean CommandList (TStringList) have add item string read 'flyby' and Object of line have pointer procedure flyby.

If press button:
Code: Pascal  [Select][+][-]
  1. procedure TTermiForm.RunButtonClick(Sender: TObject);
  2. begin
  3.   // make action
  4.   (Sender as TButton).Enabled := false;  // Make button disable (is possible run 1 command, not many)
  5.   RunCommandLine(ParameterEdit.Text);  // RunCommandLine and have ParameterEdit.Text for "command-line"
  6.   (Sender as TButton).Enabled := true;  // If command have run then have button enable and can run other command
  7. end;
  8.  
Then is call RunCommandLine(...)


Then i make write more RunCommandLine:
Code: Pascal  [Select][+][-]
  1. procedure TTermiForm.RunCommandLine(CommandLine: string);
  2. var
  3.   index : SizeInt;
  4.   s : string;
  5. begin
  6.   // have line command enter edit print Memo
  7.   PrintLine(' $ ' + CommandLine);
  8.  
  9.   // have make ParameterList empty (ParameterList type TStringArray)
  10.   ParameterList := nil;
  11.  
  12.   // Have split line command.
  13.   // Make split use space, #8,#9,#10,#13 and no split quote part double quote.
  14.   // Split is all most work same ExtractWord()
  15.   ParameterList := CommandLine.Split([' ',#8,#9,#10,#13], '"');
  16.   // ParameterList now can have many parts. First part have command. Other part after have (many) parameter.
  17.   // If have ParameterEdit.Text empty then ParameterList empty
  18.  
  19.   // ParameterList empty or no empty ?
  20.   if Length(ParameterList) > 0 then
  21.   // is no empty ...
  22.   begin
  23.     // .. then have "command" find in CommandList
  24.     index := CommandList.IndexOf(ParameterList[0]);  // ParameterList[0] = Split item first and mean "command".
  25.     // is find "command" ? (is from ParameterEdit)
  26.     if (index >= 0) then  
  27.     // Yes, is find command ....
  28.     begin
  29.       // ... then have execute command
  30.       TProcedure(CommandList.Objects[index])();
  31.     end
  32.     // If index < 0 then IndexOf not have find "command" and print error
  33.     else PrintLine(ParameterList[0] + ' : command not found');
  34.   end
  35.   // if Length(ParameterList) <= 0 then have empty ParameterEdit then have press button. Is mean "command" empty
  36.   else PrintLine('Empty command');
  37. end;      

What is more no understand ? I happy write explain  :)

Add: have write more explain.
« Last Edit: May 07, 2019, 08:05:26 pm by Thausand »

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: DataProblems Maybe
« Reply #106 on: May 07, 2019, 08:23:26 pm »
Can't attach too big.


Attached 3 Screen Shots.
I sorry. i no see screenshot.... maybe you forget attach ?

Quote
In procedure RunCommandLine it goes from Line 13 to 23 no matter what I enter.

I can't figure out what the line is doing.
Is what write user lucamar.

Other place in source make commandlist:
Code: Pascal  [Select][+][-]
  1. procedure TTermiForm.FormCreate(Sender: TObject);
  2. begin
  3.   // make setup
  4.   .. have remove for write forum look in zip for see.
  5.  
  6.   // have command list
  7.   CommandList := TStringList.Create;
  8.   CommandList.AddObject('flyby', TObject(@flyby));
  9. end;
  10.  
That mean CommandList (TStringList) have add item string read 'flyby' and Object of line have pointer procedure flyby.

If press button:
Code: Pascal  [Select][+][-]
  1. procedure TTermiForm.RunButtonClick(Sender: TObject);
  2. begin
  3.   // make action
  4.   (Sender as TButton).Enabled := false;  // Make button disable (is possible run 1 command, not many)
  5.   RunCommandLine(ParameterEdit.Text);  // RunCommandLine and have ParameterEdit.Text for "command-line"
  6.   (Sender as TButton).Enabled := true;  // If command have run then have button enable and can run other command
  7. end;
  8.  
Then is call RunCommandLine(...)


Then i make write more RunCommandLine:
Code: Pascal  [Select][+][-]
  1. procedure TTermiForm.RunCommandLine(CommandLine: string);
  2. var
  3.   index : SizeInt;
  4.   s : string;
  5. begin
  6.   // have line command enter edit print Memo
  7.   PrintLine(' $ ' + CommandLine);
  8.  
  9.   // have make ParameterList empty (ParameterList type TStringArray)
  10.   ParameterList := nil;
  11.  
  12.   // Have split line command.
  13.   // Make split use space, #8,#9,#10,#13 and no split quote part double quote.
  14.   // Split is all most work same ExtractWord()
  15.   ParameterList := CommandLine.Split([' ',#8,#9,#10,#13], '"');
  16.   // ParameterList now can have many parts. First part have command. Other part after have (many) parameter.
  17.   // If have ParameterEdit.Text empty then ParameterList empty
  18.  
  19.   // ParameterList empty or no empty ?
  20.   if Length(ParameterList) > 0 then
  21.   // is no empty ...
  22.   begin
  23.     // .. then have "command" find in CommandList
  24.     index := CommandList.IndexOf(ParameterList[0]);  // ParameterList[0] = Split item first and mean "command".
  25.     // is find "command" ? (is from ParameterEdit)
  26.     if (index >= 0) then  
  27.     // Yes, is find command ....
  28.     begin
  29.       // ... then have execute command
  30.       TProcedure(CommandList.Objects[index])();
  31.     end
  32.     // If index < 0 then IndexOf not have find "command" and print error
  33.     else PrintLine(ParameterList[0] + ' : command not found');
  34.   end
  35.   // if Length(ParameterList) <= 0 then have empty ParameterEdit then have press button. Is mean "command" empty
  36.   else PrintLine('Empty command');
  37. end;      

What is more no understand ? I happy write explain  :)

Add: have write more explain.
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

Thausand

  • Sr. Member
  • ****
  • Posts: 292
Re: DataProblems Maybe
« Reply #107 on: May 07, 2019, 09:12:15 pm »
Can't attach too big.
Have copy-paste Memo ?

I no understand what is no work for you  :(

In theory it work simpe: TEdit read "flyby byAirports.txt"  (no quote) then press TButton.

Then can wrong not find file then make read TEdit command + filename complete , have example "flyby E:\MyFiles\MyStorage\some\were\can\find\byAirports.txt"

If directory file or name file have space then my program no work ok and have need fix. That because if space then need quote TEdit command and/or need quote TEdit filename then type helper strip() no remove quote  :o

Other time my program no work correct and have error if no have "read/access right" for file or no have "read/acces right" for directory. That no problem my program and error windows/user.

I no want my program "hard-code" name file/directory "byAirports.txt"

Thausand

  • Sr. Member
  • ****
  • Posts: 292
Re: DataProblems Maybe
« Reply #108 on: May 07, 2019, 10:07:53 pm »
Ok, user JLWest me send picture private.

Then i write conclude:
- program flybylaz executable locate: F:\CodeLib\Flyby\flybylaz_publish\flybylaz.exe
- file airport locate: F:\CodeLib\Flyby\ByAirport.txt
- JLWest user start my program and make write edit: F:\CodeLib\Flyby\byairport.txt then button click
- Then FlyByLaz program write: command not found

How make work:
- Make sure file airport locate: F:\CodeLib\Flyby\ByAirport.txt
- start flybylaz program
- write Edit box: flyby F:\CodeLib\Flyby\byairport.txt
- click button

Is that work JLWest ?

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: DataProblems Maybe
« Reply #109 on: May 07, 2019, 11:08:50 pm »
Ok, user JLWest me send picture private.

Then i write conclude:
- program flybylaz executable locate: F:\CodeLib\Flyby\flybylaz_publish\flybylaz.exe
- file airport locate: F:\CodeLib\Flyby\ByAirport.txt
- JLWest user start my program and make write edit: F:\CodeLib\Flyby\byairport.txt then button click
- Then FlyByLaz program write: command not found

How make work:
- Make sure file airport locate: F:\CodeLib\Flyby\ByAirport.txt
- start flybylaz program
- write Edit box: flyby F:\CodeLib\Flyby\byairport.txt
- click button

Is that work JLWest ?

Make sure file airport locate: F:\CodeLib\Flyby\ByAirport.txt

Look at the screen .PNG's from my GDrive.

I sent the link via a private message.
 
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

Thausand

  • Sr. Member
  • ****
  • Posts: 292
Re: DataProblems Maybe
« Reply #110 on: May 08, 2019, 01:37:11 am »
Ok, user JLWest me send picture private.

Then i write conclude:
- program flybylaz executable locate: F:\CodeLib\Flyby\flybylaz_publish\flybylaz.exe
- file airport locate: F:\CodeLib\Flyby\ByAirport.txt
- JLWest user start my program and make write edit: F:\CodeLib\Flyby\byairport.txt then button click
- Then FlyByLaz program write: command not found

How make work:
- Make sure file airport locate: F:\CodeLib\Flyby\ByAirport.txt
- start flybylaz program
- write Edit box: flyby F:\CodeLib\Flyby\byairport.txt
- click button

Is that work JLWest ?

Make sure file airport locate: F:\CodeLib\Flyby\ByAirport.txt

Look at the screen .PNG's from my GDrive.

I sent the link via a private message.

I have write answer post reply #108  :)

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: DataProblems Maybe
« Reply #111 on: May 08, 2019, 05:24:40 am »


GDrive link of the following:
https://drive.google.com/open?id=1RgTBOWDfciSqyUeyBc2nTb3-QEmKa9_Q


OK:

Step by step:

Step 1:

   - Make sure file airport locate: F:\CodeLib\Flyby\ByAirport.txt

Go to Cmd (Dos Box)
CD F:
F:\>cd Codelib\Flyby

F:\Codelib\flyby>Dir

Shows:

Volume in drive F is Storage
 Volume Serial Number is 34B9-7BA5

 Directory of F:\CodeLib\Flyby

05/07/2019  05:00 PM    <DIR>          .
05/07/2019  05:00 PM    <DIR>          ..
05/05/2019  12:25 AM         2,383,288 ByAirport.txt   <------- File Same dir as program
05/06/2019  01:53 AM            11,528 flyby.pas
05/07/2019  08:25 AM            15,848 flyby.txt
05/05/2019  09:57 PM             3,433 flybyfpc_publish.zip
05/07/2019  08:43 AM    <DIR>          flybylaz_publish
05/05/2019  09:57 PM           134,992 flybylaz_publish.zip
05/06/2019  02:00 PM           686,339 Screenshot (43).zip
05/07/2019  07:56 AM         1,711,837 Screenshot (45).png
05/07/2019  08:05 AM         1,700,495 Screenshot (45).zip
05/07/2019  08:06 AM         1,640,720 Screenshot (46).png
05/07/2019  08:08 AM         1,625,823 Screenshot (46).zip
05/07/2019  05:00 PM                 0 x
              11 File(s)      9,914,303 bytes
               3 Dir(s)  750,504,476,672 bytes free

Step 2:

       - start flybylaz program

See .png on GDrive.

 convert to program and I will try to run in dos box (Not windows program)

Included list of all airports, all Cities and all Countries.      
      
      
      
      
      
      
      
I Show:

7,970,312 in Apt.txt
1,421 Cities
258 Countries


FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

Thausand

  • Sr. Member
  • ****
  • Posts: 292
Re: DataProblems Maybe
« Reply #112 on: May 08, 2019, 09:02:13 am »
Hi hello JLWest,

GDrive link of the following:
https://drive.google.com/open?id=1RgTBOWDfciSqyUeyBc2nTb3-QEmKa9_Q
Yes thanksy for picture. I have see many time.

Quote
Go to Cmd (Dos Box)
CD F:
F:\>cd Codelib\Flyby

F:\Codelib\flyby>Dir

Shows:

Volume in drive F is Storage
 Volume Serial Number is 34B9-7BA5

 Directory of F:\CodeLib\Flyby

05/07/2019  05:00 PM    <DIR>          .
05/07/2019  05:00 PM    <DIR>          ..
05/05/2019  12:25 AM         2,383,288 ByAirport.txt   <------- File Same dir as program
No  ;D

Quote
05/06/2019  01:53 AM            11,528 flyby.pas
05/07/2019  08:25 AM            15,848 flyby.txt
05/05/2019  09:57 PM             3,433 flybyfpc_publish.zip
05/07/2019  08:43 AM    <DIR>          flybylaz_publish  <------------ this directory program flybylaz  lazarus

That no important. Important is know were is locate file directory Airport.txt

Quote
Step 2:

       - start flybylaz program

See .png on GDrive.
Yes  :)

You make show many many many time you no type editbox "flyby F:\CodeLib\Flyby\ByAirport.txt".

I have write answer problem reply post #108. I have suggest you read.

Quote
convert to program and I will try to run in dos box (Not windows program)
I sorry and write if can you no make work lazarus flybylaz then can also no make work command-line flyby version. Is make start same.

Quote
I Show:

7,970,312 in Apt.txt
1,421 Cities
258 Countries
Country count is ok if no count nil  :).

City count i have make calculate and write later.
Is later:
City count unique me and no count nil = 4719. That read my program have many more count city program you. How is count you program city ?

add:

I not know. Why you write:
Code: [Select]
7,970,312 in Apt.txt
[u]1,421 Cities[/u]
258 Countries
....then have package.zip show good count ICAO/Airport, Country and City ? (*)

(*) package show screenshot you no type "flyby" and alone show editbox "F:\CodeLib\Flyby\ByAirport.txt". You have break keyboard and no have letter "f", "l", "y", "b", "y" ?  :D
« Last Edit: May 08, 2019, 10:01:02 am by Thausand »

 

TinyPortal © 2005-2018