Serguei_Tarassov's blog

Installing Delphi 7 on Windows 7/8/10/Server 2012

How to install and use Delphi 7 and help files on Windows 8/10 or Server 2012.

Installation

Start Delphi setup and install all required items including help files.

In Windows 8/Server 2012 or later (should work on Windows 7 too):

  • Create the shortcut to Delphi32.exe
  • Open shortcut properties and set "run as administrator" option
  • Add Delphi to the of DEP (Data Execution Prevention). Go to My Computer - Properties - Advanced System Settings - Performance Settings - Data Execution Prevention

Bit-packed structure (record) in Free Pascal and Delphi

Here is the code explaining some methods to pack bit accessing logic in your program.

program project1;
 
type
  TRec1 = packed record // Doesn't pack at all
    b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16: boolean;
  end;
 
  TRec2 = bitpacked record // Free Pascal specific
    b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16: boolean;
  end;
 
  TRecByte = (b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16);
  TRecBytes = set of TRecByte;
var
  r1: TRec1;
  r2: TRec2;
  s1: TRecBytes;

Windows XP multiprocessor/core support

How to add support of multi-core/multiprocessor support to Windows XP SP3?

Run this in command line:

rundll32 syssetup,SetupInfObjectInstallAction ACPIAPIC_MP_HAL 128 %windir%\inf\hal.inf

This command replace single-core kernel to multi-core kernel without reinstalling Windows. You should be required to confirm driver installation and to reboot twice.

Sorted map vs hashed map

In theory, hash map structure should be very fast on retrieving by key operations, close to O(1) like for an array. A sorted map (keys are sorted) should be O(log2 N) instead. The following test checks the difference.

Common scenario

We will use one tester class per type of tested structure. The keys are string[10] and are generated randomly in prepared array to avoid additional checks whether the key exists or not.

Why need to specify unit names?

In the previous article "Crack C# namespaces in 30 seconds" I demonstrated how to make error having no idea about it. So you will have a lovely time in debugging. But in C# you're condemned to use using directive or your code will be unreadable with all these horrible specifiers MySolution.AppModules.Accounting.AccountingType.DefaultValue.

Pages

Subscribe to RSS - Serguei_Tarassov's blog