#51 2016-01-25 09:49:39

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Smart Mobile Studio

I am sorry Ab, but the SAP implementation of OData causes some troubles.

Regarding your comment:

If a type is defined as Edm.Int64, then the server side filtering algorithm (of OpenUI5) adds a capital L into the search string of this field.
A real OData server knows what to do with it. Our mORMot (REST) does not.

Edit: the same is valid for float fields and binary (blob) fields

There is no problem using Edm.Int32. Values are just converted into a string of sufficient length and send to the server.
So, for the moment, this is ok AFAIK.

Still some things to do:
DateTime types and Navigation Properties.
Working on it !

Must admit that OData, with all its version, can be (is) troublesome .....

Last edited by AOG (2016-01-25 10:00:09)

Offline

#52 2016-01-25 11:56:45

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Smart Mobile Studio

Added navigation properties and field length into metadata ....
Plase do not judge the code quality of metadata generation ... its just a start and proof of concept ... ;-)

Offline

#53 2016-01-30 10:45:22

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Smart Mobile Studio

@Ab

Thanks for your recent changes !!!!
Makes life more easy ... ;-)

But there is always a "however".

However:
For me, ComputeInBodyFields does not work as expected.
If fields are not present in the inbody, the fieldbits are not set.
My mod:

  procedure ComputeInBodyFields(Occasion: TSQLEvent);
  var Rec: TSQLRecord;
      bits,finalbits: TSQLFieldBits;
  begin
    Rec := Table.Create;
    try
      Rec.FillFrom(pointer(Call.InBody),@bits);
      if Occasion=seAdd then finalbits:=Rec.RecordProps.SimpleFieldsBits[soInsert] else
      if Occasion=seUpdate then finalbits:=Rec.RecordProps.SimpleFieldsBits[soUpdate] else
      finalbits:=bits;
      Rec.ComputeFieldsBeforeWrite(Server,Occasion);
      with TableRecordProps.Props do
        if Occasion=seAdd then
          finalbits := finalbits+ModCreateTimeFieldsBits else
          finalbits := finalbits+FieldBits[sftModTime];
      Call.Inbody := Rec.GetJSONValues(true,Rec.IDValue<>0,finalbits);
    finally
      Rec.Free;
    end;
  end;

Aditional feature request (has to do with OData).
Hardcoded:

Call.OutBody := '{"values":'+Call.OutBody+
  FormatUTF8(Server.URIPagingParameters.SendTotalRowsCountFmt,[SQLTotalRowsCount])+'}';

Request:

Call.OutBody := '{'+Server.URIPagingParameters.ResultsEnCapsulation':'+Call.OutBody+
  FormatUTF8(Server.URIPagingParameters.SendTotalRowsCountFmt,[SQLTotalRowsCount])+'}';

In addition the the above request. This

if (SQLResults<>0) and not ContainsUTF8(pointer(SQLWhere),'LIMIT ') then begin

does inhibit the use of Server.URIPagingParameters.SendTotalRowsCountFmt without SQLResults.
Request: to be able to use Server.URIPagingParameters.SendTotalRowsCountFmt even if SQLResults=0

Thanks

Offline

#54 2016-01-30 12:58:13

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Smart Mobile Studio

Edit:
Perhaps the above code snippet is only needed for adding records and not for updating:

if Occasion=seAdd then finalbits:=Rec.RecordProps.SimpleFieldsBits[soInsert] else
   finalbits:=bits;

Offline

#55 2016-02-07 10:27:59

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Smart Mobile Studio

@Ab
I am now using BeforeUri and AfterUri to process OData V2 commands.
Thanks for adding these features. They were very welcome !

Question:
I am rewriting the original URL inside of BeforeUri.
I have seen that, in that case, I also must adapt other Ctxt params also, if the Url is changed

Ctxt.ParametersPos := PosEx(RawUTF8('?'),Ctxt.Call^.url,1);
if Ctxt.ParametersPos>0 then Ctxt.Parameters := @Ctxt.Call^.url[Ctxt.ParametersPos+1]; 

Until now, I am only processing various OData commands.


The next step will be to convert something like /root/Product('1') into /root/Product/1
Not that hard to rewrite the Url.
But the Uri is already set.
Do I need to rewrite the Uri also ?

Thanks.

edit: If I look at the sources, I think BeforeUri is already to late to get the right table, but please confirm.

Last edited by AOG (2016-02-07 10:35:36)

Offline

#56 2016-02-11 09:58:47

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Smart Mobile Studio

@Ab.
In addition to the above.
Would it perhaps be possible (or better) to make URIDecodeREST either:
1) a public function ?
2) a function that we could be override ?

(the Url cannot be changed inside of Request(Ctxt: THttpServerRequest) : Url is readonly)

Offline

#57 2016-06-29 10:19:43

Leslie7
Member
Registered: 2015-06-25
Posts: 248

Re: Smart Mobile Studio

ab wrote:

I still use SMS for my own projects, since I'm able to deploy applications on Android and iPhone (and any other system) as HTML5 app, by-passing the iTunes/GooglePlay stores

Could you please share a little more on the  "by-passing" part?   

My mobile apps are not distributed publicly and I am looking for efficient ways to distribute/update a HTML5 app without some "stores" involved. The target is mostly android but occasionally IOS or Windows Mobile may come to the picture.  AFAIK installing to IOS requires purchasing an apple developer ID.  Reading your comment made me wonder if there is any way around this?

Last edited by Leslie7 (2016-06-29 10:23:33)

Offline

#58 2016-06-29 11:19:00

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,207
Website

Re: Smart Mobile Studio

If you publish a HTML5 manifest file with proper cache of the associated file resources, and the flags to allow local installation of a shortcut, your HTML5 app could run stand-alone, and offline if necessary, without the need to publish it on the stores...
See http://www.html5rocks.com/en/tutorials/ … e/beginner
and http://stackoverflow.com/q/1951381/458259

Offline

#59 2016-06-29 13:43:34

Leslie7
Member
Registered: 2015-06-25
Posts: 248

Re: Smart Mobile Studio

This is VERY helpful. Thank you.

Last edited by Leslie7 (2016-06-29 13:43:47)

Offline

#60 2016-06-29 14:10:14

Leslie7
Member
Registered: 2015-06-25
Posts: 248

Re: Smart Mobile Studio

AB,

One more question: is there any example I could look at about data binding when the data is supplied by a mORMot based server to an ionic based UI ? (UI Rendering & saving forms)

Offline

#61 2016-06-29 16:25:30

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,207
Website

Re: Smart Mobile Studio

Not yet, as far as I remember.

Offline

#62 2016-06-29 21:39:07

Leslie7
Member
Registered: 2015-06-25
Posts: 248

Re: Smart Mobile Studio

Ok, thanks.

Offline

#63 2016-07-07 15:34:48

Leslie7
Member
Registered: 2015-06-25
Posts: 248

Re: Smart Mobile Studio

Alex,

I have seen you posting a sample app at the SMS forum  (MS Employee Directory). This could be useful sample code for many of us.  Could you please share the source code for both server and client?

Offline

#64 2016-07-30 00:40:30

erick
Member
Registered: 2015-09-09
Posts: 155

Re: Smart Mobile Studio

DigDiver wrote:

Does anybody try to use Elevate Web Builder?

Hi,

I bought an SmartMobileStudio license a year ago because i wanted to use it for web page development with Mormot, which I chose because of the open database layer.  My projected needed web to database connectivity.

The SMS learning curve felt steep, and so I bought the 3rd party book they advertise, but it was a few years out of date, incomplete, and abandoned.  I was a little annoyed that the sales hype for the book didn't say that.  Also, SMS version 2.2 was promised but not delivered in a long time and they reverted back to 2.1.  I wrote a few apps, but was not enthralled with it.

Someone in a Delphi group enthusiastically suggested Elevate Web Builder EWB 2.04 instead.  So I bought a copy of it and  found it had an active community, new releases every 1/2 year or so, and it felt like Delphi 7 - fast, solid, clean, well documented.  I though it delivered where SMS was still mostly promising.  Maybe in a few months SMS will change, but like everyone, I needed a solution today and to feel the product is actively being improved.

There is now a 200 page book on EWB on Amazon, I know 'cause I wrote it, it's my fourth book.  But I would recommend holding off buying the book because a 300-ish page 2nd edition will be released in about two weeks, it's being proof read by the EWB software author.  Someone here commented that EWB didn't look as powerful.  There are lots of samples on my web page showing what it can do, including OAuth 2.0 and interface with almost any JavaScript library.  It's very powerful.

I didn't write this to sell my book, as evidenced by the fact I just told you not to buy the current book.  I'm just making the point that it has a lot going for it now and that I'm a person who likes to get involved.

What I want to say is EWB includes SOA and obviously serialization and deserialization code from published properties.  But the exchange is currently different than what Mormot expects or uses.   

I haven't yet interfaced it to Mormot.  However that's what I'd like to do next, hopefully with the help of a few mormot-knowedgeable people.

I'm looking for suggestions as to whether to interface with Mormot's interface layer and data exchange, or to use EWB's database model and write a Momot layer which can talk to EWB's SOA api.  The first is more RPC-like, whereas the second would simplify use of things like Grids already available in EWB.

Obviously there are tradeoffs with each model.  Input would be helpful. 

Erick

Offline

#65 2016-07-30 00:48:28

erick
Member
Registered: 2015-09-09
Posts: 155

Re: Smart Mobile Studio

After that long introduction, I should say what EWB offers over SOA to help with your understand of my question:

EWB implements RESTful JSON GET and PUT.  The get would be trivial to convert.
The PUT encapsulates Create/Update/Delete of the CRUD model.  I've written code to convert the
request sinto basic SQL, but obviously we don't want clients to have ability to randomly update
create or delete any object they want.  We want business logic.

If I go with the Mormot model, there would be a lot more EWB code to write.  Though presumably I could look at
the SMS Mormot code to get started.

I'm leaning toward running Mormot over the wire and writing libs in EWB to match Mormot.

Erick

Offline

#66 2016-07-30 00:53:43

erick
Member
Registered: 2015-09-09
Posts: 155

Re: Smart Mobile Studio

erick wrote:
DigDiver wrote:

Does anybody try to use Elevate Web Builder?

> Someone here commented that EWB didn't look as powerful.  There are lots of samples on my web page showing what it can do, including OAuth 2.0 and >interface with almost any JavaScript library.  It's very powerful.

http://erickengelke.com  for samples, including the web page itself.

Erick

Offline

#67 2016-07-30 02:34:45

erick
Member
Registered: 2015-09-09
Posts: 155

Re: Smart Mobile Studio

Okay, I've looked back over my mormot work form last year, yeah, definitely mormot on the wire.

EWB lacks native Object Pascal Interfaces in common with Delphi.  I might have to write something to connect it with Mormot.

I'm thinking that rather than use Mormot's shared code of writing interfacing code specifically in EWB.  I mean, the code is so
heavily mixed with {IFDEFs} that I'm afraid of it.

My next step is to see what  mormot looks like on the wire.  I know it's JSON, but what field names it sends and receives
to see what kind of work  I'm going to do.

Erick

Offline

#68 2016-07-30 08:03:02

Leslie7
Member
Registered: 2015-06-25
Posts: 248

Re: Smart Mobile Studio

Erick,

I have EWB too. Exploring SMS these days.

SMS compiler is much more advanced than EWB. It has a very interesting memory model. Supports the use of pointers and delphi style memory allocation instead of relying directly on DOM, which makes possible to write shared code with delphi/fpc much more easily. This feature being new I am not sure how stable it is. 

On the other hand EWB is stronger on the GUI front , plus Controls can be bound to datasets in delphi style. 
Inmemory datasets with transaction handling are also more advanced in EWB.

IDE:

SMS text editor is better, more like Delphi/Lazarus
Property editors are lacking in both products for me.

EWB support is quality but releases often get heavily delayed. 

I wish we could have the best of both world in one product. smile

Offline

#69 2016-07-30 08:30:22

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,207
Website

Re: Smart Mobile Studio

Generating cross-platform client code for EWB should not be so much difficult.

Following SMS integration pattern, it is technically feasible.

Generating client wrappers is certainly the way to go with EWB: it would allow safe and efficient access to a mORMot server.

Offline

#70 2016-07-30 12:04:45

erick
Member
Registered: 2015-09-09
Posts: 155

Re: Smart Mobile Studio

ab wrote:

Generating cross-platform client code for EWB should not be so much difficult.

Following SMS integration pattern, it is technically feasible.

Generating client wrappers is certainly the way to go with EWB: it would allow safe and efficient access to a mORMot server.

Yes, last night i figured out your protocol on the wire using the browser's network activity pane.
I looked at the javascript example to get started.  Having EWB replace JavaScript is a first goal, then
the more general case will be the next challenge.

Erick

Offline

#71 2016-07-30 16:19:57

erick
Member
Registered: 2015-09-09
Posts: 155

Re: Smart Mobile Studio

I got the Get and Delete options working today.  Now I'm working on the POST options.

Offline

#72 2016-07-30 18:19:34

erick
Member
Registered: 2015-09-09
Posts: 155

Re: Smart Mobile Studio

I have it ALMOST working, but there is a change that needs to be made in mormot to make it work.
For JSON posts you accept:

   ID : 4
   Name : "Peter"

but embedded in EWB it uses
  "ID" : 4
  "Name" : "Peter"

which is technically valid too, but mormot doesn't seem to like it.
Make EWB not use quotes would break compatibility with systems
that allow embedded spaces.  So I think I will patch mormot to skip
the quotes. 

Wish me luck.

Erick

Offline

#73 2016-07-30 18:28:09

erick
Member
Registered: 2015-09-09
Posts: 155

Re: Smart Mobile Studio

erick wrote:

I have it ALMOST working


Nothing spurs you to make success like saying something stupid.  Mormon is fine, the problem is uniqueness constraint of the data I was posting.  Silly me.

E

Offline

#74 2016-07-31 03:29:27

erick
Member
Registered: 2015-09-09
Posts: 155

Re: Smart Mobile Studio

I put up a quick example of EWB with Mormot working together at http://erickengelke.com/ewb/mormot/mormot.zip
and included the sample's 3kB source code for EWB, though not all the libraries

I will have more information available before September.

Offline

#75 2016-07-31 08:18:02

Leslie7
Member
Registered: 2015-06-25
Posts: 248

Re: Smart Mobile Studio

Erick, the link is not working.

Offline

#76 2016-07-31 11:58:07

erick
Member
Registered: 2015-09-09
Posts: 155

Re: Smart Mobile Studio

erick wrote:

I put up a quick example of EWB with Mormot working together at http://erickengelke.com/ewb/mormot/mormot.zip
and included the sample's 3kB source code for EWB, though not all the libraries

I will have more information available before September.

Sorry, I changed the link so it wouldn't be confused with a Mormot download

It should be
http://erickengelke.com/ewb/mormot/ewbmormot.zip

Offline

#77 2018-05-04 22:04:20

Vitaly
Member
From: UAE
Registered: 2017-01-31
Posts: 168
Website

Re: Smart Mobile Studio

warleyalex wrote:

This is a very experimental SMS + F7 + mORMot
Compiled with SMS Basic Version (v2.1.0.3592)

https://www.dropbox.com/s/zwpwqa2fh1k1u … 7.rar?dl=0

Can anybody reshare this source code? the link does not work anymore sad
If not, analogous example would be very good, too. Please!

Offline

Board footer

Powered by FluxBB