#1 Re: mORMot 2 » Service method returns encoded/garbled text on Lazarus » 2024-09-20 22:36:14

For the best search results use Google with <keywords> site:synopse.info. The forum search can be unreliable and this approach has the advantage of also returning blog posts.

#2 Re: mORMot 2 » How to Calculate Stock Quantity with Millions of Records with mORMot2? » 2024-09-16 08:56:43

doesn’t this approach break the principles of database normalization and design?

No because you're basically creating a small data warehouse. These are usually built using batch ETL processes and contain aggregates of your normalised data, which fits with your use case. You also have the option of putting the aggregates into a separate columnar database if you need even more speed - maybe something like DuckDB.

#3 Re: mORMot 2 » Copying property values via rtti » 2024-08-07 16:04:15

The modified CopyObject works perfectly - thank you.

#4 mORMot 2 » Copying property values via rtti » 2024-08-05 21:50:47

rdevine
Replies: 6

I'd like to be able to copy the (published) property values from a TSynPersistent subclass to a TOrm subclass - only the ones that match by name and type. I've been trawling through the v1 DDD code but have noticed it's not ported to v2. I can see a set of useful functions in the v2 rtti unit but is there anything elsewhere in v2 to simplify this? Or should I just use what's in the rtti unit and roll my own?

Thanks, Bob

#5 Re: mORMot 2 » Custom Authentication Class » 2024-07-15 16:57:30

Fixed on FPC by using the "as" cast rather than a hard one, i.e. this:

(Ctxt as TXAUriContext).fSessionOS := os;

Rather than this:

TXAUriContext(Ctxt).fSessionOS := os;

It would still be useful to have SessionOS and AuthenticationFailed accessible from other units though.

Cheers, Bob

#6 mORMot 2 » Custom Authentication Class » 2024-07-15 10:39:16

rdevine
Replies: 2

I created a custom authentication class based on TRestServerAuthenticationDefault (to avoid re-implementing CheckPassword). My Auth() override is similar to the TRestServerAuthenticationDefault version but different enough that I can't use OnAuthenticationUserRetrieve. To get access to fSessionOS and AuthenticationFailed, which are both protected, I use the following hack:

TXAUriContext = class(TRestServerUriContext);

I then just cast CTxt to get to the protected members. This works fine on Windows but gives me a 216 runtime error on Linux/FPC (Invalid Typecast).

I'm no FPC expert so am not sure if there's a workaround, but would it be possible to have a setter for SessionOS and have AuthenticationFailed made public?

Thanks, Bob

#7 Re: mORMot 2 » Where do I start? » 2024-07-04 11:08:24

Kabiri wrote:

I am determined to learn mormot2

Definitely worth the effort - it's an excellent framework. I'd disagree with Edwin though - I'd concentrate on v2 and then back-reference to v1 when required. For v1 Stephan Bester's tutorials are very useful, as is https://tamingthemormot.wordpress.com/.

For more in-depth examples using v2 those by Thomas (tbo - mentioned above by flydev) are excellent.

Cheers, Bob

#8 Re: mORMot 2 » Exception needed in Retrieve » 2024-05-22 13:28:41

Yeah I was checking the return value but had missed that I'd declared the wrong subclass. The type of oversight that can take a while to spot :-)

#9 mORMot 2 » Exception needed in Retrieve » 2024-05-22 10:38:43

rdevine
Replies: 2

If I try to use CreateAndFillPrepare with a TAuthUser subclass that isn't in the model I get an exception as expected. But if I do the same with Retrieve it fails silently (returns false). Would be useful to have an exception here also.

Cheers, Bob

#10 Re: mORMot 1 » TMS WebCore » 2024-03-11 20:19:55

Thank you! I've been meaning to get back to it and, e.g., sort out templates but it's been working great for me as-is so it keeps slipping down the list :-) I should find some time later in the week to test with WebCore before merging - thanks again.

Cheers, Bob

#11 mORMot 2 » Vector database » 2023-11-16 23:15:31

rdevine
Replies: 0

This looks like fun :-)

https://observablehq.com/@asg017/introducing-sqlite-vss

Interestingly he says "I'm starting a new blog about SQLite: the SQL database engine that is taking off in many new software engineering areas."

#12 Re: mORMot 2 » FPC Problem » 2023-10-16 23:11:07

The problem is still present with the latest code. I've debugged further and it first appears in commit:

e778e5e8bcf79a210f7a45c15542cb97861e2ede  20/04/2023 @ 15:28

It occurs in TSynLog.LogInternalFmt at the line:

fWriter.Add(TextFmt, TextArgs, twOnSameLine,
  [woDontStoreDefault, woDontStoreVoid, woFullExpand]);

At the time it occurs TextFmt contains 'CreateMissingTables on %'.

The only thing I can see that looks odd is a chinese-type character in VWideChar in TextArgs.

I'll try and find time tomorrow to dig a bit deeper.

Cheers, Bob

#13 mORMot 2 » FPC Problem » 2023-10-15 19:59:46

rdevine
Replies: 2

I recently rebuilt a Linux daemon that was last built back in March 2023. I usually just pull the latest code from Github and with the latest I get a SIGSEGV. Using console and the debugger this occurs in TRestOrmServerDB.CreateMissingTables at the first line writing to the log - fDB.Log.Add.Log(sllDB, 'CreateMissingTables on %', [fDB], self); If I comment the logging then it runs fine.

I've moved back and forward through the commit history and it appears to have been introduced somewhere between 5bbf1ca70b862429dda76bf07f582209e6b5a433 (18/04) and 4ac661b0ce839456b17088d573c3c30d93b5efab (21/04).

Let me know if you want me to narrow it down a bit further.

I'm using the correct SQLite static file and FPC 3.2.3 on Fedora.

Cheers, Bob

#14 Re: mORMot 2 » CurrentServiceContext » 2023-09-18 14:46:01

I've found that the comments in v2 are usually very similar to those in v1 - anything I can't find I search a phrase from the v1 comment and always find what I need.

Cheers, Bob

#15 Re: mORMot 2 » mORMot2 + JavaScript client » 2023-08-26 14:29:16

Yes the pas2js compiler is definitely the lowest risk option for sure. DWScript is very nice but it's just one developer. In theory I guess Quartex could allow switchable compilers but I've no idea if it's on the roadmap. EWB is AFAIK a one-man operation. It uses a proprietary compiler that is quite primitive compared to pas2js (e.g. it doesn't even have interfaces). It's fine if you're doing old fashioned "double-click-on-a-button-and-code-the-handler" style development. I've owned (and used) EWB and SMS over the years and WebCore/pas2js is by far the best so far (although I haven't given Quartex a serious look yet).

Cheers, Bob

#16 Re: mORMot 2 » mORMot2 + JavaScript client » 2023-08-23 23:04:42

I've been using TMS WebCore with mORMot for a while now and it works great - the pas2js compiler is just fantastic. It might also be worth taking a look at pas2js in Lazarus.

Since SMS died, DWScript is now available through the Quartex project. I'm planning to take a look at it soon - it certainly looks a bit more complete than SMS ever was.

Cheers, Bob

#17 mORMot 2 » Remote SQLite management » 2023-07-03 16:08:31

rdevine
Replies: 1

I'm looking for a way to manage a SQLite database on a cloud VPS (only for testing during development - not for production use!). I've come across this which provides a Web UI:

https://github.com/coleifer/sqlite-web

Anyone get any other suggestions?

Edit: Just found this - looks ideal with a Docker image - https://dbgate.org/

Thanks, Bob

#18 Re: mORMot 1 » mORMot and AWS for SaaS » 2023-05-29 21:57:20

I've actually gone off AWS - primarily because of cost. Initial costs might look reasonable but bandwidth costs can be a killer, especially for a SaaS startup. I'm hoping to get mORMot integrated with one of the serverless providers in a few months - will report back! The one certainty though is that mORMot was definitely the right choice - a joy to use.

Cheers, Bob

#19 Re: mORMot 2 » Server-Sent Events (SSE) » 2023-05-16 17:58:58

Ok thanks, I thought they might be useful for just sending progress updates of a computation to the client (I don't need two-way). I'll take a look at WebSockets.

Cheers, Bob

#20 mORMot 2 » Server-Sent Events (SSE) » 2023-05-16 13:54:48

rdevine
Replies: 2

Anyone using SSE with mORMot? I came across an old post saying they were on the roadmap but don't see anything in the docs or source.

Cheers, Bob

#21 Re: mORMot 2 » Linux FPC setup » 2023-03-13 13:35:40

Sorry - my bad - I'd completely missed the fact that I need to register my record type using Rtti.RegisterFromText in FPC.

Cheers, Bob

#22 Re: mORMot 2 » Linux FPC setup » 2023-03-13 11:10:12

Ok thanks - I pulled that fix but still have the problem. Will investigate....

#23 mORMot 2 » Linux FPC setup » 2023-03-13 10:36:25

rdevine
Replies: 4

I've got an interface-based service that works perfectly well on Windows but gives me a 406 "failed parsing ... from input JSON" on Linux (x64 Fedora and CentOS). The JSON received at the server looks identical on both platforms so it's a puzzle. Anyway, before digging in further, just to confirm the recommended FPC version for mORMot 2 - is it still "fixes-3.2" in fpcupdeluxe or is 3.4 ok? Also, I see that a few users are using the cross-compiler - anyone using the x64 cross-compiler for Linux from Windows? So far I've been building on a Fedora VM rather than cross-compiling.

Thanks, Bob

#24 Re: mORMot 2 » Interface enumerated return type » 2023-02-25 10:00:58

Still getting a generic AV message (I can see the new exception in the code as I step through but it doesn't get there). For testing I'm using a VCL forms app with the following simple code in the form unit:

  TTestEnum = (tteOne = 1,
               tteTwo = 2);

  ITestIntf = interface(IInvokable)
    ['{7F2B6047-D04B-488E-AA6D-03E184BE980A}']
    function TestEnum: TTestEnum;
  end;
  ....
  initialization
    TInterfaceFactory.RegisterInterfaces([TypeInfo(ITestIntf)]);

#25 Re: mORMot 2 » Interface enumerated return type » 2023-02-24 17:19:18

It happens in the case of enumerated return type where the values are explicitly specified, e.g. TTestEnum = (enum1 = 1, enum2 = 2,...).

(Just saw your edited reply :-)) I realise there's no way round it - just it would be helpful to have an exception message.

Cheers, Bob

#26 mORMot 2 » Interface enumerated return type » 2023-02-24 15:53:55

rdevine
Replies: 4

If I declare an interface service method with an enumerated return type which has the values specified, then I get an AV in TInterfaceFactory.Create at AddMethodsFromTypeInfo(aInterface). I guess this is from the lack of RTTI in Delphi enums with specified values. Not a problem for me but would be good to raise a specific exception. Using Delphi 11.2 and the latest pull of mORMot2.

Cheers, Bob

#27 mORMot 2 » Multiple TRestServer instances » 2023-02-16 12:13:23

rdevine
Replies: 1

I'd like to split my interface-based services across multiple TRestServerFullMemory instances in a single TRestHttpServer. I create the TRestHttpServer with an initial TRestServerFullMemory with a root, say "myroot". If I attempt to add a second TRestServerFullMemory with root "myroot/mysubroot" using TRestHttpServer.AddServer it fails because UriMatch comes back with a match, so I guess this root format isn't allowed. I see a couple of redirect options in TRestHttpServer and have also just noticed this: https://blog.synopse.info/?post/2022/12 … -Christmas. What would you recommend for best performance? I'm using nginx as a reverse proxy so I suppose have options there.

Thanks, Bob

#28 mORMot 1 » Passkeys » 2022-10-29 17:08:14

rdevine
Replies: 1

I've seen a lot of discussion now that these are coming into use - any plans? Must admit I haven't dug in too deeply so might be something we can do already.

https://fidoalliance.org/passkeys/

Cheers, Bob

#29 Re: mORMot 1 » TMS WebCore » 2022-10-11 10:17:04

Thanks Arnaud :-)

>why use an external sha256.js

When I started I couldn't get the mormot version to work, and was also learning about using external JS libraries in WebCore. I eventually figured out that I was picking up the wrong sh0 so restored the mormot code. I left the JS option in as an example of using an external library, but the default is the mormot code.

I'll need to learn a bit about Mustache but will try and find some time for the template soon.

Cheers, Bob

#30 mORMot 1 » TMS WebCore » 2022-10-10 23:03:49

rdevine
Replies: 8

I've uploaded some files for creating TMS WebCore/mORMot clients to:

https://github.com/SigmaSciences/mORMot-Web

It still needs a lot of testing and has missing functionality (I only use interface and method-based service from Web clients), but will hopefully be useful. I use mORMot 2 exclusively so haven't tested with v1. Pull requests welcome, though drop me an email (@gmail) with any suggestions (rlsdevine).

Cheers, Bob

#31 Re: mORMot 1 » Problem with TRestServerAuthenticationHttpBasic » 2022-10-05 15:56:07

Hi Thomas - I've created mORMot 2 WebCore units that I'm planning to stick on GitHub in the near future. I haven't created any tests yet which is why I haven't put them up but they seem to work (for interface/method services only - I stripped the ORM functionality out for the first version). I can send you what I've got in the meantime in case it's useful - I'm on gmail.com. Username is rlsdevine.

Cheers, Bob

#32 Re: mORMot 1 » Forum Search future does not work » 2022-09-22 09:47:48

Yes I also came across this a few months ago. The most reliable way to search the forum is to just Google, e.g., IgnoreCertificateErrors site:synopse.info/forum

In fact, the Search button on the forum should maybe just link to a page explaining how to search using Google - it's always going to be more reliable I think. With the current setup unsuspecting users could be missing a lot.

Cheers, Bob

#33 Re: mORMot 1 » Migrating to mormot 2 » 2022-08-11 23:23:09

If the new name for a class isn't obvious (e.g. remove the "SQL") I just search for a piece of text from the comments - the ones I've searched for so far have been unchanged.

Cheers, Bob

#34 Re: mORMot 1 » High-performance frameworks » 2022-07-21 13:36:26

This is really exciting stuff - well done guys!

@mpv
>For a long time we can't participate because we can't compile a mORMot in cloud environment. Now that FPC 3.2 is released it is possible.

I'm curious to understand what the problem was - just for my own understanding :-)

Thanks - and good luck.

#35 mORMot 1 » New Javascript runtime » 2022-07-09 19:06:54

rdevine
Replies: 0

Although I agree QuickJS is the way to go, this looks quite interesting:

https://bun.sh/

I also hear rumours that Besen 2 is in the works.

#36 Re: mORMot 1 » mORMot and AWS for SaaS » 2022-06-12 09:20:07

Thanks Arnaud - yes those two points are part of my design. I'm looking at possibly using AWS for functions such as Federated Identity Management and load balancing. E.g. AWS Incognito handles logins via Google, Facebook etc. (I'll have a free tier and many users could be non-corporate). I have a vague memory you run a cloud service on mORMot - I take it your authentication is done through your own microservice since you'll have a purely corporate user base?

Cheers, Bob

#37 mORMot 1 » mORMot and AWS for SaaS » 2022-06-11 09:35:12

rdevine
Replies: 6

I'm building a SaaS system that will likely use AWS Lambda with a mORMot server acting as a "mediator" server for directing client requests. The system will eventually extend beyond Lambda, probably with additional mORMot servers (it'll be microservice-based). Just curious if anyone is using mORMot in conjunction with any AWS services and what your experiences are. Cloudflare workers are another option but the AWS ecosystem seems pretty impressive.

Thanks, Bob

#38 Re: mORMot 1 » TRestStorageInMemory usage » 2022-04-14 23:44:16

The AV is caused by specifying nil for the server in the TRestStorageInMemory constructor. In v1 I can use nil in the TSQLTestStorageInMemory but in v2 the nil fRest in the base TRestOrm eventually gets used in TRestOrm.GetServerTimestamp (via TOrm.ComputeFieldsBeforeWrite).

#39 Re: mORMot 1 » TRestStorageInMemory usage » 2022-04-14 16:08:06

That's very clear - thank you. I must be messing something up with my stand-alone test - will investigate further.

#40 mORMot 1 » TRestStorageInMemory usage » 2022-04-14 13:44:40

rdevine
Replies: 3

I'm starting to work my way through the various demos - am preparing to build my first real mORMot system so trying to understand the basics. Also comparing v1 and v2 and will be using the latter for my system.

Demo 1 in v1 (In Memory ORM): Uses TSQLRestStorageInMemory - Data is written as JSON to a text file. Easy to understand although have seen mention by AB in a couple of forum threads that TSQLRestStorageInMemory shouldn't be used "stand-alone".

Demo 1 in v2 (Martin Doyle): Uses TRestClientDB. Data is written to a SQLite database file.

Modify Demo 1 in v2: Use TRestServerFullMemory. Data is now written as JSON to a text file. Found a reference in the forum by AB (thread 34049) that T(SQL)RestServerFullMemory has a full REST process included so is slower than TSQLRestStorageInMemory/TRestStorageInMemory.

Modify Demo 1 in v2: Use TRestStorageInMemory. Examining the v2 code, there's no simple alias for TSQLRestStorageInMemory/TRestStorageInMemory and the implementation has changed. I get an AV when attempting to add a record.

So my question is - should TRestStorageInMemory never be used stand-alone? I've seen the test code where an instance is extracted from a TRestServerDB subclass, and also forum thread 36294 which does something similar. Is this the only way TRestStorageInMemory should ever be used?

Thanks, Bob

#41 mORMot 1 » Forum search for class names » 2022-04-13 10:16:12

rdevine
Replies: 2

Searching for various class names in the mORMot forum I'm often getting no hits even when I know there is one, e.g. TSQLRestServerFullMemory which is mentioned here https://synopse.info/forum/viewtopic.php?pid=34035 and various other places.

If I search for say *ServerFull* I get a couple of other hits but not the above thread. Using Google seems reliable - any idea what's going wrong with forum searches?

Thanks, Bob

#42 Re: mORMot 1 » Javascript client » 2022-03-09 14:35:09

Excellent - thank you.

I'm going to try and track down the warleyalex code but if anyone has any opinions regarding pas2js vs. DWScript I'd be interested to hear.

Thanks, Bob

#43 mORMot 1 » Javascript client » 2022-03-09 12:13:17

rdevine
Replies: 2

I've been dabbling in mORMot over the years and am now planning my first project that will hopefully go into production (using mORMot 2). However, I need a web-based client and am wondering if anyone is using mORMot 2 with a Javascript client. Will the code I've seen around for v1 work? I have access to TMS Webcore (pas2js) and Quartex (DWScript) so should be able to cover all the bases.

Thanks, Bob

#44 Re: mORMot 1 » UniDAC vs. ZEOS » 2020-08-23 17:25:40

Thanks Arnaud - I've found the Zeos forum and there's a section for each database.

#45 mORMot 1 » UniDAC vs. ZEOS » 2020-08-23 16:48:15

rdevine
Replies: 10

I'll soon be requiring multi-database connectivity and have been mulling over buying UniDAC. However, today I saw Arnaud's post on Praxis about Zeos 7.3 and am wondering if I should use it instead. I've seen a number of impressive benchmarks on this forum for Zeos, but am interested in any thoughts anyone has on pros/cons of each, use in production etc. I use Delphi 10.4 on the client and am planning to use FPC on Linux servers, but also some Delphi/Windows server implementations.

Also can anyone point me to a full list of the different databases that Zeos can connect to?

Thanks in advance, Bob

#46 Re: mORMot 1 » Penentration testing / Pen testing » 2020-05-25 17:11:59

Hi Erick - that's great news, looking forward to it. I'm specifically interested in the security aspects of your web apps - having gone through Pen Testing it sounds like it'll be an invaluable resource for mORMot web apps. I used EWB many years ago, then Smart Mobile Studio and am now on TMS Web Core (although still subscribe to SMS). Combined with the FNC components Web Core really is in a different league, and the pas2js compiler is very impressive.

Cheers, Bob

#47 Re: mORMot 1 » Penentration testing / Pen testing » 2020-05-08 13:26:29

Hi Erick - are you still planning to publish a 3rd edition with the security overview?

Cheers, Bob

#48 Re: mORMot 1 » Beginner needs guidance - Lazarus HTTPS REST Server » 2018-05-03 23:38:58

@RedOctober - I agree with edwinsn. Start with the samples, identify key classes that are used and search the forums for other info, then use the docs to complete the picture. The forums are a goldmine of useful info and you'll find it's not as complicated as it first appears.

#49 Re: mORMot 1 » Smart Mobile Studio supported or not?? » 2018-05-03 21:24:26

@edwinsn I just create subclasses of the components I use, sometimes so that I can easily swap-in components from different vendors (which then just involves changing the unit name in the uses section), and sometimes to get matching properties for Vcl and FMX components. E.g. I wrap TEdit with IFDEFs for Vcl/FMX and create common property names when I need it. I wish EMB had standardised the property names across the two platforms! FMX on Windows is a dead-loss but I've found it ok on mobile, so for desktop I focus on the Vcl and have recently purchased CrossVcl for OSX.

I was an early adopter of EWB but dropped it after a year. It's rock-solid but the OP transpiler still doesn't handle interfaces or generics. Of course DWScript and pas2js don't yet handle generics but it's at least on the roadmap. EWB is another product that could have been miles ahead if they'd focused on client-side functionality - but a lot of resource was spent building server-side functionality to help sell their database products. They should have just used mORMot :-)

#50 Re: mORMot 1 » Smart Mobile Studio supported or not?? » 2018-05-03 15:19:22

The FNC components are very cool. I'm developing a fairly complex desktop app and I'm careful to inherit-out my visual components and keep the UI separate from my code (I build almost the entire UI in code). Using FNC I got the original VCL version running under FMX Windows in a couple of hours, and an additional couple of hours to get it running on Android. I think they're worth the money and have high hopes for TMS Web - the ability to cover that number of platforms is very impressive. I'm also an SMS subscriber and the new version is very good, but I think they've missed the boat.

Board footer

Powered by FluxBB