#2 mORMot 1 » TCrtSocket.ReceiveTimeout problem » 2014-12-23 07:34:32

Replies: 2
tcp := TCrtSocket.Open(RawByteString(aServer), RawByteString(IntToStr(FPort)));
  if tcp <> nil then begin
      tcp.ReceiveTimeout := 5 * 1000;
      Writeln(tcp.SockOut^, aCommand);
      aRawData := tcp.SockReceiveString; // Never come back sometimes
      Result := string(aRawData).Trim;
      on E: Exception do
        LogException(E, Format('Command: %s - TWhoisQuery.SendCommand()', [aCommand]));

Up codes, SockReceiveString with comment has a problem, it never come back sometimes.

#3 Re: mORMot 1 » Is file name of TSynLog in english only? » 2014-10-21 05:29:08

ChinaPeng wrote:

mORMot 只UTF8编码 你的文件名称没有转码  编码问题


#5 mORMot 1 » Is file name of TSynLog in english only? » 2014-10-15 07:38:00

Replies: 5

When my app file use chinese, the log file name to be messing(incorrect code page?)
e.g.   ä¸­æ–‡é—®é¢˜ 20141015 152947.log

#6 Re: mORMot 1 » A newbie question about 'How to use TSynLog' » 2014-10-14 01:45:17

ab wrote:

I just right your .dpr, and here is what is written when you execute the program:

..... header ...

20141013 10403644 info  do some stuff 

So sounds right to me, right?

But you may be reading the file in debug mode.
In this case, the log content may still be in memory, not already flushed to the disk.
By default, and for a huge performance boost, data is written in a memory buffer, then written to the disk using a background thread.
If you add a "readln" after the "Add.Log" you would see all data appear in the file after a small delay.

See TSynLogFamily.BufferSize and TSynLog.Flush method or set TSynLogFamily.AutoFlushTimeOut and the corresponding documentation.

Ok, I add AutoFlushTimeOut := 1; then the log string appear.

#7 Re: mORMot 1 » A newbie question about 'How to use TSynLog' » 2014-10-12 08:47:00

I just know that TSynLog can't work reason in my testing project.
My testing project is a console project, and I add 'Readln' procedure at the end, yes, when I add it, my logs lose, when I remove it, my logs are correct!
@ab, is this a bug? Could you check it?

#8 Re: mORMot 1 » A newbie question about 'How to use TSynLog' » 2014-10-12 03:45:10

cheemeng wrote:

FYI, it works for me when I tried it (I have not committed the latest patch so I still manually added the trailing slash).

  with TMyLog.Family do
    Level := [sllInfo, sllError, sllServer];
    DestinationPath := ExtractFilePath(Application.ExeName) + 'logs\';

  TMyLog.Add.Log(sllInfo, 'Testing');

Question for @win2014: Does the logs folder exist?

Of course, I saw it. My mean is log info is not correct.

#10 Re: mORMot 1 » A newbie question about 'How to use TSynLog' » 2014-10-07 17:10:26

I added '/' to the 'logs', then log file go into it, but still no my log info, and I open log file, the last line is

TMyLog 1.18.311 2014-10-08T01:05:15

#11 mORMot 1 » A newbie question about 'How to use TSynLog' » 2014-10-07 09:44:07

Replies: 10

For save time, Just show my codes:

  TMyLog = class(TSynLog)


    with TMyLog.Family do begin
      Level := LOG_VERBOSE;
      DestinationPath := ExtractFilePath(ParamStr(0)) + 'logs';

    TMyLog.Add.Log(sllInfo, 'do some stuff');

I have read the sample one by one, and see that per-class knowledge, but the codes above can't work: the log file created in dir of exe, not the logs dir, the string "do some stuff" not in log file, what happends? My SynCommons is the latest version, I can ensure that.

#12 Re: mORMot 1 » Huge string log will be truncated? » 2014-09-12 08:38:12

I just found version info in SynCommons.pas, I'm sure I'm using 1.18

SYNOPSE_FRAMEWORK_VERSION = '1.18'{$ifdef LVCL}+' LVCL'{$endif};

#13 mORMot 1 » Huge string log will be truncated? » 2014-09-12 01:27:24

Replies: 3

I need to log some HTML page, like this:

TSynLog.Add.Log(sllInfo, aLabel + ' ' + html);

The HTML page length several ten thousand, but I see the </html> often lost, the HTML be truncated! I sure the page is complete.
Somebody help?

#16 mORMot 1 » Just found a litter bug in SynSM » 2014-08-17 06:18:44

Replies: 1

I call procedure TSMObject.DefineProperty(const name: SynUnicode; const value: variant) like this:
smObj.DefineProperty('propName', 'propValue');
Then it raise 'Unhandled variant type 21' - ESMException.
I read the source clearly and found the kernal rutine

procedure TSMObject.DefineProperty(const name: SynUnicode;
  const value: variant; attrs: TJSPropertyAttrs);

See that? VariantToJsVal cast the value into correct jsval, but it return a jsval type, and no proper DefineProperty() accept this param..so it call itself again..
Try to patch this, I wrote codes instead:


Exception has no raise again.

I love the beautiful SynSM, thanks mpv's times.

#17 Re: SyNode » Adding JavaScript support for mORMot framework » 2014-08-07 04:02:13

mpv wrote:

You try to do something with javaScript runtime not from thread this runtime created. If this happens in delphi debugger in multithread application this is "normal" situation, because debugger thread is not a thread where runtime initially created. In our implementation we create one runtime and one context per thread. See Mozilla sources:

JSRuntime::abortIfWrongThread() const
    if (ownerThread_ != PR_GetCurrentThread())
    if (!js::TlsPerThreadData.get()->associatedWith(this))

Thanks mpv very much. I have read these statement above from sm source and I have trace into cpu viewer for asm, but my asm knowledge as my english, haha...
Thanks excellent sm wrapper again!

#18 Re: SyNode » Adding JavaScript support for mORMot framework » 2014-08-05 00:42:56

@mpv What things to do in JS_AbortIfWrongThread in sm, in delphi debug evironment, I found it raise zero point write av exception.
Hope reply.

#20 mORMot 1 » ESynException with message 'TSynLog.AutoTable VMT entry already set'. » 2014-07-24 09:09:59

Replies: 2

I just use SynSM in a small testing app. The app creates some threads, and those threads run some javascript. Sometimes, this exception raise, sometime no. What means? What happens?


#21 Re: mORMot 1 » How to register a delphi class to SynSM? » 2014-07-12 06:00:05

mpv wrote:

@edwinsn - we prepare all patches and build instruction for SpiderMonkey - I send sources to AB.
@tueddy & win2014 - Yes, we add ability to share Delphi classes with SpiderMonkey. For my main product (commercial) we already done this year ago and now we migrate this part of sources to the Syn*. The main problem is support of both "old" RTTI and new RTTI. I think we solve it in a month.
Our implementation is much speed-efficient compared to http://delphi-javascript.googlecode.com/svn/trunk

Seems good news! Exciting!
I write some "processor-oriented" code fix my question, even they looks ugly, but works.

#22 Re: mORMot 1 » JS_SetRuntimePrivate and JS_GetRuntimePrivate can not locate on the SM » 2014-06-23 10:16:13

I had fixed this, see below:

function JS_GetRuntimePrivate(rt: PJSRuntime): pointer; cdecl; external SpiderMonkeyLib name '?JS_GetRuntimePrivate@@YAPAXPAUJSRuntime@@@Z';
procedure JS_SetRuntimePrivate(rt: PJSRuntime; data: pointer); cdecl; external SpiderMonkeyLib name '?JS_SetRuntimePrivate@@YAXPAUJSRuntime@@PAX@Z';

#23 mORMot 1 » JS_SetRuntimePrivate and JS_GetRuntimePrivate can not locate on the SM » 2014-06-22 02:55:02

Replies: 4

When I use JS_SetRuntimePrivate or JS_GetRuntimePrivate in SynSM, the app directly crash! And then show "Can not locate the program import point JS_SetRuntimePrivate..".

#24 Re: mORMot 1 » How to register a delphi class to SynSM? » 2014-06-16 09:06:35

e.g. I defines a type TMyClass = class; in delphi code, then I want use this type in js:
var mycl = new TMyClass();
In delphi-javascript wrap, it could be very easy.

#25 mORMot 1 » How to register a delphi class to SynSM? » 2014-06-16 01:22:59

Replies: 13

Is there any demo about that?
I had look for this, but found nothing.

#26 Re: mORMot 1 » AV SpiderMonkey Mustache rendered failed » 2014-06-14 01:57:39

There are no problems in XE6, sample TestMustacheUnit runs very well!

#27 Re: mORMot 1 » AV SpiderMonkey Mustache rendered failed » 2014-06-10 12:23:10

DigDiver wrote:

I also have a problem when starting TestMustache in Delphi XE3 .

constructor TSMEngine.Create(aManager: TSMEngineManager);
fCx.Options := [jsoVarObjFix,jsoBaseLine,jsoTypeInference,jsoIon,jsoAsmJs];

Error in line JS_SetOptions(@self,uint32(Value))

procedure JSContext.SetOptions(const Value: TJSOptions);

Value: (from debuger)

[jsoUnused5,jsoUnused11,jsoNoScriptRVal,jsoUnrootedGlobal,jsoBaseLine,jsoPcCount,(out of bound) 22,(out of bound) 25]

Yes, like to me.

#29 Re: mORMot 1 » AV SpiderMonkey Mustache rendered failed » 2014-06-10 09:10:44

ab wrote:

I suppose you are not using the latest .dll files.

source code wrote:

   Download the SpiderMonkey library at http://synopse.info/files/synsm.7z
   and put mozjs-24.dll and libnspr4.dll files with your TestMustache.exe

Yes, I just download dll from this url, and the source are from github, https://github.com/synopse/mORMot(download zip button).

#30 Re: mORMot 1 » AV SpiderMonkey Mustache rendered failed » 2014-06-10 08:59:46

program SynSMPractise;


{$R *.res}


  engMan: TSMEngineManager;
  jsEng: TSMEngine;

    engMan := TSMEngineManager.Create();
    jsEng := engMan.ThreadSafeEngine;
    jsEng.Evaluate('var a = 0;');
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);

These are my practice codes,when I run it without ide,is display
"Assertion failure: lock != NULL, at c:/nspr/pr/src/threads/combined/prulock.c:198
EExternalException: External exception 80000003",if I run it in ide debug mode,it crashed in this line: "fCx.Options := [jsoVarObjFix,jsoBaseLine,jsoTypeInference,jsoIon,jsoAsmJs];".

#31 Re: mORMot 1 » AV SpiderMonkey Mustache rendered failed » 2014-06-10 08:46:14

I also get the error External Exception 80000003 when I open the executable file name "TestMustache.exe",my ide is xe3 up2,system is win7,but in xp sp3,it also display.

Board footer

Powered by FluxBB