On my Delphi research list:
[Window Title] Error [Content] Error creating form: Root class not found: "". [OK]
I think it has to do with form inheritance, but a quick glance didn’t raise any warning signs.
–jeroen
Posted by jpluimers on 2019/10/03
On my Delphi research list:
[Window Title] Error [Content] Error creating form: Root class not found: "". [OK]
I think it has to do with form inheritance, but a quick glance didn’t raise any warning signs.
–jeroen
Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | 1 Comment »
Posted by jpluimers on 2019/10/02
I got an interesting question a while ago: should an application terminate (anonymous) threads or not?
Started.WaitFor might not return (which you cannot get around this because all overloads of the CheckThreadError are non-virtual)A problem is that a thread might not execute unless you call WaitFor before Terminate is called. The reason is that the internal function ThreadProc does not start Execute if the thread is already terminated.
The
ThreadProcin theSystem.Classesunit is an ideal place to set breakpoints in order to see which threads might start.Other useful places to set breakpoints:
TAnonymousThread.ExecuteTExternalThread.Execute
Execute not being called by ThreadProc is a bug, but it is not documented because QC is gone (taking the below entry with it), it is not in QP and the docwiki never got updated.
Given QC has so much information, I am still baffled that Embarcadero took it down.
Sergey Kasandrov (a.k.a. serg or sergworks) wrote in [WayBack] Sleep sort and TThread corner case | The Programming Works about this bug and refers to WayBack: QualityCentral 35451 – TThread implementation doesn’t guarantee that thread’s Execute method will be called at all .
The really bad thing are the WayBack: QualityCentral Resolution Entries for Report #35451 Resolution “As Designed” implying the design is wrong.
In his post, sergworks implemented the Sleep sorting in Delphi. Related:
- WayBack: Genius sorting algorithm: Sleep sort
- [WayBack] Reddit – 4chan: Sleep sort : programming
- [WayBack] 4chan: Sleep sort : programming
- [WayBack] Sorting algorithms/Sleep sort – Rosetta Code
- [WayBack] What is the time complexity of the sleep sort? – Stack Overflow
Note that application shutdown is a much debated topic. Best is to do as little cleanup as possible: your process is going to terminate soon anyway. No need to close handles or free memory: Windows will do that for you anyway. See for instance:
- [WayBack] The old-fashioned theory on how processes exit – The Old New Thing
- [WayBack] Quick overview of how processes exit on Windows XP – The Old New Thing
- [WayBack] Changes to power management in Windows Vista – The Old New Thing
- [WayBack] Now that Windows makes it harder for your program to block shutdown, how do you block shutdown? – The Old New Thing
- [WayBack] A process shutdown puzzle – The Old New Thing
- [WayBack] A process shutdown puzzle: Answers – The Old New Thing
- [WayBack] A process shutdown puzzle, Episode 2 – The Old New Thing
- [WayBack] Why does Internet Explorer not call DLL_PROCESS_DETACH on my DLL when I call ExitProcess? – The Old New Thing
- [WayBack] When DLL_PROCESS_DETACH tells you that the process is exiting, your best bet is just to return without doing anything – The Old New Thing
- [WayBack] Why can’t I delete a file immediately after terminating the process that has the file open? – The Old New Thing
- [WayBack] During process termination, the gates are now electrified – The Old New Thing
- [WayBack] How my lack of understanding of how processes exit on Windows XP forced a security patch to be recalled – The Old New Thing
- [WayBack] The old-fashioned theory on how processes exit – The Old New Thing
- [WayBack] Some reasons not to do anything scary in your DllMain – The Old New Thing
Related to waiting:
Related to executing:
–jeroen
Posted in Conference Topics, Conferences, Delphi, Development, Event, Multi-Threading / Concurrency, Software Development, The Old New Thing, Windows Development | Leave a Comment »
Posted by jpluimers on 2019/09/26
This was a change between IE6 and IE7 on the default time-out decreasing from 3600 seconds to 30 seconds: [WayBack] Soap Delphi Client end with a timeout for a 1MB call – Stack Overflow.
If you want to increase the timeout, then use InternetSetOption. You can get the current value using InternetQueryOption.
In Delphi, THTTPReqResp.Send supports this by setting the various time out options right after creating the request:
Request := HttpOpenRequest(FInetConnect, 'POST', PChar(FURLSite), nil,
nil, nil, Flags, 0{Integer(Self)});
Check(not Assigned(Request));
{ Timeouts }
if FConnectTimeout > 0 then
Check(not InternetSetOption(Request, INTERNET_OPTION_CONNECT_TIMEOUT, Pointer(@FConnectTimeout), SizeOf(FConnectTimeout)));
if FSendTimeout > 0 then
Check(not InternetSetOption(Request, INTERNET_OPTION_SEND_TIMEOUT, Pointer(@FSendTimeout), SizeOf(FSendTimeout)));
if FReceiveTimeout > 0 then
Check(not InternetSetOption(Request, INTERNET_OPTION_RECEIVE_TIMEOUT, Pointer(@FReceiveTimeout), SizeOf(FReceiveTimeout)));
Related:
INTERNET_OPTION_CONNECT_TIMEOUT, INTERNET_OPTION_SEND_TIMEOUT , INTERNET_OPTION_RECEIVE_TIMEOUT.–jeroen
Posted in Conference Topics, Conferences, Delphi, Development, Event, SOAP/WebServices, Software Development | Leave a Comment »
Posted by jpluimers on 2019/09/26
Via [WayBack] does anyone know of any Spring.Container examples (preferably non trivial) that show how to build an app with a container just referenced from the Compo… – Russell Weetch – Google+:
Stefan Glienke:
The principle of having a composition root has nothing to do with a particular DI container. Its what you eventually get when following the principle if DI: ask for dependencies – don’t create or look for them yourself (aka service locator).
You did not mention it but I guess you mean a VCL application – now the design of the VCL is not particularly built with DI in mind and thus it can be a bit tricky to hook up the application MainForm to the container to get it injected everything. However there are several examples how to achieve that (mainly by using DelegateTo and doing the Application.CreateForm there).
An example explaining this is for instance in [WayBack] How to initialize main application form in Spring4D GlobalContainer?
Many more can be found through Spring4d DelegateTo and Spring4d DelegateTo CreateForm and
–jeroen
Posted in Delphi, Development, Software Development, Spring4D | Leave a Comment »
Posted by jpluimers on 2019/09/25
Marjan Venema had a great answer at [WayBack] How to expose a Delphi set type via Soap – Stack Overflow.
–jeroen
Posted in Conference Topics, Conferences, Delphi, Development, Event, SOAP/WebServices, Software Development | Leave a Comment »
Posted by jpluimers on 2019/09/25
On my research list as it pointed me to TensorFlow imports from both .NET and Delphi: [WayBack] Fixed by Code: Using TensorFlow™ with Delphi – or how to use a TStack<T> to simulate a RPN calculator.
Links from it:
I like the demo there, as I’ve done RPN calculator with some modeling tools before which makes for a good demo, and it reminds me of the HP 12C financial calculator my dad used to have.
If you like more TensorFlow, then watch the video I linked before: “Large-Scale Deep Learning with TensorFlow,” Jeff Dean – YouTube
Via
Older conversion try: [WayBack] Converting the TensorFlow C++ headers to object pascal. It has this empty struct defined.typedef struct TF_Tensor TF_Tensor;Think it converts to obj… – Eli M – Google+
–jeroen
Posted in .NET, Delphi, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2019/09/24
For my link archive, [WayBack] Convert an object instance into a JSON string and making use of custom attributes – Flix Engineering:
JSON, JSONMarshalled, JSONName Delphi Convert an object instance into a JSON string and making use of custom attributes
This is a welcome explanation as in [WayBack] REST.Json.Types – RAD Studio API Documentation, these attributes have very shallow documentation:
Via: [WayBack] Is there any documentation for attribute and Json? uses Rest.Json, Rest.Json.Types; [JSONName(‘TokenName’)] – Thomas Bornhaupt – Google+
–jeroen
Posted in Delphi, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2019/09/20
Reminder to self: [WayBack] Dave’s Development Blog – Using CodeSite on interfaced objects:
Note to self…
If using
CodeSiteto log Constructor and Destructor behaviour on interfaced objects, make sure its the first unit in the project so that it is the first unit initialised AND THE LAST unit finalised!This will save you hours and hours hunting down shutdown AVs
Or in my projects, the uses list in the Delphi project should be this order:
FastMM4BootstrapCodeSiteVia: [WayBack] Using CodeSite on interfaced objects – David Hoyle – Google+
–jeroen
Posted in Delphi, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2019/09/19
In recent Delphi versions one is encouraged to use the routines from
System.NetEncoding. AlsoSoap.EncdDecdis only a wrapper to them. Even if you use the stream based implementations the whole stream is read into aTBytes. So no real gain there any more.
Source: [WayBack] Hi, We need to implement a functionality in our VCL application where the user…
Related:
–jeroen
Posted in Delphi, Development, SOAP/WebServices, Software Development | Leave a Comment »
Posted by jpluimers on 2019/09/18
For my link list: [WayBack] GitHub – ultraware/DelphiGrpc: DelphiGrpc is a Delphi implementation of the realtime and streaming gRPC protocol (http://grpc.io).
The following libraries are used:
- build on top of ngHttp2.dll (https://nghttp2.org/) for full http/2 communication
- using sgcWebsockets library (https://www.esegece.com/websockets) for (custom) websocket communications (no need for http/2 dll)
- using GrijjyFoundation library (https://github.com/grijjy/GrijjyFoundation) for native Delphi protobuffers support
- using DelphiScalableClientSockets library (https://github.com/grijjy/DelphiScalableClientSockets) for a Delphi wrapper around ngHttp2.dll and a scalable connection implementation (IOCP and pooling)
Via [WayBack] Interesting finding today – DelphiGrpc – a grpc.io implementation in Delphi – Edwin Yip – Google+
–jeroen
Posted in Delphi, Development, Software Development | Leave a Comment »