Recent

Author Topic: TurboPower Visual Planit Lazarus port version 1.04 released  (Read 41298 times)

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1875
Re: TurboPower Visual Planit Lazarus port version 1.04 released
« Reply #45 on: September 02, 2016, 04:11:02 pm »
@JD

In the end, all should be merged with the oficial mORMot.
My mORMot will be removed at that moment.

The whole process of making mORMot fully compatible with FPC is an ongoing effort.
Just today, static linking of SQLite3 on Win64 with FPC was accomplished.
As was making some mORMot datasets compatible with Linux (also FPC).

NewPascal is also part of the efforts to get the most out of mORMot with FPC.
And also a work-in-progress project.

Huge progress has been made the last couple of years.
For me, running the mORMot (and FPC/Lazarus-apps) on an Odroid-C2 (ARM 64bit) was one of the best parts of it.
I have measurement systems with Odroid-C2 and small touchscreens running now for 2 months 24/7 collecting data over USB without a single failure. So nice.

As being a work-in-progress, user feedback is VERY welcome !

JD

  • Hero Member
  • *****
  • Posts: 1913
Re: TurboPower Visual Planit Lazarus port version 1.04 released
« Reply #46 on: September 02, 2016, 05:18:28 pm »
@DonAlfredo

Where then do I download your FPC version in the meantime? The one I'm using comes from mORMotTvPlanit.

BTW I know about the NewPascal initiative but I am waiting the availability of a Linux version.
Linux Mint - Lazarus 4.6/FPC 3.2.2,
Windows - Lazarus 4.6/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

wp

  • Hero Member
  • *****
  • Posts: 13489
Re: TurboPower Visual Planit Lazarus port version 1.04 released
« Reply #47 on: September 02, 2016, 08:04:22 pm »
DonAlfredo, now I adapted the fulldemo to mORMot. Like the other demo it is in the full demo folder. There are two projects now, one using a BufDataset, and one using a mORMot datastore. Each datastore is contained in its own datamodule which is "used" by the project and the mainform by means of conditional defines set in each project options (BUFDATASET, or MORMOT). This keeps most of the IFDEFs out of the main form and the search paths separated.

One question is left: The live synchronisation is not working. What could be wrong? The sources are on ccr, r5123.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1875
Re: TurboPower Visual Planit Lazarus port version 1.04 released
« Reply #48 on: September 02, 2016, 09:31:28 pm »
Your integration of the mORMot looks very good ! Thanks !!

Can confirm the non-update.
Have designed a work-around.
(apparently, the controls are not updated if their dataset changes ... strange behavior)

Workaround:

Remove the timer from the datamodule.
Add a new public function to the datamodule:

Code: Pascal  [Select][+][-]
  1. TDemoDM = class(TDataModule)
  2.     ...
  3.   private
  4.   public
  5.     ...
  6.     function UpdateFromServer:boolean; <---------------
  7.   end;
  8.  
  9. function TDemoDM.UpdateFromServer:boolean;
  10. begin
  11.   result:=Datastore.CheckUpdate;
  12. end;

Add a timer to the mainform. In Ontimer, do:

Code: Pascal  [Select][+][-]
  1. procedure TMainForm.Timer1Timer(Sender: TObject);
  2. begin
  3.   Timer1.Enabled := False;
  4.   if DemoDM.UpdateFromServer then
  5.   begin
  6.     VpMonthView1.Invalidate;
  7.     VpDayView1.Invalidate;
  8.     VpWeekView1.Invalidate;
  9.     VpTaskList1.Invalidate;
  10.     VpContactGrid1.Invalidate;
  11.     VpResourceCombo1.Invalidate;
  12.   end;
  13.   Timer1.Enabled := True;
  14. end;

Awfull, but working on my system !

Edit: perhaps this is better:
Code: Pascal  [Select][+][-]
  1. procedure TMainForm.Timer1Timer(Sender: TObject);
  2. var
  3.   x:integer;
  4. begin
  5.   if DemoDM.UpdateFromServer then
  6.   begin
  7.     for x:=0 to Self.ComponentCount-1 do
  8.     begin
  9.       if (Self.Components[x].InheritsFrom(TVpLinkableControl)) AND ((Self.Components[x]).InheritsFrom(TWinControl))
  10.       then TWinControl(Self.Components[x]).Invalidate;
  11.     end;
  12.   end;
  13. end;
  14.  
« Last Edit: September 02, 2016, 09:49:53 pm by DonAlfredo »

wp

  • Hero Member
  • *****
  • Posts: 13489
Re: TurboPower Visual Planit Lazarus port version 1.04 released
« Reply #49 on: September 02, 2016, 10:16:28 pm »
Thanks for the hint. What exactly is "TDataset.Refresh" doing? Does it propagate to the planner controls? Note that the tvplanit controls do not follow the usual architecture of Dataset - Datasource - DataLink - data-aware control.

You are using the RefreshXXXX methods a bit differently from what TurboPower does. They use this to load only data within a window specified by +/-DayBuffer around the selected date. (For this purpose, every datastore has the SetFilterCriteria method for the filtering - this one had caused a lot of trouble in the beginning when I started this activity). I think, in case of a "large" database this would be an important option because the planner components would only load a mimimum dataset from the server.

JD

  • Hero Member
  • *****
  • Posts: 1913
Re: TurboPower Visual Planit Lazarus port version 1.04 released
« Reply #50 on: September 02, 2016, 11:10:28 pm »
@DonAlfredo

I have a problem with SynCommons.pas. I cannot compile because of an error on line 58435

Code: Pascal  [Select][+][-]
  1. {$ifdef CPUINTEL}
  2. procedure TestIntelCpuFeatures;
  3. var regs: TRegisters;
  4. begin
  5.   regs.edx := 0;
  6.   regs.ecx := 0;
  7.   GetCPUID(1,regs);                                <------ Error happens here
  8.   PIntegerArray(@CpuFeatures)^[0] := regs.edx;
  9.   PIntegerArray(@CpuFeatures)^[1] := regs.ecx;
  10.   GetCPUID(7,regs);
  11.   PIntegerArray(@CpuFeatures)^[2] := regs.ebx;
  12.   PByteArray(@CpuFeatures)^[12] := regs.ecx;
  13. end;
  14. {$endif CPUINTEL}
  15.  

I get compiler error shown below:

SynCommons.pas(58435,3) Error: Identifier not found "GetCPUID"

JD
« Last Edit: September 02, 2016, 11:16:38 pm by JD »
Linux Mint - Lazarus 4.6/FPC 3.2.2,
Windows - Lazarus 4.6/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

wp

  • Hero Member
  • *****
  • Posts: 13489
Re: TurboPower Visual Planit Lazarus port version 1.04 released
« Reply #51 on: September 02, 2016, 11:40:13 pm »
I had this too. It went away after I deactivated the PUREPASCAL define in the Synpose.inc (I had activated it when playing with Laz 1.4.4).
« Last Edit: September 03, 2016, 01:51:22 am by wp »

wp

  • Hero Member
  • *****
  • Posts: 13489
Re: TurboPower Visual Planit Lazarus port version 1.04 released
« Reply #52 on: September 03, 2016, 01:49:27 am »
The live synchronisation is not working. What could be wrong?
Found it. The original TVpCustomDatastore seeks the dependent controls as children of its "Owner". In my demo, however, the owner is the datamodule, not the form. I had seen this and fixed this for the constructor and destructor, but forgot about the notification procedure. Working now correctly in r5125.

When stepping through the RefreshEvents code in the debugger I saw that you do call inherited where the filtering occurs that I mentioned in the previous mail. I don't think that the code inherited from TVpCustomDBDatastore is correct in this situation because it uses the Filter property of the dataset (via the inherited SetFilterCirteria method). This iterates through all dataset records, and I could imagine that the timer interval of 250 ms could produce a lot of network travel in cases of a large database.

The minimum code required for notification of the dependent controls is the code inherited from TVpCustomDatastore ("if not Loading then NotifyDependents;").

An idea: Why not add the timer to the datastore? Along with properties "AutoUpdateTimerEnabled" and "AutoUpdateInterval", and an event "OnAutoUpdate"? Since there are also single-user datastores I think the timer should not be in the base classes (i.e. TVpCustomDatastore or TVpCustomDBDatastore) but in those datastores where this feature could be interesting. DonAlfredo, what do you think?

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1875
Re: TurboPower Visual Planit Lazarus port version 1.04 released
« Reply #53 on: September 03, 2016, 08:06:46 am »
@wp

Please find attached a new version of the mORMot datastore.
It includes the filtering you mentioned earlier.

Also added Port and Logging features:

Code: Pascal  [Select][+][-]
  1. if FNoServer then HostIP := '' else
  2. begin
  3.    //HostIP   := 'localhost';
  4.    // AWS (amazon web service) tvplanit demoserver
  5.    HostIP:='54.194.211.233';
  6.    HostPort := '8888';
  7. end;
  8. EnableLogging:=True;
  9.  

Also attached files needed to create a daemon !

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1875
Re: TurboPower Visual Planit Lazarus port version 1.04 released
« Reply #54 on: September 03, 2016, 08:10:04 am »
@wp
About the timer, I do not have a strong opinion.
My gut-feeling: a timer is GUI update --> a form thing and not a datastore thing ...

JD

  • Hero Member
  • *****
  • Posts: 1913
Re: TurboPower Visual Planit Lazarus port version 1.04 released
« Reply #55 on: September 03, 2016, 10:04:01 am »
I had this too. It went away after I deactivated the PUREPASCAL define in the Synpose.inc (I had activated it when playing with Laz 1.4.4).

On line 77 of Synopse.inc, I already have {.$define PUREPASCAL} undefined but the problem persists.
« Last Edit: September 03, 2016, 10:28:49 am by JD »
Linux Mint - Lazarus 4.6/FPC 3.2.2,
Windows - Lazarus 4.6/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

wp

  • Hero Member
  • *****
  • Posts: 13489
Re: TurboPower Visual Planit Lazarus port version 1.04 released
« Reply #56 on: September 03, 2016, 10:11:14 am »
Please find attached a new version of the mORMot datastore.
It includes the filtering you mentioned earlier.
Calling "inherited" at the end of the RefreshXXXX methods is not correct because it brings you into the code inherited by TVpCustomDBDatastore which loads all records and iterates through them to do the filtering. Just call the notification directly. Like this:
Code: Pascal  [Select][+][-]
  1. procedure TVpmORMotDataStore.RefreshResource;
  2. begin
  3.   RefreshTable(FResourceTable);
  4.   if not Loading then
  5.     NotifyDependents;
  6. end;
Could you test this before I upload it to svn?

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1875
Re: TurboPower Visual Planit Lazarus port version 1.04 released
« Reply #57 on: September 03, 2016, 10:48:06 am »
The mORMot datasource dataset does not perform filtering ! That is why the filtering is done at SQL level. The dataset filter-settings do nothing for this special dataset.
So, please use the oploaded version.
It should work as expected (as it does on my system).

wp

  • Hero Member
  • *****
  • Posts: 13489
Re: TurboPower Visual Planit Lazarus port version 1.04 released
« Reply #58 on: September 03, 2016, 11:04:15 am »
@wp

Please find attached a new version of the mORMot datastore.
It includes the filtering you mentioned earlier.

Also added Port and Logging features:

Code: Pascal  [Select][+][-]
  1. if FNoServer then HostIP := '' else
  2. begin
  3.    //HostIP   := 'localhost';
  4.    // AWS (amazon web service) tvplanit demoserver
  5.    HostIP:='54.194.211.233';
  6.    HostPort := '8888';
  7. end;
  8. EnableLogging:=True;
  9.  

Also attached files needed to create a daemon !
What is the daemon good for?

I think I'll add another commandline option to the full demo allowing to select between local host and AWS.

The daemon server code in the attachment does not compile ("TVpServer unknown"). Used the one from your git site.

Compiling the daemon server I get the error that the compiler cannot find libkernel32a, libgcc.a and libmsvcrt.a. I resolved this by adding the fpc-win32. But now this dependency is in the project file (the same, by the way, for the VpRESTserver and mormotdemo project files on svn), and this can't be correct, because somebody may want to compile for linux or win-64.

Recompiling again fails with error 5 (file access error). Looks as if the daemon is still running and can't be overwritten by the new compilation. How to stop the daemon? (I'm on Windows).

What is the server registration good for?

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1875
Re: TurboPower Visual Planit Lazarus port version 1.04 released
« Reply #59 on: September 03, 2016, 11:17:49 am »
Daemons:
http://wiki.freepascal.org/Daemons_and_Services

About the dependency on the object-files:
If you do a clean and build, it should work without extra paths (I hope).

ps: sorry for being short in answers ... no Internet ... have to do all on my phone.

 

TinyPortal © 2005-2018