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,854 other subscribers

Archive for the ‘Delphi’ Category

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 »

Delphi threadvar: TLS thread local storage

Posted by jpluimers on 2019/02/07

Managing TLS correctly with all kinds of dynamic storage seems to be a nightmare.

From what I think it’s safe to use a TStopWatch [WayBackSystem.Diagnostics.TStopwatch (introduced in Delphi XE2) as threadvar (which gets into TLS: Thread-local storage) because it’s a record type and as a bonus will be zero-initialised in something like this:

threadvar
 ThreadStopwatch: TStopwatch; // threadvars are zero-initialised, like TStopwatch.Reset was called. Ensure TStopwatch.InitStopwatchType called before using this.

... thread code:
var
  lThreadElapsedMilliseconds: string;
begin
...
  if not ThreadStopwatch.IsRunning then
    ThreadStopwatch.Start;
  try
    lThreadElapsedMilliseconds := ThreadStopwatch.ElapsedMilliseconds.ToString();
    // log duration of call-to-call somewhere
... logic
    lThreadElapsedMilliseconds := ThreadStopwatch.ElapsedMilliseconds.ToString();
    // log duration of logic somewhere
  finally
    ThreadStopwatch := TStopwatch.StartNew; // resets new count
  end;

As long as I perform this in the main thread somwehere to pre-initialise the class variable, then no thread should have the penalty for that:

TStopwatch.Create(); // ensures non-public TStopwatch.InitStopwatchType is called, enabling the threadvar ThreadStopwatch get the penalty for that

If I ever need to dig deeper into TLS with Delphi, then these are starters:

–jeroen

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

Delphi Declarations and Statements: Hinting Directives

Posted by jpluimers on 2019/02/06

From [WayBackDeclarations and Statements: Hinting Directives you might remember this:

The ‘hint’ directives platformdeprecated, and library may be appended to any declaration. These directives will produce warnings at compile time. Hint directives can be applied to type declarations, variable declarations, class, interface and structure declarations, field declarations within classes or records, procedure, function and method declarations, and unit declarations.

However, it doesn’t as at least these fail:

type
{ [dcc32 Error] ClassConstUsageConsoleProject.dpr(14): E1030 Invalid compiler directive: 'DEPRECATED' }
  TMyProcedure = procedure() of object deprecated 'do not use TMyProcedure';
{ [dcc32 Error] E1030 Invalid compiler directive: 'DEPRECATED' }
  TMyReference = reference to procedure() deprecated 'do not use TMyReference';

These two helped me though:

This fails too:

type
{ [dcc32 Error] E2029 '=' expected but ';' found }
  TArrayChars = array of Char; deprecated;
{ [dcc32 Error] E2029 ';' expected but identifier 'deprecated' found }
  TArrayChars = array of Char deprecated;

But this is a workaround:

type
  TArrayCharsOld = array of Char;
  TArrayChars = TArrayCharsOld deprecated;

Which works for the procedure types as well:

type
  TMyProcedureOld = procedure() of object;
  TMyProcedure = TMyProcedureOld deprecated 'do not use TMyProcedure';
  TMyReferenceOld = reference to procedure();
  TMyReference = TMyReferenceOld deprecated 'do not use TMyReference';

Bug https://quality.embarcadero.com/browse/RSP-18316

–jeroen

Posted in Delphi, Development, Software Development | 1 Comment »

keyman/DevDelphiStarterCompileWrapper.pas at master · keymanapp/keyman

Posted by jpluimers on 2019/02/05

Cool: bds.exe -ns -b projectname.dproj will build a project from the command-line.

Should work in Starter Edition (and the now defunct AppMethod).

[WayBackkeyman/DevDelphiStarterCompileWrapper.pas at master · keymanapp/keyman.

Via: [WayBack] Question: is there any chance Embarcadero would reconsider and stop blocking the use of the command line compilers for Starter Edition?I run an open s… – Marc Durdin – Google+

–jeroen

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

Passing the `–symbol-report` to the Delphi compiler gives you a nice XML overview with all symbols used

Posted by jpluimers on 2019/01/31

Cool undocumented parameter --symbol-report at the [WayBack/Archive] Hatena Diary mid 2017:

Read the rest of this entry »

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development, Undocumented Delphi | 7 Comments »

The G+ GExperts community does no longer accept new members and new posts: use the English DelphiPraxis GExperts sub-forum (which has RSS)

Posted by jpluimers on 2019/01/31

For GExperts: go to http://en.delphipraxis.net/forum/31-gexperts/ with these RSS feed https://en.delphipraxis.net/forum/31-gexperts.xml/

Via [WayBack] NOTE: This community does no longer accept new members and new posts. Since Google will shut down Google+ in April 2019, I have moved to the GExperts su… – Jeroen Wiert Pluimers – Google+ and[WayBack] NOTE: This community does no longer accept new members and new posts. Since Google will shut down Google+ in April 2019, I have moved to the GExperts su… – Thomas Mueller (dummzeuch) – Google+

–jeroen

 

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