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,706 other followers

Archive for June 26th, 2019

Binding git diff to Beyond Compare

Posted by jpluimers on 2019/06/26

This became a huge batch-file which I need to refactor into smaller bits.

:: based on bc.bat
:: needs to be refactored into find-bc.bat
:: assumes git is on the path

:begin
@echo off

:checkGit
:: https://stackoverflow.com/questions/4781772/how-to-test-if-an-executable-exists-in-the-path-from-a-windows-batch-file/25696405#25696405
  where /q git || echo Cound not find git on the PATH %PATH%. && goto :eof
:: for now, the above is good enough as git installs itself on the path, but Beyond Compare does not.

:findBeyondCompare
  setlocal EnableExtensions EnableDelayedExpansion
  IF /I [%PROCESSOR_ARCHITECTURE%] == [amd64] goto :x64
  IF /I [%PROCESSOR_ARCHITEW6432%] == [amd64] goto :x64
  goto :x86
:x64
  :: OS is 64bit
  set hkcuBaseKey=HKEY_CURRENT_USER\Software\Scooter Software\Beyond Compare
  set hklmBaseKey=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Scooter Software\Beyond Compare
  
  goto :findBC
:x86
  :: OS is 32bit
  set hkcuBaseKey=HKEY_CURRENT_USER\Software\Scooter Software\Beyond Compare
  set hklmBaseKey=HKEY_LOCAL_MACHINE\SOFTWARE\Scooter Software\Beyond Compare
  goto :findBC
:findBC
  :: https://gist.github.com/rojepp/634908
  :: http://stackoverflow.com/questions/5369528/windows-batch-reg-query-key-value-to-a-variable-but-do-not-display-error-if-key
  set SupportedBeyondCompareVersions=3, 4
  for %%v in (%SupportedBeyondCompareVersions%) do (
    for /f "usebackq tokens=2* delims= " %%c in (`reg query "%hkcuBaseKey% %%v" /v ExePath 2^>NUL`) do (
      call :do set bcExe="%%d"
    )
  )
  if not [%bcExe%]==[] goto :foundBC
    for /f "usebackq tokens=2* delims= " %%c in (`reg query "%hkcuBaseKey%" /v ExePath 2^>NUL`) do (
      call :do set bcExe="%%d"
    )
  if not [%bcExe%]==[] goto :foundBC
  for %%v in (%SupportedBeyondCompareVersions%) do (
    for /f "usebackq tokens=2* delims= " %%c in (`reg query "%hklmBaseKey% %%v" /v ExePath 2^>NUL`) do (
      call :do set bcExe="%%d"
    )
  )
  if not [%bcExe%]==[] goto :foundBC
    for /f "usebackq tokens=2* delims= " %%c in (`reg query "%hklmBaseKey%" /v ExePath 2^>NUL`) do (
      call :do set bcExe="%%d"
    )
  :: note that FOR /R needs a wildcard!
  if not [%bcExe%]==[] goto :foundBC
    for /r . %%d in (bcompare*.exe) do (
      call :do set bcExe="%%d"
    )
:foundBC
:: https://stackoverflow.com/questions/2772456/string-replacement-in-batch-file
:: note the BCompExe assignment requires at least https://ss64.com/nt/setlocal.html to have EnableDelayedExpansion and likely EnableExtensions 
:: see https://ss64.com/nt/delayedexpansion.html for ! expansion
  if [%bcExe%]==[] ( echo no bc.exe found in registry or relative to batch file) else (
    echo bcExe=%bcExe%
    if exist %bcExe% (
      call :do set bcCompExe=%bcExe:BCompare=BComp%
      :: echo bcCompExe=!bcCompExe!
      echo "Beyond Compare" %bcExe:\=/%
      echo "BComp" !bcCompExe:\=/!
      call :do git config --global diff.tool bc
      call :do git config --global difftool.bc.path !bcCompExe:\=/!
      call :do git config --global merge.tool bc
      call :do git config --global mergetool.bc.path !bcCompExe:\=/!
    )
    if not exist %bcExe% echo not found: [%bcExe%]
  )
:exit
  endlocal
:end
  goto :eof
:do
  echo %*
  call %*
  goto :eof

–jeroen

Posted in Batch-Files, Development, Scripting, Software Development | Leave a Comment »

Unicode ligatures: not all software does normalised search forgetting ffi 

Posted by jpluimers on 2019/06/26

Via a private share, I found out that some software forgets to perform a Unicode normalisation when doing a search.

That means that ligatures do not match the non-ligatures in for instance these words:

  • “ff” and “ff”, as in “difference” versus “difference”
  • “fi” and “fi” as in “notification” versus “notification”.

For more information, read [WayBackUnicode equivalence – Wikipedia and make sure you know about these normal forms:

NFD
Normalization Form Canonical Decomposition
Characters are decomposed by canonical equivalence, and multiple combining characters are arranged in a specific order.
NFC
Normalization Form Canonical Composition
Characters are decomposed and then recomposed by canonical equivalence.
NFKD
Normalization Form Compatibility Decomposition
Characters are decomposed by compatibility, and multiple combining characters are arranged in a specific order.
NFKC
Normalization Form Compatibility Composition
Characters are decomposed by compatibility, then recomposed by canonical equivalence.

–jeroen

Posted in Development, Encoding, Software Development, Unicode | Leave a Comment »

Why Isn’t Agile Working? – Hacker Noon

Posted by jpluimers on 2019/06/26

Definitely worth reading when you think you’re being Agile, but you don’t. [WayBackWhy Isn’t Agile Working? – Hacker Noon.

Via:

–jeroen

 

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

 
%d bloggers like this: