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

Delphi XE3/XE4: removing empty .VLB files; XE5 update 2 and special offers are out. #codingindelphi

Posted by jpluimers on 2013/12/19

Even when not using Visual Live Binding, Delphi generates empty .VLB files in both Delphi XE3 (virtually always) and Delphi XE4 (most of the time).

Visual Live Binding is one way of binding data to UI in FireMonkey and can also be used in VCL, but does not have to (Alister Christie made a nice video ▶ Delphi Training Tutorial #77 – Visual Live Bindings – YouTube about it).

Empty VLB files, and a batch file to delete them

The “empty” VLB files are almost empty, as they are exactly 3 bytes long and contain the byte sequence EF BB BF which is the Unicode BOM (byte order mark) for the UTF-8 encoding. Read the rest of this entry »

Posted in Delphi, Delphi XE3, Delphi XE4, Delphi XE5, Development, Encoding, QC, Software Development, Unicode, UTF-8, UTF8 | Tagged: , | Leave a Comment »

Borland Fun Facts: Matt Pietrek worked there too!

Posted by jpluimers on 2013/12/19

Another episode in the Missed Schedule series that was originally scheduled for 20131201:

Until I read the comments at Monitoring the Monitor, I only knew the early days of Matt Pietrek‘s work at NuMega and as co-author of one of the first Undocumented Windows books (another one appeared about the same time).

Now I know Matt was one of the people interviewing Allen Bauer for his first position at Borland.

A bit more search revealed Matt worked at Borland from 1988 until 1992, roughly the era from Turbo Pascal 5 until Borland Pascal 7 (when Borland already had started researching Delphi), but more importantly with Turbo Debugger versions 1-3 that were indispensable when programming using Turbo C / Turbo C++ and Borland C++.

When Borland was working in Delphi 95, and Microsoft on Windows 95, he moved to Nu-Mega (later Acquired by Compuware) doing lots of work in debuggers.

Some interesting links from or involving Matt:

–jeroen

Posted in Borland Pascal, Debugging, Delphi, Delphi 1, Development, Pascal, Software Development, Turbo Pascal | 2 Comments »

XOR swap/exchange: nowadays an almost extinct means to exchange two distinct variables of the same size

Posted by jpluimers on 2013/12/19

Almost a year ago, a thread on “premature Delphi optimization” came by on G+ about this code:

procedure ExchangeInteger(var AValue1, AValue2: Integer);
begin
  AValue1 := AValue1 xor AValue2;
  AValue2 := AValue1 xor AValue2;
  AValue1 := AValue1 xor AValue2;
end;

I don’t think that was premature optimization, just some code from an old fart that had already been programming in the era where processors had reasons to use it:

Back then, the only efficient way to exchange two variables of the same data type was using the XOR swap algorithm.

Nowadays you have more options, and this is where the fun in that thread began, which I will show in a minute.

First a bit of history

The XOR swap algorithm was widely known in the 80s of last century and before, especially because the 6502 processor (oh the days of LISA Assembler) was vastly popular, as was the Z80. Together, they powered the majority of the home computers in the 70s and 80s.

Read the rest of this entry »

Posted in Borland Pascal, Delphi, Delphi 1, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Development, History, Pascal, Software Development, Turbo Pascal, UCSD Pascal | 7 Comments »

Generating complex math visualizations in SVG using C# and ILNumerics – Scott Hanselman

Posted by jpluimers on 2013/12/15

Funny how Generating complex math visualizations in SVG using C# and ILNumerics and MathViz (no, not this MathViz!) look so similar.

I hope the MathViz code becomes public one day.

–jeroen

via: Generating complex math visualizations in SVG using C# and ILNumerics – Scott Hanselman.

Posted in .NET, Delphi, Development, HTML, HTML5, iOS Development, Mobile Development, Software Development, Web Development | Leave a Comment »

Delphi postbuild events: interesting take by David Heffernan (via: Stack Overflow)

Posted by jpluimers on 2013/12/12

StackOverflow user David Heffernan – Stack Overflow has an interesting take on Delphi postbuild events:

At the moment my actiona read:

if exist PostBuild.bat call PostBuild.bat $(Platform) $(Config) $(OutputDir)

And then the PostBuild.bat script calls a Python script so that I can write my scripts in a real language.

I actually impose the build actions in a shared option set that I reference from all of my projects. That way I enforce consistency and predictability.

I know others use tools like FinalBuilder but building is so important that I feel it’s worth my effort in rolling my own tooling.
– David Heffernan Feb 14 at 20:24

–jeroen

via: Delphi XE3: Problems with complex pre-build events – Stack Overflow.

Posted in Delphi, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | Leave a Comment »

Funny Delphi code of the day: on literals

Posted by jpluimers on 2013/12/09

The fact that the [WayBack] 31-character limit on ClientDataSet field and index names is worse, but I just encountered this GetParamNameWODog function in a Delphi 3rd party library:


function GetParamNameWODog(const ParamName: _string): _string;
begin
if (ParamName <> '') and (ParamName[1] = '@') then
Result := Copy(ParamName, 2, 1000)
else
Result := ParamName;
end;

What’s wrong with using the Length function here?

Yes, SQL Parameter names will probably less than 1000 characters, but then the 1000 literal should be a constant with a meaningful name, and the '@' literal should be too. Read the rest of this entry »

Posted in Delphi, Delphi XE3, Development, QC, Software Development | Tagged: , , | 12 Comments »

Owly CI should team up with Ohloh

Posted by jpluimers on 2013/12/05

This was originally scheduled for December 1st at noon and therefore made it to the “Missed Schedule” list as well:

Two interesting sites I found recently:

OwlyCI is like NuGet for Delphi. They add Delphi open source repositories, and provide them as installable packages, and shows build statistics.

Ohloh provides statistics (including build statistics!) for open source repositories (any language and environment)  and shows various other statistics like check in counts, LoC, etc. Koders merged into Oholoh about a year ago.

I think they should team up (:

–jeroen

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

Windows Development: Switching JIT debuggers (via: Stack Overflow)

Posted by jpluimers on 2013/12/03

StackOverflow user User Sertac Akyuz posted a small Delphi snippet showing how to switch the Windows JIT debugger.

I’ll need to complete it somewhere, but since the concept is interesting, here is his answer:

Write a simple application that would launch the debugger you want in case of an application crash.

Register your app in

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug

In case of an 64bit OS, also to the following key

HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug

add/modify the string named Debugger with value:

"C:..\Win32\Debug\Project1.exe" %ld %ld

A very simple application:

procedure TForm1.FormCreate(Sender: TObject);
begin
  ComboBox1.Items.Add('BDS 16');
  ComboBox1.Items.Add('BDS 15');
  ComboBox1.Items.Add('WinDbg');
  ComboBox1.Items.Add('VS');
  // etc..
  ComboBox1.ItemIndex := 0;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  proc: THandle;
begin
  Assert(ParamCount >= 2);
  proc := OpenProcess(SYNCHRONIZE, False, StrToInt(ParamStr(1)));
  case ComboBox1.ItemIndex of
    0: ShellExecute(0, '', 'C:\..\RAD Studio\9.0\bin\bds.exe',
          PChar(Format('/attach:%s;%s', [ParamStr(1), ParamStr(2)])), '',
          SW_SHOWNORMAL);
    1 : // etc..
    2: ShellExecute(0, '', 'C:\Program Files (x86)\..\windbg.exe',
          PChar(Format('-p %s -e %s -g', [ParamStr(1), ParamStr(2)])), '',
          SW_SHOWNORMAL);
    3: ShellExecute(0, '', 'C:\Windows\system32\VSJitDebugger.exe',
          PChar(Format('-p %s -e %s', [ParamStr(1), ParamStr(2)])), '',
          SW_SHOWNORMAL);
    //..
  end;
  if Bool(proc) then begin
    WaitForSingleObject(proc, INFINITE);
    Application.Terminate;
  end;
end;

–jeroen

via: windows – Switching JIT debuggers? – Stack Overflow.

Posted in .NET, Delphi, Development, Software Development, Visual Studio and tools | Leave a Comment »

Development tools should become more version control friendly, and version control tools more whitespace tolerant

Posted by jpluimers on 2013/11/28

There are a few more messages in the “Missed Schedule” backlog, and I really hope that WordPress is going to address this really annoying bug soon as I have to recheck my blog multiple times a day now.

Back on topic:

Development tools should become more version control friendly, and version control tools more whitespace tolerant

I’m taking Delphi and Bitbucket here as an example, but this holds for many more development tools and version control tools.

Ultimately, you want changes to be as simple as this one: only the relevant changed lines show up as an actual change.

But often changes include convoluted non-relevant information.

A few things development tools should not do: Read the rest of this entry »

Posted in .NET, C#, Delphi, Development, DVCS - Distributed Version Control, Software Development, Source Code Management, Visual Studio and tools | 2 Comments »

Delphi .dproj files: FrameworkType and FormType (via: Embarcadero Discussion Forums)

Posted by jpluimers on 2013/11/28

One more of the “Missed Schedule” series, this time it was originally scheduled for October 1st, (2013 that is).

Delphi XE2 and up introduced the FrameworkType and FormType elements in the .dproj files to distinguish between VCL and different flavours of FireMonkey.

Actually, Delphi XE1 already had the value None for FrameworkType, so some cross-platform changes trickled into the Delphi builds early.

Though the IDE writes these values to the .dproj files, you [Wayback/Archive] cannot change their values from within the Delphi IDE, not even through the Open Tools API.

There is no documentation about the values in the .dproj files. the only places I could find were these about FrameworkType in combination with [Wayback/Archive] Actions:

that basically tell this:

FrameworkType

Defines whether an action is created for the VCL or FireMonkey (FMX) framework. The default of this parameter is VCL (for compatibility with legacy applications).

This parameter is used to avoid situations when VCL actions are used in FireMonkey applications and inversely; this can lead to a serious increase in an application’s size and to execution errors, for example, calling of Windows API under MacOS.

But it is incomplete, and there is no documentation about FormType. Read the rest of this entry »

Posted in Delphi, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Development, Missed Schedule, SocialMedia, Software Development, WordPress | Leave a Comment »