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

Fixing the WSDLImp command-line Delphi WSDL importer to parse WSDL files including XSD files using xsd:group at the top level

Posted by jpluimers on 2018/05/24

I finally found out the cause of the Delphi WSDL Importer generating wrong .pas files when the WSDL file includes an XSD file that uses an xsd:group (see below) at the top-level.

The resulting access violation was caused by forgetting a nil check for a Context (at the top-level it is nil because there is no encompassing type yet; xsd:group can be at the top-level).

There might also be other WSDL/XSD constructs leading to the same code path: a good set of WSDL/XSD combination would be needed for proper integration testing on this. Hopefully, Embarcadero has such a set.

Patches

All patches are at https://gist.github.com/jpluimers/2824c03ae816229a53ffa4830b2d6208. If you need a binary build that includes the patches, drop a comment below.

Before fixing, I had to get it building which required modifying the search path and output path (both see Delphi WSDL importer compiler defines). This is the first patch below (which results includes a huge .dproj change as that’s what the IDE does to a project when you change just a few simple things).

The second patch below is the fix.

The fix is to replace if (TypeDef.IsAnonymous) then by if (TypeDef.IsAnonymous) and Assigned(Context) then in side the function TWSDLTypeImporter.AddComplexType of WSDLImpWriter.pas.

After careful checking of the group handling (around etElementGroup, cmGroupRef,  xtiElemGroupIXMLElementGroup, IXMLElementGroups), no other fixes are needed as the rest of the xsd:group handling functions correctly at least for the WSDL/XSD combinations I had to import.

During fixing, I found some compiler defines would produce much more output. That output tremendously helped finding out if xsd:group handling was indeed correct.

In the third patch, I have added another modification that introduces a new -logall command-line parameter that enables all these in one go.

I have handed over the patches through internal channels in order to circumvent a long and tedious QC/QualityPortal process. Hopefully they will make it in the next major Delphi version.

Related

Patches generated by following the steps in [WayBack] Generate a git patch for a specific commit – Stack Overflow:

git format-patch -1 <<commit-SHA>>

Command-line parameters

The WSDLImp has many command-line parameters, some of which are not accessible from the IDE expert. More information on these at:

xsd:group

An xsd:group contains a group of definitions. It is similar to a list of fields in a record/class/interface in Delphi that you can use in multiple record/class/interface definitions. The group only has a name at the XSD level, but not at the Delphi generated code level: there the group is expanded in each place it is used.

More information: [WayBack] xsd – How to use the xml schema group element – Stack Overflow

–jeroen

Read the rest of this entry »

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

Indy repo URLs and nightly builds

Posted by jpluimers on 2018/05/24

For my link archive:

Password embedded Indy SVN repository URLs

Based on [WayBack] Indy Subversion Source Access

This might come in handy: [WayBackCreating a two way sync between a Github repository and Subversion – Ben Lobaugh Online

Nightly Indy builds

Via [WayBack] Indy DevSnapshot and https://gitter.im/IndySockets/Indy

–jeroen

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

Getting the new MMX from Raabe Software to work when installing it as separate Administrative user

Posted by jpluimers on 2018/05/24

I have a policy to install software with a separate Administrative user, but develop with a normal non-Administrative user.

For some software, this creates problems, either because it cannot cope while running as a non-UAC user, or because they write their configuration (either on disk or in the registry) to the user that installed the software as opposed to:

  • write the configuration as a template to a generic place (like %ProgramData% or HKLM) then
  • apply that template when a user first runs the software

ModelMaker Code Explorer does the latter, of which I earlier wrote about in Fixing Unable to create ModelMaker Tools Shared Directory and Cannot create file “C:\HungarianTypeLookup.txt”. Access is denied..

Uwe Rabbe (who now maintains MMX) will fix this, but until then, you either will see no MMX menu entry at all, or get errors like the ones below.

Others have ran into them as well, so hopefully these steps will provide a fix for them as well, see

I think the best fix is for the installer to detect if it is being run as regular user or administrator, then decide upon those where to write in the registry. I’m not sure though how other Delphi experts handle this, so I am open on input from other parties.

Steps below are based on

No MMX in the Delphi menu at all

This likely means MMX is not registered in the registry for the current user.

Read the rest of this entry »

Posted in Delphi, Development, ModelMaker Code Explorer, Software Development | 3 Comments »

MMX – speed up your Delphi development, now maintained by Raabe Software

Posted by jpluimers on 2018/05/23

New home [WayBackMMX – speed up your Delphi development

Old home [WayBack] ModelMaker Tools

Thanks a lot to Gerrit Beuze for al the efforts and insights while he created and maintained MMX for such a long time

Thanks a lot to Uwe Raabe for taking over the maintenance and providing the binaries for free.

I have posted links to some archived site pages below, just in case anybody needs them (when QC went off-line after a while the Google Search failed to show search results for this; hopefully this will keep some of the information retrievable).

As a follow up to:

–jeroen

Archived links (in semi-random order) hopefully they survive the shutdown of the links:

Read the rest of this entry »

Posted in Delphi, Development, Diagram, History, ModelMaker Code Explorer, Software Development, UML | 2 Comments »

Delphi – when compiling consts doesn’t work…

Posted by jpluimers on 2018/05/23

Delphi has a lot of loose ends. With the extension of the language, it gets more and more. Or as Stefan Glienke formulated it:

It should all compile but it does not because currently what is a real const and what is a variable treated as const by the compiler is a f…ing mess and thus some combinations don’t work. If you have watched that C++ session recently posted here you know how const should be handled by a compiler in 2017.

[WayBack] The recent next gen compiler debate reminded me of this nice talk.This is about c++ but it shows off nicely what a high quality compiler can achieve in… – Christoph Hillefeld – Google+

Source [WayBackI don’t need a solution for this but wonder if Elements4 should compiles or not… – Paul TOTH – G+

–jeroen

Read the rest of this entry »

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

Delphi WSDL importer compiler defines

Posted by jpluimers on 2018/05/22

As a follow-up on Delphi WSDL default importer settings, you can use these compiler defines to increase output.

Output that the built-in Wizard will never show you (that is also the reason you will not see any errors like access violations in the IDE).

TL;DR

Always use the command-line WSDL importer WSDLImp as it has the same default options as the IDE.

The command-line WSDL importer called WSDLImp does show error messages, but in case of an error still continues writing the wrong .pas file.

Syntax:

"C:\Program Files (x86)\Embarcadero\Studio\19.0\bin\WSDLImp.exe" -DD:\Playground\iECK_ImportWSDL "D:\Playground\iECK DT2.0 services v2.1.1\wsdl\ECK-DT2-CatalogService-v2.1.1.wsdl"

When debugging the code, I found out there are many conditional defines you can enable so it shows more output. Output that greatly helps to pin-point issues while importing more complex WSDL, especially when the WSDL has include or import elements.

These are the defines:

  • TRACK_MEMORY this requires the FastMM4 unit in the path
  • SHOW_XML_INFO
  • LOG_TYPES_DUMP
  • LOG_TYPES_LOOKUP
  • LOG_TYPES_READING
  • LOG_TYPES_SORTING
  • LOG_TYPES_UNWIND
  • LOG_TYPES_WRITING

The really odd thing is that there is a hidden command-line option -debug which does not automatically enable these, but does use SHOW_XML_INFO which seems enabled by default and writes an output file with extension .xml in addition to .pas, where the XML has an overview of the parsed data types.

I am going to fiddle around to see if I can enable all of the LOG_ entries from the command-line in a simple way.

When you debug the WSDLImp tool, ensure these two directories are on the unit search path:

  • $(BDS)\source\soap
  • $(BDS)\source\xml

The first is needed so the compiler can find CompVer.inc, the second so you can step through the XML handling code.

Also make sure you change the output path from $(BDS)\bin (which only works under UAC and overwrites the stock output) with something like .\$(Platform)\$(Config) (which  puts it along the .DCU files).

–jeroen

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

Delphi Are you familiar with “forgotten” hints? Here is a very rough example how to get rid of them…

Posted by jpluimers on 2018/05/22

Thanks for [WayBack] Are you familiar with “forgotten” hints? Here is a very rough example how to make them disappear without restarting the IDE… – Attila Kovacs – Google+

The code is centered around enumerating all windows of class TDesignerHintWindow and closing them.

These Windows happen to me a lot more in Galileo based IDEs than the classic Delphi < 8 ones.

–jeroen

Read the rest of this entry »

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

Is there any way to record a keyboard macro in the IDE?

Posted by jpluimers on 2018/05/22

Yes there is, but it only does code editor commands. It’s been there since at least 1998 (read Delphi 4), probably all 32-bit versions and maybe even the 16-bit Delphi 1 version.

via:

–jeroen

PS: the G+ thread at … had these comments:

Ondrej Kelle
Reminds me of my keyboard macro manager, later adopted by GExperts: [WayBack] 19145 Keyboard macro manager

Thomas Mueller (dummzeuch)
… which I recently extended to actually display and edit those macros.

[WayBack] Edit keyboard macros with the Macro Library expert – twm’s blog

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

Expand your Collections collection – Part 2: a generic ring buffer – grijjy blog

Posted by jpluimers on 2018/05/17

For my Delphi link archive: [WayBackExpand your Collections collection – Part 2: a generic ring buffer – grijjy blog.

–jeroen

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

Delphi Mqtt Clients

Posted by jpluimers on 2018/05/16

For my link archive via: [WayBackDelphi Mqtt Client (Use Indy)https://github.com/wizinfantry/delphi-mqtt-client – 오대우 – Google+

Background reading:

–jeroen

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