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

Session plan for all of CodeRage XII (starts 20171107)

Posted by jpluimers on 2017/11/07

Schedule in European time zone:

Schedule in USA time zones:

–jeroen

via: [WayBack] If you’re not sure what the sessions are at this year’s CodeRage – here’s a full list and timetable. CodeRage is a free multi-day online conference wit… – David Millington – Google+

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

Delphi history: on why was TypInfo.pas is not named TypeInfo…

Posted by jpluimers on 2017/11/02

[WayBack] A colleague and I was just wondering, why was TypInfo.pas not named TypeInfo.pas? The original theory of 8.3 naming convention doesn’t hold as TypInfo i… – Willo “qbitza” van der Merwe – Google+

Because of collision: though hardly documented in the early Delphi days the standard function TypeInfo has been there forever so System.TypeInfo already takes TypeInfo in the global namespace as the System unit is used by default and doesn’t have a namespace prefix.

One more reason to suffix unit names with a word like Unit.

And one more reason to always get a Delphi version with source code for RTL/VCL/…: it’s an invaluable source for not so well documented things.

The TypInfo name was also from an era when some people hadn’t learned yet dat using abbrvtns is a sin. Ken Thompson has learned [WayBackspell it with an “e” · golang/go@c90d392 but we’re suck with StrPas, StrUtils, IntToStr and others forever like Unix is stuck with creat(2): [WayBackcreat(2): open/possibly create file/device – Linux man page and [WayBackhistory – What did Ken Thompson mean when he said, “I’d spell creat with an ‘e’.” – Unix & Linux Stack Exchange.

–jeroen

References:

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

{$DUPLICATEENABLE ON} against name collisions in Delphi…

Posted by jpluimers on 2017/11/01

Need to research {$DUPLICATEENABLE ON} further one day, but surely looks useful but is not really documented, not even at the Delphi 2009 documentation where it was introduced: [WayBackSysUtils.pfIgnoreDupUnits Constant.

–jeroen

Via: [WayBackMonkeyMixer has just been updated!- I’ve fixed a unit naming collision with Castlia- I’ve added an XE7 project group (which includes both the BPL and… – Simon Stuart – Google+

PS:

A cryptic G+ comment [WayBack] by Uwe Schuster:

DUPLICATEENABLE is old, but since it is something for IDE packages to avoid intersections with user/3rd party packages there is no need for a documentation. I do use it in an IDE package that did use the JCL/JVCL units as well and does another unit with a common name. IIRC I did mention it related to MonkeyMixer.

I think he argues that documentation is both not needed, but the usage of the directive sometimes is. Which somehow feels like a contradiction to me.

PS2: via Stefan Glienke, an error message that is related to this:

---------------------------
Error
---------------------------
Cannot load package 'Package2.'  It contains unit 'Whatever', which is also contained in package 'Package1'.
---------------------------
OK
---------------------------

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

Especially important for Delphi users on Windows 10 Creators Update: IDE Fix Pack 6.1 released | Andy’s Blog and Tools

Posted by jpluimers on 2017/10/31

The new [Archive.isIDE Fix Pack 6.1 released | Andy’s Blog and Tools is huge, especially for Windows 10 targets:

Windows 10 Creators Update 1703 caused issues with all Delphi programs, libraries and packages because it changed how Windows loads imported DLLs in such a way that it causes performance issues and can crash the debugger.

Delphi 10.2 Tokyo Update 2 fixed this by not producing multiple dll import sections for one DLL anymore.

IDE Fix Pack 6.1 implements that “feature” for all previous Delphi versions (2009-10.1 Berlin) and extends it to not only eliminate duplicate dll imports but also duplicate delay dll imports.

There are also (optional) updates that you can enable with new compiler switches:

  • Eliminating fwait instructions (but be careful, as they can confuse the debugger)
  • Optimising calls to virtual methods through interfaces
  • Optimising certain function prolog code

There are some smaller changes too.

I’m going to try this soon.

–jeroen

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

Until someone writes proper string visualisers for the Delphi debugger…

Posted by jpluimers on 2017/10/31

A few tricks to write long strings to files when the Delphi debugger cuts them off (just because they like using 4k buffers internally);

  • TStringStream.Create(lRequestMessage).SaveToFile('c:\temp\temp.txt')
  • TIniFile.Create('c:\a.txt').WriteString('a','a',BigStringVar)
  • TFileStream.Create('c:\a.txt', fmCreate or fmShareDenyNone).WriteBuffer(Pointer(TEncoding.UTF8.GetBytes(BigStringVar))^,Length(TEncoding.UTF8.GetBytes(BigStringVar)))

They all work form the debug inspector, but they do leak memory. See comments below.

Via:

–jeroen

Read the rest of this entry »

Posted in About, Conference Topics, Conferences, Delphi, Development, Encoding, Event, Software Development | 6 Comments »

The Format function introduced in Delphi 1 was based on the FormatStr function in Turbo Vision available in Turbo Pascal 6 or higher

Posted by jpluimers on 2017/10/26

I did find my Borland Pascal 7.0.1 ISO which showed that https://github.com/romiras/turbo-pascal-archive/blob/master/Files/Dos%20Navigator/FORMAT.ASM is identical to ./BP/RTL/TV/FORMAT.ASM which is used from ./BP/RTL/TV/DRIVERS.PAS to provide this:

{ String formatting routines }

{$L FORMAT.OBJ}

procedure FormatStr(var Result: String; const Format: String; var Params);external {FORMAT};

There are various examples like in ./BP/EXAMPLES/DOS/TVDEMO/ASCIITAB.PAS at line 143:

FormatStr(TempStr, ' Char: %c Decimal: %0# Hex: %0#x ', ASCIIChar);

So it was in the Drivers unit, but also easy to incorporate in your own unit by linking the .OBJ file and providing the external declaration in any unit.

The Drivers unit is very independent of the rest of Turbo Vision: it uses the Objects unit (which most projects use as the System unit at ~500 lines of code provided very little functionality by itself).

For the diskette based install, the .TPU files were on the standard disks and the sources for both RTL and Turbo Vision on separate disks, but anyone would install them as they provided a lot of insight. The CD-ROM has them all on the same medium (both as installers and unpacked in the BP directory).

I just checked Turbo Pascal 6.0 (that I did have a VM for) which has them in the same way.

Source: [WayBackWe’re discussing with the collegues: anybody knows when Format function was introduced in Delphi? – Klaus Edelmann – Google+

–jeroen

Posted in Borland Pascal, Delphi, Development, History, Pascal, Software Development, Turbo Pascal | Leave a Comment »

EKON 21 – The Conference for Delphi & More

Posted by jpluimers on 2017/10/24

I barely made it to EKON21 mainly because of extensive family members care-taking, so could not attend everything and archived the site for

The Conference for Delphi & More | 23 – 25 October 2017, Cologne | presented by Entwickler Akademie and Entwickler Magazin

[WayBackEKON 21 – The Conference for Delphi & More:

It seems one older conference is archived.

–jeroen

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

delphi – VCL events with anonymous methods – what do you think about this implementation? – Stack Overflow

Posted by jpluimers on 2017/10/19

A long time ago, Pablo Vizcay a.k.a. [WayBackpragmatic_programmer wrote some cool code at [WayBackdelphi – VCL events with anonymous methods – what do you think about this implementation? – Stack Overflow.

I still think it’s a very neat solution to bind method references to events.

type
  TNotifyEventDispatcher = class(TComponent)
  protected
    FClosure: TProc<TObject>;

    procedure OnNotifyEvent(Sender: TObject);
  public
    class function Create(Owner: TComponent; Closure: TProc<TObject>): TNotifyEvent; overload;

    function Attach(Closure: TProc<TObject>): TNotifyEvent;
  end;

implementation

class function TNotifyEventDispatcher.Create(Owner: TComponent; Closure: TProc<TObject>): TNotifyEvent;
begin
  Result := TNotifyEventDispatcher.Create(Owner).Attach(Closure)
end;

function TNotifyEventDispatcher.Attach(Closure: TProc<TObject>): TNotifyEvent;
begin
  FClosure := Closure;
  Result := Self.OnNotifyEvent
end;

procedure TNotifyEventDispatcher.OnNotifyEvent(Sender: TObject);
begin
  if Assigned(FClosure) then
    FClosure(Sender)
end;

end.

And this is how it’s used for example:

procedure TForm1.FormCreate(Sender: TObject);
begin    
  Button1.OnClick := TNotifyEventDispatcher.Create(Self,
    procedure (Sender: TObject)
    begin
      Self.Caption := 'DONE!'
    end)
end;

–jeroen

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 | 1 Comment »

Why Delphi users love @TMSsoftwareNews: bugfix within 2.5 hours.

Posted by jpluimers on 2017/10/17

People love @TMSSoftwareNews because of the short bug-fix turnaround. In this case 2.5 hours: [WayBack@jpluimers: @TMSsoftwareNews when entering a perfectly valid email address like word.word+tag.subtag@gmail.com: Please enter a valid Email Address.

–jeroen

Read the rest of this entry »

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

TEncryptedIniFile: easy to use class for handling app settings with encryption in Delphi – TMS Software Blog

Posted by jpluimers on 2017/10/17

[WayBackTMS Software | Blog | TEncryptedIniFile: easy to use class for handling app settings with encryption

via: [WayBackA new blog has been posted:TEncryptedIniFile: easy to use class for handling app settings with encryption – Michael Thuma – Google+

I wonder how that works with encryption algorithms based on thin Delphi wrappers around proven open source encryption libraries.

–jeroen

PS: Note the G+ link died. Not sure why, but that’s why I archived the original as a WayBack link when writing this post.

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