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,860 other subscribers

Archive for the ‘Delphi’ Category

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 »

TMemIniFile have non-virtual SetStrings procedure. To add support processing of…

Posted by jpluimers on 2016/10/05

TMemIniFile have non-virtual SetStrings procedure.

One of the classic Delphi RTL examples of Delphi team members  not reading Delphi Component Design by +Danny Thorpe 

You can still get it for a few dollars, used: http://www.amazon.com/Delphi-Component-Design-Danny-Thorpe/dp/0201461366

–jeroen

via: TMemIniFile have non-virtual SetStrings procedure. To add support processing of….

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

Delphi XE8 [dcc32 Fatal Error] dcc32_F2084_C2359.dpr(30): F2084 Internal Error: C2359

Posted by jpluimers on 2016/10/05

Fails in Delphi XE8 with a nice [dcc32 Fatal Error] dcc32_F2084_C2359.dpr(27): F2084 Internal Error: C2359

It is fixed in Delphi 10.0 Berlin, but of course a C2359 search does not reveal that as Quality Portal is behind a wall. So for future reference the bug: [RSP-13471] Int64 for loops can generate Internal Compiler Error – Embarcadero Technologies. Thanks +Stefan Glienke for mentioning the issue.

program dcc32_F2084_C2359;

type
  TNumber = Int64; // UInt64; // fails too; other numeric types do not fail. Fails in a unit as well.
  TNumbers = TArray;
  TNumberRange = record
  strict private
    function GetLowerBound: TNumber;
  public
    function Numbers: TNumbers;
    property LowerBound: TNumber read GetLowerBound;
  end;

{ TNumberRange }

function TNumberRange.GetLowerBound: TNumber;
begin
  Result := Default(TNumber);
end;

function TNumberRange.Numbers: TNumbers;
var
  lValue: TNumber;
begin
  for lValue := LowerBound to LowerBound do
  ;
end;

begin
end.

–jeroen

Read the rest of this entry »

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

If you thought you could do multi-threading, then play “The Deadlock Empire” games

Posted by jpluimers on 2016/10/04

Slay dragons, learn concurrency! Play the cunning Scheduler, exploit flawed programs and defeat the armies of the Parallel Wizard.

Source: The Deadlock Empire

Via: Face the dragon. Learn the ropes of concurrent programming. – Lars Fosdal – Google+

Source code is available and focuses on C#; maybe one day I’ll make a Delphi version: deadlockempire/deadlockempire.github.io: The Deadlock Empire: Slay dragons, learn concurrency!

BTW: a great book (with nice illustrations at both github and kernel.org) is Source: Is Parallel Programming Hard, And, If So, What Can You Do About It? [WayBack]

–jeroen

Posted in .NET, C#, Delphi, Development, Multi-Threading / Concurrency, Software Development | Leave a Comment »

TODO: Check if Continua CI parsesl DUnit XML FinalBuilder emitted XML when using pure DUnit tests and TRepeatedTest ones

Posted by jpluimers on 2016/09/29

On my TODO list.

References:

This in order to get rid of MSXML dependencies in cross platform Delphi development.

–jeroen

Posted in Continua CI, Continuous Integration, Delphi, Development, DUnit, Software Development | 2 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 »

I’m looking for an algorithm that converts a list of integers (for instance of…

Posted by jpluimers on 2016/09/28

Got a very quick response Range combo – Paste.ie – Irish For Pastebin on:

I’m looking for an algorithm that converts a list of integers (for instance of pages to be printed) from this form:1,2,3,4,6,7,8,13,14into1-4,6-8,13-14… – Jeroen Wiert Pluimers – Google+

I’ll write some unit tests soon and make it into a unit for testing.

For now it looks exactly what I need. In addition, I learned how this algorithm is called Range extraction – Rosetta Code and the opposite Range expansion – Rosetta Code.

Basically these lists are the format where a user can enter the range of pages to be printed.

The code by Asbjørn Heid uses a Functional record definition allowing for function binding just like in C++ Boost.Bind [WayBack].

Based on that, I made this changeset: https://bitbucket.org/jeroenp/besharp.net/commits/7205b070a4e6457675a083b78d26659da506fc08

–jeroen

via: I’m looking for an algorithm that converts a list of integers (for instance of…

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

The Oracle at Delphi: Set in my ways

Posted by jpluimers on 2016/09/28

A few pieces of Delphi compiler history:

Allen Bauer:

Most notably, the Object Pascal/Delphi compiler is written in mostly C with a smattering of C++, the editor kernel (sans display rendering) and debugger engine (process control/symbol table management) were written in C++. All of which I’ve worked on throughout my 24+ years on that team.

The 16bit compiler was written in pure assembler. The current compiler is written in C. It was derived from an Amiga 68000 Turbo Pascal compatible compiler. It’s never been written in Object Pascal.

That being said, there was an effort several years ago to completely rework/re-architect the compiler. That was done in OP. It just barely got to the “hello world” stage before it was set aside.

Source: The Oracle at Delphi: Set in my ways [WayBack]

–jeroen

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

Analyzing website performance with the Windows Performance Toolkit | Microsoft Edge Dev Blog

Posted by jpluimers on 2016/09/27

On my research list:

Slow pages lose users: research from Bing and Google indicates that delays as small as half a second can impact business metrics. To build fast sites, developers need powerful tools to analyze the …

Source: Analyzing website performance with the Windows Performance Toolkit | Microsoft Edge Dev Blog

via:

If you’re developing on Windows.. a must read article on analyzing webperf with Windows Performance Toolkit. – Ilya Grigorik – Google+

–jeroen

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

Nick Hodges Joins Embarcadero as Product Management Lead

Posted by jpluimers on 2016/09/23

And the other bomb-shell: Nick Hodges Joins Embarcadero as Product Management Lead

Interesting times in the Delphi community…

And I really wonder if this affects Delphi Developer Days 2016, Nick Hodges & Cary Jensen.

–jeroen

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