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
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.
put your resources in a text RC file that can be compiled through a resource compiler
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:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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:
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
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)
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.
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.
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 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:
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:
Press the “Setup…” button in the “Print Selection” dialog when printing source code, then “OK” in the “Print Setup” dialog:
Print Selection dialog
“Print Setup” dialog.
Uninstall the security updated marked in blue (Security Update for Microsoft Windows (KB3177725):