-
Content Count
136 -
Joined
-
Last visited
-
Days Won
3
Everything posted by darnocian
-
ANN: Sempare Template Engine for Delphi
darnocian replied to darnocian's topic in Delphi Third-Party
A fix is now in the dev branch with some additional tests and a way to also change the StreamWriter if required. Will look at new tagged release next week or so. (with the fix in the dev branch, the the Context workaround above would be invalidated) -
ANN: Sempare Template Engine for Delphi
darnocian replied to darnocian's topic in Delphi Third-Party
@mvanrijnen Just looking at the bug you highlighted, there is also an alternative workaround by setting the IContext.NewLine = #$A. procedure TTestTemplate.TestNewLine; type TRec = record Value: string; description: string; end; var r: TRec; s: string; ctx: ITemplateContext; begin ctx := Template.Context(); ctx.newline := #10; r.Value := 'a value'; r.description := 'some desc'; s := Template.Eval(ctx, 'Value: <% value %>'#$D#$A'Description: <% description %>', r); Assert.AreEqual('Value: a value'#$D#$A'Description: some desc', s); end; I have a custom StreamWriter that allows for stripping repeated whitespace and new lines. I'll look into also providing a way to override that better. -
ANN: Sempare Template Engine for Delphi
darnocian replied to darnocian's topic in Delphi Third-Party
Yes. Use in a multi threaded environment should be totally fine. I've even used it to serve html on an indy server. There is locking used internally when accessing some internally managed collections as required. You can load templates on the fly and the locks ensure the state of the structures don't get corrupted. You can load/parse templates upfront or on demand safely. There is no global/shared state that should cause any issues. There are a few different Template.Eval() overrides which allow you to use the templates that have been pre-parsed, or you can just reprocess a textual representation as required. When evaluation takes place, the state is totally independent of any other execution on other threads. -
ANN: Sempare Template Engine for Delphi
darnocian replied to darnocian's topic in Delphi Third-Party
I just looked at the tests... mostly testing with #$A. 😉 But made a test to replicate the issue. -
ANN: Sempare Template Engine for Delphi
darnocian replied to darnocian's topic in Delphi Third-Party
Thanks for the report. Could you please raise the issues on https://github.com/sempare/sempare-delphi-template-engine/issues I'll check it out. A double #$D would not be ideal. The #$A is more easily noticeable, but most of the stuff I used was HTML where this would have been ignored. -
omnithread Omnithread DELPHI, many calls in the same function
darnocian replied to bill parish's topic in OmniThreadLibrary
Performance wise 100% agree with you David. It was more an example to check it out initialisation in case that was an issue. -
omnithread Omnithread DELPHI, many calls in the same function
darnocian replied to bill parish's topic in OmniThreadLibrary
I realise this is an old post... The other thing - usually with COM, you need to CoInitialize() in each thread, and if you are a nice citizen, CoUninitialize(). To coordinate shutdown, you may also want to look at TCountdownEvent from System.SyncObjs. TCountdownEvent waits for a counter to reach zero. A signal in a thread would trigger the countdown. Could do something like (sorry, I automatically referenced TTask.Run rather than Parallel.Async) // This is pseudocode, so might not be 100% accurate with params var event := TCountdownEvent.Create(); event.AddCount(length(workList)); for var work in workList do begin TTask.Run(procedure begin CoInitialize(); try process(work); finally CoUninitalize(); event.signal(); end; end; end; event.WaitFor(INFINITE); With the above code, if run from a UI would still block, so that should also be threaded if the UI is meant to remain responsive. -
ANN: Sempare Template Engine for Delphi
darnocian replied to darnocian's topic in Delphi Third-Party
A new version (v1.3.1) is available on github with bug fixes (https://github.com/sempare/sempare-delphi-template-engine) Hope to have the update in getit shortly too. -
ANN: Sempare Template Engine for Delphi
darnocian replied to darnocian's topic in Delphi Third-Party
It is now available via GetIt as well -
FYI. I recall that you can reference the base ptr on the underlying PyArray. Definitely coming from unmanaged code, you want to try avoid copying if you can. C++ Boost does it quite nicely actually. I last bridged the c++ / python route a number of years ago, so with delphi it will be possible. https://www.boost.org/doc/libs/1_64_0/libs/python/doc/html/numpy/tutorial/ndarray.html https://github.com/boostorg/python/blob/develop/src/numpy/ndarray.cpp inside there is from_data_impl which I think should also be an interesting reference.
-
I was very disappointed too. It seems like they are trying to force people to upgrade. Requesting pricing won't help - I've done it twice already - they simply state it is no longer available. I appreciate it takes some time to manage packages, but is it really worth upsetting users that have been buying the product? Anyways, alternatives are available, even other programming environments were connecting to a database is not 'an enterprise feature' and is free...