#1 Re: mORMot 1 » Switching Response Format (XML/JSON) » 2015-01-28 07:03:11

ab wrote:

Yes, I'm currently adding XMLToJSON and JSONToXML functions to SynCommons.pas.

Hi Arnaud,

Was this ever implemented?

Thanks,
Bernd

#2 Re: mORMot 1 » DocVariantData - item name uppercase. » 2015-01-19 20:31:54

Thank you so much! Updating to latest:)

#3 mORMot 1 » DocVariantData - item name uppercase. » 2015-01-17 16:54:58

berndvf
Replies: 2

Hi there,

I am trying to generate some JSON using DocVariant. I am using the following test app (using Delphi 6 - seems to work fine in Delphi 7):

program test1;

{$APPTYPE CONSOLE}

uses
  SynCommons,
  SysUtils;

var
  LTest : Variant;

begin
  LTest := _ObjFast( [] );
  LTest.prop := 'VALUE';
  DocVariantData( LTest ).AddValue( 'prop2', 'VALUE2' );
  Writeln( LTest );
  Readln;
end.

Previously (I have confirmed by going back to an older version) the following was output:

{"prop":"VALUE","prop2":"VALUE2"}

Using the latest version I get the following:

{"PROP":"VALUE","prop2":"VALUE2"}

Unfortunately the service processing this JSON in case sensitive so I can't send the uppercased version through.

Thanks,
Bernd

#4 Re: mORMot 1 » SetCurrentThreadName causes External Exception when debugging » 2015-01-07 09:59:25

Great thanks. This was using Delphi 6 - I'll test with other Delphi versions.

#5 Re: mORMot 1 » Softwares created using mORMot » 2015-01-07 09:39:29

JSON Tools - A little tool to format and visualise JSON data.

This uses the JSON capabilities in mORMot to format and visualise JSON data. I often need to format JSON from an API/REST service. One of our internal tools also returns DB results back, which makes the Grid View handy.

#6 mORMot 1 » SetCurrentThreadName causes External Exception when debugging » 2015-01-07 09:14:13

berndvf
Replies: 6

Hi there,

I see that a call to SetCurrentThreadName was added to mORMot.pas recently (http://synopse.info/fossil/info/3919591 … 53a96e6c76). Every time I debug my application I now get an EExternalException on startup - is there any way I can turn this off? I understand it can be useful but it pops up even for a simple test application. Perhaps we can IFDEF it?

Thanks,
Bernd

#7 Re: mORMot 1 » Logging to the console » 2014-06-30 19:26:45

Looking at Sample 14 and your example above I see it is using TSQLLog.Family.EchoToConsole whereas I was using TSynLog.Family.EchoToConsole which gives the AV. Should I be using TSQLLog.Family and TSQLLog.Add rather the TSynLog by default ?

#8 Re: mORMot 1 » Logging to the console » 2014-06-09 20:20:44

I am trying to use EchoToConsole in a new application, but I am getting AVs no matter what events I log. I have also run the demos where services can be run as console and get the same result.

The AV occurs with the first call to TSynLog.Add.Log I call. When calling the LogHeaderLock in the LogInternal (line 40753), it then calls LogFileHeader which adds all the header information and then calls Flush (line 40596). This causes the AV on the line: inc(fTotalFileSize,fStream.Write(fTempBuf^,L)); because FStream is nil.

#10 Re: mORMot 1 » Mustache Logic-less templates for Delphi » 2014-04-29 18:04:02

This looks amazing! I'll start replacing some of our (sometimes awful) DIY template implementation with this as standard. I will update with any issues. Thanks smile

#11 Re: mORMot 1 » propsal from Newbie to mORMot » 2014-04-29 18:01:27

ab wrote:

But I would not say the same for the "GitHub for Windows tool".
For a somewhat huge project like mORMot, it is slow, non responsive, and, after waiting a lot, uses more than 400 MB just to display the repository.
Sometimes, it just crashes. The UI looks nice, but is very difficult to work with.
Another awfully fat and non working WPF / .Net application.
sad

This experiment does not help me going away from Fossil.
I will let the source in github, for testing purposes, but it won't become my main repository.
GitHub may increase visibility, but I would need some .bat files to auto-push the modifications easily.
Feedback and input is welcome!

If you are used the command line using fossil, I would suggest just installing the Git command line tools (http://msysgit.github.io/). If you have ever used TortoiseSVN, there is a similar client available for integration into Explorer (https://code.google.com/p/tortoisegit/).

I've setup a Git repository (https://bitbucket.org/bernd_summerswell/mormotexternal) which is just a mirror of your Nightly Downloads so that I can include it as Git Submodule (http://git-scm.com/book/en/Git-Tools-Submodules) in our own projects. Basically what I have done is create a batch file which downloads your Nightly download, copies it over the existing local working copy and then pushes it back to the Bitbucket repository. If you are wanting to setup a similar batch file, let me know if I can help.

On my Mac I use SourceTree (http://www.sourcetreeapp.com/) which also has a Windows version - not too sure if it is any better on Windows than the Github app - but it is really quick on the Mac, even on large projects.

#12 mORMot 1 » TWinHTTP.Post not working correctly » 2014-03-10 14:00:23

berndvf
Replies: 3

Hi there,

While using the TWinHTTP.Post function I noticed that my data was never being sent. Looking at the TWinHTTPAPI.Post function it looks like the aData parameter is never being sent. Is this correct?

SynCrtSock.pas line 5267

class function TWinHttpAPI.Post(const aURI, aData: RawByteString;
  const aHeader: RawByteString=''): RawByteString;
begin
  result := InternalREST(aURI,'POST','',aHeader);
end;

#13 Re: mORMot 1 » TDocVariant custom variant type » 2014-03-05 08:24:27

Awesome, thanks for the changes. Really makes this very powerful! It is a great solution especially for settings - no more trying to save arrays to complicated INI files for me smile Going to change some of our REST clients to use this today.

#14 Re: mORMot 1 » TDocVariant custom variant type » 2014-03-04 18:58:07

Excellent, thanks!

The only thing outstanding would be to be able to remove an item from an array or object. This would allow you to truly replace an array/TList/TCollection.

#15 Re: mORMot 1 » TDocVariant custom variant type » 2014-03-04 07:04:04

I've managed to add items to the array by doing the following:

procedure Test3();
var
  LSettings : Variant;
  LUsers : Variant;
begin
  LSettings := _Obj( [ 'PhoneSettings', _Obj( [ 'IP'        , '10.0.0.xxx',
                                                'Username'  , '123',
                                                'Password'  , '123',
                                                'Registrar' , '10.0.0.xxx'] ),
                       'Users', _ArrFast([ _ObjFast( ['DisplayName', 'Test'] ) ])
                         ], dvoValueCopiedByReference ] );

  LUsers := LSettings.Users;
  LUsers.Add( _ObjFast( [ 'DisplayName', 'Bob' ] ) );
  LSettings := _ObjFast( [ 'PhoneSettings', LSettings.PhoneSettings, 'Users', LUsers ] );
  Writeln( LSettings );
end;

Which creates the correct JSON:

{"PhoneSettings":{"IP":"10.0.0.xxx","Username":"123","Password":"123","Registrar
":"10.0.0.xxx"},"Users":[{"DisplayName":"Test"},{"DisplayName":"Bob"}]}

Is there any way to remove an item from an the array or object?

#16 Re: mORMot 1 » TDocVariant custom variant type » 2014-03-03 19:46:21

Firstly, thanks this is an amazing addition!

I am trying to use the TDocVariant to store settings for a new utility I am writing. What I want to do is load the JSON from a file into the TDocVariant, then add users to the Users array and save back to the file in JSON format.

However, I am unable to write any new values to the array. Adding values to the initial value is not a problem.

Running the following:

procedure Test1();
var
  LSettings : Variant;
begin
  LSettings := _ObjFast( [ 'PhoneSettings', _Obj( [ 'IP'        , '10.0.0.xxx',
                                                    'Username'  , '123',
                                                    'Password'  , '123',
                                                    'Registrar' , '10.0.0.xxx'] ),
                           'Users', _ArrFast([ _Obj( ['DisplayName', 'Test'] ) ])
                         ] );

  TDocVariantData( LSettings.Users ).AddItem( _Obj( ['DisplayName', 'Test2' ] ) );

  Writeln(  LSettings );
end;

outputs:

{"PhoneSettings":{"IP":"10.0.0.xxx","Username":"123","Password":"123","Registrar":"10.0.0.xxx"},"Users":[{"DisplayName":"Test"}]}

I've tried this in Delphi 6 and 2010, and tried with various combinations of _Obj/_Arr and _ObjFast/_ArrFast

Board footer

Powered by FluxBB