The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • 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

Archive for the ‘Software Development’ Category

MahdiSafsafi/ImmersiveColors: Easy way to access Windows 10 Immersive colors

Posted by jpluimers on 2018/09/20

Source: MahdiSafsafi/ImmersiveColors: Easy way to access Windows 10 Immersive colors

via: [WayBack] This is just what I tried to find, but could not figure out what those colors are called :)But anyways some Delphi-superhero has done all work for us… – Tommi Prami – Google+

–jeroen

Posted in Color (software development), Delphi, Development, Software Development | Leave a Comment »

SVN Git Mirror – cloning SVN into git and keeping them in sync

Posted by jpluimers on 2018/09/20

Based on

More references and ideas:

jeroen

Read the rest of this entry »

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

Reminder to self: check if this has been solved – [RSP-19557] TParallel.Join does not create enough threads – Embarcadero Technologies

Posted by jpluimers on 2018/09/19

Delphi 10.1 Berlin broke [RSP-19557] TParallel,Join does not create enough threads – Embarcadero Technologies. It was reported 9 months ago, and since it took quite some longer than a year for a new Delphi version to be released, I wonder if it is fixed by now.

Related:

–jeroen

 

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

When a Delphi TCP server causes sudden EIdConnClosedGracefully Exceptions on the client

Posted by jpluimers on 2018/09/19

I always forget which sides of the connection throw this error, but the client side does as explained in [WayBackdelphi – Troubleshooting EIdConnClosedGracefully Exceptions? – Stack Overflow by [WayBackRemy Lebeau the main Indy contributor:

EIdConnClosedGracefully means the other party … has disconnected its end of the connection. Once that exception has been raised, you cannot send more data to the other party. You must reconnect first.

Read the rest of this entry »

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

I tend to forget there is a record intialiser TPair.Create(Key, Value) – via: delphi – TDictionary populated during create example code – Stack Overflow

Posted by jpluimers on 2018/09/18

I tend to forget that since TPair – introduced in Delphi 2009 – has had a TPair.Create(Key, Value)record initialiser since Delphi 2010, though only fully documented since Delphi XE4:

With some spart short methods, Cosmin Prund shows a really nice helper at [WayBack] delphi – TDictionary populated during create example code – Stack Overflow allowing a call like this:

  with TDictHelper<Integer, string> do
    Dict := Make([P(1, 'one'), P(2, 'two')]);

His answer has all the details (including describing the pros and conse), so here is only the helper:

uses
  SysUtils, Generics.Collections;

type
  TDictHelper<Key, Value> = class
  public
    class function P(const K:Key; const V:Value): TPair<Key, Value>;
    class function Make(init: array of TPair<Key, Value>): TDictionary<Key, Value>;overload;
    class function Make(KeyArray: array of Key; ValueArray: array of Value): TDictionary<Key, Value>;overload;
  end;

{ TDictHelper<Key, Value> }

class function TDictHelper<Key, Value>.Make(init: array of TPair<Key, Value>): TDictionary<Key, Value>;
var P: TPair<Key, Value>;
begin
  Result := TDictionary<Key, Value>.Create;
  for P in init do
    Result.AddOrSetValue(P.Key, P.Value);
end;

class function TDictHelper<Key, Value>.Make(KeyArray: array of Key;
  ValueArray: array of Value): TDictionary<Key, Value>;
var i:Integer;
begin
  if Length(KeyArray) <> Length(ValueArray) then
    raise Exception.Create('Number of keys does not match number of values.');
  Result := TDictionary<Key, Value>.Create;
  for i:=0 to High(KeyArray) do
    Result.AddOrSetValue(KeyArray[i], ValueArray[i]);
end;

class function TDictHelper<Key, Value>.P(const K: Key;
  const V: Value): TPair<Key, Value>;
begin
  Result := TPair<Key, Value>.Create(K, V);
end;

–jeroen

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | 7 Comments »

Locating the 7z.exe command-line tool on Windows

Posted by jpluimers on 2018/09/18

From one of my scripts: it will find a  64-bit 7z.exe if it was installed as part of the 7-zip installer, then run it with the parameters provided to the batch file.

  setlocal
  
:verify7zip
:: registry trick from http://www.robvanderwoude.com/files/sortdate2_nt.txt
:: extra trick: tokens=2* allows to get the  3rd (and beyond: space delimited!) value in one variable %%b
  for /F "tokens=2*" %%a IN ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\7-Zip" /v Path64 2^>nul') do set sevenZipDirectoryPath=%%b
  call :checkMissingSetting sevenZipDirectoryPath     || goto :help
  
  set sevenZipExeFilePath=%sevenZipDirectoryPath%7z.exe
  if not exist "%sevenZipExeFilePath%" call :showError "No 7-zip executable at %sevenZipExeFilePath%" || goto :help
  
:run7zip
  "%sevenZipExeFilePath%" %*

  endlocal
  goto :end
  
:checkMissingSetting
  if not defined %1 call :notifyMissingSetting %1 && exit /b 1
  call :showSetting %1
  exit /b 0
  goto :end

:notifyMissingSetting
  echo Registry didn't provide the environment variable "%1"
  goto :end
  
:showError
  :: remove double quotes using tilde trick:
  echo %~1
  
:help
  echo Syntax: %0 7z.exe-commandline-parameters
  goto :end

:end

–jeroen

Posted in 7zip, Batch-Files, Compression, Development, Power User, Scripting, Software Development | Leave a Comment »

YouTube video how to use DDetours library to hook Win32 API in Delphi

Posted by jpluimers on 2018/09/18

via [WayBack] Just was sneaking around YouTube and found this video showing how to use DDetours library to hook Win32 api. – Mahdi Safsafi – Google+

–jeroen

Read the rest of this entry »

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

When Google Search returns one link twice in the results, thinking it was published on two different dates.

Posted by jpluimers on 2018/09/13

I laughed when https://www.google.com/#q=visual%20studio%20code%20indent%20settings%20per%20file%20type got me the first link twice (see below screenshot).

But I was glad that that link to [WayBack] visual studio code – How to set per-filetype tab size? – Stack Overflow.

This one:

In addition, it taught me how to configure the settings.json with md specific settings, which – despite the IDE indicating the JSON is invalid – just works: markdown indentation is now 2 character positions.

    "[md]": {
      "editor.tabSize": 2
    }

The search result:

Read the rest of this entry »

Posted in .NET, Chrome, Development, Google, GoogleSearch, Power User, Software Development, Visual Studio and tools, vscode Visual Studio Code | Leave a Comment »

chrisrolliston/CCR.PrefsIniFile: TCustomIniFile decendants for Delphi wrapping the Android, iOS and OS X Preferences APIs

Posted by jpluimers on 2018/09/13

If you need cross platform settings storage: [WayBackchrisrolliston/CCR.PrefsIniFile: TCustomIniFile decendants for Delphi wrapping the Android, iOS and OS X Preferences APIs

Via: [WayBack] In my application I use System.Win.Registry unit file to read or write to Windows Registry. Now that I have added MAC paltform I need an equivalent method to edit the plist file… – Dimitra Ger – Google+

–jeroen

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

Happy Day of the Programmer!

Posted by jpluimers on 2018/09/13

Happy Day of the Programmer!

Enjoy this little gem: [Archive.isHarvey Green’s answer to What are the best examples of software bugs that became features (a.k.a. misbugs)? – Quora

This is from an anecdote by Ken Demarest, one of the original developers who worked on Wing Commander I on the PC…

… we were getting an exception from our EMM386 memory manager when we exited the game. We’d clear the screen and a single line would print out, something like “EMM386 Memory manager error. Blah blah blah.” We had to ship ASAP. So I hex edited the error in the memory manager itself to read “Thank you for playing Wing Commander!”

via many sources that usually forget to mention the full source:

Thanks [Archive.isHarvey!

Some more links referenced by the above worth browsing on a day like this:

Read the rest of this entry »

Posted in Development, Software Development | Leave a Comment »