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

logging facility in Synopse seems to be an interesting alternative to JclDebug. Need to check out how they differ in looking up the method name for tracing.

Posted by jpluimers on 2020/07/15

On my todo list, as Synops is updated more often than JCL: [WayBack] The logging facility in Synopse seems to be an interesting alternative to JclDebug: According to this StackOverflow answer, one of its features is looki… – Thomas Mueller (dummzeuch) – Google+

–jeroen

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

delphi – How to reset the download when the GetIt package manager fails? – Stack Overflow

Posted by jpluimers on 2020/07/08

Since GetIt is hardly, if at all documented, but has quite a few of problems, I will likely need to use this another time: [WayBack] delphi – How to reset the download when the GetIt package manager fails? – Stack Overflow

TL;DR:

Luis Navarro from Embacadero just explained to me:

Close the IDE, then delete the OmniThread folder from MyDocuments\Embarcadero\Studio\17.0\CatalogRepository After that, you have to edit the registry and delete also the Omnithread folder from HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\17.0\CatalogRepository\Elements

Related: [RSP-12387] GetIt does not reset the download when Delphi crashes whilst downloading. – Embarcadero Technologies

Via:

–jeroen

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

delphi – How do I build an array of const? – Stack Overflow

Posted by jpluimers on 2020/07/02

As I one day likely need to pas a dynamically created array of const from scratch (which behind the scenes actually is an array of TVarRec, where each element is, TVarRec which is a variant record that can have both values and pointers to values. So the result will be kind of a mess :)

Further reading:

Edit 20251105: also relevant is this excellent article [Wayback/Archive] Rudy’s Delphi Corner – Open array parameters and array of const which was pointed to me [W/A] at Delphi Developers

--jeroen

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

Specifying the msbuild configuration for a Delphi project on the commandline – twm’s blog

Posted by jpluimers on 2020/07/02

Reminder to self: check my own build configurations as there is a difference for Delphi 2007 and Delphi >= 2009: [WayBackSpecifying the msbuild configuration for a Delphi project on the commandline – twm’s blog.

Thomas indicate that:

  • Delphi 2007 uses /p:Config=Debug (or Release)
  • Delphi 2009+ uses /p:Configugration=Debug (or Release)

From my own notes, I think Delphi >= 2009 also understands the Delphi 2007 way.

Via: [WayBack] Starting with Delphi 2007 EmBorCodera switched to msbuild for the build system. The newly introduced .dproj file used since then is a valid build script… – Thomas Mueller (dummzeuch) – Google+

References:

–jeroen

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

Delphi Exception handling code review reminders

Posted by jpluimers on 2020/06/18

I bumped into [WayBack]When an exception is nil in the exception handler – twm’s blog for some legacy code a while ago.

Some code review reminders:

  • raise Exception( is always wrong: no exception instance is created
  • Exception.Create( without a raise is wrong most of the times
  • except end is almost always wrong
  • except and finally in encompassing blocks often is a code smell

I need to check which ones are caught by [WayBack] Code Analysis Tool | FixInsight for Delphi (which is now at [WayBack] TMS Software | VCL, FMX, ASP.NET, .NET controls & components for Delphi, C++Builder & Visual Studio | TMS FixInsight Pro.)

--jeroen

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

Chr equivalent for Unicode in Delphi 7 – Stack Overflow

Posted by jpluimers on 2020/06/17

From a long time ago: [WayBackchr equivalent for Unicode in Delphi 7 – Stack Overflow answered by David Heffernan:

Q

I need to initialize a Widestring in Delphi 7 but I can’t use chrfunction which is ANSI

var
  ws : Widestring;
begin

 ws := chr($FFFF) + chr($FFFF) + chr($FFFF);

end;

What can I use, then ?

A

I’m not sure there’s a simply way to do what you wish. You can convert a Word into a WideChar with a simple cast:

WideChar($FFFF)

but you cannot concatenate WideChar. So this is a compiler error:

WideChar($FFFF) + WideChar($FFFF)

You could use a helper function to get the job done:

function InitialiseWideString(const chars: array of Word): WideString;
var
  i: Integer;
begin
  SetLength(Result, Length(chars));
  for i := 0 to high(chars) do
    Result[i+1] := WideChar(chars[i]);
end;

Then you can call it like this:

ws := InitialiseWideString([$0054, $0069, $006D, $0065, $0020, $0074, $006F, 
  $0020, $0075, $0070, $0067, $0072, $0061, $0064, $0065]);

–jeroen

Posted in Delphi, Delphi 7, Development, History, Software Development | 3 Comments »

Dynamically instantiating instances in Delphi without knowing their full type is hard

Posted by jpluimers on 2020/06/17

For my reading list: [WayBack] So am working on a particular .NET project and came across NewtonSoft JSON.NET Serializer, it allows you serialize Collections such as a generic list an… – Ugochukwu Mmaduekwe – Google+:

Stefan Glienke:
Serializing and mostly deserializing generics in Delphi is a major PITA because we don’t have such capabilities to dynamically work with them like in C# where you can easily create new generic lists at runtime where you don’t know the precise type T at compile time.

–jeroen

 

Posted in .NET, C#, Delphi, Development, Software Development | Leave a Comment »

Delphi AMQP links

Posted by jpluimers on 2020/06/11

Some links I found about Delphi and AMQP.

AMQP

Delphi and AMQP

Threads:

Tests

Other environments

–jeroen

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

Don’t mix objects and interfaces

Posted by jpluimers on 2020/06/11

Worth repeating Dalija Prasnikar, because I bumped into sources of people not getting this concept: [WayBack]: Don’t mix objects and interfaces.

You should not, but sometimes it is hard not to.

The rules in his article are very important as they indicate what’s safe and what’s not:

  1. object references are weak, interface references are strong
  2. reference counted object instances need at least one strong reference to keep them alive therefore you can’t use object reference as primary owning reference
  3. reference counted object instances can be safely accessed through temporary, short-lived (weak) object references, as long as there are strong reference(s) keeping the object alive

So basically:

  • ensure a reference counted instance has at least one strong reference to manage the lifetime
  • temporary (short-lived) weak references are OK as long as you are sure the strong reference lives longer

Note that unsafe will make interfaces references weak instead of strong; the same holds for pointer lists [WayBack] Using the [unsafe] attribute, it is possible to store the interface without reference counting. Is there any way for this behavior to be “transferred” … – Jacek Laskowski – Google+

–jeroen

via: [WayBack] Dalija Prasnikar – Google+

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

Thread.Destroy deadlocks in finalization of COM+ dll’s…

Posted by jpluimers on 2020/06/04

Reminder to self that this is still broken:

[WayBack] Thread.Destroy deadlocks in finalization of COM+ dll’s This serious bug still exists in Delphi 10.2 after 12 years being reported! http://qc.embarcade… – 丽丽乌克 – Google+

Original report:

It was posted by Bart van der Werf, who also posted a workaround that is inside those WayBack links.

–jeroen

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