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

InplaceExeWrapper for those tools that do not allow specifying an output file – twm’s blog

Posted by jpluimers on 2019/12/17

In my bin directory from [WayBack] InplaceExeWrapper Project Top Page – OSDN: [WayBackInplaceExeWrapper for those tools that do not allow specifying an output file – twm’s blog:

There are a lot of command line tools that are very useful, but have one flaw: They directly modify a file in place and do not allow you to specify an output file instead.

Enter InplaceExeWrapper which called as

InplaceExeWrapper --expectfilenameonstdout c:\path\to\dprojnormalizercmd.exe input.dproj output.dproj

does the following:

  1. Create a temporary directory under %TEMP%
  2. Copy the input file input.dproj there
  3. Call the tool as dprojnormalizer tempfile.dproj
  4. Copy the modified file to the output file output.dproj
  5. Delete the temporary directory

So basically it replaces the missing functionality of specifying an output file for the tool it calls.

Here is the full help on command line parameters and options:

Synopsis: InplaceExeWrapper [options] Executable InFile [OutFile]

Parameters:
Executable        : Executable to call (if set to "copy" we only copy InFile to OutFile)
InFile            : input filename
OutFile           : output filename, defaults to infile

Options:
--CheckResult=value : If set, the executable must return the value given for this option (must be a number)
--debug           : if given, some debug output is written to error.txt in the temp directory and the temp directory will not be deleted.
--ExpectFilenameOnStdout : if set, the output of the executable must contain the filename
--help
-?
-h
-H                : display parameter help
--ShowCmdLine     : Show command line as passed to the program.
--StartupLog=value : Write a startup log to the given file.
--TempDir=value   : directory to use for temporary files (must exist)
--toStdOut        : if set, output is written to stdout and infile is not changed

Via [WayBack] There are a lot of command line tools that are very useful, but have one flaw: They directly modify a file in place and do not allow you to specify an o… – Thomas Mueller (dummzeuch) – Google+

–jeroen

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

Delphi: “Override method %s.%s should match case of ancestor %s.%s (H2365)”

Posted by jpluimers on 2019/12/17

If you write consistent code, you will never see [WayBackOverride method %s.%s should match case of ancestor %s.%s (H2365), but a long while ago I bumped into a project where some the developers had trouble using their shift key and failed to use code completion in quite a few parts of the source code.

So next a lot of lines containing things like Begin, whIle, repeaT, wrong indentations (not just at the wrong level, but even getting things indented at the same level wrong).

Code formatted like this was no exception, not even for methods bound to events:

procedure  TForm1.Button1CLick(SendeR  : TOBJect ) ;
 Begin
  Button2Click  (Sender );
end;

You cannot disable this hint individually as it is not on the list at [WayBack] Delphi XE2’s hidden hints and warnings options | Marc Durdin’s Blog, so you either have to fix the code (which I prefer), or disable all hints with {$ HINTS OFF} as per [WayBackcompiler construction – Can specific Delphi hints be disabled? – Stack Overflow (thanks Lars Truijens).

The above occasion was the first and only time I saw the hint H2365 until recently when I again bumped into a project that had grown over a long time needing some maintenance.

This reminded me I should have blogged about it, found back [Archive.is] H2365 Override method %s.%s should match case of ancestor %s.%s (Delphi) Today was the first time I have ever seen this compiler hint. Why does Delphi… – Graeme Geldenhuys – Google+ and dug a bit deeper.

Read the rest of this entry »

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

Delphi ^A syntax: Documented, implied, or undocumented? – Stack Overflow

Posted by jpluimers on 2019/12/12

The syntax is documented. In the Turbo Pasal 3 documentation, i.e. the Z80 era.

Source my answer to [WayBackDelphi ^A syntax: Documented, implied, or undocumented? – Stack Overflow (I have added some WayBack Internet Archive links below) as it is from the Turbo Pascal era where the caret was introduced to support control characters:

This is from long ago as an escape character to enable you to have consts for control characters in a more readable way.
const
  CtrlC = ^C;
begin
  Write(Ord(CtrlC));
end.

This defines a Char constant with value #3, then writes 3 in Borland Pascal 7, and I remember seeing it years before that too.

I just checked the Turbo Pascal 5.0 and Borland Pascal 7.0 languages guides, but could not find it, so it seems undocumented.

Edit: I do remember this was a Borland thing, and just [WayBack] checked: it is not part of the ISO Pascal standard (formerly this was ANSI Pascal Standard, thanks Sertac for noticing this).

It [WayBack] is documented in the Free Pascal documentation [WayBack].

SGI uses the backslash as escape character, as per their docs [WayBack].

More Edit: I found it [WayBackdocumented in Delphi in a Nutshell and the [WayBackDelphi Basics site.

Found it: Just found it on page 37 of the Turbo Pascal 3 Reference Manual [WayBack].

(Marco van de Voort found the Free Pascal documentation)

It in fact originates in the 1984 Turbo Pascal 1 edition, as per the [WayBack] Turbo_Pascal_Reference_Manual_Feb84.pdf:

Read the rest of this entry »

Posted in Borland Pascal, Delphi, Development, FreePascal, History, Pascal, Software Development, Turbo Pascal, Z80 | 1 Comment »

Exceptional Safety

Posted by jpluimers on 2019/12/11

I think I tend to forget with [WayBack] Exceptional Safety is this:

object destruction process must not cause or raise any unhandled exceptions or you will have memory leaks beyond your ability to fix them.

Particulary, that means the BeforeDestruction method – and destructors themselves – must never ever allow exceptions to escape them. Any escaping exception there will always cause memory leak. Period.

–jeroen

via [WayBack] Single or nested try…finally blocks? None will prevent the memory leak if your destructors are broken. – Dalija Prasnikar – Google+

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

Delphi/GDIPBitmap at master · tothpaul/Delphi · GitHub

Posted by jpluimers on 2019/12/11

Next time I don’t need something like TPngImage any more:

this little unit let you load any GDI+ supported graphic format (BMP, JPG, PNG or TIF) into a Delphi TBitmapit’s a TBitmap helper, so just add the unit to you’re project and call the method GDIPLoadFromStream

Source: Delphi/GDIPBitmap at master · tothpaul/Delphi · GitHub

Found via: [WayBack] Let’s extend TBitmap with a GDIP loader :) TBitmap.GDIPLoadFromStream can load any GDI+ supported format (JPEG, PNG, TIFF) https://github.com/tothpaul… – Paul TOTH – Google+

–jeroen

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

The ARC vs non-ARC situation adds yet another layer of complexity to creating cross platform code…

Posted by jpluimers on 2019/12/10

Interesting rant on the Delphi cross platform situation, for which this is a reminder to see how the current situation is after 2.5 years: [WayBack] The ARC vs non-ARC situation adds yet another layer of complexity to creating cross platform code. The Linux compiler uses ARC – while Windows and OSX don’t… – Lars Fosdal – Google+

–jeroen

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

RAD Studio Custom Editor Sub-views – Dave’s Development Blog

Posted by jpluimers on 2019/12/05

This is a reminder to myself to checkout [WayBackRAD Studio Custom Editor Sub-views – Dave’s Development Blog and see if his [WayBack] Browse and Doc It plugin now supports the editor sub-views.

He also has a great free tool for Delphi: [WayBack] IDE Explorer – Dave’s Development Blog

–jeroen

Via:

Read the rest of this entry »

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

Since RAD Studio 10.2.2 introduced IDE theming, are there any guides…

Posted by jpluimers on 2019/12/04

Reminder to self to check if documentation became available: [WayBack] Since RAD Studio 10.2.2 introduced IDE theming, are there any guides on supporting IDE theming for third-party plugins? (Light/Dark/Custom VCL Styles) – Baoquan Zuo – Google+

–jeroen

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

Thomas Mueller’s Open Source Projects

Posted by jpluimers on 2019/12/03

Since Thomas has been moving projects to OSDN, he now keeps a list of which one is where at [WayBack] My Open Source Projects – twm’s blog

via:

–jeroen

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

delphi – Spring4D: Why is list of type TObjectList freed automatically after iteration? – Stack Overflow

Posted by jpluimers on 2019/11/28

A nice question and even nicer answer at [WayBack] delphi – Why is list of type TObjectList freed automatically after iteration? – Stack Overflow.

It comes down to the Spring4D collection classes expecting to be accessed using interface references because they descend from TInterfacedObject which also favours interface references over object references.

If you access them solely using object references, they start out with a reference count of 0 (zero). If an operation then first increases that to 1 (one), then decreases it back to 0 (zero), the collection instance gets freed.

A few nice tips and (sometimes opposing) opinions from the question/answer thread and the referencing G+ thread [WayBack] What do you think, +Stefan Glienke? ##Spring4D – Agustin Ortu – Google+ make them well worth reading.

Some:

  • Instead of TObjectList<TFuu>.Create, you should use TCollections.CreateObjectList<TFuu>.
    This way, you only need Spring.Collections in your uses clause
  • interface-only usage should be enforced by hiding the classes in the implementation, exposing only interfaces
  • The functions of TCollections only return interface references and – more importantly – allow for code folding starting with Spring4D 1.2.
  • Hiding the classes in an implementation part is not possible because then this would break any possibility to inherit from these classes and extend them (as I know people do).
  • Never use object references to classes that inherit from TInterfacedObject because the reference counting can kick in and destroy your instance anywhere (or manually call _AddRef/_Release).
  • if you want to have classes, then use System.Generics.Collections

–jeroen

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