#101 Re: mORMot 1 » Issue using Base64ToBin(), but it works using synacode.DecodeBase64() » 2020-10-08 20:29:15

macfly wrote:

I think this replace will be safer if you consider only  #13 as a line break as well.

 pdf := docs._[i].S['pdf'];
 pdf := StringReplaceAll(pdf, #13#10, '');
 pdf := StringReplaceAll(pdf, #13, '');

NOTE: The order matters. You should replace #13#10 first, and then #13

Thank you too. But I chose Arnaud's tip because it's cleaner.

#102 Re: mORMot 1 » Issue using Base64ToBin(), but it works using synacode.DecodeBase64() » 2020-10-08 20:03:52

That is it, TrimControlChars(), worked.
I didn't know about this function thank you.

But, just thinking, if the data that I've provided is considered valid, shouldn't we add a TrimControlChars() call in Base64 functions before conversion?
I've asked the guy and we tested using Java.util (built-in) and Apache commons. Both add line feed in the output...

#104 Re: mORMot 1 » Issue using Base64ToBin(), but it works using synacode.DecodeBase64() » 2020-10-08 19:08:12

Of course I've test and it still doesn't working. sad

        pdf := StringReplaceAll(docs._[i].S['pdf'], #13#10, '');
        //FileFromString(DecodeBase64(pdf), fn, True);
        FileFromString(Base64ToBin(pdf), fn, True);

#105 Re: mORMot 1 » Issue using Base64ToBin(), but it works using synacode.DecodeBase64() » 2020-10-08 18:48:17

The other system, made in Java, uses a known lib (Apache, I think) to encode in Base64... So, I think it's a valid parser and because that I cannot ask them to change it. sad
Is it possible to implement a workaround in mORMot?

#106 Re: mORMot 1 » Issue using Base64ToBin(), but it works using synacode.DecodeBase64() » 2020-10-08 18:15:00

ab wrote:

Could you put the input text into a gist so that we reproduce it?

I couldn't send the private PDF so, I asked the other part to make a fake one.

Here https://gist.github.com/mdbs99/fb6ddf23 … 2fff7a82f7

The structure is:

<Parametros>
  <docs>
    <doc>
      <nome>filename</nome>
      <pdf>base64</pdf>
    ...
</Parametros>

#107 mORMot 1 » Issue using Base64ToBin(), but it works using synacode.DecodeBase64() » 2020-10-08 12:00:54

mdbs99
Replies: 14

Hi,
I have a system that is compiled on Delphi 7 using mORMOt (last commit 1dee1951016b9ab7 in 2020-03-29).
The system receives an XML which has some PDF encoded in Base64. These PDF are stored in a TDocVariantData structure. Later, it is read in some form to show PDF's for user.
To show a PDF I need to save as a file, in temporary directory. My issue is that I cannot decode Base64 just using Base64Bin() function, but it works using the (old) Synapse lib. But I would like to rip of this lib for use just mORMot.

Consider this:

var
  i: Integer;
  fn: TFileName;
  pdf: RawByteString;
begin
  {...}
  { docs is a TDocVariantData...}
  for i := 0 to docs.Count-1 do
  begin
    {find the correct PDF selected by user...}
    pdf := docs._[i].S['pdf'];
    // FileFromString(DecodeBase64(pdf), fn, True); //<< this works
    FileFromString(Base64ToBin(pdf), fn, True); // << this does not
    ShellExecute(fn); // starts Adobe PDF
  end;
end;

- synacode.DecodeBase64() from Synapse reads perfectly
- XML looks like UTF8
- I've tried to make some conversions, like UTF8ToString / StringToUF8, SynUnicodeTo ... etc, but in vain.

Any ideas?

best regards.

#108 Re: mORMot 1 » Fast MM5 » 2020-05-08 13:17:29

ab wrote:

The unit is stand alone so it works with mormot 1.18 too.

Sure. But in that transition to 2.0, would be nice to have a batch script to copy this unit from 2.0 to 1.8 — renamed, following unit name pattern of 1.8, I presume.

#109 Re: mORMot 1 » Revision 2.x of the framework » 2020-03-03 20:20:07

That is good.

I agree about almost all, especially about 2.2 — even it is easy using only one unit like SynCommons with "all included", it could be difficult to maintain the code because its size and bugs on IDE.

About 2.4, Although, I completely agree to focus on FPC as main target,  I'm concerned about Delphi 7 compatibility, as I still have some systems on it. sad

#110 Re: mORMot 1 » Contributing to FPC » 2020-02-23 15:06:27

ab wrote:

Last time I checked, any attempt to provide some alternate asm to FPC x86_64 RTL (by Johannes IIRC) was a more or less rejected, for several reasons I don't remember well.

I think they don't like code that may not work in all platforms which FPC cover.

#111 Re: mORMot 1 » JSON record serialization: I got an issue reading boolean values » 2020-01-21 15:09:32

Ops! the JSON was wrong, they changed but I forgot to change on the code... f*ck!

Thank you!!

#112 mORMot 1 » JSON record serialization: I got an issue reading boolean values » 2020-01-21 14:43:51

mdbs99
Replies: 2

Hello,
I'm trying to serialize a JSON into record with nested one, but RecordLoadJSON returns FALSE.

JSON (body.json file) is like this:

{
  "integrationId":19,
  "token":{
    "accessToken":"eyJhbGciOiJSUzI1NiIsInR5c",
    "createdIn":"2020-01-21 09:28:44",
    "expiresIn":"2024-12-25 09:28:44"
  },
  "success":true,
  "message":null
}

Then, I have TTokenResponse and TLoginResponse:

type
  TTokenResponse = packed record
    accessToken: RawUTF8;
    createdIn: TDateTime;
    expiresIn: TDateTime;
  end;

  TLoginResponse = packed record
    integrationId: Integer;
    token: TTokenResponse;
    sucess: boolean;
    message: RawUTF8;
  end;

initialization
  TTextWriter.RegisterCustomJSONSerializerFromText([
    TypeInfo(TTokenResponse), 'accessToken:RawUTF8 createdIn,expiresIn:TDateTime',
    TypeInfo(TLoginResponse), 'integrationId:Integer token:TTokenResponse sucess:boolean message:RawUTF8'
  ]);

If I remove "success" field from both (JSON and record), it works.

I'm using last version of mORMot but compiling on Delphi 7.

For testing, could be like this:

function Login: TLoginResponse;
var
  l: TRawUTF8List;
begin
  RecordZero(result, TypeInfo(TLoginResponse));
  l := TRawUTF8List.Create;
  try
    l.LoadFromFile('body.json');
    if not RecordLoadJSON(result, l.Text, TypeInfo(TLoginResponse)) then
      raise Exception.Create('Invalid...');
  finally
    l.Free;
  end;
end;

best regards.

#113 Re: synopse.info » Merry Christmas and Happy New Year! » 2019-12-26 14:37:19

Merry Christmas and a Happy New Year!

#114 Re: mORMot 1 » Lazarus package » 2019-04-28 15:18:17

Hello,

Packages have been included and now I'm trying to add it in Online Package Manager (OPM).
I've already asked about the author but it seems that he has an issue to compile.

It looks like something related with the version. I'm using Lazarus 2.1.0 r59757M FPC 3.3.1.

Someone knows if we can compile mORMot using FPC 3.0.4, at least the base package?
If it's not possible now, can we make some changes to do it?

I think they only accepted packages that run in the current FPC version.

--

EDIT: he added, but is good to have it working on current version of FPC.

#116 Re: mORMot 1 » SynCommons.pas(25536,17) Error: Unknown identifier "SYSTEM.LSTRFROMPCH » 2018-08-05 17:50:53

I have just one place, just one Synopse.inc.
Using `a71a5d9b84ad99448cde64396403290c00c196dc` (the previous one) works.

Please, what FPC/Laz revisions are you using on Windows?

#117 mORMot 1 » SynCommons.pas(25536,17) Error: Unknown identifier "SYSTEM.LSTRFROMPCH » 2018-08-05 14:27:41

mdbs99
Replies: 4

I cannot compile from Github `dd5e00b89ba9f18a95c3e9eab1aa138da99a229f` (last commit in 1th August) in my environment: Lazarus 1.9.0 r58678M FPC 3.1.1 r39572 i386-win32-win32/win64

Message error in the subject.

#118 Re: mORMot 1 » MSSQL: Which is the best driver to use? » 2018-07-02 21:22:49

I read "Release Notes-7.2.4-stable.pdf" and they wrote that we need to move on from ntwdblib.dll to ADO or FreeTDS, which is a old tech so, that is good.

I will ask them about these changes and tuning but one more question:
The SourceForge SVN is it currently compatible with FPC 3.0.4?  I believe you can answer if you use MSSQL. I don't want to use a "non-updated-forked" branch which has some patches just for FPC... I would like to use the official one.

Thank you.

#119 mORMot 1 » MSSQL: Which is the best driver to use? » 2018-07-02 18:50:23

mdbs99
Replies: 3

I'm a MSSQL user among 2008 and 2016 versions.
I would like to know which is the best option to use mORMot with this DBMS.

Nowadays, I have some systems that uses mssqlconn provides by FPC packages. The problem is that this implementation uses dblib.dll (I'm not thinking in Linux at this time) and in this link you can see that the last version is about the 2008 version (check dblib's download link).

I use a lot of Stored Procedures and this version doesn't work properly in many cases (eg. using XML stuff, try-catch inside SP's, etc). So, many times I need to ask to change the SP's implementation just because driver issues...

The second issue is about the dependency of this dblib.dll. I've heard that mORMot doesn't have any dependency (for all DBMS?) which is amazing for me. I could just deploy a new executable with no dependencies.

Finally, I know that mORMot developers like ZEOS lib as well, which could be an option too.

What do you recommend for a developer like me that uses FPC (last) and Lazarus (last) to build programs that could use the lasted version of MSSQL?

Thanks.

#120 Re: mORMot 1 » How to get paramOut values of one stored Procedure which returns rows » 2018-07-02 18:00:52

I believe you can use `SET NOCOUNT ON` before all these instructions.

#121 PDF Engine » Digital Signature » 2018-04-29 23:51:41

mdbs99
Replies: 1

Can SynPDF read/write digital signatures in PDF's?
I'm talking about this pattern -> https://www.adobe.com/content/dam/acom/ … sInPDF.pdf

#122 Re: mORMot 1 » mORmot examples 64-bit on Delphi10.2 fails compiling » 2018-02-22 18:31:44

ab wrote:

(I changed my job, and we are focusing on FPC)

Good to know. smile

#123 Re: mORMot 1 » Is there a XPATH implementation? » 2018-02-19 12:14:25

edwinsn wrote:

XML is too verbose and is such a mess, JSON is better.

Food for thought: http://jmespath.org/

It's not about verbosity or not. It's about integration with other systems.
As you can see above, there are some that think the same.

#124 Re: mORMot 1 » Is there a XPATH implementation? » 2018-02-14 16:52:55

Hello Leslie7
Actually, FPC already has a XPATH implementation... but this project could be interesting. Thanks for the tip.

#125 Re: mORMot 1 » TSQLRecord.ID type change suggestion » 2018-02-14 15:11:34

ab wrote:

Then there is no problem to use the SOA of mORMot. Using SynOleDB for direct access to the MSSQL database.

But you can't use the ORM directly.

Understood  sad

#128 Re: mORMot 1 » TSQLRecord.ID type change suggestion » 2018-02-14 11:36:21

Thanks. But, in my case, I'm referring about MS SQL Server.
I would like to access MS SQL directly and many tables, on a specific system, don't have ID as integer, only uniqueidentifier type as primary key.

#129 Re: mORMot 1 » TSQLRecord.ID type change suggestion » 2018-02-14 01:47:57

Is it possible fake this ID by overriding some method?
It's early to say but, I'm thinking if `TID` could be a `Variant` instead of `Int64`. What do you think?

#130 Re: mORMot 1 » Is there a XPATH implementation? » 2018-02-13 20:16:13

It's strange do not have anyone complain about missing XML.
Many companies use WebServices and XML is the mostly used.

#131 Re: mORMot 1 » TSQLRecord.ID type change suggestion » 2018-02-13 19:37:28

That is a old thread, but I think this is the best place to ask:
If my table has only GUID/UUID primary key, how would be mORMot behavior, if there is not ID column at the physical table?

#132 Re: mORMot 1 » Is there a XPATH implementation? » 2018-02-13 14:38:38

All right.
But, as I have many systems that works with XML, what is the simplest way to use mORMot to work with?
In mostly cases, I need to receive a XML, parse (using XPATH), create a new one, and send it back.
I mean, is that possible (and fast) to use some mORMot "XML to JSON" functions, parse the JSON, create a new one, and use "JSON to XML" to send it as XML at the end?

#133 mORMot 1 » Is there a XPATH implementation? » 2018-02-12 21:33:44

mdbs99
Replies: 15

I know that is possible to work with XML instead JSON (see here). But is there an XPATH implementation to work with?

FPC has an implementation of XPATH but, it's based on WideString. I would like to know if we have a (fastest) implementation by Synopse, which works on Delphi and FPC.

#134 Re: mORMot 1 » Why mORMot doesn't have packages? » 2018-01-21 12:53:17

ab wrote:

Any input is welcome!

I've been thinking and my conclusion is the same as you had, I believe, years ago:
Even when packages provide a improvement at developing — simplifying the dependencies paths in user projects — it's simpler do not create packages in main source. Let this "specialization" to the users (developers) in their local computer.

I've tried to make a simple lib compatible with Delphi and Lazarus and it was a pain make changes in both source packages.

However, the new Online Package Manager for Lazarus won't work without a package. Tradeoffs...

Anyway, mORMot is changing my thoughts. Thanks for that.

#135 Re: Meet Us » ABout lazarus » 2018-01-20 22:47:14

I agree with you. It is more productive, but the debugger is a mile behind Delphi.
I've read that they are working in a new one (pure Pascal) but I don't know if they released some version.

#136 Re: mORMot 1 » Why mORMot doesn't have packages? » 2018-01-20 22:37:59

ab wrote:

So for us, packages are not convenient.

Indeed, I use more FPC/Lazarus for new projects than Delphi.
I have just one employer that still works with Delphi 7 and that is the version that I use.

Anyway, I like this simplest approach. But, I would like to understand the pros and cons.

I know it could be a pain to change every package version for each Delphi version —in Lazarus we need just one — but can't you see any pros?

#137 Language » Pascal Generics are great or we are just following other languages? » 2018-01-20 22:23:41

mdbs99
Replies: 2

I'm consider a old-school programmer.
Nowadays we see a lot of use of generics. I can't see a Java code that doesn't have generics.

My question is: We really need generics or we are just following other languages like Java or C#?

For me, most code that use generics are much more confuse. I think there is an abuse of generics.

We can live without them? What do you think?

#138 mORMot 1 » Why mORMot doesn't have packages? » 2018-01-20 20:39:11

mdbs99
Replies: 3

Most Delphi/Lazarus projects have package(s). Why mORMot doesn't have?
Maybe Arnaud did not want manager a package for each Delphi version, as all developers do in most projects?

Having packages could improve the developing by just add it in the project, instead using paths.
In share projects — in a company — the library path should be the same if you're using just paths. But this could be a problem because some developers like to "install" their sources in different directories.

#139 Re: Meet Us » ABout lazarus » 2018-01-20 19:10:02

@ab

After 7 years, do you think Lazarus is better now? Do you use it?

Board footer

Powered by FluxBB