Recent

Author Topic: Reading multiple data from a TMemo  (Read 6218 times)

madref

  • Hero Member
  • *****
  • Posts: 700
  • ..... A day not Laughed is a day not Lived !!
    • Nursing With Humour
Re: Reading multiple data from a TMemo
« Reply #45 on: April 03, 2019, 09:35:50 am »
I now get what you are doing :)


But something what I am doing is wrong.


Take a look at the example project I made and please tell me what I am doing wrong.
« Last Edit: April 03, 2019, 09:38:25 am by madref »
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 2.0.2 / FPC 3.0.4
Lazarus Trunc / FPC 3.0.4
Mac OS X Mojave

Thausand

  • Full Member
  • ***
  • Posts: 234
Re: Reading multiple data from a TMemo
« Reply #46 on: April 03, 2019, 11:23:12 am »
Take a look at the example project I made and please tell me what I am doing wrong.
Have look.

Not know what not work for you.

Memo write me:
Code: [Select]
Using data file "52677.txt"

     Microz Eaters Limburg     sPeriode1     pkMinor     1
     Microz Eaters Limburg     sPeriode1     pkMajor     0
     Microz Eaters Limburg     sPeriode1     pkMisc     1
     Microz Eaters Limburg     sPeriode1     pkGMP     0
     Microz Eaters Limburg     sPeriode1     pkMP     0
     Microz Eaters Limburg     sPeriode1     pkPS     0
     Microz Eaters Limburg     sPeriode2     pkMinor     0
     Microz Eaters Limburg     sPeriode2     pkMajor     0
     Microz Eaters Limburg     sPeriode2     pkMisc     0
     Microz Eaters Limburg     sPeriode2     pkGMP     0
     Microz Eaters Limburg     sPeriode2     pkMP     0
     Microz Eaters Limburg     sPeriode2     pkPS     0
     Microz Eaters Limburg     sPeriode3     pkMinor     2
     Microz Eaters Limburg     sPeriode3     pkMajor     0
     Microz Eaters Limburg     sPeriode3     pkMisc     2
     Microz Eaters Limburg     sPeriode3     pkGMP     0
     Microz Eaters Limburg     sPeriode3     pkMP     0
     Microz Eaters Limburg     sPeriode3     pkPS     0
     Microz Eaters Limburg     sPeriode4     pkMinor     0
     Microz Eaters Limburg     sPeriode4     pkMajor     0
     Microz Eaters Limburg     sPeriode4     pkMisc     0
     Microz Eaters Limburg     sPeriode4     pkGMP     0
     Microz Eaters Limburg     sPeriode4     pkMP     0
     Microz Eaters Limburg     sPeriode4     pkPS     0
     Zoetermeer Panters     sPeriode1     pkMinor     0
     Zoetermeer Panters     sPeriode1     pkMajor     0
     Zoetermeer Panters     sPeriode1     pkMisc     0
     Zoetermeer Panters     sPeriode1     pkGMP     0
     Zoetermeer Panters     sPeriode1     pkMP     0
     Zoetermeer Panters     sPeriode1     pkPS     0
     Zoetermeer Panters     sPeriode2     pkMinor     3
     Zoetermeer Panters     sPeriode2     pkMajor     0
     Zoetermeer Panters     sPeriode2     pkMisc     0
     Zoetermeer Panters     sPeriode2     pkGMP     0
     Zoetermeer Panters     sPeriode2     pkMP     0
     Zoetermeer Panters     sPeriode2     pkPS     0
     Zoetermeer Panters     sPeriode3     pkMinor     0
     Zoetermeer Panters     sPeriode3     pkMajor     0
     Zoetermeer Panters     sPeriode3     pkMisc     0
     Zoetermeer Panters     sPeriode3     pkGMP     0
     Zoetermeer Panters     sPeriode3     pkMP     0
     Zoetermeer Panters     sPeriode3     pkPS     0
     Zoetermeer Panters     sPeriode4     pkMinor     0
     Zoetermeer Panters     sPeriode4     pkMajor     0
     Zoetermeer Panters     sPeriode4     pkMisc     0
     Zoetermeer Panters     sPeriode4     pkGMP     0
     Zoetermeer Panters     sPeriode4     pkMP     0
     Zoetermeer Panters     sPeriode4     pkPS     1
You not have or is no good ?

If you not have then Is some important.
1) Project Options -> Debugging -> Include Assertion Code
2) you code filename "TempSheet.txt" (not save) and parse "52677.txt". Not get html. Not make bad forget  ;)

I not know you fix 2 ?

i tell other:
I many problem lazarus 2.0 rc. Not load project you = empty project. I try fix, many more error lazarus keep wrong so i smart fool fix. Then lazarus project options and inspector not see and not get back  :'( I anchordocking. Maybe broke not install. I waste many time  :'(

« Last Edit: April 03, 2019, 11:25:44 am by Thausand »

madref

  • Hero Member
  • *****
  • Posts: 700
  • ..... A day not Laughed is a day not Lived !!
    • Nursing With Humour
Re: Reading multiple data from a TMemo
« Reply #47 on: April 03, 2019, 01:03:39 pm »
I dont get any teams
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 2.0.2 / FPC 3.0.4
Lazarus Trunc / FPC 3.0.4
Mac OS X Mojave

Thausand

  • Full Member
  • ***
  • Posts: 234
Re: Reading multiple data from a TMemo
« Reply #48 on: April 03, 2019, 01:44:59 pm »
madref i make debug to you. I make small fix first then send.

But i ask:
You MacOS, not work debugger ? not work heaptrace ? not can do WriteLn Lazarus ?

If all true then make better tool unit for log not fix special for you project but tool use all projects write. Make tool unit need more time but simple.

madref

  • Hero Member
  • *****
  • Posts: 700
  • ..... A day not Laughed is a day not Lived !!
    • Nursing With Humour
Re: Reading multiple data from a TMemo
« Reply #49 on: April 03, 2019, 01:58:26 pm »
madref i make debug to you. I make small fix first then send.

But i ask:
You MacOS, not work debugger ? not work heaptrace ? not can do WriteLn Lazarus ?

If all true then make better tool unit for log not fix special for you project but tool use all projects write. Make tool unit need more time but simple.
I know how to debug...but heaptrc no... i am not that smart
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 2.0.2 / FPC 3.0.4
Lazarus Trunc / FPC 3.0.4
Mac OS X Mojave

Thausand

  • Full Member
  • ***
  • Posts: 234
Re: Reading multiple data from a TMemo
« Reply #50 on: April 03, 2019, 02:09:29 pm »
I know how to debug...but heaptrc no... i am not that smart
If write project make heaptrace (-glh project option). If memory wrong then you project tell when happen.

If you know debug then good. Tell breakpoint TWedstrijdSheetParser.HasStr and follow. Is many, i know. I write log HasStr and read.

I have make quick project and smelly log. Is very bad implement. Not learn bad. Is just now quick.

Can make and run and post log ? If no log then write no log. Want know.
« Last Edit: April 03, 2019, 03:33:03 pm by Thausand »

Thausand

  • Full Member
  • ***
  • Posts: 234
Re: Reading multiple data from a TMemo
« Reply #51 on: April 03, 2019, 02:23:14 pm »
Hello madref,

I ask my eror lazarus and user wp tell http://forum.lazarus-ide.org/index.php/topic,44161.msg316085.html#msg316085
Quote
The enumeration of nodes in some xml project files (.lpi, .lfm) has been changed in trunk recently which results in an "empty project" error when a new project is saved by Lazarus trunk and re-opened in an older version. If this happens open the project in Laz-trunk and check the new box "Maximize compatibility of project files" in "Project options" > "Miscellaneous". When saved with this option checked the xml nodes are written in the old way and the project is readable by all Lazarus versions.
Then you use trunk. I not use trunk.

Then if send project then my lazarus not can open you project.

wp write underlini. is important check first then publish. Please can make so ?

madref

  • Hero Member
  • *****
  • Posts: 700
  • ..... A day not Laughed is a day not Lived !!
    • Nursing With Humour
Re: Reading multiple data from a TMemo
« Reply #52 on: April 03, 2019, 02:52:51 pm »
this is what I get
Code: [Select]
Using data file "/users/madref/documents/referee3 database/52677.txt"


"","sPeriode1","pkMinor","0"
"","sPeriode1","pkMajor","0"
"","sPeriode1","pkMisc","0"
"","sPeriode1","pkGMP","0"
"","sPeriode1","pkMP","0"
"","sPeriode1","pkPS","0"
"","sPeriode2","pkMinor","0"
"","sPeriode2","pkMajor","0"
"","sPeriode2","pkMisc","0"
"","sPeriode2","pkGMP","0"
"","sPeriode2","pkMP","0"
"","sPeriode2","pkPS","0"
"","sPeriode3","pkMinor","0"
"","sPeriode3","pkMajor","0"
"","sPeriode3","pkMisc","0"
"","sPeriode3","pkGMP","0"
"","sPeriode3","pkMP","0"
"","sPeriode3","pkPS","0"
"","sPeriode4","pkMinor","0"
"","sPeriode4","pkMajor","0"
"","sPeriode4","pkMisc","0"
"","sPeriode4","pkGMP","0"
"","sPeriode4","pkMP","0"
"","sPeriode4","pkPS","0"
"","sPeriode1","pkMinor","0"
"","sPeriode1","pkMajor","0"
"","sPeriode1","pkMisc","0"
"","sPeriode1","pkGMP","0"
"","sPeriode1","pkMP","0"
"","sPeriode1","pkPS","0"
"","sPeriode2","pkMinor","0"
"","sPeriode2","pkMajor","0"
"","sPeriode2","pkMisc","0"
"","sPeriode2","pkGMP","0"
"","sPeriode2","pkMP","0"
"","sPeriode2","pkPS","0"
"","sPeriode3","pkMinor","0"
"","sPeriode3","pkMajor","0"
"","sPeriode3","pkMisc","0"
"","sPeriode3","pkGMP","0"
"","sPeriode3","pkMP","0"
"","sPeriode3","pkPS","0"
"","sPeriode4","pkMinor","0"
"","sPeriode4","pkMajor","0"
"","sPeriode4","pkMisc","0"
"","sPeriode4","pkGMP","0"
"","sPeriode4","pkMP","0"
"","sPeriode4","pkPS","0"
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 2.0.2 / FPC 3.0.4
Lazarus Trunc / FPC 3.0.4
Mac OS X Mojave

Thausand

  • Full Member
  • ***
  • Posts: 234
Re: Reading multiple data from a TMemo
« Reply #53 on: April 03, 2019, 03:26:33 pm »
this is what I get
I think that not possible ?

Line 53 read exit  :o

Code: Pascal  [Select]
  1. procedure TForm_RefereeMain.StartClick(Sender: TObject);
  2. var url: string;
  3.     HTMLText, tmp: TStringList;
  4.     pp: TWedstrijdSheetParser;
  5.     fTeam   : TTeamStr;
  6.     fPeriod : TPeriodStr;
  7.     fPenalty: TPenaltyKind;
  8.     fPenaltyValue : integer;
  9.     UserDir, FlatString: String;
  10.  
  11. begin
  12.   // bestand van wedstrijdsheet maken
  13.   tmp := TStringList.Create;
  14.   url := 'https://www.nijb.nl/nijbsheet.php?GameID=52677';
  15.   // UserDir := '/users/madref/documents/referee3 database/';
  16.   UserDir := '';
  17.   HTMLText := TStringList.Create;
  18.   try
  19.     try
  20.       try
  21.         TFPHTTPClient.SimpleGet(URL, HTMLText);
  22.         ProcHTMLText(tmp, HTMLText);
  23.       except
  24.         on E: Exception do
  25.         begin
  26.           tmp.Add(Format('Exception class name = %s', [E.ClassName]));
  27.           tmp.Add(Format('Exception message = %s', [E.Message]));
  28.         end;
  29.       end;
  30.     finally
  31.       HTMLText.Free;
  32.     end;
  33.     tmp.SaveToFile(UserDir + '52677.txt');
  34.   finally
  35.     tmp.free;
  36.   end;
  37.  
  38.   // This Add:
  39.   Log := TStringList.Create;
  40.  
  41.   // bestand lezen
  42. //  pp := TWedstrijdSheetParser.Create(UserDir + 'TempSheet.txt');
  43.   pp := TWedstrijdSheetParser.Create(UserDir + '52677.txt');
  44.  
  45.   // This Add:
  46.   pp.free;
  47.   // This Add:
  48.   Memo_Test.Lines.Text := Log.Text;
  49.   // This Add:
  50.   Log.Free;
  51.   // This Add:
  52.  
  53.   exit;
  54.  
  55.   // bestand interpreteren
  56.   try
  57.     Memo_Test.Clear;
  58.     Memo_Test.Append('Using data file "' + pp.Filename + '"'#10);
  59.  
  60.     for fTeam in TTeamStr do
  61.     begin
  62.       for fPeriod in TPeriodStr do
  63.       begin
  64.         for fPenalty in TPenaltyKind do
  65.         begin
  66.           // data stored array
  67.           fPenaltyValue := pp.DataArray[fteam][fperiod][fpenalty];
  68.          // easy example write but need store database then query database
  69.           WriteStr(FlatString, '     ',GetName(pp,fTeam),'     ', fPeriod,'     ', fPenalty, '     ', fPenaltyValue);
  70.           Memo_Test.Lines.Add (FlatString);
  71.         end;
  72.       end;
  73.     end;
  74.   finally
  75.     pp.Free;
  76.   end;
  77.  
  78. end;     // StartClick
  79.  

Is read for me (small example):
Code: [Select]
Line  = "game52677-action-nl Microz Eaters Limburg vs Zoetermeer Panters"
aStr  = "sTeamA"
LineHasStr = FALSE

Line  = "game52677-action-nl Microz Eaters Limburg vs Zoetermeer Panters"
aStr  = "sTeamB"
LineHasStr = FALSE

Line  = "game52677-action-nl Microz Eaters Limburg vs Zoetermeer Panters"
aStr  = "sPeriode1"
LineHasStr = FALSE

Line  = "game52677-action-nl Microz Eaters Limburg vs Zoetermeer Panters"
aStr  = "sPeriode2"
LineHasStr = FALSE

Line  = "game52677-action-nl Microz Eaters Limburg vs Zoetermeer Panters"
aStr  = "sPeriode3"
LineHasStr = FALSE
Many more line i have.

madref

  • Hero Member
  • *****
  • Posts: 700
  • ..... A day not Laughed is a day not Lived !!
    • Nursing With Humour
Re: Reading multiple data from a TMemo
« Reply #54 on: April 03, 2019, 03:28:45 pm »
this is from my original program
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 2.0.2 / FPC 3.0.4
Lazarus Trunc / FPC 3.0.4
Mac OS X Mojave

Thausand

  • Full Member
  • ***
  • Posts: 234
Re: Reading multiple data from a TMemo
« Reply #55 on: April 03, 2019, 03:30:50 pm »
this is from my original program
That why i post my for you compile and run. Make big log memo. Copy paste and see what wrong.

I make old project away and replace new. Not so smelly. same output.

madref

  • Hero Member
  • *****
  • Posts: 700
  • ..... A day not Laughed is a day not Lived !!
    • Nursing With Humour
Re: Reading multiple data from a TMemo
« Reply #56 on: April 03, 2019, 03:31:42 pm »
i am getting crazy and frustrated  >:( >:( >:( >:( >:( 


when I use Howard's original code all works well.
but when I use it in my example project it won't work
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 2.0.2 / FPC 3.0.4
Lazarus Trunc / FPC 3.0.4
Mac OS X Mojave

madref

  • Hero Member
  • *****
  • Posts: 700
  • ..... A day not Laughed is a day not Lived !!
    • Nursing With Humour
Re: Reading multiple data from a TMemo
« Reply #57 on: April 03, 2019, 03:32:12 pm »
this is from my original program
That why i post my for you compile and run. Make big log memo. Copy paste and see what wrong.


idont even get a log
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 2.0.2 / FPC 3.0.4
Lazarus Trunc / FPC 3.0.4
Mac OS X Mojave

Thausand

  • Full Member
  • ***
  • Posts: 234
Re: Reading multiple data from a TMemo
« Reply #58 on: April 03, 2019, 03:39:55 pm »
idont even get a log
You compile and run my project i post for to make log. Not you project.

You mad not understand. I show how make understand with big log. I not can see when no log i make in project.

I think you make small think error when combine howardpc and my work. I make other log. Not same log howardpc. Can be reason.  For me work so can be reason you MacOS. I not know and not can write if no log for see.

No get mad. I try help fix error is better  :)

madref

  • Hero Member
  • *****
  • Posts: 700
  • ..... A day not Laughed is a day not Lived !!
    • Nursing With Humour
Re: Reading multiple data from a TMemo
« Reply #59 on: April 03, 2019, 03:40:00 pm »
I ran it in Lazarus 2.0.0 and not in trunk and then I got the same as you
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 2.0.2 / FPC 3.0.4
Lazarus Trunc / FPC 3.0.4
Mac OS X Mojave