Archive for the ‘Delphi’ Category
Posted by jpluimers on 2020/03/17
For my link archive if I want to make Explorer (for Linux caja) or console shortcuts to source or target directories: [WayBack] Fast-Forward »: My Lazarus External Tools with these XML files from [WayBack] Lazarus External Tools · GitHub:
And the Delphi equivalent from 2004: [WayBack] Fast-Forward »: My Delphi Tools, which addes “Open Source in Notepad2” and “Start Resource Explorer”.
via: [WayBack] Ondrej Kelle – Google+
–jeroen
Read the rest of this entry »
Posted in Delphi, Development, Lazarus, Software Development | Leave a Comment »
Posted by jpluimers on 2020/03/17
A few notes from my response to [WayBack] [Fatal error] F2084 Internal error : AV101E53EB-R0000000C-0 I’m getting this when trying to do some code completion. Any idea ? – Stéphane Wierzbicki – Google+:
This compiler related error usually made it go away for me either when it occurs during project compilation or when using code completion: Close the IDE. Delete your DCU files. Then restart the IDE.
Starting fresh gives a high chance if fixing this unless it is indeed a compiler related error in which case it returns. For that you need to trim down your code to see under which circumstances.
Reasoning (please shoot at it when things are wrong/missing):
Both the IDE code completion and the project compilation use the compiler. The DCU cache is shared between these compiler instances. The DCU cache depends on internal memory structures. Various pointer related errors (both from the IDE, compiler and 3rd party extensions) can damage this cache.
Especially weak IDE uses of the compiler are the find symbol and rename symbol functionalities. I’ve stopped using those about a decade ago.
Sometimes the F2084 (which I often mistype as F2048) is indeed an error in the compiler. Over the years, some of them have been fixed too. See my earlier articles on F2084.
–jeroen
Posted in Conference Topics, Conferences, Delphi, Development, Event, F2084, Software Development | Leave a Comment »
Posted by jpluimers on 2020/03/11
Bad surprise of the day: SysUtils.TEncoding in XE2+ defaults to ANSI, while in XE it defaulted to UTF-8 .Among other things this means that TStringList… – Eric Grange – Google+
Source: Bad surprise of the day: SysUtils.TEncoding in XE2+ defaults to ANSI, while i…
Delphi

+Stefan Glienke Indeed, you’re right. The issue must be deeper somewhere. Don’t have time to investigate too much, I’m bypassing the RTL now (also have to work around the limitation that for utf-8 the TEncoding.GetString method returns an empty string if one character in the buffer isn’t utf-8)

I wouldn’t trust the RTL at all with loading non-ascii text, we’ve had it hang on invalid UTF-8 codes more than once.
–jeroen
Posted in Ansi, Delphi, Development, Encoding, Software Development, UTF-8, UTF8 | Leave a Comment »
Posted by jpluimers on 2020/03/03
Too many people forget this (including myself) every now and then) so here is a reminder to use the [WayBack] SetString method when assigning strings from memory regions having characters but no null terminator:
Anyway, assuming that you use a Unicode Delphi you want to use SetString in its place:
SetString(password, PWideChar(Credential.CredentialBlob), Credential.CredentialBlobSize div 2);
It was by David Heffernan commenting on [WayBack] I have this code sample on StackOverflow using a function WideCharToWideString… I can’t seem to find anything on this function… – Nils Guillermin – Google+.
Note that like the above Delphi 2009 link (where it is a WideChar function to Unicode string conversion function), it was also available in Delphi 2007 and earlier as [WayBack] SetString.
–jeroen
Posted in Delphi, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2020/02/26
As this is still an issue with current Delphi versions: every now and then it looses which designers are needed for a frame:
[WayBack] What is the easiest way of getting Delphi to accept a newly added file as a frame and to treat it as such? – Stack Overflow (by Brian Frost)
<DCCReference Include="x\y\z\myFrame.pas">
<Form>frameMy</Form>
<FormType>dfm</FormType>
<DesignClass>TFrame</DesignClass>
</DCCReference>
Then check your .dfm file to see if it starts with the correct inherited or object as per Delphi – TInterfacedDataModule revisted – use ‘inherited’ in your .dfm files when your datamodules look like forms in the designer.
Oh and at design time, be very careful embedding frames. Better not to do it at all and for certain: do not embed frames in a nested way: [WayBack] Frames in 10.2.2 Hi Has anyone else had issues with frames under 10.2.2? The project seems to have lost its links to the frames? If I went to the Too… – Vince Bartlett – Google+
–jeroen
Posted in Delphi, Development, Software Development | 1 Comment »
Posted by jpluimers on 2020/02/26
This post is a reminder to myself that not all mappings from XSD to programming languages are possible.
There are many impossible cases, so this is just a general reminder.
A Delphi specific case for instance is the mapping of enumerations: one reason is that XSD enumerations are case sensitive, but the Delphi language is not: [WayBack] Using XML Enumerations with Delphi XML Data Binding Wizard – Stack Overflow.
More generic examples from my answer to the above question:
- In XSD you can derive from an existing type in two ways: extending it and limiting it. Object Oriented languages only allow you extend when deriving.
- Delphi is not alone in these kinds of limitations. Generating wrappers from XSD schema’s is the field of specialized tools, even in the Java or .NET world.
I’ve seen horrible things with wildcards that are sort of mappable to Java, but not to C#. This could likely go on for much longer…
–jeroen
Posted in C#, Delphi, Development, Java, Java Platform, Software Development, XML, XML/XSD, XSD | 2 Comments »
Posted by jpluimers on 2020/02/25
I missed this one, so I was glad I archived it because I was curious for Daan van der Werf – Delphi op de werkvloer “Groothandel & Magazijn”.
So here it is: [WayBack] Delphi Conference 2018 – Barnsten.com, with fixed and archived links where possible.
Presentations and code from the Delphi Conference 2018
…
- 09:30-10:30 – Keynote: Marco Cantú – Product Manager Delphi – “Delphi 10 for Windows 10 and beyond”
- 10:30-11:30 – Brian Long – Creative Delphi Debugging Techniques
- 11:50:12-40 – Brian Long – How to Access the Android API
- 11:50:12-40 – Bruno Fierens – A RADically new way to develop modern web applications
- 13:30-14:20 – Roald van Doorn – Continuous delivery with existing VCL Applications
- 13:30-14:20 – Daan van der Werf – Delphi op de werkvloer “Groothandel & Magazijn”
- 14:30-15:20 – Danny Wind – Micro Services and Progressive Web Apps (PWA) Delphi
- 14:30-15:20 – Bob Swart – Delphi en FireDAC Enterprise Connectors
- 15:40-16:30 – André Mussche – De opkomst van spraakherkenning
- 15:40-16:30 – Marco Cantù – RAD Server In Depth
–jeroen
Posted in Conferences, Delphi, Development, Event, Software Development | 2 Comments »
Posted by jpluimers on 2020/02/25
Reminder so self: [WayBack] sglienke / Spring4D / source / Source / Reactive / Spring.Reactive.pas — Bitbucket fragments:
type
TInterlocked = SyncObjs.TInterlocked;
TInterlockedHelper = class helper for TInterlocked // TODO: move to Spring.pas
class function CompareExchange<T: IInterface>(var Target: T; const Value, Comparand: T): T; overload; static;
class function Exchange<T: IInterface>(var Target: T; const Value: T): T; overload; static;
end;
{$REGION 'TInterlockedHelper'}
class function TInterlockedHelper.CompareExchange<T>(var Target: T;
const Value, Comparand: T): T;
begin
Result := Default(T);
PPointer(@Result)^ := CompareExchange(PPointer(@Target)^, PPointer(@Value)^, PPointer(@Comparand)^);
if PPointer(@Result)^ = PPointer(@Comparand)^ then
begin
if Assigned(Value) then
Value._AddRef;
end
else
if Assigned(Result) then
Result._AddRef;
end;
class function TInterlockedHelper.Exchange<T>(var Target: T;
const Value: T): T;
begin
Result := Default(T);
PPointer(@Result)^ := Exchange(PPointer(@Target)^, PPointer(@Value)^);
if Assigned(Value) then
Value._AddRef;
end;
{$ENDREGION}a
–jeroen
Posted in Delphi, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2020/02/20
From an interesting discussion at [Archive.is/WayBack] FaceBook: Delphi developer thread by Jarto Tarpio with some measurements by Jarto Tarpio and André Mussche.
- Manipulation of strings and lists in Delphi have high memory allocation/deallocation rates, so HTTP related services with high call rates are affected more than regular services
- FastMM:
- conditional defines that can help are
NeverSleepOnThreadContention, UseSwitchToThread, and UseReleaseStack then measure.
- has one huge advantage: It’s very, very good at keeping memory fragmentation at bay
- default settings are for applications that use lots of CPU, but have no really high memory allocation/deallocation rates
- has very good debugging facilities
- Under
FullDebugMode address space is never released back to the operating system so once the address space has been exhausted there is very little room to manoeuvre.
- TCMalloc:
- is very good at multi-threaded memory management with high allocation/deallocation rates
- needs to be persuaded to releases memory to the OS:
it only releases to the system under two occasions: Freeing another part of the memory, or asking it to release all parts marked as freed.
- has no debugging facilities
The differences make it a challenge to integrate in your development and deployment process: because of the debugging facilities, you’d like FastMM in all your environments, but TCMalloc in multi-threaded environments with high allocation/deallocation rates.
One possibility is to have your CI environment deliver both in all stages, run all tests on both, then choose the final one depending on your run-time configuration.
That gives a burden on configuring your Continuous Integration, but the gain might outweigh this cost.
Relevant links from the Facebook thread:
–jeroen
Posted in Delphi, Development, FastMM, Software Development | 5 Comments »