Recent

Author Topic: Anyone using mORMot with Lazarus? I need help getting started.  (Read 11529 times)

RedOctober

  • Sr. Member
  • ****
  • Posts: 452
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.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

balazsszekely

  • Guest
Re: Anyone using mORMot with Lazarus? I need help getting started.
« Reply #1 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.

RedOctober

  • Sr. Member
  • ****
  • Posts: 452
Re: Anyone using mORMot with Lazarus? I need help getting started.
« Reply #2 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) )  :-)

Soner

  • Sr. Member
  • ****
  • Posts: 305
Re: Anyone using mORMot with Lazarus? I need help getting started.
« Reply #3 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

balazsszekely

  • Guest
Re: Anyone using mORMot with Lazarus? I need help getting started.
« Reply #4 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.

RedOctober

  • Sr. Member
  • ****
  • Posts: 452
Re: Anyone using mORMot with Lazarus? I need help getting started.
« Reply #5 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.

 

MSGEndoDoc

  • New Member
  • *
  • Posts: 11
Re: Anyone using mORMot with Lazarus? I need help getting started.
« Reply #6 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? 
Martin

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Anyone using mORMot with Lazarus? I need help getting started.
« Reply #7 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.
« Last Edit: May 04, 2018, 01:22:39 pm by Handoko »

RedOctober

  • Sr. Member
  • ****
  • Posts: 452
Re: Anyone using mORMot with Lazarus? I need help getting started.
« Reply #8 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.

Thaddy

  • Hero Member
  • *****
  • Posts: 14204
  • Probably until I exterminate Putin.
Re: Anyone using mORMot with Lazarus? I need help getting started.
« Reply #9 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.
Specialize a type, not a var.

MSGEndoDoc

  • New Member
  • *
  • Posts: 11
Re: Anyone using mORMot with Lazarus? I need help getting started.
« Reply #10 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
Martin

abouchez

  • Full Member
  • ***
  • Posts: 110
    • Synopse
Re: Anyone using mORMot with Lazarus? I need help getting started.
« Reply #11 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/
« Last Edit: July 25, 2019, 04:51:19 pm by abouchez »

tudi_x

  • Hero Member
  • *****
  • Posts: 532
Re: Anyone using mORMot with Lazarus? I need help getting started.
« Reply #12 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 ?
Lazarus 2.0.2 64b on Debian LXDE 10

chayimamaral

  • Newbie
  • Posts: 3
Re: Anyone using mORMot with Lazarus? I need help getting started.
« Reply #13 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....

RedOctober

  • Sr. Member
  • ****
  • Posts: 452
Re: Anyone using mORMot with Lazarus? I need help getting started.
« Reply #14 on: August 21, 2019, 08:39:29 pm »
Thank you chayimamaral!

 

TinyPortal © 2005-2018