You are not logged in.
Pages: 1
You can find the example with explanations and sourecode here (forum Delphi-PRAXIS). The text is written in german, the sourcecode uses english names. Sourcecode and program can be found in the appendix.
The example is the answer to a forum member's question and the implementation of one of two solution variants, all with mORMot. I wrote this example because I noticed that answering a question with the reference to mORMot and the necessary functions has no effect. I think without concrete introduction with full source code to play with, mentioning mORMot makes no sense.
The example shows a very simplified image database with the following technical details:
An embedded SQLite database that can be optionally AES encrypted.
Complete tasks such as storing and reading records with the built-in ORM.
A full text search using the Title and Comment fields.
A field for meta data that can contain different fields for each record and can be queried via SQL.
Acceleration in saving and reading graphic formats JPEG, PNG, GIF, TIFF.
The interface is kept very simple and includes only a few functions. The source code is written in such a way that it invites you to try it out on your own.
With best regards
Thomas
Offline
Thanks a lot Thomas.
Could we add this sample as third-party sample in the mORMot repository?
note:
Just instead of DynArrayCopy() you may have used directly pmResultIDs^ := searchIDs;
Offline
Could we add this sample as third-party sample in the mORMot repository?
You are welcome to do that. I have no experience with licensing or legal issues. If a disclaimer is missing, please add it. Make any changes you feel are necessary.
note:
Just instead of DynArrayCopy() you may have used directly pmResultIDs^ := searchIDs;
I thought of that, but out of caution, I preferred to make a copy of the array. Maybe that was a little too cautious. Thank you for the tip.
This was my first complete article with the topic mORMot. In the past I only posted hints about mORMot, or posted single functions like this as an answer. I hope the beginning with the help of the sourcecode is easier.
I have tested the article with Google Translator. The result is not perfect, also some formatting is destroyed, but it is readable.
With best regards
Thomas
Last edited by tbo (2022-06-21 16:17:49)
Offline
I have the example ready for my next article. Are you interested to see the source code in advance?
With best regards
Thomas
Offline
I have published my second article with the topic mORMot here (forum Delphi-PRAXIS). The text is written in german, the sourcecode uses english names. Sourcecode and program can be found in the appendix.
With the example code you get:
A ZIP file as data storage, which can optionally store entries encrypted with AES.
Connection of a progress indicator with the help of a mediator.
Introducing a function that can AES encrypt and decrypt a file.
Acceleration in saving and reading graphic formats JPEG, PNG, GIF, TIFF.
And some little things more...
Here is the translation into English with Google Translator. The result is not perfect, also some formatting is destroyed, but it is readable.
With best regards
Thomas
Offline
I have published my third article with the topic mORMot here (forum Delphi-PRAXIS). The title is: Introduction to method-based services - server and client. The text is written in german, the sourcecode uses english names. Sourcecode and program can be found in the appendix.
With the example code you get:
An HTTP server for HTTP/1.0/1.1 requests.
Authentication of the user on the server and creation of a user-specific directory.
Login with the client to the server and exchange content list and image documents.
Connection of a progress indicator with the help of a mediator.
Acceleration in saving and reading graphic formats JPEG, PNG, GIF, TIFF.
And some little things more...
Here is the translation into English with Google Translator. The result is not perfect, but it is readable.
With best regards
Thomas
Offline
Hi Thomas!
Thank you for your series of articles and samples! Have sure that they are helping clarify a little more the "how-to" in the mORMot world, that powerful but sometimes hermetic (until you figure it out...) series of frameworks.
Have a great day!
Offline
I have published my fourth article with the topic mORMot here (forum Delphi-PRAXIS). The title is: Introduction to interface-based services - server and client. The text is written in german, the sourcecode uses english names. Sourcecode and program can be found in the appendix.
With the example code you get:
An HTTP server for HTTP/1.0/1.1 requests.
Authentication of the user on the server and creation of a user-specific directory.
Login with the client to the server and exchange content list and text documents.
A simple Markdown editor with preview of HTML output in the browser window.
And some little things more...
Here is the translation into English with Google Translator. The result is not perfect (rather average), also some formatting is destroyed, but it is readable.
With best regards
Thomas
Offline
Thanks a lot Thomas!!!
Offline
I have published my fourth article with the topic mORMot ...
Awesome!
Offline
That's how a great library gets popularized. Well done, tbo!
Is it about mORMot 1 or mORMot 2?
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Thank you for the kind words to all.
Is it about mORMot 1 or mORMot 2?
The source code for the examples are for the latest version of mORMot2.
With best regards
Thomas
Offline
Maybe put all the code in a github repository?
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
I have published my fifth article with the topic mORMot here (forum Delphi-PRAXIS). The title is: Mustache editor with integrated HTTP server for displaying HTML pages. The text is written in german, the sourcecode uses english names. Sourcecode and program can be found in the appendix.
With the example code you get:
A simple mustache editor (TMemo/TSynEdit component) with auto-completion for common HTML tags.
An integrated HTTP server for HTTP/1.0, HTTP/1.1, HTTPS with self-signed or own certificate.
The Edge web browser for viewing HTML pages with undockable stand-alone window.
Direct linking of images, CSS, JavaScript from ZIP files into the HTML page.
And some little things more...
Mustache Editor Instruction Manual:
Edge Browser is used for the display. With the function key "F5" the display is refreshed. With "F6" the project data are saved. If a project name has been assigned, it is saved immediately.
Images, CSS, JavaScript, JSON or ZIP files are loaded only from the assets directory. The folder structure/directory depth in a ZIP file is not limited. Example of a path is: Bootstrap.zip/bootstrap.min.css
Partials for Mustache Renderer can only be loaded from the Partials directory. Partials correspond to Pascal include files.
The Bootstrap files "bootstrap.min.css" and "bootstrap.bundle.min.js" are always added.
External files are loaded in order of appearance. Possible to specify the order of Bootstrap files by entering "*.css" or "*.js" in the order.
JavaScript files are loaded with option "defer". This behavior can be influenced. By prepending a "!" directly to the file name, it is loaded immediately. Prefixing a "?" will load with the "async" option.
The root for loaded JSON data is the filename. The JSON object from the Person.json file is addressed with "Person.FirstName".
The auto-complete for Mustache Editor covers common HTML tags. The definitions are stored in the file HtmlAutoComplete.dci.
The browser window can be undocked and placed as a stand-alone view.
Here is the translation into English with Google Translator. The result is not perfect (rather not so good), also some formatting is destroyed, but it is readable.
With best regards
Thomas
Offline
One more great contribution!
Thanks, Thomas!
Offline
Perhaps your samples could be introduced to thirdparty demos.
Offline
I took the liberty to integrate all five articles into the thirdparty demos folder.
https://github.com/synopse/mORMot2/tree … yDemos/tbo
It was a quick & dirty inclusion, with only a very quick review of the google-translated content.
I used basic markdown formatting, and made only a very few minor changes.
Thanks again Thomas for sharing!
Offline
I took the liberty to integrate all five articles into the thirdparty demos folder.
Thanks for including my examples.
For the 05-WebMustache example, a readme should be created with the link to the WebView2Loader.dll download page. The DLL should simply be copied into the program directory. It can be loaded from here: Microsoft.Web.WebView2. The file are located in the nupkg "build\native" or "runtimes" directory.
With best regards
Thomas
Offline
Good point.
I have just forced the file to be included in the repository.
https://github.com/synopse/mORMot2/commit/5e4d33db
It is a small file, anyway.
Thanks for sharing!
Offline
It would be good if it was mentioned that the attached version of WebView2Loader.dll is for 32-bit. If someone wants to create a 64-bit version of the program, he has to replace the DLL. Both versions for x64 and x86 are available in the NuGet file (see link above). Or you add the 64-bit version with the name x64_WebView2Loader.dll. I think a programmer should then know what to do.
With best regards
Thomas
Offline
@Arnaud: The source code is not complete and cannot be compiled! Therefore, it is not usable as an example.
I have published my sixth article with the topic mORMot here (forum Delphi-PRAXIS). The title is: Mediator for connecting FastReport with Preview and/or Designer. The article describes how to create your own TfrxUserDataSet using DocVariant. The text is written in german, the sourcecode uses english names. In the appendix you can find a sample application to play with. Only the source code for the program itself is included, not for the libraries.
The program is a test environment for mORMot and FastReport. There are five functions available: New project, open and close project, show report preview or report designer. To get started right away, a project "Test01" is ready created. Basic operation:
Each project has its own folder. The default Projects directory is located below the Program directory.
The FastReport layout file name is the directory name plus extension ".fr3". It is created by saving a report in the designer.
The name of the variable file in JSON object format is the directory name plus extension ".variables". When creating a new project, an empty file is created.
All files with the extension "*.json" are included as DataSets. The name of the DataSet is the file name. JSON object and array format is supported. A DataSet is included in the report by adding the JSON data file to the project directory. Drag-and-drop to/from the file view is supported.
And some little things more...
Here is the translation into English with Google Translator. The result is not perfect (rather not so good), also some formatting is destroyed, but it is readable.
With best regards
Thomas
Offline
Pages: 1