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 XE7’ Category

Delphi Continuous Integration: When you get E2202 “Required package ‘rtl’ not found” or F1027 “Unit not found: ‘System.pas'”

Posted by jpluimers on 2016/11/08

If when setting up Continuous Integration (CI) with Delphi and you get errors like E2202 "Required package 'rtl' not found" or F1027 "Unit not found: 'System.pas'", then something is wrong with your library path on the CI server.

Before going into the details of why, the quick solution is to set either of these environment variables in your build script

  • Delphi 2007, 2010: Win32LibraryPath
  • Delphi XE and up: DelphiLibraryPath

Now back to the details of why these might not be set, most information is from my Delphi build automation workshop.

Read the rest of this entry »

Posted in Delphi, Delphi 10 Seattle, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 1 Comment »

Delphi XE2 sanctuary lib galore…

Posted by jpluimers on 2016/11/02

Anyone who knows how to work around this? It happens every once in a while right after logging in over RDP to a VM with running Delphi XE2 (but similarly also in other Delphi versions like XE7):

---------------------------
Error
---------------------------
Access violation at address 74FD82A4 in module 'shell32.dll'. Write of address 00000014.
---------------------------
OK Details >>
---------------------------

With the below stacktrace including the sanctuary which always give me the creeps.

http://qc.embarcadero.com/wc/qcmain.aspx?d=139126 (which – like all IDE submitted bug reports – is private hence the copy at https://gist.github.com/jpluimers/6d8c0f29be107a83e48a5fd035900f74 ).

Read the rest of this entry »

Posted in Delphi, Delphi XE2, Delphi XE7, Development, QC, Software Development | 2 Comments »

Loading your MAINICON and VersionInfo through plain text .RC resource files.

Posted by jpluimers on 2016/10/19

I like repositories to have as much of the information in text format.

Delphi traditionally puts both the MAINICON and the VersionInfo resources in a binary .res file and also updates that file on almost every recompile.

There are quite a few posts explaining how to get them from text, but a version controlled example works best for me, so there is one at https://github.com/jpluimers/atom-table-monitor/blob/master/ATOMScannerConsole

The trick is to:

  1. put your resources in a text RC file that can be compiled through a resource compiler
  2. add these to your Delphi project via the project manager, so it generated RcCompile elements which instructs the build process to run the resource compiler first:


<RcCompile Include="MAINICON.rc">
<ModuleName>MAINICON.rc</ModuleName>
<Form>MAINICON.res</Form>
</RcCompile>
<RcCompile Include="VERSIONINFO.rc">
<ModuleName>VERSIONINFO.rc</ModuleName>
<Form>VERSIONINFO.res</Form>
</RcCompile>

Here are the example files:

Read the rest of this entry »

Posted in Delphi, Delphi 10 Seattle, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, QC, Software Development | 2 Comments »

In `System.SysUtils`, `class function TCardinalHelper.Parse` throws errors for valid Cardinal values

Posted by jpluimers on 2016/10/05

Oh nice System.SysUtils.TCardinalHelper.Parse:

class function TCardinalHelper.Parse(const S: string): Cardinal;
begin
  Result := StrToInt(S);
end;

Which means you get this nice EConvertError with message ''4294967295' is not a valid integer value'. with this simple test (which doesn’t even reach the Assert):

uses
  System.SysUtils;

procedure Cardinal_Parse_High_Cardinal_Succeeds();
var
  Expected: Cardinal;
  Value: string;
  Actual: Cardinal;
begin
  Expected := High(Cardinal);
  Value := Expected.ToString();
  Actual := Cardinal.Parse(Value);
  Assert(Expected = Actual);
end;

So I write some unit tests (see below) of which helpers for these types fail in one way or the other:

  • Cardinal
  • NativeUInt
  • Single
  • Double
  • Extended

These work for the boundary cases:

  • SmallInt
  • ShortInt
  • Integer
  • Int64
  • NativeInt
  • Byte
  • Word
  • UInt64
  • Boolean
  • ByteBool
  • WordBool
  • LongBool

 

–jeroen

via: Oh nice, in System.SysUtils: “` class function TCardinalHelper.Parse(const…

Read the rest of this entry »

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 5 Comments »

How to deploy a Delphi OSX project from the command line – kouraklis.com

Posted by jpluimers on 2016/09/28

This is so cool: How to deploy a Delphi OSX project from the command line – kouraklis.com [WayBack]

I always wanted to hack the communication path to PAServer [WayBack] – despite issues – but never had the time. Luckily others had…

See:

The reason I like this very much are many. Just a few:

Read the rest of this entry »

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »

Delphi Code Monkey: Delphi Features I Avoid Using And Believe Need to be Gradually Eliminated from Codebases

Posted by jpluimers on 2016/09/21

Hear, hear! Delphi Code Monkey: Delphi Features I Avoid Using And Believe Need to be Gradually Eliminated from Codebases

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2007, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »

New Book: MVVM in Delphi by John Kouraklis should be available at the beginning of november.

Posted by jpluimers on 2016/09/13

John Kouraklis last week announced a new book: MVVM in Delphi.

It will be available early november and is already listed at the APress site: MVVM in Delphi – Architecting and Building Model View ViewModel Applications [WayBack] where you can pre-order.

It’s good to see that the last years more Delphi books have been published and I hope this MVVM book falls in the more advanced category.

Since I’ve given a few Delphi MVVM talks (latest at https://github.com/jpluimers/Conferences/tree/master/2013/20131121-BE-Delphi) I’m genuinely interested. So I will get this book and – time permitting – write a review.

Nick Hodges did the technical review, and since Nick’s book are great I have high hopes (:

From the APress site:

Full Description

Dive into the world of MVVM, learn how to build modern Windows applications, and prepare for cross-platform development. This book introduces you to the right mindset and demonstrates suitable methodologies that allow for quick understanding of the MVVM paradigm. MVVM in Delphi shows you how to use a quick and efficient MVVM framework that allows for scalability, is of manageable complexity, and provides strong efficiency.

One of the biggest challenges developers face is how to convert legacy and monolithic Delphi applications to the MVVM architecture. This book takes you on a step-by-step journey and teaches you how to adapt an application to fit into the MVVM design.

What you’ll learn

  • Gain the fundamentals of MVVM
  • Visualize MVVM as a design philosophy
  • Create easy-to-use frameworks for building your own MVVM applications
  • Develop a methodology for converting legacy applications to the MVVM pattern
  • Architect cross-platform and multi-lingual applications using the MVVM pattern

Who this book is for

Delphi developers with a good knowledge of Delphi or programming experience in a different language. In addition, this book is attractive to Delphi developers who want to modernize existing applications based on the MVVM design.

and

Table of Contents

1. MVVM as Design Pattern
2. Setting Up the POSApp
3. MVVM as Design Philosophy
4. Two-way Communication
5. MVVM and Delphi
6. Planning the Application
7. Developing the Application
8. How to Convert your App to MVVM
A. Appendix: Other MVVM Delphi frameworks

–jeroen

via: New Book: MVVM in Delphi… [WayBack]

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »

Delphi version info table: C# Builder, Delphi 8 through 10.3 Rio and Appbuilder

Posted by jpluimers on 2016/09/06

I’ve published the Delphi version info table as a Gist: https://gist.github.com/jpluimers/b5891600b73642788b492393710c6070.

Note I need help with these:

The updated script that forms the base of this table is here: https://bitbucket.org/jeroenp/wiert.me/src/tip/Native/Delphi/Scripts/List-Delphi-Installed-Packages.ps1

You can pass any of these args to get information

  • Individual columns:
    • CompanyNames, Versions, ProductNames, ProductVersions, BetaNames. ReleaseDates, Architectures, CharacterSets, Defines, CompilerVersions, RTLVersions, DllSuffixes, ProjectVersions, Frameworks, ProductVersions, ProductFullNames, BaseKeyPaths, HKCU-BaseKeyPaths, HKLM-BaseKeyPaths
  • Base of the below table:
    • ProductSummaries
  • Installed info (installation status obtained through the registry):
    • InstalledProductVersions, InstalledProductFullNames, InstalledProductSummaries, InstalledPackages

An elaborate wrapper around the Define column is jedi.inc which is used in many projects (both open source and closed source) to distinguish between various Delphi versions, libraries and platforms at compile time (URL: github.com/project-jedi/jedi/blob/master/jedi.inc)

Read the rest of this entry »

Posted in .NET, C#, C# Builder, Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 5 Comments »

Delphi: Alt+Down Arrow is the keyboard shortcut for ellipsis buttons

Posted by jpluimers on 2016/09/01

Thanks Primož Gabrijelčič for reminding me on Stack Overflow that Alt + Down opens the dialogs behind ellipsis buttons in the Delphi IDE.

It’s the CUA and Windows short-cut to open drop-down lists (comboboxes) and for opening drop-down list for a property in the object inspector, but I never realised also would work for these ellipsis buttons.

This was my original stack-overflow question: Is there a keyboard shortcut for the ellipsis buttons of the Project Options in the Delphi IDE?

The Project Options in the Delphi IDE has a few option (like the Search Path) each with an ellipsis button (the one on the right having only three dots ... in the image below) to pop-up a dialog.

What keyboard shortcut activates that button?

Project Options with ellipsis button

–jeroen

Via: Object Inspector Keyboard Shortcuts – RAD Studio

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Keyboards and Keyboard Shortcuts, Software Development | Leave a Comment »

Workaround for Printing from Delphi (or the Delphi IDE): three strikes and you get “Printer is not currently printing.” – yes I mentioned “Delphi 8!”

Posted by jpluimers on 2016/08/31

Recently when printing the 3rd time and up, you get this error in many Delphi programs and the Delphi IDE:

Printer is not currently printing.

Printer is not currently printing.

In the past this only occurred when you used a TPrinter and forgot to call BeginDoc.

But now it always occurs after reusing the same TPrinter instance for the 3rd time and up. Since the Delphi Galileo based IDEs (8 and higher; likely older ones as well: the source code printing hasn’t changed in a long time). The error actually occurs twice: after starting a source code print job, but also after cancelling the same failed source code print job.

The second error stroke me as odd, so I went searching for “printer is not currently printing” “IDE” leading to this stack overflow question: c++builder – Why is TPrinter (XE7) suddenly having problems today? – Stack Overflow [WayBack].

The pattern there is using the Printer() function which has been the way the (un)official code examples have shown for ages (Delphi 2007 Printers.Printer Function [WayBack]; earlier examples like Delphi 7 [WayBack] usually in PDF files).

Like in the Delphi 7 “5-32 Developer’s Guide” page example:

procedure TForm1.Button1Click(Sender: TObject); 
var
  r: TRect;
  i: Integer;
begin
  with Printer do
  begin
    r := Rect(200,200,(Pagewidth - 200),(PageHeight - 200)); 
    BeginDoc;
    Canvas.Brush.Style := bsClear;
    for i := 0 to Memo1.Lines.Count do
      Canvas.TextOut(200,200 + (i * Canvas.TextHeight(Memo1.Lines.Strings[i])),
    Memo1.Lines.Strings[i]); 
    Canvas.Brush.Color := clBlack;
    Canvas.FrameRect(r);
    EndDoc; 
  end;
end;

(Yes, that’s back in the D7 days when examples were still using with and not using try/finally statements for resource cleanup).

Actual cause and permanent fix

The printing problems are caused by various recent Windows updates part of MS16-098:

Though MS16-098: Security update for Windows kernel-mode drivers: August 9, 2016 mentions the issue without a fix, KB3177725 in MS16-098: Description of the security update for Windows kernel-mode drivers: August 9, 2016 mentions both the issue and a permanent fix:

After you apply this security update and you print multiple documents in succession, the first two documents may print successfully. However, the third and subsequent documents may not print.

To resolve this issue, install update 3187022. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

3187022 Print functionality is broken after any of the MS16-098 security updates are installed

This article describes printing issues that occur after any of the security updates that are described in Microsoft Security Bulletin MS16-098 are installed in Windows. You can fix these issues by installing the update that is described in this article. Before you install this update, check out the Prerequisites section.

This update applies to the following operating systems:

  • Windows Server 2012 R2
  • Windows 8.1
  • Windows RT 8.1
  • Windows Server 2012
  • Windows Server 2008 R2 Service Pack 1 (SP1)
  • Windows 7 SP1
  • Windows Server 2008 Service Pack 2 (SP2)
  • Windows Vista SP2

No solution for Windows 10 yet…

Until you install the fix: workarounds

For your own code (Thanks Remy Lebau for your answer), add this code for your BeginDoc call:

MyPrinter.Copies := MyPrinter.Copies;

You might want to keep including this in your code as you’re never sure when the end-users apply which Windows update.

For the Delphi IDE either:

  1. Press the “Setup…” button in the “Print Selection” dialog when printing source code, then “OK” in the “Print Setup” dialog:
    Print Selection dialog

    Print Selection dialog

    “Print Setup” dialog.

  2. Uninstall the security updated marked in blue (Security Update for Microsoft Windows (KB3177725):

    Security Update for Microsoft Windows (KB3177725)

    Security Update for Microsoft Windows (KB3177725)

–jeroen

Read the rest of this entry »

Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 8, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 2 Comments »