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 July, 2020

Squirrel · GitHub: Server-driven updates for native apps

Posted by jpluimers on 2020/07/23

Reminder to self as I might need it one day:

Server-driven updates for native apps (Windows/Mac/iOS)

[WayBack]Squirrel · GitHub

Via: [WayBackHow do you deploy and update desktop applications? Carl and Richard talk to Paul Betts about the open source project called Squirrel – https://github.c… – .NET Rocks! – Google+

–jeroen

Posted in Deployment, Development, DevOps, Software Development | Leave a Comment »

Yes Delphi does some type inference on generic method calls

Posted by jpluimers on 2020/07/23

Delphi does indeed so some type inference as Primoz found out below. It has been doing this for a long time, improved over time, but has a long road ahead.

One odd thing is that generics (and the majority of inference support) were introduced in Delphi 2009 ([WayBack] Generics with Delphi 2009 Win32), but the inference was already documented in Delphi 2007: [WayBack] Delphi 2007 – Declaring Generics: Parameterized Types

This is a reminder to myself to write some more example code on what kinds of inference work and which do not, especially because of the comments from David Heffernan, Marco Cantu and Stefan Glienke, especially since the improvement over time has been small. I am curious to see how the promised “working on it” by now lives up to reality.

David Heffernan
This is a rare piece of code where type inference actually works. Mostly it does not which is very frustrating.

It’s a little ironic that you ask why you don’t need to include <T>. Normally people ask about the much more frequent instances where you do need to include <T> because the compiler’s type inference is so weak.

David Heffernan
+Marco Cantù Much more commonly there are times when you want the compiler to infer the type, but it won’t. It would really make a difference to us if the compiler was better at this.

Marco Cantù
+David Heffernan I tend to agree the compiler should be much better at type inference. Working on it!

Stefan Glienke
Infering the generic argument from a constructed generic type would be great.

GuessTheType<T>(const x: TArray<T>);

var
  a: TArray<Integer>;
begin
  GuessTheType(a);

does not work although the compiler could infer the parameter for GuessTheType from its x parameter but currently it does not know that a originally was a TArray<T> (yes, I know array of T as signature works but that is a different thing).

P.S. +Marco Cantù btw how hard can it be to finally implement generic standalone routines without that ugly static type? Probably one of the highest voted feature requests: https://quality.embarcadero.com/browse/RSP-13724)

Source: [WayBack] Anybody here knows since when we don’t have to write when calling generic ProcSomething(param: T)? It was brought to my attention today that the… – Primož Gabrijelčič – Google+

–jeroen

A quick look into the generated assembler code proves that the type is indeed resolved correctly:

Project17.dpr.26: TGeneric.GuessTheType<Exception>(x);
0041C530 8B151C484200     mov edx,[$0042481c]
0041C536 A1F4974100       mov eax,[$004197f4]
0041C53B E84CD3FFFF       call TGeneric.GuessTheType<System.SysUtils.Exception>
Project17.dpr.27: TGeneric.GuessTheType(x);
0041C540 8B151C484200     mov edx,[$0042481c]
0041C546 A1F4974100       mov eax,[$004197f4]
0041C54B E83CD3FFFF       call TGeneric.GuessTheType<System.SysUtils.Exception>
Project17.dpr.28: TGeneric.GuessTheType(s);
0041C550 8B1520484200     mov edx,[$00424820]
0041C556 A1F4974100       mov eax,[$004197f4]
0041C55B E83CD3FFFF       call TGeneric.GuessTheType<System.SysUtils.TSimpleRWSync>

Source: https://plus.google.com/+Primo%C5%BEGabrijel%C4%8Di%C4%8D/posts/edE3YWtwY3B

view raw

readme.md

hosted with ❤ by GitHub


program Project17;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils;
type
TGeneric = class
class procedure GuessTheType<T>(const value: T);
end;
var
x: Exception;
s: TSimpleRWSync;
{ TGeneric<T> }
class procedure TGeneric.GuessTheType<T>(const value: T);
begin
end;
begin
TGeneric.GuessTheType<Exception>(x);
TGeneric.GuessTheType(x);
TGeneric.GuessTheType(s);
end.

view raw

project17.dpr

hosted with ❤ by GitHub

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

The most useful git commands | orga.cat

Posted by jpluimers on 2020/07/22

The most advanced commands are towards the tail of [WayBack] The most useful git commands | orga.cat

Here there are some examples of git commands that I use often.

They include:

Get the git root directory

git rev-parse --show-toplevel

Source: http://stackoverflow.com/q/957928/1391963

See closest tags

git describe --tags `git rev-list --tags --max-count=1`

Source: http://stackoverflow.com/q/1404796/1391963. See also git-describe.

See recently used branches (i.e. branches ordered by most recent commit)

git for-each-ref --sort=-committerdate refs/heads/ | head

Source: http://stackoverflow.com/q/5188320/1391963

Which means I need to look into at least these:

–jeroen

 

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

Geek And Poke: NoSQL

Posted by jpluimers on 2020/07/22

Old, but still too funny not to share:[WayBackGeek And Poke: NoSQL.

Via: [WayBack] Adrian Marius Popa – Google+

Larger pictures are in the top link.

 

–jeroen

Read the rest of this entry »

Posted in Database Development, Development, Fun, NoSQL, Software Development | Leave a Comment »

Why and how GitLab abandoned Microsoft Azure for Google Cloud | VentureBeat

Posted by jpluimers on 2020/07/22

Reminder to self to check out how this move went: [WayBack] Why and how GitLab abandoned Microsoft Azure for Google Cloud | VentureBeat.

Via [WayBack] Kristian Köhntopp – Google+

–jeroen

Posted in Azure Cloud, Cloud, Containers, Development, DevOps, Docker, GCP Google Cloud Platform, Google Kubernetes Engine, Infrastructure, Kubernetes (k8n), Software Development | Leave a Comment »

GitHub – adaloveless/commonx: Delphi/Object Pascal Classes and Tools for just about everything and everyone.

Posted by jpluimers on 2020/07/21

Warning: I posted this without doing a proper copyright check on the linked github repository, and it looks like this library heavily copies code from copyrighted materials.

So better not use them, for one because they contain copyrighted material, and also because the copyrighted units are not current.

At least these units are Copyright by Embarcadero:

Androidapi.JNI.Environment.pas:4:{ Copyright(c) 2014 Embarcadero Technologies, Inc.      }
Better_JSON.pas:5:{ Copyright(c) 2016 Embarcadero Technologies, Inc.      }
Bluetoothcomponentthreaded.pas:4:{ Copyright(c) 2016 Embarcadero Technologies, Inc.      }
FMX.Better.Controls.pas:5:{ Copyright(c) 2011-2013 Embarcadero Technologies, Inc. }
FMX.Better.ListBox.pas:5:{ Copyright(c) 2011-2013 Embarcadero Technologies, Inc. }
Generics.Collections.Fixed.pas:5:{ Copyright(c) 1995-2014 Embarcadero Technologies, Inc. }
HTTPClient_2019.pas:6:{ Copyright(c) 1995-2018 Embarcadero Technologies, Inc. }
InetWinSocketReg.pas:5:{ Copyright(c) 1995-2012 Embarcadero Technologies, Inc. }
pngimage_fmx.pas:5:{ Copyright(c) 1995-2014 Embarcadero Technologies, Inc. }
SocketsEditor.pas:5:{ Copyright(c) 1995-2012 Embarcadero Technologies, Inc. }

Read the rest of this entry »

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

Git install tip for Windows installations: “”

Posted by jpluimers on 2020/07/21

When installing Git on Windows, you might want to change the default HTTPS transport back-end setting into “Use the Windows Secure Channel library” as it will use the Windows Certificate Stores for certificate validation. For Windows users, this allows for a more natural way to configure additional Root CS certificates (for instance the ones coming from Active Directory Domain Services).

If you later want to change this, then you can either re-run the installer, or perform these commands (based on the installer source):

To select the OpenSSL library:

config --system http.sslBackend openssl

To select the Windows Secure Channel library:

config --system http.sslBackend schannel

I do need to check out other ways of installing it (more on that in [WayBack] 5 Ways to Install Git on Windows · James Sturtevant), but for now I’m using the regular installer.

At first time install (subsequent installs will re-use the first-time install location without a way to overwrite them):

  • If you run that “As Administrator”, then it will install for all users (64-bit in C:\Program Files\Git, 32-bit in C:\Program Files (x86)\Git)
  • Otherwise in %LOCALAPPDATA%\Programs\Git which usually is in C:\Users\<username>\AppData\Local\Programs\Git).

Note that the actually executables are inside a bin subdirectory of the installation path.

–jeroen

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

Operant Conditioning by Software Bugs – Embedded in Academia

Posted by jpluimers on 2020/07/21

Good to remember both these:

[WayBack] Operant Conditioning by Software Bugs – Embedded in Academia which means when using a system, you subconsciously start behaving around it’s issues. This also happens when you the software you wrote the software for such a system: you hardly test the things that you broke.

The magic SysReq key on Linux systems running on PC-hardware allows you to sync/mount read-only/shutdown a system by keyboard (and many more options – see the Wikipedia list below). Do not forget to enable this as it is disabled by default. And remember that many laptops forego the SysReq key (as do Mac systems).

The order while holding Alt-SysReq down is S,U,B…

Both via [WayBack] Kristian Köhntopp – Google+

–jeroen

Read the rest of this entry »

Posted in *nix, *nix-tools, Development, Keyboards and Keyboard Shortcuts, Power User, Software Development, ThinkPad | Leave a Comment »

🔎Julia Evans🔍 auf Twitter: “an amazing directory: /proc… “

Posted by jpluimers on 2020/07/20

So cool: 🔎Julia Evans🔍 auf Twitter: “an amazing directory: /proc… “:

–jeroen

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

google chrome – How to hide the bookmark bar? – Super User

Posted by jpluimers on 2020/07/20

So I wondered why on some tabs, the bookmark bar would never disappear:

Chrome’s default new tab page (NTP) always shows a bookmark bar, even if you turn it off for other pages. You can however install browser extensions which replace the NTP, and the replacements do not automatically get the bookmarks bar (but can with some extra programming).

So for instance Google’s Earth View extension does not show bookmarks, whereas Pinterest’s now does.

Thanks deltab for answering this at [WayBack] google chrome – How to hide the bookmark bar? – Super User

–jeroen

Posted in Chrome, Google, Power User | Leave a Comment »