The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,862 other subscribers

Archive for the ‘Delphi’ Category

Any opinion on RAD Server vs Node.js/LoopBack vs TMS XData vs other?

Posted by jpluimers on 2019/02/26

Interesting thread still: [WayBack] Any opinion on RAD Server vs Node.js/LoopBack vs TMS XData vs other? – Kyle Miller – Google+

Tools mentioned there (not limited to Delphi):

–jeroen

Read the rest of this entry »

Posted in Delphi, Development, Software Development | Leave a Comment »

Thomas Mueller has started to write some documentation on the internal workings of GExperts…

Posted by jpluimers on 2019/02/26

From a while ago, for my link archive:

[WayBack] I have started to write some documentation on the internal workings of GExperts. For now, it covers only a very small part of the IDE form enhancement… – Thomas Mueller (dummzeuch) – Google+

Back then, this was done:

–jeroen

Posted in Delphi, Development, GExperts, Software Development | Leave a Comment »

Application shutdown: wait for all threads to terminate or not?

Posted by jpluimers on 2019/02/21

A while ago, I ran into a problem that an anonymous thread would run longer than the main thread of the application.

This caused all sorts of trouble, so in this case I decided to fix it for that particular thread.

There are various opinions if this should be done for all threads or not. Like always, it depends, so it is good to mention a few:

This particular case resulted into the memory manager shutting down earlier than the anonymous thread, but the anonymous thread was still using memory allocation functions, resulting into a few things of which you do not want the first and second to happen on a continuous integration system:

  1. Error messages during shutdown, which is unwanted on a headless system:
    ---------------------------
    MyIntegrationTests.exe: MM Operation after uninstall.
    ---------------------------
    FastMM has detected a GetMem call after FastMM was uninstalled.
    ---------------------------
    OK 
    ---------------------------

    or

    ---------------------------
    MyIntegrationTests.exe: MM Operation after uninstall.
    ---------------------------
    FastMM has detected a FreeMem call after FastMM was uninstalled.
    ---------------------------
    OK 
    ---------------------------

    either of them followed by

    ---------------------------
    Error
    ---------------------------
    Runtime error 203 at 00408EFF
    ---------------------------
    OK 
    ---------------------------

    or

    ---------------------------
    Error
    ---------------------------
    Runtime error 204 at 0040AFE9
    ---------------------------
    OK 
    ---------------------------

    The errors are mappings of:

    203, { reOutOfMemory }
    204, { reInvalidPtr }
  2. The MyIntegrationTests_MemoryManager_EventLog.txt to rapidly grow to 100s of megabytes.
  3. The MyIntegrationTests_MemoryManager_EventLog.txt not to be truncated.

This particular case was easy to fix by adding a global (but implementation section contained) boolean indicating if the thread was already finished:

unit DebugInformationLoaderUnit;

interface

implementation

uses
  JclDebug;

var
  LoadDebugInformationAsyncFinished: Boolean = False;

procedure LoadDebugInformationAsync;
begin
  TThread.CreateAnonymousThread(
    procedure
    begin
      TThread.NameThreadForDebugging('LoadDebugInforoamtionAsync');
      DebugInfoAvailable(MainInstance);
      LoadDebugInformationAsyncFinished := True;
    end).Start;
end;

initialization
  LoadDebugInformationAsync;

finalization
  while not LoadDebugInformationAsyncFinished do
  begin
    Sleep(1);
  end;
end.

In addition, I did this to suppress message boxes outside Delphi:

program MyIntegrationTests;

...

{$Include FastMM4Options.inc}

uses
  FastMM4 in '..\..\..\Shared\FastMM4.pas',
  System.Classes,
...;

{$R *.RES}

begin
  TThread.NameThreadForDebugging(ParamStr(0));

  SuppressMessageBoxes := SuppressMessageBoxes // follow pattern in FastMM4.FinalizeMemoryManager
    {$ifdef RequireIDEPresenceForLeakReporting}
        and DelphiIsRunning
    {$endif}
    {$ifdef RequireDebuggerPresenceForLeakReporting}
        and ((DebugHook <> 0)
        {$ifdef PatchBCBTerminate}
        or (Assigned(pCppDebugHook) and (pCppDebugHook^ <> 0))
        {$endif PatchBCBTerminate}
        )
    {$endif}
    ;
  {$WARN SYMBOL_PLATFORM OFF} NoErrMsg := {$WARN SYMBOL_PLATFORM ON} SuppressMessageBoxes; // Set RTL message boxes as well;

  ...
end.

–jeroen

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »

Breaking in the Delphi debugger without a breakpoint

Posted by jpluimers on 2019/02/20

You can fire a debugger breakpoint using either of these two:

  • asm int 3 end which is the x86 debug interrupt
  • DebugBreak() which is the Windows API function wrapping the above interrupt

I’m not sure how accurate it is (in the past it would fail under some debuggers other than the Delphi IDE), but as of Delphi 2, there is a DebugHook variable that is non-zero when running under the Delphi debugger, so you can protect your code.

Via [WayBackI remember some time ago, Jeroen Pluijmers posted a snippet of how to place a breakpoint directly in the Delphi source without relying on the F5 key. – Alberto Paganini – Google+

Related:

–jeroen

Posted in Delphi, Development, Software Development, Windows Development | Leave a Comment »

cdecl: C gibberish ↔ English

Posted by jpluimers on 2019/02/20

Cool site if I ever need to decipher C declarations again: [WayBackcdecl: C gibberish ↔ English.

You can even store the C code as a URL.

via:

–jeroen

Posted in C, Delphi, Development, Software Development | 2 Comments »

Delphi component to show some text file at design time

Posted by jpluimers on 2019/02/19

Interesting idea: [WayBackDelphi component to show some text file at design time

Via: [WayBack] On some projects I put an invisible TMemo on the main form to keep notes about things todo…is there any extension that could attach a kind …could save to … – Paul TOTH – Google+

–jeroen

Read the rest of this entry »

Posted in Delphi, Development, Software Development | Leave a Comment »

To celebrate his 85th birthday, some links to interviews with Niklaus Wirth interviews

Posted by jpluimers on 2019/02/15

Today, Niklaus Wirth, “father” of The Pascal Programming Language turned 85.

Happy birthday!

Almost 50 years ago, Niklaus Wirth submitted his famous paper “The Programming Language Pascal” which was published early 1971

Luckily it is archived on both the WayBack machine and Archive.is as the only PDF copy I could find on-line isn’t always on-line: http://oberoncore.ru/_media/library/wirth_the_programming_language_pascal.pdf

Originally it was published by Niklaus Wirth  in Acta Informatica, Vol. 1, Fasc. 1, 1971 pp. 35-63

He has been very active, just browse through the [WayBack] List of computer science publications by Niklaus Wirth

To celebrate his birthday, here are some interviews with him:

If you like the ones above as much as I do, then search for more: there are plenty!

–jeroen

via: Happy 80th birthday Niklaus Wirth! « The Wiert Corner – irregular stream of stuff

Read the rest of this entry »

Posted in Delphi, Development, History, Pascal, Software Development | Leave a Comment »

Anonymous method do location capturing, so when you expect value capturing you get the “Mysterious Case Of Wrong Value”

Posted by jpluimers on 2019/02/14

Interesting read [WayBack] Mysterious Case Of Wrong Value.

In order to capture by value (which in C++ you can specify), you need an intermediate function like Dalija describes:

function CreateFunction(Value: Integer): TFunc<Integer>;
begin
  Result :=
    function: Integer
    begin
      Result := Value;
    end;
end;

Via: [WayBack] Dalija Prasnikar – Google+

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

VCL Root units

Posted by jpluimers on 2019/02/13

Delphi VCL units that are not using any other VCL units:

  • Vcl.Bind.Consts
  • Vcl.Consts
  • Vcl.ComStrs
  • Vcl.HtmlHelpViewer
  • Vcl.IdAntiFreeze
  • Vcl.Imaging.GIFConsts
  • Vcl.Imaging.JConsts
  • Vcl.Imaging.pnglang
  • Vcl.OleConst
  • Vcl.ShellAnimations
  • Vcl.Shell.ShellConsts
  • Vcl.Touch.GestureConsts
  • Vcl.Touch.KeyboardTypes
  • Vcl.VDBConsts
  • Vcl.XPMan

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

Berlin 10.1.2 Vcl.RibbonConsts removed, so now Vcl.ScreenTips compilation fails – Pascal Today

Posted by jpluimers on 2019/02/12

The Ribbon controls got removed since Delphi 10.1 Berlin, but the dependency in Vcl.ScreenTips remained, so:

After installing the official Delphi Berlin Update 2 I have faced nasty problem. One of my unit was using the Vcl.ScreenTips unit (for TScreenTipsWindow). And when you compile such a project you ge…

Source: Berlin 10.1.2 Vcl.ScreenTips compilation fail – Pascal Today

In the mean time however, it has been moved to GetIt: [WayBack] Ribbon Controls in RAD Studio 10.1 Berlin.

Note that the XE8 introduced [Archive.is] GetIt package manager is under the Tools menu, which is not covered by [Archive.is] IDE Insight – RAD Studio.

Anyway: here you can get it in Delphi 10.1 Berlin (now also in 10.2 Tokyo, where at first it was not available through GetIt):

jeroen

Posted in Delphi, Delphi 10.1 Berlin (BigBen), Delphi 10.2 Tokyo (Godzilla), Development, Software Development | Leave a Comment »