#401 Re: mORMot 1 » mORMot.pas » 2014-11-01 14:22:14

AOG

With my (Virtual) Linux machine, I get the same numbers as you do !
So not much improvement, but still a little benefit from assembler.
Proves that FPC is a good compiler for Linux !
And Ab a very efficient programmer !!

Debugging.
Well, your previous output showed an error in the SynTable test.
Inserting this:

writeln('AssertionsFailed: ',AssertionsFailed);

into different places inside the SynTable test run, shows you the place of the error.

Then, I use (some version of) Delphi to step through the code, until the lowest level.
Until the bug surfaces.

Consumes (a lot of) time, but bug-hunting consumes a lot of time unfortunately.

#402 Re: mORMot 1 » mORMot.pas » 2014-11-01 13:34:46

AOG

@ComingNine.

Yes, I saw this error before, in your outputs.

As far as I now, it is this statement inside SynSelfTests that is causing trouble:

check(data.Field['text']=u);

(line 2989)

But I am not yet sure about it. Still checking and testing.
If I now more, I will report about it !

#403 Re: mORMot 1 » mORMot.pas » 2014-11-01 13:27:57

AOG

@ComingNine.

This is very good news ! Thank you for sharing your setup. Enjoy mORMot on Linux !!

One minor thing: you can try removing the -dPUREPASCAL.
mORMot should work without it on i386. It will speed up some parts of mORMot by using assembler.

@Ab.
Very (very) good ideas !!

But, IMHO, before we go the official way, we would have to include FPC projects in the samples.
E.g. make the samples 100% compatible with FPC.
And include an *.lpi for very easy FPC deployment.
I volunteer in making them ... ;-)

I have been in contact with Sternas (CodeTyphon CEO) before, for making CodeTyphon do ARMHF things.
If we have our FPC-samples ready, I am positive about inclusion in CodeTyphon.

However, mORMot runs also fine with FPC 2.6.4 (and Lazarus).

Alfred.

#404 Re: mORMot 1 » mORMot.pas » 2014-11-01 09:31:16

AOG

Yes, I can confirm. All apps for Linux I am building now are static linked against SQLite !

My advice for crosscompiling:

Start with the most easy FPC program to check your setup:

program Project1;
uses
  cthreads;
begin
  writeln('Hello world. Press enter to continue');
  readln;
  writeln('Thank you !');
end.

Next, start with easy dynamic linking for mORMot to check your mORMot setup.

Next, compile your own sqlite3fts3.o with the provided Linux-script on your Linux machine.

Then, compile static.

#405 Re: mORMot 1 » mORMot.pas » 2014-10-31 18:31:44

AOG

The lib directory on a Linux system contains a lot of links.
AFAIR Sftp Net Drive shows these links as files, but they are not.

First step:
Copy the lib-directory to your Windows system.
Check that all links are converted into real files !

Second step
crtbegin.o and crtend.so and libgcc.a can be found inside /lib/gcc
Copy these also.

And be sure that you link with 32bit library files ... as our mORMot is still 32bits.

Codetyphon offers complete i386 Linux libraries for download ... at my system this works 100%.

Success !

#406 Re: mORMot 1 » mORMot.pas » 2014-10-31 06:25:39

AOG

Small typo !!
Replace
fBuf := Fpmmap(nil,fBufSize,PROT_READ,MAP_SHARED,fFile,0,aCustomOffset);
with
fBuf := Fpmmap(nil,fBufSize,PROT_READ,MAP_SHARED,fFile,aCustomOffset);
(remove zero).

#407 Re: mORMot 1 » mORMot.pas » 2014-10-30 16:57:09

AOG

Glad to hear that dynamic works as expected !

Would you mind trying:

0): Running at least version 1.18.438 (see : http://synopse.info/fossil/info/8fd8f6f … 828c0288c6)
1): No succes: Disabling ---> Demo.MemoryMappedMB = 256; inside SynSelfTests (2-3 x)
2): No succes: Running as root.

Running on 8888 : replacing all 888 with 8888 inside SynSelfTests.

#408 Re: mORMot 1 » mORMot.pas » 2014-10-30 13:09:42

AOG

Agreed ! My mistake ... perhaps caused by my ARM-obsession (@EgonHugeist) ... ;-)

#409 Re: mORMot 1 » mORMot.pas » 2014-10-30 11:47:33

AOG

@Ab and @ComingNine,

Some progress to report !

Found out that this regression could be caused by a wrong use of packed record inside SynSQLite3Static.

TSQLFile = packed record ---------> change to ---------> TSQLFile = record
(remove the packed statement)

At my system, everything works as expected now, including WAL and Demo.MemoryMappedMB !

Testing reports welcome !!

#410 Re: mORMot 1 » mORMot.pas » 2014-10-30 08:20:20

AOG

Ok.

Found a working (at my system) workaround !

Disable:

Demo.MemoryMappedMB = 256;

(at two places) in the SynSelfTests.
Please report back if this solves your problems (when running as non-root).

I will look into this more closely.

#411 Re: mORMot 1 » mORMot.pas » 2014-10-29 19:45:30

AOG

Strange regression.
Few things you could try:

0)
At my system, the same happens when running the tests as non-root.
Could you try running the tests as root ?

1)
Inside SynCommons.
{$ifdef PUREPASCAL} <----------- change to {$ifdef FPC_OR_PUREPASCAL}
function Div100(Y: PtrUInt): TWordRec;

Inside Synopse.inc (last lines):

2) Did you use dynamic or static linking ?
{$define NOSQLITE3STATIC}

3) Did you enable encryption ?
{$define NOSQLITE3ENCRYPT}

#412 mORMot 1 » Rest client callback » 2014-10-29 06:26:51

AOG
Replies: 1

Looking at sample 26 Restful-ORM.

The ORM server has a public method called Blob. With GET, POST, PUT and DELETE parts.

GET can be accessed by CallBackGetResult.

function TSQLNoteFile.GetBlob(aClient: TSQLRestClientURI): RawUTF8;
begin
  Result := aClient.CallBackGetResult('Blob',[],RecordClass,fID);
end;

PUT can be accessed in the same way with CallBackPut.

But how can DELETE (and POST) be accessed by the REST-client (by callback) ?

I am now accessing the DELETE part by using:

aClient.URI(aClient.Model.URI[RecordClass]+'/'+{$ifndef ENHANCEDRTL}Int32ToUtf8{$else}IntToStr{$endif}(fID)+'/Blob','DELETE');

This works, but it is not in line with the other callbacks.

#413 Re: mORMot 1 » Wow! Full FPC support now??!! » 2014-10-28 17:57:14

AOG

Wow ... now you have to explain to me how you are building and using !!

1) what is the system you are compiling on ?
2) CodeTypon version ?
3) what is your target system ?

And any more details you care to share !

#414 Re: mORMot 1 » Wow! Full FPC support now??!! » 2014-10-28 11:17:01

AOG

I would suggest first using mORMot on FPC without static linking.
I then needs the normal sqlite3.dll library on Windows.

Inside Synopse.inc do this somewhere near the end (depends on your version):
{$ifdef CPU64} 
  {$define NOSQLITE3STATIC}
{$endif}
{$define NOSQLITE3STATIC} <------------- add this !!

mORMot now compiles without static libraries. Just add an appropriate sqlite3.dll in your exe-directory.

But, if you want static, there is a script for building the special version of sqlite3 (c-fpcmingw.bat).
On Windows, you will need MinGW to compile. And some MinGW libraries (libkernel32.a and libgcc.a).

Let me know if you are ready with the normal dynamic tests (with sqlite3.dll), and want to test static.
I will make the necessary files available for you !

#415 Re: mORMot 1 » Wow! Full FPC support now??!! » 2014-10-28 07:47:10

AOG

You are right !
Sorry about this ... sometimes I forget that I use my own compiler settings to get things running in my setup.

But, if you encounter this asm problem, you can solve it by adding the "assembler" statement to the declaration:
e.g. your line 315 SynLZO error:

function _lzo1x_1_do_compress(in_p: PAnsiChar; in_len: PtrInt;
  out_p: PAnsiChar; out out_len: integer): integer;
{$ifdef USEASM}
---------------> {$ifdef FPC} assembler;{$endif} <---------------

In FPC, pure assembler functions and procedures have to be defined by this "assembler" statement.
But if you set FPC into Delphi-mode, this is not necessary.

Hope this is clear.

#416 Re: mORMot 1 » mORMot.pas » 2014-10-27 12:16:31

AOG

Sure !

1)

My personal situation determines my development setup.

I have a Win 8.1 64 bit laptop.
Therefor, I use CodeTyphon or Lazarus for Windows. Mostly 32 bit.

CodeTyphon makes crosscompiling very easy.
My setup: https://drive.google.com/file/d/0B96fg3 … sp=sharing

CodeTyphon Center ->  CrossBuild -> i386-linux.
This will build the crosscompiler and the RTL for Linux i386.

You will need some Linux i386 libraries.
Normally, I just copy all files from \lib on my Linux-system ... way to much libraries, but ok.
You can also download the needed library by using CodeTyphon Center: CodeTyphon Center ->  CrossBuild -> Download Libraries.

Next, you will need to inform CodeTyphon about the location of your Linux libraries: https://drive.google.com/file/d/0B96fg3 … sp=sharing

Add some extra's into the compiler options: https://drive.google.com/file/d/0B96fg3 … sp=sharing

Add things like this into your source files (dpr):

{$IFDEF FPC}
  {$MODE Delphi}
{$ENDIF}
{$I Synopse.inc} // define HASINLINE USETYPEINFO CPU32 CPU64 OWNNORMTOUPPER
uses
  // in your dpr :
  {$ifdef Linux}
  // if you use threads
  cthreads,
  // widestring manager for Linux if needed !!
  // could also be put in another unit ... but doc states: as early as possible
  // cwstring,
  {$endif}

You are ready to go.

There is also FPCUP : http://wiki.freepascal.org/fpcup . Makes installing and crosscompiling also very easy.

Naturally, if you have a Linux system available, it would be much easier to install CodeTyphon (or FPC [and Lazarus]) directly on this system !
No crosscompiling needed anymore.

1.1)
The Linux SQLite static library is made on the Linux system itself. Using gcc.
I have made some new pathes, including a script to build the sqlite static library on Linux. Keep in touch with the timeline.

(1.2)
As mORMot is not yet FPC 64 bit ready, I just use a 32 bit distro.
But 64 bit readiness is on its way ....

2)
Setting up CodeTyphon is very straight forward. Lots of info on the net.
Lazarus is an automatic install.
FPCUP needs some more effort, but has a good Wiki.

If you encounter problems, please report back !

We are still making improvements regarding FPC and Linux.
And hunt for bugs !!

Ps:
Perhaps it will be an option to include Linux sqlite3 object files with mORMot, as a separate download. Same as for Windows. You could ask Ab.

#417 Re: mORMot 1 » mORMot.pas » 2014-10-25 13:25:07

AOG

Good result !! Glad to hear !!
However, I do not have detailed knowledge about compiling on Centos 64 bit.
But, looking at your self-test-results, you are ready to go ahaead with mORMot.

#418 Re: mORMot 1 » Wow! Full FPC support now??!! » 2014-10-25 13:22:27

AOG

Inside Synopse.inc, do this:

Orig: {$MODE DELPHI} // e.g. for asm syntax
New: {.$MODE DELPHI} // e.g. for asm syntax

So, place a dot in front of this define, to disable it !

#419 Re: mORMot 1 » Wow! Full FPC support now??!! » 2014-10-25 06:52:13

AOG

Testing mORMot is done by running the available self test : SynSelfTests.pas

And this is the LPR

program LinuxSynTestFPCLinuxi386;

{$IFDEF FPC}
  {$MODE Delphi}
{$ENDIF}

{$I Synopse.inc} // define HASINLINE USETYPEINFO CPU32 CPU64 OWNNORMTOUPPER

{$APPTYPE CONSOLE}

uses
  {$ifdef Linux}
  cthreads,
  // widestring manager for Linux !!
  // could also be put in another unit ... but doc states: as early as possible
  cwstring,
  {$endif}
  mORMotSelfTests;

begin
  SQLite3ConsoleTests;
end.

#420 Re: mORMot 1 » mORMot.pas » 2014-10-25 06:47:07

AOG

Strange.

Compiled mORMot 1.18.392 .

Installed Ach Linux 64 bit.
And installed lib32-glibc, lib32-sqlite, lib32-zlib, lib32-gcc-libs.

Result:
mORMot runs as expected inside my 64 bit Arch VirtualBox.

Sidenote:
I did sent some patches for mORMot to allow for static binding with Sqlite on Linux.
For self-contained executables. Keep in touch with the timeline / forum.

Sidenote2:
mORMot is not yet 64bit FPC ready.
You still have to compile as 32bit executable on Linux.

#421 Re: mORMot 1 » Wow! Full FPC support now??!! » 2014-10-22 19:15:08

AOG

@warleyalex
Please help me by providing the most simple (console) program demonstration your problem !
And please add some info about the error: what do you expect errorfree / what is the error.

#422 Re: mORMot 1 » Wow! Full FPC support now??!! » 2014-10-22 16:00:00

AOG

You can also use plain Lazarus with FPC (2.6.4) !

On Windows, everything works fine (for me, on codepage 1252) !

On Linux, some codepage issues remain.
But the mORMot core runs 100% !

Also, there is no dependency on LCL anymore.
So, you can compile mORMot by command line with just FPC.

#423 Re: mORMot 1 » Wow! Full FPC support now??!! » 2014-10-22 07:49:12

AOG

My FPC development setup is CodeTyphon 5.0 32 bit on Win 8.1 64 bit.
And Lazarus 1.2.4 / FPC 2.6.4 32 bit for checking backwards compatibility of some software.

My deployment setups are:

1)
Arch Linux i386 in a Oracle virtual box on my Win 8.1 pc (just for mORMot).
2)
Arch Linux on a BeagleBone Black (ARMV7).
3)
Arch Linux on a Raspberry Pi (ARMV6).


This is also the reason why I am interested in running mORMot on Linux:

I have many small ARM-clients for data acquisition. Running 24/7. Years.
Billions of numbers (long term battery test measurements).
These store data on a central server, also ARM.
All these running Arch. Most with GUI. Servers just command line.

mORMot allows for datastorage in a very structured and portable manner.

My first steps with mORMot, I used MongoDB, because I like the NoSQL way of storing data.
And MongoDB offers more or less JSON out of the box.
And data is available without any knowledge of relational maps. In most cases, there are no maps !!
All data is just there. At the cost of more storage size. But storage is cheap nowadays.
Everybody can read and understand the data due to this simple storage method.
(nested) fields and dynamic records and arrays can easily be added, removed, changed

But mORMot makes ORM very easy. So I am going to use mORMot for easy and simple ORM.
And mORMot forces me to think better about (structured) data storage.

I have only one (future) concern with mORMot: dynamic arrays.
Again, MongoDB makes dynamic arrays very easy and readable without any prior knowledge.
AFAIR, mORMot uses binary storage when storing dynamic arrays. I hope that, at one time it will be JSON.
But correct me if I am wrong (Ab) !!!

Greetings, Alfred.

#424 Re: mORMot 1 » Wow! Full FPC support now??!! » 2014-10-20 21:42:13

AOG

@warleyalex
You are there !! As far as you can currently go with mORMot on Linux with FPC !!
Thanks for testing. More feedback is welcome.

You should be able to do anything you like, use nearly all features of mORMot, on Linux.
Except using variant late binding and interface based services.
All other features are available.

We wait for the FPC team to implement the RTTI feature request and solve the variant problem.

For me, I am very happy now being able to run full featured mORMot servers on small Linux hardware. Even ARM.

#425 Re: mORMot 1 » Wow! Full FPC support now??!! » 2014-10-20 15:39:41

AOG

For Linux, you need a few things more !

In your dpr-file:
uses
  {$ifdef Linux}
  // if you use threads in your application
  cthreads,
  // widestring manager for Linux, if needed !!
  // could also be put in another unit ... but doc states: as early as possible
  // cwstring,
  {$endif Linux}

Good luck !

#426 Re: mORMot 1 » mORMot.pas » 2014-10-19 08:50:20

AOG

Thanks Ab !!

Please note that this post (http://synopse.info/forum/viewtopic.php … 073#p13073) still lists some valid problems !
I am busy with solving these problems.

But cross-compiling for Linux i386 and ARM will now be successfull !

#427 Re: mORMot 1 » mORMot.pas » 2014-10-19 05:54:49

AOG

Thank you for testing.
And sorry about this.

On Linux, access to port 888 is limited to root processes.
(and I did perform the tests as root ... so I forgot about it)

I have made another executable, that uses port 8888, that is also available for non-root users.

https://drive.google.com/file/d/0B96fg3 … sp=sharing

Please report ... ;-)

Greetings and good luck.

#428 Re: mORMot 1 » mORMot.pas » 2014-10-18 19:47:26

AOG

Unfortunately I cannot help you ....

I only found this on the web:

https://www.syncovery.com/documentation … t-linuxes/

Few minutes ago, I gave Ab the latest FPC / Linux patches ... so keep in touch with the forum / timeline !

#429 Re: mORMot 1 » mORMot.pas » 2014-10-18 06:00:37

AOG

Thanks for your feedback !
Our very nice Linux mORMot needs sqlite3 installed on your system ....
This deadlock happens on systems without sqlite3 !

#430 Re: mORMot 1 » mORMot.pas » 2014-10-17 15:49:05

AOG

And .... if you want to test and help ....

An executable for Linux i386: https://drive.google.com/file/d/0B96fg3 … sp=sharing

An executable for Linux ARM: https://drive.google.com/file/d/0B96fg3 … sp=sharing

Both designed for Arch Linux, but I think ok for other Linux systems !

#431 Re: mORMot 1 » mORMot.pas » 2014-10-17 15:04:58

AOG

Hello,

You have to configure CodeTyphon to find the include file !

https://drive.google.com/file/d/0B96fg3 … sp=sharing

Add the path to mORMot (the path to synopse.inc) to the include files !!

And please give us a littlebit more time (few days) .... we are fighting with the last few bugs to enable full mORMot on Linux.
It's 99.99% ready now !!

Greetings, Alfred.

#432 Re: mORMot 1 » Wow! Full FPC support now??!! » 2014-10-04 21:04:10

AOG

Hello to all,

Yes, we can confirm very (very) good progress with FPC !

Please note that FPC has some limitations (see above).
We hope for and wait for reponse by the FPC development team.

mORMOt with FPC under Windows is nearly 100% complete.
Done with Lazarus and CodeTyphon under Win8.1.

Basic mORMot (ORM) runs also perfect on Linux i386 and Linux ARM (Raspberry Pi / BBB).
I will supply some new patches for Arnaud tomorrow.
These pathes should/could make full blown mORMOt possible on Linux i386 and ARM.
(but I am not yet quite sure about the quality of these patches)

All (cross-)compiling is done under Windows, with CodeTyphon and/or Lazarus.
CodeTyphon makes crosscompiling very easy !

So, I expect mORMot to be FPC ready for Windows in a few days.
Linux i386 and ARM will follow shortly ... some testing has still to be done.

Thanks to Arnaud for his great work and assistance !

Alfred.

Sample 27 on Linux ARM (left) and Linux i386 (right): https://drive.google.com/file/d/0B96fg3 … sp=sharing

Part of self test of mORMot compiled with FPC: https://drive.google.com/file/d/0B96fg3 … sp=sharing

#433 Re: mORMot 1 » CreateMissingTables with MongoDB Enigma » 2014-09-25 06:24:08

AOG

Have a look at this post: http://synopse.info/forum/viewtopic.php … 710#p12710

If tables are defined external, they are also defined as static.
Initialization (of fields) in createmissingtables is then skipped.

You have to do this manually (after CreateMissingTables):

if not aRestServer.TableHasRows(TSQLAuthGroup) then TSQLAuthGroup.InitializeTable(aRestServer,'',[itoNoIndex4ID, itoNoIndex4UniqueField, itoNoIndex4NestedRecord, itoNoIndex4RecordReference]);

This works for MongoDB (as opposed to MySQL, for the user who posted this solution)

#434 Re: Free Pascal Compiler » Compiling mORMot with FPC under Windows » 2014-09-17 09:34:52

AOG

After a couple (many) hours working with the mORMot code, I think I have succeeded in getting the RTTI part of mORMot running very well with FPC under Windows !

Creation of TSQLModel and TCustomServer ok.

However, now I am struggling with the variant part (TDocVariantData).
This [ field.name := nfo.Name; ] does not work.
This [ TDocVariantData(field)['name'] := nfo.Name; ] does work.

(Following IntSet ----> code stuck inside TDocVariantData.GetValueIndex ---> VName cannot be accessed ---> SigSegFault :
Length(VName) = 2 ; writeln(VName[0]) = error)

Could you please advice me ?

I could replace code, but mORMOt uses more variant trickery on other levels.

1) does it make sense to replace (lot of work) ?
2) do you have a better idea ?
3) does it make sense for me to go on trying ?


Thanks !

#435 Re: Free Pascal Compiler » Compiling mORMot with FPC under Windows » 2014-09-15 13:03:03

AOG

Clear. Thanks !!

I will not make a refactoring ticket, before I have tried->tested->succeeded myself !

Thanks for the explanations.

#436 Re: Free Pascal Compiler » Compiling mORMot with FPC under Windows » 2014-09-15 11:43:39

AOG

Thanks for the info !!

And yes, this consumes a lot of time ... and still does ... perhaps I have to stop ... ;-)

I have a final (and perhaps a [very] stupid) request :

Could you refactor your code in mORMot.pas that it does not declare it's own TypeInfo, but something like mORMotTypeInfo.

I have many problems in which the compiler (FPC, CodeTyphon) does not know whre to look for TypeInfo, when I include the typinfo unit.

Refactoring would make it possible to (slowly) use a (future enhanced) typinfo unit from FPC.

Now, I have a lot of errors like this : mORMot.pas(20681,25) Error: Incompatible types: got "TYPINFO.PPropInfo" expected "MORMOT.PPropInfo".

I know this is a strange request ... I will accept your decision !!

Greetings and thanks.

#437 Free Pascal Compiler » Compiling mORMot with FPC under Windows » 2014-09-15 09:29:40

AOG
Replies: 9

Hello Ab,

I am busy trying to compile mORMot with FPC, under windows.

I am able to compile a simple server, but it is not running.

I have a request.

Would it be possible to extract the RTTI part out of mormot.pas ?

A separate RTTI-unit would make (my) life much easier.
At this moment, RTTI implementations of mORMot and FPC are not working together very well.

It should/could be (made) possible to use (parts of) the FPC typinfo unit ?!

Thanks in advance, Alfred.

#438 Re: mORMot 1 » mORMot on ARM (RaspberryPi/BBB) » 2014-09-08 12:33:30

AOG

Strange ... on my PC, edit1 and edit 2 are exactly the same, except for the qoutes !

https://drive.google.com/file/d/0B0llA4 … sp=sharing

#439 Re: mORMot 1 » mORMot on ARM (RaspberryPi/BBB) » 2014-09-08 08:58:10

AOG

About UTF8 under FPC: could you please state (enlighten) the problem with the help of the (CodeTyphon 4.92) code below ?

procedure TForm1.Button1Click(Sender: TObject);
var
  s,d: RawUTF8;
  e:unicodestring;
begin
  case RadioGroup1.ItemIndex of
    0: begin
         s := '∮ E⋅da = Q,  n → ∞, ∑ f(i) = ∏ g(i)'; // here s has UTF-8 encoding
       end;
    1: begin
         s := 'ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ'; // here s has UTF-8 encoding
       end;
    2: begin
         s := 'ሰማይ አይታረስ ንጉሥ አይከሰስ።'; // here s has UTF-8 encoding
       end;
  end;
  d := '"'+s+'"'; // now d is not UTF-8 but AnsiString with the Windows code page ??
  edit1.Text:=s;
  edit2.Text:=d;
  e:=UTF8Decode(s);
  edit3.Text:=e;
  Edit4.Text:=InttoStr(Length(s));
  Edit5.Text:=InttoStr(Length(d));
  Edit6.Text:=InttoStr(Length(e));
end;

#441 Re: mORMot 1 » mORMot on ARM (RaspberryPi/BBB) » 2014-09-08 07:30:02

AOG

Your code works for 100% on ARM !
I do not have Linux x86 at the moment. Waiting for the Minnowboard MAX.
(I used TrimRight in my code, because it is [much] cheaper under Delphi, and TSQLRestClientURI.ExecuteAdd works the location header from right to left, and the problems were on the right part of the string).

I did not want to compare Brook and mORMot. I have seen the previous discussions.
I just wanted to make the statement that it should be possible to have mORMot servers running under Linux.
And perhaps with not too much effort.

If I can help, please let me know ... I also do not have the money, but plenty of time !

ps: ARM hardware is very cheap.  And a Pi or BeagleBone Black runs very easy headless with Arch Linux (setup consumes few minutes). I can recommend it !

#442 mORMot 1 » mORMot on ARM (RaspberryPi/BBB) » 2014-09-07 20:32:31

AOG
Replies: 12

I am planning to use mORMot for data-logging on some Raspberry Pi and BeagleBone Black computers.

Running the RegressionTests ( Samples; 27 - CrossPlatform Clients; CodeTyphon ) went ok without big problems.

This (inside SynCrossPlatformREST; function FindHeader; nightly 07sep2014):

result := copy(line,length(Name)+1,length(line)-length(Name)-1);

did not work. Change into:

line:=TrimRight(line);
Delete(line,1,length(Name));
result:=line;

and all tests went for 0 failures on Windows and ARM Linux (with the server running on a separate Win8-PC).
All datalogging software will now be adapted for remote logging with mORMot.
(data-flushing / reconnect will be very important for this)
Thank you Arnaud for your CrossPlatform work !!

Question.
The Brook 3.0 framework ([F]CGI and standalone) servers also run without problems on Linux (ARM servers).
Linux mORMot can also communicate with the Linux REST-servers from Brook.

I would welcome a mORMot Linux server, or a possible merge between Brook and mORMot on the server side.
I know this is work in progress.
Could you give an update about your ideas and plans concerning CrossPlatform servers ?

Thanks !

#443 Re: mORMot 1 » MongoDB : picture gallery » 2014-05-25 08:09:26

AOG

Yes. That's mORMot.

Just change something like

fMongoClient := TMongoClient.Create('SERVER_IP',27017);
fDB := fMongoClient.Database[DB_NAME];
fClient := TSQLRestClientDB.Create(fModel,nil,':memory:',TSQLRestServerDB);
StaticMongoDBRegister(TSQLORM,fClient.Server,fDB,'mORMot');

into

fClient := TSQLRestClientDB.Create(fModel,nil,DB_NAME,TSQLRestServerDB);

to go from remote MongoDB to local SQLite. All other coding remains the same !! A very very nice feature of mORMot.

See Sample 15 (External DB Performance) and Sample 24 (MongoDB)

Good luck.

#444 Re: mORMot 1 » MongoDB : picture gallery » 2014-05-24 11:22:29

AOG

Wow.

After using your latest software (from today), I can report:

* dates inside a dynamic array are stored as dates !
* blobs inside a dynamic array are stored as binaries !

THANK YOU VERY MUCH !!
This makes my life very easy. And my software much more useful.

To be honest: it's all about sharding.
Present data is so hard to fit in a standard scheme. Speaking for myself, I am always in need for dynamic (array) storage. And this means sharding in most cases.
But sharding using a special formatting system makes long term support hard (even when using JSON in a text-field).

Sharding with MongoDB (more or less native by the use of arrays and nesting) is much more secure and reliable.
And the data itself is also usefull and understandable for non-mORMot-users.

So, thanks again.

I am using XE4.

And I am refactoring a flat-file database into something ORMish with mORMot.
And the mORMot-MongoDB is a perfect (dynamic) fit.

Alfred.

#445 Re: mORMot 1 » MongoDB : picture gallery » 2014-05-24 08:18:29

AOG

The database itself (the fields) contained an array (name: 'Photos'), containing, among others, a string type with only 4 characters with name 'Picture'.
So not a binary datatype, but a string.

(I am using RoboMongo to view the database contents; I did not view the JSON contents).

However, I solved the problem by using:

Photo.Picture:=TSQLRawBlobToBlob(pic);

No UpdateBlob whatsoever is needed, while this 'Picture'-field is not saved or treated as a blob. It is a string.

I think this is the same method (or produces in the same result) as your suggestion !

Retrieving by using:

Photo.Picture:=BlobToTSQLRawBlob(pic);

For now, it works. And I am happy with it !

A single question remains:
Is it true that only simple types are allowed (or processed correctly) inside a dynamic array inside a SQLrecord ?

Edit:
I saw that a TDateTime inside a dynamic array is also converted into a string.
However, MongoDB allows for perfect sharding: every native datatype is allowed for nesting (arrays).
Could this be a future feature of the mORMot/MongoDB combination ?

Edit2:
I will try your update concerning Blobs !!
(sorry for missing your comments on this update)


Thanks.

ps: many thanks for adding MongoDB ... it allows for very nice and flexible database storage in combination with your very nice framework !!

#446 mORMot 1 » MongoDB : picture gallery » 2014-05-23 08:10:25

AOG
Replies: 8

Hello All,

I am trying to setup a simple picture gallery with mORMot and MongoDB.
Thumbnails have to be stored inside MongoDB.
Original picture is accessed by 'Path' if needed.


  TPhoto = packed record
    Picture: TSQLRawBlob;
    ModDateTime : TDateTime;
    Path : RawUTF8;
  end;
  TPhotos = array of TPhoto;

  TSQLUSER = class(TSQLRecord)
  private
    fName: RawUTF8;
    fDate: TDateTime;
    fPhotos : TPhotos;
  published
    property Name: RawUTF8 read fName write fName stored AS_UNIQUE;
    property Date: TDateTime read fDate write fDate;
    property Photos: TPhotos index 1 read fPhotos write fPhotos;
  end;

Using the above works ok, but I cannot get any data into 'Picture'.

var
  R: TSQLUSER;
  i:integer;
  pic: RawByteString;
  Photo:TPhoto;
begin
  R := TSQLUSER.Create;

  R.Name := 'TestName';

  // pic is loaded with thumbnail image data
  Photo.ModDateTime:=Now;
  Photo.Picture:=pic;
  R.DynArray('Photos').Add(Photo);

  i:=Client.Add(R,True);

  //Client.UpdateBlobFields(R); // does not work
  //Client.UpdateBlob(TSQLUSER,i,'Photos',pic); // does not work
  //Client.UpdateBlob(TSQLUSER,i,'Picture',pic); // does not work
end;

Does anybody know how to update the blobdata of 'Picture' with a thumbnail ?.

Thanks, Alfred.

#447 Re: mORMot 1 » External database : connected or not. » 2014-02-24 08:50:01

AOG

Sorry about not being clear ... my bad ...

I was talking about the external mysql (mariadb) server being down !!
No errors are raised when that happens.
But more severe: when the mysql-server is up again, data update to the external mysql database is not resuming.

So once an external mysql server is down, the connection with this external mysql server is permanently broken.
My question: how to detect this and how to re-connect with the external server.

Thanks, Alfred.

#448 mORMot 1 » External database : connected or not. » 2014-02-24 07:36:35

AOG
Replies: 2

Hello to all,

I am using mORMot (and ZEOS 7.1.3a) to store measurement data in an external MariaDB:

Model := CreateSampleModel;
Database := TSQLDBZEOSConnectionProperties.Create('mysql://server:3306','data','datauser','');
VirtualTableExternalRegisterAll(Model, Database);
Database.ForcedSchemaName:='data';
Client := TSQLRestClientDB.Create(Model,nil,SQLITE_MEMORY_DATABASE_NAME,TSQLRestServerDB,false,'');
Client.Server.CreateMissingTables;
....
....
Client.Add(...);         <--- no errors with server down
...
...
Client.TransactionBegin(...);         <--- no errors with server down
Client.BatchStart(...);         <--- no errors with server down
Client.BatchAdd(...);         <--- no errors with server down
Client.BatchSend(...);         <--- no errors with server down
Client.Commit;         <--- no errors with server down

All code above works ... tables are created ... data is saved !! Very good.

However, I do not know how to detect that the server is down ... does anybody know how to detect an external database server error when saving data ?

Real world:
Sometimes the connection is down at the moment the data is going to be saved.
Connection comes up again after a few seconds.
No further data is saved in the external database ... no errors occur in de code.

Greetings, Alfred.

Board footer

Powered by FluxBB