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

Archive for 2018

Euler’s identity – cool explanatory videos by Burkard Polster

Posted by jpluimers on 2018/10/19

[WayBack] e^iπ = -1 – Daniela Osterhagen – Google+ reminded me of [WayBackEuler’s identity (often called the most beautiful formula in the world) and these two great videos by Burkard Polster I bumped into a few years back below.

She points to a German link about “the most beautiful formula in the world”, to which I fully agree:

Gerade einmal sechs Symbole braucht es dafür

[WayBackFreistetters Formelwelt: Die schönste Formel der Welt – Spektrum der Wissenschaft

Read the rest of this entry »

Posted in Power User, science | Leave a Comment »

when btrfs-size shows a snapshot as 16777216.00TB or btrfs qgroup as 16.00EiB

Posted by jpluimers on 2018/10/19

A long time ago I wrote about the btrfs-size tool: [WayBackA bash script to btrfs snapshot details like disk sizes (requires btrfs quota to be enabled).

One day, it showed a ridiculously large size for /tmp:

# ./btrfs-size.sh 
=============================================================================================================================================================================================================================================================
Snapshot / Subvolume                                               ID   Total    Exclusive Data
=============================================================================================================================================================================================================================================================
257 gen 855182 top level 5 path .snapshots                         257  4.30MB   4.30MB   
258 gen 856438 top level 257 path .snapshots/1/snapshot            258  1.84GB   193.01MB 
...
262 gen 856438 top level 5 path srv                                262  1.83GB   1.83GB   
263 gen 856438 top level 5 path tmp                                263  16777216.00TB16777216.00TB
264 gen 856438 top level 5 path usr/local                          264  260.00KB 260.00KB 
...
990 gen 849192 top level 257 path .snapshots/583/snapshot          990  1.83GB   8.23MB   
991 gen 849224 top level 257 path .snapshots/584/snapshot          991  2.09GB   62.66MB  
=============================================================================================================================================================================================================================================================
                                                                Exclusive Total: 3.26GB    

This tracks back to the output of this command, which I’ve shortened a bit:

# btrfs qgroup show /
qgroupid         rfer         excl
--------         ----         ----
0/5          16.00KiB     16.00KiB
0/257         4.30MiB      4.30MiB
...
0/262         1.83GiB      1.83GiB
0/263        16.00EiB     16.00EiB
0/264       260.00KiB    260.00KiB
...
255/274         0.00B        0.00B
255/797      16.00KiB     16.00KiB

This is a known issue as quotas in btrfs – though workable – aren’t fully stable yet: [WayBack] Linux BTRFS Storage: Re: During a btrfs balance nearly all quotas of the subvolumes became exceeded

It also provides this simple solution:

Read the rest of this entry »

Posted in *nix, *nix-tools, btrfs, File-Systems, Power User | Leave a Comment »

git 2.19.1 on Windows: NullReferenceException during https pull/push/fetch

Posted by jpluimers on 2018/10/19

When using git 2.19.1 on Windows, you will likely get a NullReferenceException during pull/push/fetch operations on https connections.

Easiest workaround is to downgrade to 2.19.0: [WayBack] git pull fatal: NullReferenceException encountered. On an local instance of Bitbucket · Issue #1868 · git-for-windows/git · GitHub

I am seeing the same thing using 2.19.1 against our internal Bitbucket server. Reverting back to 2.19.0 the problem no longer occurs.

Harder workaround is to install the Git Credential Manager 1.18.1: [WayBack] git pull fatal: NullReferenceException encountered. On an local instance of Bitbucket · Issue #1868 · git-for-windows/git · GitHub.

[WayBack] Release Git Credential Manager for Windows v1.18.1 · Microsoft/Git-Credential-Manager-for-Windows · GitHub

Bug Fixes:

  • Fixes Null Reference exceptions when parameters or contentType are not populated

To install the Git Credential Manager, download and double-click the GCMW-1.18.1.exe installer. It is that easy, it will even install Git for Windows 2.17.0 and the Microsoft .Net Framework for you if necessary.

Hopefully that one will integrated in a minor update to git for Windows soon: [WayBack] git pull fatal: NullReferenceException encountered. On an local instance of Bitbucket · Issue #1868 · git-for-windows/git · GitHub

moderately soon, hopefully, there will be a minor version release of Git for Windows that will include the updated GCM v1.18.1. [just need more volunteer time for the PR and tests ;-)
That should eliminate the `Fatal: NullReferenceException” but appears not to fix the #1874https://github.com/git-for-windows/git/issues/1874 delays. (still to hear from the OP if the issue is definitely the AV, or something elese)

If you really dare, you can try the nightly snapshot which already includes GCMW-1.18.1: [WayBack] git pull fatal: NullReferenceException encountered. On an local instance of Bitbucket · Issue #1868 · git-for-windows/git · GitHub

the next official Git for Windows version will have a new Git Credential Manager version. Also, the current snapshot at https://wingit.blob.core.windows.net/files/index.html should have it already.

–jeroen

Posted in Development, DVCS - Distributed Version Control, git, Software Development, Source Code Management | Leave a Comment »

Some links on encrypting configuration files or sections

Posted by jpluimers on 2018/10/18

All encryption comes down to a combination of key management and tooling.

With more and more communication projects going on, encryption of the secrets (passwords, API keys, etc) in configuration files, especially the ones that might end up in (sometimes public) repositories will need my attention some day.

My gut feeling is that an asymmetric solution might work best for these kinds of problems.

Here are some links:

–jeroen

Posted in Development, Encryption, Security, Software Development | Leave a Comment »

Some Indy SSL Perfect Forward Secrecy links

Posted by jpluimers on 2018/10/18

Some links on Indy SSL Perfect Forward Secrecy especially for the [WayBackSSL_CTX_set_ecdh_auto method that was introduced in OpenSSL 1.0.2.

Indy now has it built in: [WayBack] Patches from Jeroen Wiert Pluimers: · graemeg/indy@659f629 · GitHub (this is on a regular git mirror of the official Indy svn repository).

–jeroen

 

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

Archiving Delphi documentation

Posted by jpluimers on 2018/10/18

[WayBackHow can I search for Delphi documentation? – Stack Overflow explains how I’ve been searching Delphi documentation for almost a decade.

I love how Google Search filters can be used, and even mentioning “docwiki” or “docwiki delphi” usually narrows your search down to the official documentation.

However, since a while, [Archive.is] docwiki.embarcadero.com/robots.txt disallows older indexing by search indexes or archiving in the WayBack machine.

So with older Delphi versions, I tend to archive using Archive.is instead:

For the most recent Delphi version, I archive both the non-versioned link and the versioned link. Depending on the unit naming, these URLs can be used:

–jeroen

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

Delphi: [BRCC32 Error] ProjectName.vrc(63): file not found: C:\Users\Public\Documents\RAD Studio\10.0\Styles\SlateClassico.vsf

Posted by jpluimers on 2018/10/17

The Delphi styling mechanism hard codes style paths for Delphi built-in styles.

During compilation, a .VRC file is generated for your project (in this example ProjectName.vrc which is a resource compiler script. This was introduced by Delphi 2007 (see: Pre-build trick does not work to circumvent [BRCC32 Error] xxx.vrc(1): error creating xxx.res (via: Embarcadero Discussion Forums & StackOverflow)), got extended over time and by now this script can includes at least:

  • version info
  • main icon
  • manifest reference
  • platform targets
  • supported styles

For the latter, you can get errors like this one:

[BRCC32 Error] ProjectName.vrc(63): file not found: C:\Users\Public\Documents\RAD Studio\10.0\Styles\SlateClassico.vsf

The solution to this error is simple:

  1. Go to your project options
  2. Switch to “All Targets”
  3. Go to node “Application”, then “Appearance”
  4. Look for the style named just in front of the .vsf extension (in this case StateClassico)
  5. Remove the checkmark.
  6. Press OK
  7. Rebuild

Example files :

/* ----- VS_VERSION.dwFileFlags ----- */
#define VS_FF_DEBUG             0x00000001L
#define VS_FF_PRERELEASE        0x00000002L
#define VS_FF_PATCHED           0x00000004L
#define VS_FF_PRIVATEBUILD      0x00000008L
#define VS_FF_INFOINFERRED      0x00000010L
#define VS_FF_SPECIALBUILD      0x00000020L
#define VS_FFI_FILEFLAGSMASK    0x0000003FL

/* ----- VS_VERSION.dwFileOS ----- */
#define VOS_UNKNOWN             0x00000000L
#define VOS_DOS                 0x00010000L
#define VOS_OS216               0x00020000L
#define VOS_OS232               0x00030000L
#define VOS_NT                  0x00040000L
#define VOS_WINCE               0x00050000L

#define VOS__BASE               0x00000000L
#define VOS__WINDOWS16          0x00000001L
#define VOS__PM16               0x00000002L
#define VOS__PM32               0x00000003L
#define VOS__WINDOWS32          0x00000004L

#define VOS_DOS_WINDOWS16       0x00010001L
#define VOS_DOS_WINDOWS32       0x00010004L
#define VOS_OS216_PM16          0x00020002L
#define VOS_OS232_PM32          0x00030003L
#define VOS_NT_WINDOWS32        0x00040004L

/* ----- VS_VERSION.dwFileType ----- */
#define VFT_UNKNOWN             0x00000000L
#define VFT_APP                 0x00000001L
#define VFT_DLL                 0x00000002L
#define VFT_DRV                 0x00000003L
#define VFT_FONT                0x00000004L
#define VFT_VXD                 0x00000005L
#define VFT_STATIC_LIB          0x00000007L

1 VERSIONINFO
FILEVERSION 1, 0, 124, 56
PRODUCTVERSION 1, 0, 0, 0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
{
 BLOCK "StringFileInfo"
 {
  BLOCK "040904E4"
  {
   VALUE "FileVersion",  "1.0.124.56\000\000"
   VALUE "ProductVersion",  "1.0.0.0\000\000"
   VALUE "ProductName",  "My server\000\000"
   VALUE "CompanyName",  "My company\000\000"
  }
 }
 BLOCK "VarFileInfo"
 {
  VALUE "Translation", 1033, 1252
 }
}

and

MAINICON ICON "MyProject_Icon.ico"
1 24 "MyProject.$manifest"
PLATFORMTARGETS RCDATA {1}
SlateClassico VCLSTYLE "C:\\Users\\Public\\Documents\\RAD Studio\\10.0\\Styles\\SlateClassico.vsf"

–jeroen

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

How to configure Nginx SSL/TLS passthrough with TCP load balancing – nixCraft

Posted by jpluimers on 2018/10/17

Explains how to configure Nginx with SSL Passthrough on Linux or Unix-like system to encrypt traffic on all backends.

Uses the stream module ngx_stream_core_module.

Source: [WayBackHow to configure Nginx SSL/TLS passthrough with TCP load balancing – nixCraft

via: [WayBackLearn how to setup TCP load balancing with Nginx and configure SSL Passthrough on Linux/Unix. – nixCraft – Google+

–jeroen

Read the rest of this entry »

Posted in Communications Development, Development, HTTP, Internet protocol suite, TCP, TLS | Leave a Comment »

Using Windows API function MoveFile to check if a filename is valid…  – via Stack Overflow

Posted by jpluimers on 2018/10/17

This has a really neat Windows API trick [WayBackdelphi – How can I sanitize a string for use as a filename? – Stack Overflow by [WayBack] Alex.

Via: [WayBack] Interesting use of MoveFile, with NIL as the first parameter. https://stackoverflow.com/a/961500/49925 – Thomas Mueller (dummzeuch) – Google+

  function IsValidFilePath(const FileName: String): Boolean;
  var
    S: String;
    I: Integer;
  begin
    Result := False;
    S := FileName;
    repeat
      I := LastDelimiter('\/', S);
      MoveFile(nil, PChar(S));
      if (GetLastError = ERROR_ALREADY_EXISTS) or
         (
           (GetFileAttributes(PChar(Copy(S, I + 1, MaxInt))) = INVALID_FILE_ATTRIBUTES)
           and
           (GetLastError=ERROR_INVALID_NAME)
         ) then
        Exit;
      if I>0 then
        S := Copy(S,1,I-1);
    until I = 0;
    Result := True;
  end;

–jeroen

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

The part before the @ in email addresses is case sensitive

Posted by jpluimers on 2018/10/16

At [WayBackError when trying to signup using an email address with uppercase letters (#27898) · Issues · GitLab.org / GitLab Community Edition · GitLab, I commented this:

Both the :e-mail and :email_confirmation fields should get the same case processing treatment.

That treatment should consist of this:

  1. The part before the @ should be treated as case sensitive
  2. The part after the @ should be treated as case insensitive

This means that:

  • Foo@Example.Org and Foo@example.org are the same
  • Foo@example.org and foo@example.org are different

The main reason is that there are email systems expecting case sensitivity in the part before the @ sign.

I think excluding those users from being able to use GitLab is a bad idea.

See especially the comments at the Stack Overflow answer to Are email addresses case sensitive?

Relevant RFC 5321: Simple Mail Transfer Protocol sections:

Important comments:

I work at a large company and there is another person with the same first and last name. I discovered today that his local-part differs from mine only in capitalization. This has been working properly, so I was surprised to see “no widely used mail systems distinguish different addresses based on case”. We use MS Exchange which I would call “widely used”. – Matthew James Briggs Nov 24 ’15 at 20:14

RFC 5321 2.4. General Syntax Principles and Transaction Model – SMTP implementations MUST take care to preserve the case of mailbox local-parts. In particular, for some hosts, the user “smith” is different from the user “Smith”. Mailbox domains follow normal DNS rules and are hence not case sensitive. – Adam111p Apr 27 ’16 at 10:02

Most important parts of the answer:

From RFC 5321, section-2.3.11:

The standard mailbox naming convention is defined to be “local-part@domaiN“; contemporary usage permits a much broader set of applications than simple “user names”. Consequently, and due to a long history of problems when intermediate hosts have attempted to optimize transport by modifying them, the local-part MUST be interpreted and assigned semantics only by the host specified in the domain part of the address.

So yes, the part before the “@” could be case-sensitive, since it is entirely under the control of the host system. In practice though, no widely used mail systems distinguish different addresses based on case.

The part after the @ sign however is the domain and according to RFC 1035, section 3.1,

“Name servers and resolvers must compare [domains] in a case-insensitive manner”

 –jeroen

Posted in Communications Development, Development, Internet protocol suite, SMTP, Software Development | Leave a Comment »