Lazarus

Programming => Packages and Libraries => Topic started by: RedOctober on May 03, 2018, 07:10:11 pm

Title: Anyone using mORMot with Lazarus? I need help getting started.
Post by: RedOctober on May 03, 2018, 07:10:11 pm
I posted this over in the mORMot forum, but I thought it might be more appropriate posted here.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I used to use Delphi 1 to XE7. Then it got too pricey and buggy.  Now I use Lazarus (1.8.2) on Free Pascal (3.0.4) and target only the Windows 10 platform on full size desktop computers (for now). I have written an app in Lazarus that I now need to build a "licensing" module for.  I asked about Delphi MVC being ported to Lazarus FPC, on the DMVC Facebook Page and Daniel Teti said that DMVC wd not be ported to Lazarus.  One of the other ppl in the DMVC FB group told me about mORMot.  After trying to plow through the massive introduction docs, I'm lost as to where to begin.  To make this simple, I'll state there what I am trying to accomplish, and if some kind person could tell me how to do it with mORMot, I will learn the rest as I need to.

Project Goal:

I build small utilities that I would like to have a "licensing" function in, that ensures that my end user has a paid for license to use my software.  Let's call it the "LF" for short.  The job of the LF is very simple.  When the utility software first starts, it asks the end user for the GUID (license key) that I have sent them via email.  After the user types in the License Key, in the background, the LF calls into a dedicated server at my home office, using HTTPS REST web technology, and submits the license key.  The REST server decides if it is a legitimate license key and responds with one of two phrases to be shown to the end user:  "Success! You are licensed!" or "Invalid License Key".. AS WELL AS.. in the background, not shown to the user, a text BLOB, which is just the end user's name and address and email address, and, another GUID which is the "hidden" license key.

What I don't need help with:

I can write the client side LF in Lazarus.  I can handle all the database stuff.  I use Firebird 3x RDBMS.

What I DO need help with:

- How do I build the HTTPS REST server side that does what I want using mORMot in Lazarus?
- How do I build the Licensing Function into my existing Lazarus FPC client that "talks to" the mORMot server side in Lazarus?

Thanks in advance for any help you can provide.

To be clear:

This is not to produce any kind of visible web page.  My utilities run only on Windows 7 to 10 and my server is a Windows 2016 Essentials server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Title: Re: Anyone using mORMot with Lazarus? I need help getting started.
Post by: GetMem on May 03, 2018, 07:51:21 pm
Quote
After the user types in the License Key, in the background, the LF calls into a dedicated server at my home office, using HTTPS REST web technology, and submits the license key.  The REST server decides if it is a legitimate license key and responds with one of two phrases to be shown to the end user:  "Success! You are licensed!" or "Invalid License Key".. AS WELL AS.. in the background, not shown to the user, a text BLOB, which is just the end user's name and address and email address, and, another GUID which is the "hidden" license key.
You're licensing technique is fundamentally flawed(I'm not trying to rude, so please take it as a constructive criticism). To crack your system, all I need to do is to change a JNE line(jump if not equal) to JE with Ollydbg. Your "Invalid License Key" message makes the problem even worse. A better idea is to ship a second, smaller exe to your clients. The second exe sends the registration code, if it's a valid one the server sends back the full version of your exe.
Title: Re: Anyone using mORMot with Lazarus? I need help getting started.
Post by: RedOctober on May 03, 2018, 08:13:05 pm
Good point GetMem.  (Though I still need help with the mORMot stuff for the "Launcher" (second .exe in your response) )  :-)
Title: Re: Anyone using mORMot with Lazarus? I need help getting started.
Post by: Soner on May 03, 2018, 08:30:00 pm
I would not learn such complex system like mormot for only this issue.
Make it with Indy as client/server application. You have choice between http, tcp or udp client/server.
You can find in Indy 9 demos enough example for this. Look here http://www.indyproject.org/Sockets/Demos/index.EN.aspx (http://www.indyproject.org/Sockets/Demos/index.EN.aspx)
Title: Re: Anyone using mORMot with Lazarus? I need help getting started.
Post by: GetMem on May 03, 2018, 08:34:28 pm
Yes, I agree with Soner. Mormot is a high performance framework but is an overkill for this particular task.
Title: Re: Anyone using mORMot with Lazarus? I need help getting started.
Post by: RedOctober on May 04, 2018, 02:01:52 am
Good points all.  Hey, as part of a "minimalist" or perhaps "additional" anti-piracy check, what if I put the file size (in bytes) into one of the file description fields.  Example:

Product Version
Company Name
File Description  <-- Maybe I cd put the .exe file size here
File Version

So, upon startup, I cd check what's in the File Description field and compare it with a FileSize() done on the running .exe and if they don't match, I shut down.  One catch is, every time I enter the file size info in the source code, the size of the .exe will change.

 
Title: Re: Anyone using mORMot with Lazarus? I need help getting started.
Post by: MSGEndoDoc on May 04, 2018, 12:54:17 pm
Hi RedOctober

I too am looking at Mormot  and am perplexed at the shear scale and complexity of it all.    But I still would like to use Mormot as I know it will be able to do just about anything you might want an ORM and client/server framework to do.  Later on I hope to have less technical debt as Mormot will have a solution to most problems.   Why not join the Mormot forum and ask there?  Arnaud Boucher  the main contributor is very active on the forum and knows anything and everything about Mormot. 

As a wider thought, I have discussed Mormot to my Delphi group and a recent meeting and they also seemed to be inhibited by Mormot's complexity to engage with it.   But My concept is that if a more user friendly API could be developed on top of Mormot then it would become a very competent but easily used solution for developers.   It needs to be made easier.   Moreover, what if we went further and developed a front end GUI to allow drag and drop design of enterprise level ORM + Client/Server solutions which any business analyst or SME business owner could set up themselves?  Essentially non developers could model their business or other problems directly and set up a full software solution.  This would basically be like a mini SAP, but open source and in Pascal.   There would be a business opportunity for developers to become like SAP consultants and help businesses or others with the set up where required, and of course get paid for that consultancy work.   Does anyone think this could be viable? I think Mormot really has this potential.  It just needs someone to have the vision and time and make it happen. 

Cheers,

Martin
PS I am fully employed and don't have the time  :) But does someone else? 
Title: Re: Anyone using mORMot with Lazarus? I need help getting started.
Post by: Handoko on May 04, 2018, 01:17:59 pm
Hey guys. If you're building commercial projects and need helps, maybe you can consider to create a bounty:
http://forum.lazarus.freepascal.org/index.php/board,41.0.html
http://wiki.freepascal.org/Bounties

I see the job and bounty sections here are not active. I was a member in WordPress forum and others, they have better management for commercial support, marketplace, plugin reviews, etc. That makes a big difference, it will attract skilled and serious programmers to join the developer team.
Title: Re: Anyone using mORMot with Lazarus? I need help getting started.
Post by: RedOctober on May 04, 2018, 04:04:55 pm
Hi MSGEndoDoc. So, I am not the only one.  You make very good points about mORMot.

I wish that Daniel Teti wd port Delphi MVC Framework over to Lazarus.  DMVCF is relatively simple to use (especially compared to mORMot).  I hired Daniel to help me build a project using DMVCF and I was very impressed.  The learning curve is relatively low, but I didn't have much time so I had to hire Daniel directly to get the project done in time.
Title: Re: Anyone using mORMot with Lazarus? I need help getting started.
Post by: Thaddy on May 04, 2018, 06:02:04 pm
mORMot is on a basic level simple to use, but it has too many options, you can't see the wood for the tree's or the other way around. It also lacks some fancy generators to help.
I use it a lot.
Title: Re: Anyone using mORMot with Lazarus? I need help getting started.
Post by: MSGEndoDoc on May 05, 2018, 07:28:38 am
Hi Thaddy,

Good to hear you use Mormot a lot - so any tips on how to get proficient quickly  - how to find the wood in the trees!  I have tried some of the samples of course and set up Nos 27 and 29 servers.   I have read Taming the Mormot site too but still am not confident.   

Cheers,

Martin
Title: Re: Anyone using mORMot with Lazarus? I need help getting started.
Post by: abouchez on July 25, 2019, 04:49:44 pm
Start by reading https://synopse.info/files/html/Synopse%20mORMot%20Framework%20SAD%201.18.html#TITL_204

Then look at https://github.com/synopse/mORMot/tree/master/SQLite3/Samples
 = the samples are the way to start.

Also look at https://tamingthemormot.wordpress.com/category/tutorials - this whole blog has good and simple material to start with.

At https://www.livemon.com/features/core-technology we use Lazarus + FPC with mORMot for our projects, targeting Linux server-side process with huge performance and stability.

Last but not least, you can now install mORMot as a Lazarus package! https://packages.lazarus-ide.org/
Title: Re: Anyone using mORMot with Lazarus? I need help getting started.
Post by: tudi_x on July 25, 2019, 05:46:46 pm
check the link:
https://medium.com/@step.bester/web-apis-with-mormot-891c0ecd3950

and author. it has more articles on Medium and extracts exactly what is needed for start.

@abouchez - any chance of posting something to Medium ?
Title: Re: Anyone using mORMot with Lazarus? I need help getting started.
Post by: chayimamaral on August 21, 2019, 08:34:56 pm
Impossible to use mORMot with Lazarus. I've tried 4 diferent tutorials, using FPCUpDeLuxe, but no one works....
Title: Re: Anyone using mORMot with Lazarus? I need help getting started.
Post by: RedOctober on August 21, 2019, 08:39:29 pm
Thank you chayimamaral!
Title: Re: Anyone using mORMot with Lazarus? I need help getting started.
Post by: JD on August 21, 2019, 10:53:21 pm
Impossible to use mORMot with Lazarus. I've tried 4 diferent tutorials, using FPCUpDeLuxe, but no one works....

No it isn't. Try to run the sample 4, the HTTP REST Server. It is the simplest of the lot in my opinion. Then try to build up from there. Personally, I just concentrated on sample 4 and the third party samples.

I just wanted to build an HTTP REST Server that serves JSON content.

I also read the chapter on interface based services and then using the third party sample by George, I was able to create an interface based REST server in front of a PostgreSQL database.

At the moment, I'd rather use mORMot to build a REST server than Apache Tomcat especially when the server PC is not a very powerful one. mORMot serrver apps still work very fast on Intel Dual Core PCs. So when my server PC is modest or old, I just use mORMot and I've not had complaints about performance for the time being.

By the way, I used a standard Lazarus installation and added mORMot via the OPM. I previously downloaded mORMot separately but since it became available via the OPM, I use that now.

Best of luck with your coding,  :D

JD
Title: Re: Anyone using mORMot with Lazarus? I need help getting started.
Post by: Christian on December 14, 2019, 02:33:29 am
I would like to start also with mormot at time.
In windows i managed to get it working with fpc 3.2.0 rc and actual mormot git.
In Linux 64bit i stuck to get it working even with Sample 04.
Both my initial implementation and Sample 04 crashs at start on Line 49770 in SynCommons.pas thats deep in there RTTI Stuff and i cannot work around it even when i would not need the RTTI Stuff.

Has anyone an 64bit Linux mormot running ? Wich git commit id do you use ? Wich fpc Version do you use ?
TinyPortal © 2005-2018