Recent

Author Topic: MVP made easier.  (Read 16980 times)

cdbc

  • Hero Member
  • *****
  • Posts: 2571
    • http://www.cdbc.dk
Re: MVP made easier.
« Reply #75 on: April 24, 2025, 07:31:03 pm »
Hi Hans
That's probably a good idea, sometimes it helps to visualize the buildup and the flow, to understand what's going on ...when & how...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

Hansvb

  • Hero Member
  • *****
  • Posts: 871
Re: MVP made easier.
« Reply #76 on: April 24, 2025, 08:27:33 pm »
hi,

Sometimes I feel very stupid. It took me an hour to figure out that in the TTransaction = class... this line is gone in the new version:
Code: Pascal  [Select][+][-]
  1. constructor Create(aModReason: word); virtual;

I didn't understand why I couldn't get into the create overload of my new transaction. (Not using the TransactionFactory). There just is no create function to overload. I removed the overload and now i get into my transaction create function again.
Time to stop for today.

Thanks for all the effort!



cdbc

  • Hero Member
  • *****
  • Posts: 2571
    • http://www.cdbc.dk
Re: MVP made easier.
« Reply #77 on: August 28, 2025, 08:03:34 pm »
Hellllloooooo
Right, so I had to update the 'istrlist.pas' to coerce it to compile with FPC v3.2.4
That ofc. means updating MVP-Setup too, as it depends heavily on 'IStrings' and co. It's a small update, so only date-bump in version number...
...So get it HERE while it's hot8-)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

Hansvb

  • Hero Member
  • *****
  • Posts: 871
Re: MVP made easier.
« Reply #78 on: August 28, 2025, 09:24:54 pm »

░░░░░░░░░░░░░░░░░░░░░░█████████
░░███████░░░░░░░░░░███▒▒▒▒▒▒▒▒███
░░█▒▒▒▒▒▒█░░░░░░░███▒▒▒▒▒▒▒▒▒▒▒▒▒███
░░░█▒▒▒▒▒▒█░░░░██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██
░░░░█▒▒▒▒▒█░░░██▒▒▒▒▒██▒▒▒▒▒▒██▒▒▒▒▒███
░░░░░█▒▒▒█░░░█▒▒▒▒▒▒████▒▒▒▒████▒▒▒▒▒▒██
░░░█████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██
░░░█▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒▒▒██
░██▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒██▒▒▒▒▒▒▒▒▒▒██▒▒▒▒██
██▒▒▒███████████▒▒▒▒▒██▒▒▒▒▒▒▒▒██▒▒▒▒▒██
█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒████████▒▒▒▒▒▒▒██
██▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██
░█▒▒▒███████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██
░██▒▒▒▒▒▒▒▒▒▒████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█
░░████████████░░░█████████████████

cdbc

  • Hero Member
  • *****
  • Posts: 2571
    • http://www.cdbc.dk
Re: MVP made easier.
« Reply #79 on: November 25, 2025, 05:59:46 pm »
G'Day folks
Right, so I updated 'istrlist.pas' to support 2 new 'Reverse' features and in doing so I /reintroduced/ 2 existing methods, to properly cater for objects, strings & 'Self'; Now it doesn't _wipe_ the objects anymore  O:-)
That ofc. means updating MVP-Setup too, as it depends heavily on 'IStrings' and co. It's a small update, so only date-bump in version number...
...So get it HERE while it's hot.  8-)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

Hansvb

  • Hero Member
  • *****
  • Posts: 871
Re: MVP made easier.
« Reply #80 on: November 29, 2025, 02:29:46 pm »
Hi Benny,

I haven't really tested istrlist.pas. I just replaced istrlist.pas with the new one in an existing project and get no errors  :). I haven't looked at the new features yet. My time is currently spent on another little Lazarus project.


cdbc

  • Hero Member
  • *****
  • Posts: 2571
    • http://www.cdbc.dk
Re: MVP made easier.
« Reply #81 on: December 01, 2025, 01:19:56 pm »
Hi Hans
Good to hear from you mate, I hope all is well on your end of things =^
It should work straight out of the box  :-X Nice to hear that it does  :D
Here's the short story:
@lar unwillingly stumbled upon a bug in 'TStrings'  :(  So a couple of us tried to help him out and got to analyzing the code in 'TStrings'. @BrunoK noticed that the current implementation doesn't cater for the objects when calling 'Reverse', it wipes them out  >:( @Zvoni noticed that calling 'Reverse' alone didn't reverse itself and @Thaddy tried to call it with itself, to no avail...
So in all togetherness, we figured it out and while the rest cooked up a bug-report and filed it, I implemented the changes and features in 'IStrings'.
The net-result is:
a Reintroduced 'function Reverse: TStrings;' { not much changed }
a Reintroduced 'procedure Reverse(aList: TStrings);' { includes objects and self }
a New 'function ReverseEx: IStrings;' { returns a com-object - no freeing after use }
a New 'procedure ReverseSelf;' { does what the name says }
Code: Pascal  [Select][+][-]
  1. function TiStringList.Reverse: TStrings; { reintroduce }
  2. begin
  3.   Result:= TStringsClass(Self.ClassType).Create;
  4.   try Reverse(Result);
  5.   except FreeAndNil(Result); Raise; end;
  6. end;
  7.  
  8. procedure TiStringList.Reverse(aList: TStrings); { reintroduce }
  9. var li: ptrint;
  10. begin { the existing one in classes wipes the objects -- they were gone afterwards!!! }
  11.   if aList = Self then begin ReverseSelf; exit; end; { someone might do this }
  12.   for li:= inherited Count-1 downto 0 do
  13.     aList.AddObject(Strings[li],Objects[li]); { copy strings & objects in reverse order to aList }
  14. end;
  15.  
  16. function TiStringList.ReverseEx: IStrings;
  17. begin
  18.   Result:= CreStrings; { we need a new result stringlist }
  19.   Reverse(Result.AsTStrings); { now get the reversed result from reintroduced method }
  20. end;
  21.  
  22. procedure TiStringList.ReverseSelf;
  23. var lsl: IStringList; { we need an interim list }
  24. begin
  25.   lsl:= ReverseEx as IStringList; { fetch our own reverse }
  26.   AssignEx(lsl); { now clear ourselves and assign the reverse list to us }
  27. end;
I made all the changes in FPC-release / Lazarus-release, as to make sure, there would be no surprises  8-)
You may notice a 'blob.istrlist.inc' in the 'IStringlist' repo, that's for easy integration in MVP-Setup \o/\ö/\o/
Pheeewwww, Glad it works -- Happy coding mate =^
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

Hansvb

  • Hero Member
  • *****
  • Posts: 871
Re: MVP made easier.
« Reply #82 on: December 14, 2025, 09:29:51 am »
Hi Benny,

I'm going to make a tool and use your mvp easy setup for that. I want to put this tool on github or something like that. Is that allowed and if so, what should I mention in the code so that I do justice to your license (and hard work)?

cdbc

  • Hero Member
  • *****
  • Posts: 2571
    • http://www.cdbc.dk
Re: MVP made easier.
« Reply #83 on: December 14, 2025, 10:54:32 am »
Hi Hans
Whatever you produce with MVP-Setup is completely up to you to decide, I even think, that I give up/waver all rights in the Readme file...  8)

The only thing I retain copyright on is 'MVP-Setup' itself and even that is liberally licensed under BSD 3-Clause...  :D

It would ofc. be nice to be mentioned and maybe you could somewhere link to my Gitlab repo or maybe this thread (to give fpc/laz some exposure8-)
Whatever you see fit mate, is all good with me =^
I'm happy that you use it, that's basically it  ;)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

Hansvb

  • Hero Member
  • *****
  • Posts: 871
Re: MVP made easier.
« Reply #84 on: December 14, 2025, 04:10:38 pm »
I already suspected that but wanted to ask nicely  :D.
If my tool sees the light of day, I will put it on a git repository. And make a reference to you and MVP-Setup.

It will be an export tool for a typical Dutch niche. In the Netherlands, all kinds of data from sewers are stored in a database and you can put the data on an open data portal. That upload must be done with the ttl format (RDF Triple Language). Since the application at my work can't do that, I made a proof of concept that now can export a bit of data to a ttl file. I now want to convert that to some better structured code before i go further with it. So for the time being, my winter evenings are filled with a lot of puzzle work. :-X

cdbc

  • Hero Member
  • *****
  • Posts: 2571
    • http://www.cdbc.dk
Re: MVP made easier.
« Reply #85 on: December 14, 2025, 04:26:54 pm »
Hi Hans
Nifty, that sounds way cool  8-)
Very nice project  8)
I wish you fair winds with it =^
Thanks for asking mate.
Regards Benny

N.b.: My winter project is becoming, putting to new(ish) use the winders10 computers going out of commission...
I get'em, clean'em up, do necessary ram upgrades or changing of batteries and then put "ElementaryOS" onto them  8-)
ElementaryOS is a Linux distro, that looks and acts like a Mac -- It's really cool, no maintenance... and really fast on win10 machines  ;D
It's perfect for non techical users... \o/\ö/\o/

Ohhh -- I almost forgot, I'm also working on releasing my 'Plugin framework' into the wild, when I can get it ready :-X
« Last Edit: December 14, 2025, 04:38:04 pm by cdbc »
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

Hansvb

  • Hero Member
  • *****
  • Posts: 871
Re: MVP made easier.
« Reply #86 on: December 14, 2025, 04:52:20 pm »
That "ElementaryOS" sounds good. I should also take a look. I installed Ubuntu alongside Win11. That also feels much faster then Windows but I'm not used to it yet. Do it too little.

cdbc

  • Hero Member
  • *****
  • Posts: 2571
    • http://www.cdbc.dk
Re: MVP made easier.
« Reply #87 on: December 14, 2025, 05:14:40 pm »
Hi
Yup, you should try it out, I'll bet you like 'ElementaryOS' better than Ubuntu...
Hush, don't tell nobody, but it's actually based on the buntu LTS  :D  :-X
It's very different from my own advanced, techie & cutting edge PCLinuxOS, on the surface at least...  8)

Here in Denmark, some sections in government are trying out Linux, instead of "MichaelSoft Binbows" and their office product, to try to avoid /Lock-In/.
So it seems like a good time, to fiddle with that...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

Hansvb

  • Hero Member
  • *****
  • Posts: 871
Re: MVP made easier.
« Reply #88 on: December 29, 2025, 04:21:24 pm »
Hi Benny,

i didn't check out ElementaryOS (yet) but I "discovered" something else.  :D  Actually, I'm just very slow.

I have never paid much attention to this line:
Code: Pascal  [Select][+][-]
  1. fPresenter.Provider.NotifySubscribers(prStatus,nil,Str2Pch('(!) ERROR: Could NOT retrieve static texts!'));
Is probably somewhere in 1 of your answers or example I'm afraid  :-[. But I have only now really discovered how useful it is. This allows me to capture the language-dependent texts of a unit that is started from model.main and transport them neatly for the view. This is great.

The following is about errors from a raise but this can of course also be done with regular messages
Code: Pascal  [Select][+][-]
  1. unit MappingManager;  
  2. ...
  3.  
  4. constructor TMappingManager.Create(const FileName : String);
  5. var
  6.   mt: TMappingType;
  7. begin
  8.   inherited Create;
  9.  
  10.   if FileExists(FileName) then begin
  11.     MappingFile:= FileName
  12.   end
  13.   else
  14.     raise Exception.Create('MappingFileNotFound' + ', (' + FileName + ')' );  // <--- This goes to the exception in the calling function from model.main and ends up in the view.
  15.  
  16.   for mt:= Low(TMappingType) to High(TMappingType) do
  17.     fMappings[mt]:= TStringList.Create;
  18. end;  
  19.  
  20.  
  21. model.main
  22. procedure TModelMain.ReportError(const ErrorMessage : string);
  23. begin
  24.   fPresenter.Provider.NotifySubscribers(prReportError, Self, Str2Pch('ReportError' + ',' + ErrorMessage)); // "ReportError=ERROR: "
  25. end;      
  26.  
  27. function TModelMain.ExportToOroxTtlFile(Data : PExportToOroxTtlFileRec) : TExportToOroxTtlFileRec;
  28. var
  29.   DataProvider: IGWSWDataProvider;
  30.   OroxExport: TOroxExport;
  31. begin
  32.   Result.Success:= False;
  33.   Result.Message:= '';
  34.  
  35.   try
  36.     // Create a data provider. This is the query that retrieved the data.
  37.     DataProvider:= TQueryDataProvider.Create(fDatabaseModule.CurrentQuery, True);  // No free/nil required
  38.  
  39.     OroxExport:= TOroxExport.Create(DataProvider, Data^.FileName, Data^.OrganizationName, Data^.MappingFile, Self as IExportProgressReporter);
  40.     try
  41.       fSettings.ReadFile; // Kan vervelend worden. leest het hele settingsbestand opnieuw terwijl maar 1 setting nodig is. Aanpassen.
  42.       OroxExport.ExportToOrox(fSettings.DisableErrorReport, Data^.Version);
  43.       Result.FileName:= Data^.FileName;
  44.       Result.Success:= True;
  45.       Result.Message:= 'Export voltooid'; { #todo : Taalinstelling }
  46.     finally
  47.       OroxExport.Free;
  48.     end;
  49.  
  50.   except
  51.     on E: Exception do begin      
  52.       ReportError(E.Message);  // <-- Raise arrives here, it's a step closer to the view :) !
  53.       Result.Message:= E.Message;
  54.     end;
  55.   end;
  56. end;
  57.  
  58.  
  59. procedure TModelMain.ReportError(const ErrorMessage : string);
  60. begin
  61.   fPresenter.Provider.NotifySubscribers(prReportError, Self, Str2Pch('ReportError' + ',' + ErrorMessage)); // "ReportError=ERROR: "
  62.   // <-- And here the raise message goes to the view...
  63. end;
  64.  
  65.  
  66. View...
  67. procedure TfrmMain.DoExportError(anObj : TObject; aData : PExportToOroxTtlFileRec);
  68. var
  69.   Msg: string;
  70.   Parts: TStringArray;
  71.   i: Integer;
  72.   lMsg: string;
  73. begin
  74.   if adata = Nil then Exit;
  75.  
  76.   Msg:= PChar(aData);
  77.   Parts:= Msg.Split(',');
  78.   lMsg:= '';
  79.  
  80.   // // Add to the memo (line)  
  81.   if Assigned(memReportError) then
  82.   begin
  83.     for i:= Low(Parts) to High(Parts) do begin
  84.       lMsg:= lMsg + fPresenter.GetstaticText('view.main', Parts[i]); // Build the message string in the right language
  85.     end;
  86.  
  87.     memReportError.Lines.Add(FormatDateTime('dd-mm-yyyy hh:nn:ss', Now) + ' ' + lMsg); // and here the raise message of a far far away unit is presented. Pretty cool.
  88.  
  89.     // "Auto-scroll"
  90.     memReportError.SelStart:= Length(memReportError.Text);
  91.     memReportError.SelLength:= 0;
  92.   end;
  93. end;  

cdbc

  • Hero Member
  • *****
  • Posts: 2571
    • http://www.cdbc.dk
Re: MVP made easier.
« Reply #89 on: December 29, 2025, 05:05:28 pm »
Hi Hans
Yup, that too is a cool feature ;D, I think it's great, that the smaller details slowly reveals themselves to you, while you're coding along...  8-)

I use it myself too, because it's just so dang 'handy' and the more I use it, the more I find stuff to do, that's already thought of and in there, so I can just get on with the task at hand, way cool  8)

I'm glad you're liking it =^
Happy coding mate :)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

 

TinyPortal © 2005-2018