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 2,343 other followers

Archive for the ‘Event’ Category

Delphi: types you cannot deprecate

Posted by jpluimers on 2021/05/06

Deprecating all types in a unit besides deprecating the unit itself will cause a hint and warning storm. Especially in projects having a lot of hints and warnings (taking over maintenance of a legacy project comes to mind) this can be very helpful to spot these locations inside many files where some obscure unmaintained unit like GIFImage.pas is still used.

[WayBack] TGIFImage for Delphi | MelanderBlog got donated to (then CodeGear, now Embarcadero) for inclusion in Delphi 2007. It was, as GifImg unit, but only documented since the [WayBack] Delphi 2009 GIFImg Namespace). For more information: delphi 2007 gifimg unit – Google Search

Delphi allows you to deprecate a lot of types, but you cannot deprecate these forms:

  • array [...] of TSomeType
  • ^TSomeType
  • class of TSomeType
  • procedure(...) ...
  • function(...): TSomeType ...
  • reference to procedure(...) ...
  • reference to function(...): TSomeType ...

Putting a deprecated 'use SomeUnit.TSomeOtherType' will fail with:

  • either a compiler error  pair
    • E2029 ';' expected but identifier 'deprecated' found“.
    • E2029 '=' expected but string constant found
  • a compiler error
    • E1030 Invalid compiler directive: 'DEPRECATED'

You can enumerate these kinds of types:

  • enumerations
  • records
  • classes, but only a full class declaration, so
    • not the class forward declaration like TMyClass = class
    • not a shortened class declaration like TMyException = class(Exception), this has to be the full TMyException = class(Exception) end deprecated 'reason';
  • methods only after the last separating ; of the method (so the virtual form is like procedure Name(...); virtual; deprecated 'use another method';)
  • named constants
  • global variables

The last few are not technically types, but included for completeness.

–jeroen

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

<3 "Minimum Defendable Product": it is part of "Minimum Viable Product".

Posted by jpluimers on 2021/04/21

An important concept in [Archive.is] Kristian Köhntopp on Twitter: “<3 “Minimum Defendable Product”. Das ist ein wichtiges Konzept, das übernehme ich in meinen Sprachgebrauch.… “ quoting

[Archive.is] Mario Hachemer on Twitter: “Ich hab einen Vortrag gehalten zu dem Thema IT Security in Start-ups. Einen Begriff den ich zu dem Zweck definiert hab war das “Minimum Defendable Product” im Kontrast zum MVP. Es bietet sich an als Startup kritisch zu ermitteln welche Assetklassen man sichern kann. Das spart.… “

It is from this thread (also a threat) [Archive.is] Kristian Köhntopp on Twitter: “Operational excellence… “:

Operational excellence

Secrets gehören nicht in Source. Keine SSL Keys, keine Datenbank Passworte, und auch sonst nichts.

In Source gehört Code, der Secrets aus einem Secrets Service (Vault et al) holt, oder, wenn man einige Jahre hinterher ist, aus Files, die von hierasecrets gebaut werden.
Auch zum Testen gehören keine Secrets in den Code. auch hier können Testkeys wie in Production provisioniert werden und nach dem Test verworfen werden (wenn man will)

Die Option, Secrets im Code zu haben muss im Code Review angemeckert werden.
Willkommen in 2021, willkommen zu Operational Excellence.

[Wayback] docs.aws.amazon.com/config/latest/…
Hier die passende AWS OE Security Pillar

The first tweet quoted a surprise about the Luca App (which is highly controversial in Germany: it is a Corona contact tracing app which has some [Wayback] severe security issues):

Read the rest of this entry »

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

Delphi TestInsight: running both DUnitX and DUnit tests in a test project

Posted by jpluimers on 2021/04/06

If you want to run both DUnitX and DUnit tests in a test project using TestInsight as runner encapsulation, then you need to be aware that when there are no DUnitX tests, it will raise an exception.

So use this code to prevent that:

    try
      TestInsight.DUnitX.RunRegisteredTests;
    finally
      TestInsight.DUnit.RunRegisteredTests;
    end;

–jeroen

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

Delphi: got “EOleException with message ‘Microsoft MSXML is not installed'” in a console or test project?

Posted by jpluimers on 2021/03/31

Did you ever get this run-time error in a console or test project?

EOleException with message 'Microsoft MSXML is not installed'

It means that CoInitialize or CoInitializeEx needs to be called in the thread that uses MSXML.

Then an easy workaround is to:

  1. use the unit System.Win.ComObj in any unit that (indirectly) uses Xml.XMLDoc (for instance any unit using an XML Data Binding generated unit),
  2. use the unit System.SysUtils as well (because it defines TProcedure used below)
  3. add this code in in your initialization section (which is what VCL TApplication.Initialize does):

if InitProc <> nil then TProcedure(InitProc); // Calls CoInitialize for the main thread and prevents "EOleException with message 'Microsoft MSXML is not installed'"

The initialization section of System.Win.ComObj sets up InitProc to cals CoInitialize for the main thread, which usually suffices for these simple VCL projects, but not for most console or test projects.

Based on ideas I got after reading [WayBack] 为什么LoadXMLDocument在线程类中使用会报错?-CSDN论坛 (for which Google Translate actually does a goot job [Archive.is])

–jeroen

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

Delphi: Any idea why Delphi (At least since Seattle) does this to Dproj files:  nodes change places – Tommi Prami – Google+

Posted by jpluimers on 2021/03/25

From a while back, but still so very relevant: [WayBackAny idea why Delphi (At least since Seattle) does this to Dproj files:  <DeployClass …> nodes change places – Tommi Prami – Google+.

Luckily most of the thread is archived by now, as G+ is dead.

This thread brought DProjNormalizer to my attention, but by now you should be better using Project Magician.

DProjNormalizer normalizes the XML structure of Delphi .dproj files, both during IDE save actions, and manually using the command-line tool DprojNormalizerCmd.exe too.

Note that the manual tool does an in-place modification of your .dproj files, so better use version control, have good backups, or use InplaceExeWrapper .

In the mean time, Project Magician has been released that too has a command-line tool ProjectMagicianCmd.exe:

The general usage is:
ProjectMagicianCmd [-v:<version> | -n | -r | -x | -f] [<filepath>]<filename> [-l:<logfile>] [-s]

The parameters have the following meaning:

  • -v = Sets VersionInfo in dproj files to a given value. Clears all version info entries in child build configurations.
    <version> up to 4 numbers separated by dots
  • -n = Normalize
  • -r = Removes unused platforms
  • -x = Removes “Excluded Packages”
  • -f = Refreshes and adds missing form type entries
  • <filename> may contain wildcards. If no extension is given .dproj is assumed

Project Magician adds more functionality, including the ability to specify settings on project, project group and global levels. An explanation of settings is at [WayBack] Keep Your Project Files Clean With Project Magician – The Art of Delphi Programming.

These are my global default settings from the Tools -> Options menu option, then following these bits of the tree:

You can get to all levels via the Project -> Project Magician menu option, then following the various tabs:



Note that if you have combinations of installed previous versions before, that you should ensure you install the most recent versions of these, as there have been incompatibility issues between them:

  • ProjectMagician (or DProjNormalizer)
  • SelectiveDebugging

Related searches

Thread

  • Jeroen Wiert Pluimers's profile photo

    +Walter Prins interesting tool! Do you know of a tool that can downgrade .dproj files so you can use them with older Delphi versions? (the opposite of what the IDE does)?

    Or someone that has written more than my XSD on .dproj files? My one is so small that’s hardly a real attempt. https://wiert.me/2013/08/31/delphi-first-try-on-an-xsd-for-groupproj-files/

  • Walter Prins's profile photo
    +Jeroen Wiert Pluimers No, but interesting idea. I suppose you’re probably aware that the JEDI JCL/JVCL takes a somewhat similar (ish) related approach, in that it generates project and package files that are compatible with every desired version of Delphi from minimalist (XML) template files. Every so often I think it might be worth looking whether one can re-use the code from there easily but haven’t gotten around to it. Always something else to do first. :/
  • Jeroen Wiert Pluimers's profile photo
    +Walter Prins no I didn’t. Where should I start reading on that minimalist template approach?
  • Walter Prins's profile photo

    +Jeroen Wiert Pluimers  Sorry I see I missed out the word installer in my comment: It’s the Jedi JCL/JVCL installers that uses xml templates etc.

    But the point stands: I guess it should be (perhaps) possible to reuse its infrastructure for ones own projects, though as I say I keep meaning to look into this but haven’t really done so.

    (BTW I’m assuming you are familiar with the JCL/JVCL and in in particular their installers that bootstrap from source code? If not then perhaps my comments may not be that useful?)

    Anyway, not sure if or where there’s particular documentation about this (kind of doubt it), but if you have the JCL/JVCL installed somewhere, then first of all have a look at the “xml” folders e.g. “<jclroot>\jcl\packages\xmls” and “<jvclroot>\jvcl\packages\xml“.

    These files appear to define projects and packages in a seemingly abstract/somewhat minimal way using XML. This seemingly is then used to automatically produce .dproj and .dpk files which are placed in e.g. “<jclroot>\jcl\packages\dXX” and “<jvclroot>\jvcl\packages\dXX” where dXX corresponds to a folder for each of the supported Delphi versions and compiled/used during installation.

    Having just looked into this briefly a bit further as a result of this conversation: Key units here (in the case of JVCL) seems to be “jvclroot>\devtools\PackagesGenerator\PackageGenerator.pas“, “<jvclroot>\install\JVCLInstall\PackageUtils.pas” and “jvclroot>\devtools\common\PackageInformation.pas” (used predictably by <jvclroot>\JVCLInstall.dproj)

    (Additionally, having looked at this a bit more closely, it also appears that the JCL does not actually replace all or even most of its .dproj and .dpk files after all, but ships version specific .dproj and .dpk files in most cases, though the JVCL does appear to mostly do so. )

    Edit: The JCL also has this interesting sounding unit “<jclroot>\source\windows\JclMsBuild.pas” which appears to be an MSBuild project file parser…

  • Jeroen Wiert Pluimers's profile photo
    +Walter Prins​ I was aware of the bootstrap and it’s been on my “eventually I’ll take a look” list like forever. One day…
  • Walter Prins's profile photo
    Same as me then basically, ha. ^^

–jeroen

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

 
%d bloggers like this: