#1 Re: mORMot 1 » How to parse a simple JSON text and produce JSON » 2017-02-13 12:11:07

donaldshimoda wrote:

Any easy fix? As i need right now on linux/arm and win32 im not worried, but want to know if will be fixed in a near future.

Best regards.


Hi , now i need it working on linux 386 and X64. How to fix this problem? latest version takes from the repos.

Best regards.

#2 Re: mORMot 1 » new book about mORMot » 2017-01-07 15:33:33

erick wrote:

The formatting was a problem.  I agree generally, though we will all have personal opinions on some aspects.

I will be significantly reformatting this book in 2017, probably in March as I will have a month at home for a medical leave.  There may be a few minor edits for clarification too.

That doesn't help you directly, but it does benefit the Delphi/NewPascal/Mormot/EWB communities we all care deeply about.

I will update this thread when the new revision is available.

Erick,
  I get the book yesterday. I read the first 100 pages in 4 hours. That tell a lot of the book. Im a newbie mormot user, just read some of the documentation before buy your book, not in a specifically order. I really expect from that book something exciting of mormot. I will end reading the 156 pages, but so far right now don't find any exciting there and feel very dissapointed for the buy. Sorry, but i pay 59.95 for a book with pages filled with 1/4 text on big fonts code... not fair at all.
  I must agree with the others the book is very basic, almost the stuff i read, and i read more than 35% of the book. The code samples don't work, i mean, i see many samples where vars are not defined, or assignments are wrong.
  Pictures quality are ilegible, bad stretched, like a high school weekend work. Sorry, is my sensation.
  As a recommendation for the times to come, i suggest you pass first the book to mormot developers to check that stuff and correct mistakes and help to rephrase some stuff. I believe ,mormot developers must have worried about the quality of the books about the product, even more if that book are publicity here. Im looking for a ORM solution and the book, IMHO, don't make a big favor to mormot.

  I will end reading the book (i think before monday) before give a final veredict and will come back to this topic.

Best regards.

#3 Re: mORMot 1 » Theres oficial dataset component available in mormot? » 2017-01-06 16:04:08

EMartin wrote:

My non-visual component TSynRestDataset descend from TCustomClientDataset and the internal dataset descend from TDataset (TSynRestSQLDataset->TSynBinaryDataset->TSynVirtualDataset->TDataset), what I consider "official" because is based in Delphi components. You can convert TSynRestDataset in visual building a package in design time.

TSynRestDataset works with any aware component because descend from TDataset, I implemented basic functionality for my purposes but can be extended, I made small changes but I have not uploaded it, my coworker is using it with Developer Express grid components (very old version). We works with Delphi 7.

Best regards and sorry for my spanglish.

Im spanglish too, from argentina, *chavón*! wink

Ok, your partner is using with devexpress not in visual mode?  You link by hand dataset in code? But devexpress grids takes field info at design time. Must i define by hand that stuff? How he work with this situations?

Best regards *loco*. Abrazo de gol!

#4 mORMot 1 » Theres oficial dataset component available in mormot? » 2017-01-06 13:37:55

donaldshimoda
Replies: 3

I spend last two weeks reading a lot about mormot and aurelius. Im long time user of RemObjects (im a TeamRo member BTW) and want to try the new fresh air of a ORM in that project. is an internal project so is the ideal candidate to test a new technology.

AFAIK Aurelius see a lot more Delphi user friendly that mormot. Thats and the lack of a simple Dataset component to put in a data module and link to data controls is the main stop light for me on taking my work on mormot. That and the lot of recommendation about forgetting RAD. That scary any Delphi developer (i am from Delphi 1).

Im getting today i hope the only book about mormot i fined. Is mormot and Web builder. So, i imagine has not the response for my main question.

One of the strongest thing delphi have is the amount of data controls out there. Without a very well implemented dataset we are breaking bridges not open new ones.

Im a devexpress user and without a dataset component we have nothing.

I find a dataset implementation from Emartin. is that the official or supported implementation of dataset for mormot?
Work this with any data control component? I mean if this is a standard dataset or don't.

I see that work over Json. So, theres no component working over the TSQLRecord class?

Another thing very interest in Aurelius is the amazing chance to query use linq. Linq is the standard. Do you have some plans to implement Linq on mormot?

Finally, theres a lot of plus in mormot:

Wok in linux intel and arm (not verified, test fails, maybe for not using newpascal)? Aurelius sure will have this soon (next delphi for linux release) only for intel.
Chance to maintain a versioning for the records (amazing, not sure if will use but is there)
Chance to implement a synchronization schema between servers.

All the other stuff, like automatic gun or pdf removing don't see that in my radar in the meantime.

Aurelius + xdata /remotedb

Still seems Aurelius is a lot more Delphi friendly than mormot.
Class are delphi class, not special tsqlrecords.

Anyway, just try tom share my concerns about mormot.

Will be glad to have some response from advanced users.

Best regards.

#5 Re: mORMot 1 » Get called 3 times? » 2016-12-29 13:38:03

ab wrote:

Getter / Setter methods of published properties should be equipotent, to let serialization work as expected:

...
    property Question: RawUTF8 read GetQuestion write SetQuestion;   
  end;  

function TSQLSampleRecord.GetQuestion: RawUTF8;
begin
  result := 'Msg: '+ fQuestion;
end;   

procedure TSQLSampleRecord.SetQuestion(const value: RawUTF8);
begin
  if copy(value,1,5)='Msg: ' then
   fQuestion := copy(value,6,maxInt);
end;

So here fQuestion will be filled back with the expected value.

If you need to change on the fly a property value for representation purposes (e.g. return a date as text), use a function or a public (not published) property.

Sorry, it seems like a freak hack to the normal behavior you expect from a object. That answer my question: you cannot use getter and setter on the tsqlrecords. Calling a function to change a value will by *by hand* not automatic when you get or set the property, as work in normal OOP.

Best regards.

#6 Re: mORMot 1 » Get called 3 times? » 2016-12-29 00:36:26

ab wrote:

If you use them properly, yes of course you can.

Can you please explain me how has to be used, using my code and showing what is wrong there and which will be the correct usage?

#7 Re: mORMot 1 » Get called 3 times? » 2016-12-28 22:28:59

ab wrote:

It breaks the whole serialization process.

As such it is not OK. ?

Ok, then is not possible to use standard property methods? like in standard Delphi classes?

#8 Re: mORMot 1 » FPC + ARM don't compile testSQL3 » 2016-12-28 21:45:59

I test on lazarus 3 platforms on all theres some errors, that is as expected or theres a problem?

Windows

Using mORMot 1.18.3303 FTS3
Running on Windows 10 64bit (10.0.14393) with code page 1252
TSQLite3LibraryStatic 3.15.2 with internal MM
Generated with: Free Pascal 3.1.1 compiler

Time elapsed for all tests: 289.60s
Tests performed at 28/12/2016 17:33:35

Total assertions failed for all test suits:  164 / 24,280,856
! Some tests FAILED: please correct the code.

Linux / ARM

Using mORMot 1.18.3303 FTS3
Running on Linux-4.4.9-ti-r25 #1 SMP Thu May 5 23:08:13 UTC 2016
TSQLite3LibraryDynamic 3.8.7.1 with internal MM
Generated with: Free Pascal 3.1.1 compiler

Time elapsed for all tests: 765.80s
Tests performed at 12/28/16 09:33:45 PM

Total assertions failed for all test suits:  18,277 / 14,245,783
! Some tests FAILED: please correct the code.

Linux / i386

Using mORMot 1.18.3303 FTS3
Running on Linux-4.4.0-57-generic #78~14.04.1-Ubuntu SMP Sat Dec 10 00:16:09 UTC 2016
TSQLite3LibraryStatic 3.15.2 with internal MM
Generated with: Free Pascal 3.1.1 compiler

Time elapsed for all tests: 79.80s
Tests performed at 28/12/16 13:44:48

Total assertions failed for all test suits:  21,375 / 14,001,251
! Some tests FAILED: please correct the code.

#9 Re: mORMot 1 » FPC + ARM don't compile testSQL3 » 2016-12-28 21:29:21

ab wrote:

Should be fixed now.

I see this changes

commit 75ec589893fe18692a4ce9aaf324b6604c2c7ce0
Author: Arnaud Bouchez <fakeaddress@synopse.info>
Date:   Wed Dec 28 19:31:18 2016 +0100

    new OPT4AMD conditional
    - to use "set of byte" to generate BT[mem] opcode which is actually slower under Intel than cascaded SUB, and may be faster under

ab wrote:

But it is safer to use mORMot from official github repository.

Im always using mORMot from official github repository... or i missing something?

BTW, it builds ok now! Great Job

Will post test summary when is done.

#10 Re: mORMot 1 » Get called 3 times? » 2016-12-28 20:44:46

Can please explain why? Is some internal need for TSQLRecord? fGetQuestion is not ever a function for that class. Don't assorted to the property either.
If i think in delphi/pascal terms, my solution is ok.

#11 mORMot 1 » Get called 3 times? » 2016-12-28 00:30:39

donaldshimoda
Replies: 10

Just trying sample 1, try to change the get of a property to see how it behaves.

  TSQLSampleRecord = class(TSQLRecord)
  private
    fQuestion: RawUTF8;
    fName: RawUTF8;
    fTime: TModTime;
    function GetQuestion: RawUTF8;
  published
    property Time: TModTime read fTime write fTime;
    property Name: RawUTF8 read fName write fName;
    //property Question: RawUTF8 read fQuestion write fQuestion;
    property Question: RawUTF8 read GetQuestion write fQuestion;
  end;  

function TSQLSampleRecord.GetQuestion: RawUTF8;
begin
  result := 'Msg: '+ fQuestion;
end;    

i put this test "test message" and click add the message.

When i retrieve the message this is the result:

Result seems called 3 times!

"Msg: Msg: Msg: test message"

What im doing wrong?

#12 Re: mORMot 1 » FPC + ARM don't compile testSQL3 » 2016-12-27 21:03:22

I must say im not using new pascal. Im a little confused about is need or don't. All my other freepascal projects work fine and don't want to break that if is not necessary.

Im using this freepascal commit

Repository UUID: 3ad0048d-3df7-0310-abae-a5850022a9f2
Revision: 34782
Node Kind: directory
Schedule: normal
Last Changed Author: karoly
Last Changed Rev: 34782
Last Changed Date: 2016-11-05 17:07:18 +0000 (Sat, 05 Nov 2016)

#13 Re: mORMot 1 » FPC + ARM don't compile testSQL3 » 2016-12-27 20:28:31

git log show this as first entry

commit de92ee86e173ff6948551bb089bde8dd3b1791a2
Author: Arnaud Bouchez <fakeaddress@synopse.info>
Date:   Tue Dec 27 17:37:38 2016 +0100

The error move in lines:

SynCommons.pas(35742,70) Error: Incompatible type for arg no. 1: Got "SYNCOMMONS.PTypeInfo", expected "TYPINFO.PTypeInfo"

#14 mORMot 1 » FPC + ARM don't compile testSQL3 » 2016-12-27 17:57:00

donaldshimoda
Replies: 9

I get that error message, latest build, is as expected?

SynCommons.pas(35716,70) Error: Incompatible type for arg no. 1: Got "SYNCOMMONS.PTypeInfo", expected "TYPINFO.PTypeInfo"

Best regards.

#16 Re: mORMot 1 » How to define the format of float? » 2016-12-27 12:11:51

ab wrote:

If there is a "," this is not valid JSON...
So there is no way and no mean of changing TDocVariant decimal separator.

Thanks for the response.

The opposite, the float HAVE a '.', is that:

2567.79126

The problem is don´t get recognized as a valid float value.

I have to force this using this code

aTotalVolumen := VarAsType(soVentas.TotalVolumen, varDouble);

I expect to be converted *automagically*

Thanks for any comment or indication of what im doing wrong.

#17 mORMot 1 » How to define the format of float? » 2016-12-27 00:15:53

donaldshimoda
Replies: 4

I get this JSON value

"TotalVolumen":2567.79126

But the local format use ',' as decimal separator

Then the call to

aFloatvalue := V.TotalVolumen

get an integer

256779126

How to define TdocVariant decimal separator?

#18 Re: mORMot 1 » Delphi RAD Server comparison » 2016-12-24 15:25:53

erick wrote:

Thanks Ab.

I apparently overpriced EWB, it's only $359 US.  I was mistakenly wrote what I paid in Canadian dollars.

Yes, the mormot analytics are very powerful indeed, I will put that into the videos comments if you haven't already.

I made the video on a Mac using PowerPoint, with Quicktime audio/screen recorder, and iMovie to trim the length.

Erick

I just buy your two books on amazon and expect to understand in depth EWB and mormot. We have now all our systems with Delphi/Freeepascal + RemoBjects + firebird Server.

Bets regards.

#19 Re: mORMot 1 » How to parse a simple JSON text and produce JSON » 2016-12-22 12:47:52

I start migrating on my test it:

Work fine on Delphi,

fails in windows/linux i386 (fpc 3.1 + lazarus 1.7)

unit SynCommons;

{$ifdef CPUINTEL}
procedure TestIntelCpuFeatures;
var regs: TRegisters;
begin
  regs.edx := 0;
  regs.ecx := 0;
  GetCPUID(1,regs);
  PIntegerArray(@CpuFeatures)^[0] := regs.edx;
  PIntegerArray(@CpuFeatures)^[1] := regs.ecx;
  GetCPUID(7,regs);
  PIntegerArray(@CpuFeatures)^[2] := regs.ebx;
  PByteArray(@CpuFeatures)^[12] := regs.ecx;
end;
{$endif CPUINTEL}   

SynCommons.pas(61334,3) Error: Identifier not found "GetCPUID"

Work perfect in linux ARM (fpc 3.1 + lazarus 1.7)

Any easy fix? As i need right now on linux/arm and win32 im not worried, but want to know if will be fixed in a near future.

Best regards.

#21 mORMot 1 » How to parse a simple JSON text and produce JSON » 2016-12-09 14:24:13

donaldshimoda
Replies: 5

I need to understand how to do this with mormot this (the code must be compatible with delphi and lazarus)

parse a JSON object (Respuesta string)

var
  soDetectado, soaMessage : SuperObject;
begin
    soDetectado := SuperObject.so(Respuesta);
    Detectado.IdTransaccion    :=  soDetectado[strListaDetectados+'[0].IdTransaccion'].AsString;
    Detectado.Identificador    :=  soDetectado[strListaDetectados+'[0].Identificador'].AsString;
    for soaMessage in soDetectado[strListaDetectados+'[0].Mensajes'] do
    begin
          NewMessage               := Detectado.Mensajes.Add;
          NewMessage.Mensaje       := soaMessage['Mensaje'].AsString;
          NewMessage.IDTipoMensaje :=(soaMessage['IdTipoMensaje'].AsInteger);
     end;
end;

populate a JSON object

    soEstructura  := XSuperObject.TSuperObject.Create;
    soEstructura.S['Llave'] := 'xxxxx';
    soEstructura.I['FechaRegistro'] := traducirFecha(now);
    with soEstructura.O['Informacion'] do
    begin
      S['Denominacion']       := lSomeDataset.FieldByName('DENOMINACION').AsString.ToUpper;
      S['Departamento']       := lSomeDataset.FieldByName('DEPARTAMENTO').AsString.ToUpper;
    end;
    with soEstructuraEstacion.O['Estructura'] do
    begin
      with O['Software'] do
      begin
        S['Empresa']          := 'SOME';
     end;
   end;
   aPos := 0;
      while (not lRFID.EOF) do
      begin
        with A['RFID'].O[aPos].AsObject do
        begin
          S['Codigo']      := lRFID.FieldByName('CODIGO').AsString.ToUpper;
        end;
        lRFID.Next;
        Inc(aPos);
      end;

Im using superobjects and Xsuperobject but is not fully compatible with freepascal right now.

Thanks for any point to a sample or tutorial.

Best regards.
P.S. I never user mormot before.

Board footer

Powered by FluxBB