Recent

Author Topic: crashing app when url is changed  (Read 8368 times)

zulof

  • Newbie
  • Posts: 4
Re: crashing app when url is changed
« Reply #15 on: March 27, 2019, 01:38:21 am »
hmm..using  HttpGetText from synapse I get page source when entering " https://www.nijb.nl/nijbsheet.php?GameID=55668 " but nothing comes up when entering  " https://www.nijb.nl/nijbsheet.php?GameID=52600 " ..this is strange. Cant see some obvious difference in page source of either url..

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: crashing app when url is changed
« Reply #16 on: March 27, 2019, 01:51:20 am »
it still crashes because of line number 10
if crash then error very bad. must display exception if not so bad.

sorry, i not know what error  :-[
Quote
Code: Pascal  [Select][+][-]
  1. Memo_Test.Append(s);
have tried
Code: Pascal  [Select][+][-]
  1. Memo_Test.Add(s);
?

same error ?
Tmemo.Add does not exist
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

Thausand

  • Sr. Member
  • ****
  • Posts: 292
Re: crashing app when url is changed
« Reply #17 on: March 27, 2019, 02:08:16 am »
Tmemo.Add does not exist
Sorry. my error.   :-[

Memo_Test.Lines.Add(s);
or
Memo_Test.Lines.Text:=s;
or
Memo_Test.Lines.AddText(S);

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: crashing app when url is changed
« Reply #18 on: March 27, 2019, 07:50:39 am »
nope still crashes
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: crashing app when url is changed
« Reply #19 on: March 27, 2019, 08:14:59 am »
memo_test.lines.append?
Because then the code with the line 10 crash should work. That looks good code.
Specialize a type, not a var.

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: crashing app when url is changed
« Reply #20 on: March 27, 2019, 10:27:13 am »
I know everything looks code-proof.


i have added a small example program with the problem I have in my Trunk version.


p.s. i am using a MacBook Pro with OSx Mojave and NOT Windows

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

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

Thausand

  • Sr. Member
  • ****
  • Posts: 292
Re: crashing app when url is changed
« Reply #21 on: March 27, 2019, 12:45:50 pm »
p.s. i am using a MacBook Pro with OSx Mojave and NOT Windows
ok. then no good debug OSx ? you write self many steps in code to see all write variable ?

Must be Tmemo ? why text select Tmemo ? You want see find word ? can be SynEdit ?

If work before and now not Tmemo then maybe bug ? That why i say SynEdit. Use other and maybe away bug :)

I test Tstringlist, work ok. can copy Tlistbox and Tmemo. I not try SynEdit but SynEdit many more option.

I not know you want with data. Can use FastHTMLParser parse many html-block manual and state-machine. Copy find data and record or database. That maybe solution ? Is small more complicate but can do (I not try and know).

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: crashing app when url is changed
« Reply #22 on: March 27, 2019, 03:50:24 pm »
I test Tstringlist, work ok. can copy Tlistbox and Tmemo. I not try SynEdit but SynEdit many more option.

I not know you want with data. Can use FastHTMLParser parse many html-block manual and state-machine. Copy find data and record or database. That maybe solution ? Is small more complicate but can do (I not try and know).
Do you have examples of both?
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

Thausand

  • Sr. Member
  • ****
  • Posts: 292
Re: crashing app when url is changed
« Reply #23 on: March 28, 2019, 10:24:37 am »
Do you have examples of both?
Yes can make. But i not kludge.

In other thread write howardpc:
Of course it is possible.  As I wrote before, adapt the code I shared to your requirements.
This kind of detailed question is hard to respond to constructively without knowledge of your project's data structures and design, and a forum becomes a clumsy arena to discuss your question about a project whose code remains unseen, and where only one example of sample data has been shown, which is given in a language with which I am not fluent.
howardpc make example state-machine (and many other). Is one solution. I maybe make other then you confuse.

i think better learn fasthtmlparser use. You extractor can make better but have understand how work extractor. extractor make work for you as write howardpc. I not know what data important, what want know and how storage you want. You make decide first. If not then i make example that not work for you and you copy (and not understand how work). Then you ask question more on how work my code. That not help, yes ?

add:
Ok i see now message other thread http://forum.lazarus-ide.org/index.php/topic,44814.msg315532.html#msg315532
Quote
And with your code I don't need a TMemo
You use howardpc code and is good. but show how use no memo i attach example. code run fpc but can use lazarus and copy-paste change to OOP.
« Last Edit: March 28, 2019, 11:30:26 am by Thausand »

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: crashing app when url is changed
« Reply #24 on: March 28, 2019, 10:37:50 am »
p.s. i am using a MacBook Pro with OSx Mojave and NOT Windows
I am using Linux, not Windows, but I can start up my Intel Mac mini to test if it is still not solved..
Specialize a type, not a var.

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: crashing app when url is changed
« Reply #25 on: March 31, 2019, 10:14:11 pm »
Do you have examples of both?
Yes can make. But i not kludge.

In other thread write howardpc:
Of course it is possible.  As I wrote before, adapt the code I shared to your requirements.
This kind of detailed question is hard to respond to constructively without knowledge of your project's data structures and design, and a forum becomes a clumsy arena to discuss your question about a project whose code remains unseen, and where only one example of sample data has been shown, which is given in a language with which I am not fluent.
howardpc make example state-machine (and many other). Is one solution. I maybe make other then you confuse.

i think better learn fasthtmlparser use. You extractor can make better but have understand how work extractor. extractor make work for you as write howardpc. I not know what data important, what want know and how storage you want. You make decide first. If not then i make example that not work for you and you copy (and not understand how work). Then you ask question more on how work my code. That not help, yes ?

add:
Ok i see now message other thread http://forum.lazarus-ide.org/index.php/topic,44814.msg315532.html#msg315532
Quote
And with your code I don't need a TMemo
You use howardpc code and is good. but show how use no memo i attach example. code run fpc but can use lazarus and copy-paste change to OOP.


You've added a new parser. But there is a small flaw in it.
When a goal is scored you parser writes
Code: [Select]
07:35:1-0 Era Renomar HYC Herentals: 3:  Ben COOLEN (67:  Mitch MORGAN; 9:  Peter BARTEK)[PP]instead of

Code: [Select]
07:35: 1-0 Era Renomar HYC Herentals: 3:  Ben COOLEN (67:  Mitch MORGAN; 9:  Peter BARTEK)[PP]How to correct this?
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

rvk

  • Hero Member
  • *****
  • Posts: 6109
Re: crashing app when url is changed
« Reply #26 on: March 31, 2019, 10:28:30 pm »
Are there any special characters on the problem-page.

I see in the source it is iso-8859-1. But s: string is UTF-8.
Not converting it and just putting it in a memo might cause problems.

Thausand

  • Sr. Member
  • ****
  • Posts: 292
Re: crashing app when url is changed
« Reply #27 on: March 31, 2019, 10:45:59 pm »
You've added a new parser. But there is a small flaw in it.
When a goal is scored you parser writes
Code: [Select]
07:35:1-0 Era Renomar HYC Herentals: 3:  Ben COOLEN (67:  Mitch MORGAN; 9:  Peter BARTEK)[PP]instead of

Code: [Select]
07:35: 1-0 Era Renomar HYC Herentals: 3:  Ben COOLEN (67:  Mitch MORGAN; 9:  Peter BARTEK)[PP]How to correct this?
Small flaw depend how look  :D

It do because tag bold so write (stinky) fix:
Code: Pascal  [Select][+][-]
  1. procedure THtmlTextExtractor.TagFoundHandler(NoCaseTag, ActualTag: String);
  2. var
  3.   Buf: String;
  4.   Tag: String;
  5. begin
  6.   // Use the FIgnore flag to skip some tags not needed
  7.   for Tag in TStringArray.Create('<SCRIPT','<BUTTON','<NOSCRIPT>','<STYLE>','</HTML>') do
  8.   begin
  9.     FIgnore := NoCaseTag.StartsWith(Tag);
  10.     if FIgnore then Exit;
  11.   end;
  12.  
  13.   // Writei tab these tags
  14.   Buf := #9;
  15.   for Tag in TStringArray.Create('<TD>','</TD>')  do
  16.   if NoCaseTag.StartsWith(Tag)
  17.     then FTempStream.Write(Buf[1], Length(Buf));
  18.  
  19.  
  20.   // Writei lineEnding these tags
  21.   Buf := LineEnding;
  22.   for Tag in TStringArray.Create('<BR>','<BR />','<BR/>','</P>','</DIV>','</TR>') do
  23.     if NoCaseTag.StartsWith(Tag)
  24.       then FTempStream.Write(Buf[1], Length(Buf));
  25.  
  26.   // make stinky fix bold
  27.   Buf := ' ';
  28.   for Tag in TStringArray.Create('<B>') do
  29.    if NoCaseTag.StartsWith(Tag)
  30.      then FTempStream.Write(Buf[1], Length(Buf));
  31. end;     // TagFoundHandler
  32.  
fix work but not good place. fix better make state-machine place TagFoundHandler and if-then/case state place TextFoundHandler.

Thausand

  • Sr. Member
  • ****
  • Posts: 292
Re: crashing app when url is changed
« Reply #28 on: March 31, 2019, 10:49:46 pm »
Are there any special characters on the problem-page.

I see in the source it is iso-8859-1. But s: string is UTF-8.
Not converting it and just putting it in a memo might cause problems.
Yes i see too. I ask ?

How read html (meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1")  change codepage then process text good codepage ? Is possible change code-page after read buffer ?

rvk

  • Hero Member
  • *****
  • Posts: 6109
Re: crashing app when url is changed
« Reply #29 on: March 31, 2019, 10:57:36 pm »
You could try
Memo.Lines.Add(AnsiToUtf8(s));

 

TinyPortal © 2005-2018