Delphi.Masterpiece.Connections and ini settings

Connection to postgres

Adding ini file, for ex. Domain.Registry.Tests.ini

[HostConnectionSettings.Sections.|sbsmb|.{B3026AF7-6447-438B-897D-835ADBF020AA}.PG]
Ip=localhost
Port=5432
VendorHome=..\libpq
Login=DAF7528291F804C0F9CA0F0C1B8085E51D4AB8AEF226D194
Password=
Name=sbsmb

Connecting in the code

  var LConns := Service<IConnections>(S_FD_PGId);
  FConnection := LConns['sbsmb'];

Watch settings from ini in the code

  var LSettingsPG := Service<ISections<IHostConnectionSetting>>.All.Values;
  var LCount := LSettingsPG.Count;

For Oracle it will be IHostConnectionSetting in spite of IConnectionSetting

Posted in Без рубрики | Leave a comment

Delphi. Difference between virtual and non virtual constructor.

This difference only takes place when we use class of.

Good explanation of it is on the StackOverflow. I realized an example from SO below.

Posted in Без рубрики | Comments Off on Delphi. Difference between virtual and non virtual constructor.

Js.WebPack.TryoutsWithTwoApps

Good example lives here.

And here is first tryout – 2 apps, first loadind the second through Module Federation.

And there was a problem about order of loading, leading to the following error.

Key things are the following

app1 loads app2 like this

Continue reading
Posted in Без рубрики | Comments Off on Js.WebPack.TryoutsWithTwoApps

Delphi.Masterpiece.What is the log path in masterpiece platform ?

it is defined in application context

constructor TApplicationContext.Create;
...
FLogPath := IncludeTrailingPathDelimiter(TPath.GetHomePath) + csLogDir;
...

for me it is

'C:\Users\stanley\AppData\Roaming\Logs\'
Posted in Без рубрики | Comments Off on Delphi.Masterpiece.What is the log path in masterpiece platform ?

TpLink. Forward Port

Example

Posted in Без рубрики | Comments Off on TpLink. Forward Port

Delphi. ConstantArrays

Examples

type
    TShopItem = record
      Name : string;
      Price : currency;
    end;
 
 const
    Days : array[0..6] of string =
    (
      'Sun', 'Mon', 'Tue', 'Wed',
      'Thu', 'Fri', 'Sat'
    ) ;
 
    CursorMode : array[boolean] of TCursor =
    (
      crHourGlass, crSQLWait
    ) ;
 
    Items : array[1..3] of TShopItem =
    (
      (Name : 'Clock'; Price : 20.99),
      (Name : 'Pencil'; Price : 15.75),
      (Name : 'Board'; Price : 42.96)
    ) ; 
Posted in Без рубрики | Comments Off on Delphi. ConstantArrays

Delphi. Enum and strings

working approach

Result := System.TypInfo.GetEnumName (TypeInfo (TEnum), Ord (FEnum)));

other approaches

TEnum = (enOne, enTwo, enThree, enFour, enFive, enSix);

// 1
case Self of
    enOne   : Result := 'One';

// 2
const cOne: strig = 'One';
...
case Self of
    enOne   : Result := cOne;

// 3
const cEnumStr: array[TEnum] of string = ('One', 'Two', 'Three', 'Four', 'Five', 'Six');
...
Result := cEnumStr[Self];

Source

Posted in Без рубрики | Comments Off on Delphi. Enum and strings

Git.Add putty to System Variables

If to add putty to system vars, then we can fetch,pull and so on without logging. That’s cool when you have tons of submodules.

Posted in Без рубрики | Comments Off on Git.Add putty to System Variables

How to install openssl cert on local machine and how to combine them?

Example

Opent Git Bash and execute like the following

openssl 
pkcs12 -in C:\Work\ShopSberPayQR\Services\QRCode\Sber\Win32\sberPortalAppsCerts\Main\certificate_fc24d66b-7fdf-446b-85c4-b013d7371f17.p12 -nodes -nocerts -out C:\Work\ShopSberPayQR\Services\QRCode\Sber\Win32\sberPortalAppsCerts\Main\private.key

pkcs12 -in C:\Work\ShopSberPayQR\Services\QRCode\Sber\Win32\sberPortalAppsCerts\Main\certificate_fc24d66b-7fdf-446b-85c4-b013d7371f17.p12 -clcerts -nokeys -out C:\Work\ShopSberPayQR\Services\QRCode\Sber\Win32\sberPortalAppsCerts\Main\client_cert.crt

pkcs12 -in C:\Work\ShopSberPayQR\Services\QRCode\Sber\Win32\sberPortalAppsCerts\Main\certificate_fc24d66b-7fdf-446b-85c4-b013d7371f17.p12 -cacerts -nokeys -chain -out C:\Work\ShopSberPayQR\Services\QRCode\Sber\Win32\sberPortalAppsCerts\Main\cacerts.cer

After all install all certs.

Example combine

OpenSSL.exe 
pkcs12 –export –in C:\Work\ShopSberPayQR\Services\QRCode\Sber\Win32\sberPortalAppsCerts\Test\client_cert.crt –inkey C:\Work\ShopSberPayQR\Services\QRCode\Sber\Win32\sberPortalAppsCerts\Test\private.key –out C:\Work\ShopSberPayQR\Services\QRCode\Sber\Win32\sberPortalAppsCerts\Test\certfile.pfx
Posted in Без рубрики | Comments Off on How to install openssl cert on local machine and how to combine them?

Delphi.ManagedTypes.Const

Should put const before them

  1. string
  2. Interface
  3. Record
  4. Dynamic Array
  5. Анонимный метод
  6. Variant
Posted in Без рубрики | Comments Off on Delphi.ManagedTypes.Const