You are not logged in.
What you did wouldn't work.
I think you should do it this way:
- Do not change the definition of TImmobile and Immobili.
- Add a new type TImmobileNew with the new 'Varia' field added.
- Add a new property ImmobiliNew of type TImmobileNew.
- Migrate the data from 'Immobili' to 'ImmobiliNew'.
Well done!
Well done Arnaud, this is a new concept to me, and through all these years I have been watching you and other contributors never stop enhancing the framework, what a good thing to the Pascal/Delphi community.
It might not obvious, but the third parameter called "ForceId" must be "True", in order to save to DB using the ID you assigned.
Hi ab,
That makes sense. And it's your call ![]()
@mpv, the new SynSM45 is impressive! Thanks for your effort.
Oh, I see! Thanks.
Hello Arnaud,
My understanding is that the BatchUpdate() method does NOT support updating the record ID itself, right?
Hello Arnaud,
I'm not sure your priority, anyways, the ticket system shows that the ticket is "open", so I guess you haven't added it yet ![]()
Congrats hnb.
I noticed the mORMot-not-included download is no longer available?
You know, some people like me might have already installed mORMOt manually, or prefer to setup mORMot manually, for easy keeping update with the github repos......
Cross-compile feature would be the most needed feature IMHO, because it's the most difficult part for a new Lazarus user, on the other hand, other other tasks, like setting up mORMot for Lazarus, is not that hard.
Currently I'm enjoying Alred's cross-compile distribution ![]()
Oh! I was so wrong! Thanks ab, corrected my program and I'll see what happens ![]()
Hello ab,
Actually, there are two kinds of empty files:
- Log files whose length is 0 byte, and I checked it with a text editor, they are really empty.
- Log files only has some header info, without any log entry, the following is copied from a real-life log file:
C:\_Data\DelphiDev\app1\App\Bin\app1_Server.exe 0.9.8.932 (2016-07-12 13:59:05)
Host=EDWIN-Notepad User=edwin CPU=4*9-6-15620:FFFBEBBFBFFBFA7D OS=11.1=6.1.7601 Wow64=1 Freq=2143496
Environment variables=
TSynLog 1.18.2774 FTS3 2016-07-12T14:49:47And my code for setting up the logging:
procedure TServerMgr.SetupServerLogging;
begin
TSynLog.Family.Level := LOG_VERBOSE;
TSynLog.Family.AutoFlushTimeOut := 10;
TSynLog.Family.OnArchive := EventArchiveZip;
TSynLog.Family.ArchiveAfterDays := 7;
TSynLog.Family.NoEnvironmentVariable := True;
TSynLog.Family.LocalTimeStamp := True;
TSynLog.Family.DestinationPath := GetServerLogsFolder;
ForceDirectories(TSynLog.Family.DestinationPath);
end;Any findings ![]()
Did anybody notice the recent version of mORMot generates log files that's empty?
I'm not sure since when (maybe about several weeks ago), but this problem wasn't existed since I use mORMot for years ![]()
I handle the one-to-many relationships outside of the mORMot, for flexibility, freedom and clarity.
I mean, define the classes like this:
TSQLItem = class(TSQLRecord)
published:
property HeaderId: TID; // Reference to the master table
end;
TSQLHeader = class(TSQLRecord)
public // not published
Items: TObjectList<TSQLItem>;
end;We saving, the program set TSQLItem.HeaderId to the ID of the corresponding header.
When retrieving, the program load the header and item separately, something like:
myDb.Retrieve(myHeader, aHdrId);
myHeader.Items := myDb.RetrieveList<TSQLItem>('HeaderID = ?', [], [aHdrId]);I'm not sure what others think, but to me the built-in support for one-to-many relationship provided by the framework is too limited and not flexible.
And this is why I like mORMot - it finds a very good balance between "an ORM that completely abstract away the relational database concept" and "Directly use TDataSet". In other words, it does the tedious CRUD work excellently for me, while also let me easily take advantages of the proven SQL concept.
It might be a good idea to make our code as much prepared for Lazarus/FPC as possible, while still using Delphi as the development tool for the sake of productivity.
And the following are my initial thoughts, I encourage you to add your valuable points, since this can be served as a general guide for the community ![]()
Prerequisites
===
We must split our program into modules - the app logic and the services (including UI service and other system services such as service for accessing the file system.
The idea
===
The idea behind the following opinions is **prepare for changes**, which itself is a general rule of developing software.
The plan
===
So let's see what might change for a Delphi GUI program that needs to be compiled with FPC and also run other desktop OSs supported by LCL:
* The language. There is not much we can do for this, maybe don't use language features those not supported/compatible by FPC, for example, anonymous methods and generics.
* The RTL. The run-time library is actually application services needed by our program. We should organize and encapsulate the services into interfaces, for example, all functions for accessing the file system should be defined by the IFileSys interface, and we can implement it separately for Delphi and FPC - we can even have one implementation for Linux while another for Mac OS.
* The basic data types - especially the **strings**. The String in Delphi and the String in FPC is different - they are not binary-compatible. I also heard that FPC has a recent breaking change and broke some existing code, and they seem also has a plan to change it for utf16 IIRC (links pending). So it might be a good idea to use a fixed string type as the foundation for our program from the very start.
In this regard my first idea is to use UTF8string across the compiler and platform, for two reasons:
- utf8 is proven and is vastly widely used.
- The SynCommons.pas included by the mORMot framework already has a lot of **cross-platform** functions for string manipulation, that are already compatible by both Delphi and FPC.
A sidenote: We should really consider using SynCommons.pas as the "RTL" - it's feature rich, and it is already compile-able under Delphi and FPC for Windows and Linux.
It's just my humble options, and I'll be appreciated if you can provide any help on this.
---
Edwin Yip
Current trunk has some optimalization problems. Please try -O1 as optimization level.
Thanks. Will try and test this with Ubuntu sever 16.04 LTS 64bit when I find some time...
Re. the path, I agree with ab, "C:\Users\Public\Documents\NewPascal" is way too verbose.
@AOG, I must was doing something wrong, now I switched the "Build Modes" set by ab for the TestSQL3.lpr project, I have successfully compiled the 4 targets:
- win32 (all tests passed)
- win64 (Total assertions failed for all test suits: 21 / 8,415,516)
- linux_x86_64 (untested)
- linux_i386 tested under Linux Mint xfce 32bit, see below for results:
2.11. DDD shared units:
- User model: 3,276 assertions passed 507us
! DDD shared units - Authentication model
! Exception EAccessViolation raised with messsage:
! Access violation
- Email validation process: 55 assertions passed 38.36ms
! DDD shared units - User CQRS repository
! Exception EAccessViolation raised with messsage:
! Access violation
2.12. DDD multi thread:
- Delete old database: 1 assertion passed 29us
- Start server: 1 assertion passed 13.71ms
- Single client test: 1,002 assertions passed 186.52ms
- Multi threaded clients test: 21 assertions passed 386.34ms
Total failed: 0 / 1,025 - DDD multi thread PASSED 586.73ms
Using mORMot 1.18.2771 FTS3
Running on Linux-3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22 09:37:25 UTC 2015
TSQLite3LibraryStatic 3.13.0 with internal MM
Generated with: Free Pascal 3.1.1 compiler
Time elapsed for all tests: 100.05s
Tests performed at 07/07/2016 08:29:51 PM
Total assertions failed for all test suits: 0 / 20,127,664
! Some tests FAILED: please correct the code.@AOG, This is awesome!
Re. the installation path configuration in the future, maybe just add an exe file for changing the path (which is now fixed to "c:\NewPascal")? Actually it's really really really good to just download the .zip files - it's just like the so-called portable programs, which would not force us to do the re-installation after a system re-installation. No installer is needed, that'll cost unnecessary time in maintaining them. We are all developers and we can handle .zip files
And my testing results:
- win64: There is no win64 compile support, maybe you are missing some files in FPCLazBaseWin32.rar? Result:
Error: Illegal parameter: -Twin64- win32: Compiled and the tests run successfully.
- linux i386:
when {$define PUREPASCAL} is on, I got:
SynCommons.pas(56789,3) Error: Identifier not found "GetCPUID"Otherwise I got:
..\fpc-linux32\sqlite3.o:(.data+0xc28): undefined reference to `lstat64'
C:\NewPascal\fpc\units\i386-linux\rtl\si_c21.o: In function `SI_C21_$$__FPC_LIBC21_START':
si_c21.pp:(.text.n_si_c21_$$__fpc_libc21_start+0x27): undefined reference to `__libc_csu_fini'
si_c21.pp:(.text.n_si_c21_$$__fpc_libc21_start+0x2c): undefined reference to `__libc_csu_init'
TestSQL3.dpr(190,1) Error: Error while linking- Linux x86_64: Successfully compiled (but did not test running it), with the following added to my .lpr file:
// START http://bugs.freepascal.org/view.php?id=30112
{$ifdef FPC}
{$ifdef Linux}
{$ifdef FPC_CROSSCOMPILING}
{$linklib libc_nonshared.a}
{$endif FPC_CROSSCOMPILING}
{$endif Linux}
{$endif FPC}
// END Target was win32.
Yes. Unfortunately the New Pascal Pack doesn't support win64 so I'm unable to try it out...
Now I want to try AOG's latset Lazarus distribution for cross-compiling for Linux - the Lazarus distribution downloaded from newpascal.org does NOT support cross-compiling for Linux...
Oops! I suddenly deleted those 3 sub-folders included by the slite3fpc.7z - I thought it was produced during the FPC compilation, my bad...
And the good news, all tests went successful!
Using mORMot 1.18.2771 FTS3
Running on Windows 7 64bit SP1 (6.1.7601) with code page 936
TSQLite3LibraryStatic 3.13.0 with internal MM
Generated with: Free Pascal 3.1.1 compiler
Time elapsed for all tests: 67.46s
Tests performed at 2016/7/7 15:35:00
Total assertions failed for all test suits: 0 / 21,401,191
! All tests passed successfully.@AOG,
Tried, but I absolutely have no idea why it needs the .o file (see logs below) - my compilation target is default (also tried the win32 target).
TestMormotOfficial.lpr(9,1) Error: Can't open object file: fpc-win32\sqlite3.o
TestMormotOfficial.lpr(9,1) Error: Can't open object file: fpc-win32\libkernel32.a
TestMormotOfficial.lpr(9,1) Error: Can't open object file: fpc-win32\libgcc.aI tried both the TestSQL3.lpi shipped in the official mORMot repository, and also the project file created when started this forum post, like the following:
program TestMormotOfficial;
{$I Synopse.inc}
{$APPTYPE CONSOLE}
uses
{$I SynDprUses.inc}
mORMotSelfTests;
begin
SQLite3ConsoleTests;
end. On July 7, 2016 all tests went OK using the newpascal.org distribution: http://synopse.info/forum/viewtopic.php … 989#p20989
On July 7, 2016 all tests went OK using the newpascal.org distribution: http://synopse.info/forum/viewtopic.php … 989#p20989
2016-07-07 test:
Compiler:
https://github.com/dathox/newpascalpack … alpack.zip
mORMot distribution:
https://github.com/LongDirtyAnimAlf/mORMot
Target: i386-win32:
Result:
All tests passed! Well done you guys ![]()
Detailed results:
Using mORMot 1.18.2753 FTS3
Running on Windows 7 64bit SP1 (6.1.7601) with code page 936
TSQLite3LibraryDynamic 3.8.10.2 with internal MM
Generated with: Free Pascal 3.1.1 compiler
Time elapsed for all tests: 65.12s
Tests performed at 2016/7/7 14:51:50
Total assertions failed for all test suits: 0 / 21,319,038
! All tests passed successfully.@AOG,
I still haven started using Lazarus. So today I downloaded the official mormot and your fork for fpc, I compiled the testsqlit3 project successfully with the fpclazrtticross Lazarus/FPC distribuation you provided earlier.
But interestingly, it emits the following runtime error:
[Window Title]
Error
[Content]
Project TestSQL3 raised exception class 'External: SIGSEGV'.
At address 458577
[OK]I think I should download a new version of your cross-compile-ready Lazarus, or download and use the https://github.com/dathox/newpascalpack instead?
I'm a bit confused by the newpascal.org project now - it seems that it integrates your work, but from what I see in the download .zip file, it doesn't contain files for cross-compiling for Linux.
Thanks in advance, for your possible clarification and advises ![]()
Well done AGO and hnb ![]()
BTW, I think it's necessary to include some release notes, for example, this release should include the notes about the inclusion of the enhanced RTTI.
Just a suggestion ![]()
Great! That did the trick!
I previously tried Release(), but didn't try this one :;
Hello Aranud,
I made a TSynLog derived class and customize the log options, like:
type
TMyLog = class(TSynLog)
end;
...
// I setup the log options in the constructor of my object that uses this log class, like this:
procedure TMyThread.Create;
begin
TMyLog.Family.CustomFileName := 'MyLogFile';
end;
...
// and I add logs like this:
TMyLog.Add.Log(sllInfo, '...');
...
With these setup, my log files look like: "MyLogFile 20160627 143255.log", which is OK, and my Question: is:
How to force it to create a new log file? Thanks.
@ab, hey! That's my comment
Yes, I'm Edwin Yip ![]()
PS, IIRC the fpc/lazarus distribution I downloaded from @AOG's Google Drive does have cross-compile support, isn't the one provided by newpascal.org the same version by @AOG?
The TSynLog.Enter() method sounds like a good option for this purpose!
Hello Arnaud,
What's your option on log indentation? That'll be useful for logging tasks with sub-tasks, for example:
Start long task A.
sub task a1...
sub task a2...
sub-sub-task a20001
sub-sub-task a20002
sub-sub-task a20003
.....
sub task a3...
sub task a4...
End log task A.
Start long task B...Sounds great, @BeRo1985!
PS, I'm OK if it doesn't support pre-unicode versions of Delphi.
Well done BeRo1985! I wish you'll support FPC as well ![]()
@ab,
Do you think it makes sense to have a first-level link from this website to @AOG's https://github.com/LongDirtyAnimAlf/fpctrunkrtti
@BeRo, that would be great!
Would the project backed by a complete test suite for the js langauge? I think that's crucial for quality control ![]()
My approach: every time the program is being installed, it will first try to "delete" the url registration, then does the registration.
It's defined as
TBoilerplateHTTPServer = class(TSQLHttpServer)I see now! Very useful features.
Just one more question - does it work under Linux?
Thanks for sharing. Can it be used with other html framework other than html 5 Boilerplate?
Cool! Just an idea - add some benchmarking ![]()
Yes, a download-and-ready-to-use Lazarus distribution with cross-compile feature would definitely greatly lower the barrier for people to built web services with FPC/mORMot.
I'm saying so because I know the difficulty ![]()
@Maciej,
First, I appreciate and admire your contribution to FPC.
With respect, I would ask, is it really a good idea to change the language name? The bottom line is, the planned FPC fork should provide full backward compatibility for the official FPC.
Re. the website, I would strongly suggest to use github.io. Because you'll be able to collaborate on github.com, because, with respect, I assume github will generally last longer than other webistes
But all after all, it'll be the decision you guys should make.
Re. installer, yes, I agree with you, I don't think it's worth to spend the time to make the installer script and compile for each release. We programmers should be able to deal with zip files ![]()
@AOG,
I think just zip file would be enough, it's just like a so-called portable software, the one I downloaded from your Google drive was OK - as you definitely know, I have successfully configured it and compiled the mORMot MVC demo.
But it'll be ever better if people can exact it to any folder - I'm just saying, I can live with the current situation - it's in my C:\fpclazrtticross folder.
For the mORMot part, I would prefer to configure it myself, as I did, as long as we have a clear instruction online.
Just my 2 cents. Great work, you all!
@hnb, Wow! Wonderful. And exciting!
mpv, that'll be a very good news!
@AOG,
Is Mac OS X is o your plan?
Hi AOG,
In one of previous post, you mentioned you are using the AWS t2.micro instance and are happy with it.
Today I spent sometime tested 3 price-comparable VPS (actully 3, but that's not for hosting) I own, all are using SSD, and it seems that the EC2 t2.micro instance has much lower disk IO rate.
I'm new to the cloud computing, and I'm wondering how that effects the overall performance...
The following is my benchmark result, using (https://github.com/mgutz/vpsbench), which is as easy as typing 2 lines of commands.
Note: More clear viewing of my result (screenshot): https://snag.gy/O9AwcV.jpg
vultr $5/month plan
```
CPU model: Virtual CPU 714389bda930
Number of cores: 1
CPU frequency: 2399.996 MHz
Total amount of RAM: 741 MB
Total amount of swap: 3999 MB
System uptime: 19 days, 13:19,
I/O speed: 398 MB/s
Bzip 25MB: 5.30s
Download 100MB file: 150MB/s
```
Linode $10/month plan
```
CPU model: Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
Number of cores: 1
CPU frequency: 2799.992 MHz
Total amount of RAM: 991 MB
Total amount of swap: 255 MB
System uptime: 26 days, 19:30,
I/O speed: 572 MB/s
Bzip 25MB: 8.83s
Download 100MB file: 69.9MB/s
```
AWS EC2 t2.micro Approx. $13/month, first year free
```
CPU model: Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
Number of cores: 1
CPU frequency: 2500.098 MHz
Total amount of RAM: 992 MB
Total amount of swap: 0 MB
System uptime: 30 min,
I/O speed: 63.2 MB/s
Bzip 25MB: 4.68s
Download 100MB file: 96.4MB/s
```Any info about if the AddApplicationToFirewall() function works under Windows 8/8.1/10?
Well done AOG!
@ab, even under Delphi, isn't it only the global variables will be initialized, but not the local variables?
Please be note that "jscript' is not JavaScript nor JS ![]()