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

Must read post when using Git on line endings: What’s the best CRLF handling strategy with git? – Stack Overflow

Posted by jpluimers on 2020/09/23

Start with this must read post: cross platform – What’s the best CRLF handling strategy with git? – Stack Overflow.

Then read all the links in that answer, especially

Then see if you agree with my conclusion:

use a .gitattributes file to steer line ending conversions on a per-repository base.

I usually try to have git not mess with any line endings: check-out as-is, check-in as is.

Historically this has been a mess (not limited to, but prevalent on Windows installations), not just because core.autocrlf has been superseded by core.eol, so below are some links that will help.

TL;DR

Always execute these after installing git:

git config --global core.autocrlf false
git config --global core.eol native

If needed, repeat in the current repository:

git config --local core.autocrlf false
git config --local core.eol native

Finally verify the settings with git config --list --show-origin (via [WayBack] Where does git config –global get written to? – Stack Overflow)

Note

The git config list will show equals signs. Do NOT use these when setting values: that will silently fail.

So these fail:

git config --global core.autocrlf=false
git config --global core.eol=native

git config --local core.autocrlf=false
git config --local core.eolnative

Despite the output when listing on a machine that already had these values et:

git config --list | grep -w 'core.autocrlf\|core.eol'
core.autocrlf=false
core.eol=native
core.autocrlf=false
core.eol=native

References

–jeroen

PS: To look at the various local and global settings, read Where does git config –global get written to? – Stack Overflow.

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

Can we truly assert that an array returned from a function is always a true copy?

Posted by jpluimers on 2020/09/23

The answer is no: [WayBack] Hi all, Can we truly assert that an array returned from a function is always a new true copy and that this is guaranteed to not change in between compil… – Ugochukwu Mmaduekwe – Google+

From Primož book and comment:

Depending on how you create this array.

For example, the following code outputs 42, not 17.

program Project142;

{$APPTYPE CONSOLE}

{$R *.res}

uses
System.SysUtils;

function Bypass(const a: TArray<integer>): TArray<integer>;
begin
Result := a;
end;

var
a, b: TArray<integer>;

begin
SetLength(a, 1);
a[0] := 17;
b := Bypass(a);
a[0] := 42;
Writeln(b[0]);
Readln;
end.

You can use `SetLength(arr, Length(arr))` to make array unique. Changing Bypass to the following code would make the test program emit 17.

function Bypass(const a: TArray<integer>): TArray<integer>;
begin
Result := a;
SetLength(Result, Length(Result));
end;

–jeroen

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

git – Change commit author at one specific commit – Stack Overflow

Posted by jpluimers on 2020/09/22

Every now and then I forget to git config --local user.name and git config --local user.email, so git takes my global settings and I need to fix one or more commits to it shows the correct author.

For the last commit, when not yet pushed, this is easy:

git commit --amend --author="Author Name <email@address.com>"

For historic commits, or when you already pushed, it gets far more difficult, so I am glad there is a good set of steps at [WayBackgit – Change commit author at one specific commit – Stack Overflow.

For now in my %USERPROFILE%\.gitconfig file, I have added entries for various accounts so it is easier to spot them with git config --list --global then edit them using git config --edit --local:

[user.foo]
    name = jeroenfo
    email = ########+jeroenfoo@users.noreply.github.com
[user.gh]
    name = Jeroen Wiert Pluimers
    email = jeroen.vvv.www@pluimers.com
[user.gl]
    name = Jeroen Wiert Pluimers
    email = jeroen.xxx.yyy@pluimers.com

If you pushed, but nobody pulled, and you are the only one committing, then the steps are like this if your git is 1.8 or higher:

  1. Once,
    1. perform git rebase -i --root
    2. at all commits you want to edit, change pick into edit
    3. write the file, then leave the editor (:wq)
  2. For each commit, until git indicates No rebase in progress?:
    1. perform git commit --amend --reset-author --no-edit
    2. perform git rebase --continue

–jeroen

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

Women should rule IT again, not just because inheritance in Cobol functions differently than in other languages.

Posted by jpluimers on 2020/09/22

From a while back, but still relevant: [WayBack] Vererbung funktioniert in Cobol anders als in anderen Sprachen… – Kristian Köhntopp – Google+

Translated, this is:

I found some COBOL code at a client. Nothing special. The last comment in it was from 1985, written by my mother. That was my WTF moment of the year, including the look on the face of the technical manager: here inheritance gets a totally different perspective.

An interesting take from that thread is that in the past, women ruled IT.

They should do this again while they can, as a mixed team can combine “first time right” with “minimum viable product”. It is all about balance.

Andreas Dorfer
Cool-Programmierung in den 70ern und frühen 80ern scheint eine Frauendomäne gewesen zu sein. Zumindest bei uns waren die letzten Aktiven daran in den späten 90ern (die mehr als nur Hotfixes drangebastelt haben), gestandene Frauen mit Lesebrillen an Perlenketten.

Jeroen Wiert Pluimers
+Andreas Dorfer yup, and they were doing excellent jobs. Women still could rule IT, there are just to few working in IT.

Andreas Dorfer
+Jeroen Wiert Pluimers those folks really listened and asked relevant questions before making any half baked proposal. Then they produced a lot of documents in binders, including flow diagrams… made a prototype, tested the unit and produced another binder full of paper.. And if there any question after going live, they just told you on the phone: “Look at sheet xy, paragraph z, there we documented this behaviour as conforming your request. Shall we schedule a meeting to setup a change request together?”. They had been working like accounting: sometimes incredibly slow, but with precision and accuracy… if things went wrong, the best advice was always to ask yourself, where you might have a flaw in the initial request.

Andreas Dorfer

Archive.is 384da9306d6501301d80001dd8b71c47 (900×266)

This apart from the fact that comments have not changed much over time:

Read the rest of this entry »

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

Delphi Gem of the day: putting “reintroduce” on a destructor. destructor…

Posted by jpluimers on 2020/09/22

A nice thread with examples of all the things you should not do with the Delphi reintroduce keyword:

[WayBack] Delphi Gem of the day: putting “reintroduce” on a destructor.     destructor Destroy(); reintroduce; overload; In our case all we got was a memory lea… – Moz Le – Google+

The problem is that in the original (archived) documentation, not much waring is given around using reintroduce; it is merely posted as solving a nuisance to absolve a compiler warning.

When using it though, all your alarm systems should go off at their highest level as you break polymorphism, but through careful language usage, the pattern you hide can still be used.

One day I will write a longer blog article on this.

Documentation:

A decade of progress has not changed much on this documentation apart from some nicer formatting:

–jeroen

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »

Rebooting a Linux server unattended – twm’s blog

Posted by jpluimers on 2020/09/21

[WayBack] Rebooting a Linux server unattended – twm’s blog:

/sbin/shutdown -r now

Simple, but I keep forgetting where Linux has short/long command options and short/long verbs.

–jeroen

Posted in *nix, *nix-tools, Debian, Linux, OpenShift, openSuSE, Power User, Raspbian, RedHat, SuSE Linux, Tumbleweed, Ubuntu | Leave a Comment »

Front Panel Audio Connector and Header Pinouts for Intel® Desktop: AC97 and HD Audio have the same layout…

Posted by jpluimers on 2020/09/21

Same layout, but different pin usage for AC97 and HA Audio headers: [WayBack] Front Panel Audio Connector and Header Pinouts for Intel® Desktop…

Much more background information at [WayBack] HD Audio or AC97 connector – Which to use when, and what’s the difference? – Super User

Via: [WayBackWTF? The connectors for HD Audio and AC’97 are pin compatible (so the connectors fit) but have different signals. Who came up with this stupid idea? – Thomas Mueller (dummzeuch) – Google+

–jeroen

Read the rest of this entry »

Posted in Development, Hardware Development, Power User | Leave a Comment »

WinHlp32 for Windows 10?

Posted by jpluimers on 2020/09/21

Reminder from [WayBackWinHlp32 for Windows 8.1 – twm’s blog to find a similar download for Windows 10.

–jeroen

Posted in Power User, Windows, Windows 10 | Leave a Comment »

WiFi devices having mysimplelink in their host name are Ring Cameras

Posted by jpluimers on 2020/09/18

If you stick up a Ring camera and hook it to your WiFi network, they show up with a hostname like *-mysimplelink in your network: [Archive.isStrange device Connected to my WiFi mysimplelink – Google Product Forums.

–jeroen

Posted in Power User, WiFi | Leave a Comment »

USBKill – “kills” your machine when an unauthorised USB device is inserted or an authorised device is removed

Posted by jpluimers on 2020/09/18

Interesting article: [WayBack] USBKill – Wikipedia.

Tools:

Via: [WayBack] TIL: USBKill USBKill is anti-forensic software distributed via GitHub, written in Python for the BSD, Linux and OS X operating systems. It is designed… – Jürgen Christoffel – Google+

–jeroen

Read the rest of this entry »

Posted in LifeHacker, Power User | Leave a Comment »