Oct 9, 2021

Windows 10 window border change

Problem

Losing title bar when multiple windows overlap, finding drag position becomes harder.

Solution

>Windows > Settings > Colors
Select "Title bars and windows borders".

Windows Activation Issue

If Windows is not activated you can not change color settings.
We can enable window borders by regedit commands.

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM" /v "ColorPrevalence" /t REG_DWORD /d "1" /f

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM" /v "AccentColor" /t REG_DWORD /d "7439985" /f

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM" /v "AccentColorInactive" /t REG_DWORD /d "13882323" /f

May 8, 2021

[Tips] Random string generators C#

Testing 2 different Random string generators.

void Main()
{
 for(int i=0;i<10;i++){
  Console.WriteLine("GetRandomString: " + GetRandomString(8));
 }
 for(int i=0;i<10;i++){
  Console.WriteLine("GetRandomFileName: " + GetRandomFileName());
 } 
}

public static string GetRandomString(int length)
{
    Random random = new Random();
    const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    return new string(Enumerable.Repeat(chars, length)
      .Select(s => s[random.Next(s.Length)]).ToArray());
}

public static string GetRandomFileName()
{
    string path = Path.GetRandomFileName();
    path = path.Replace(".", ""); // Remove period.
    return path;
}

Result
GetRandomString: tpZIDi0C
GetRandomString: tpZIDi0C
GetRandomString: tpZIDi0C
GetRandomString: tpZIDi0C
GetRandomString: tpZIDi0C
GetRandomString: tpZIDi0C
GetRandomString: tpZIDi0C
GetRandomString: tpZIDi0C
GetRandomString: tpZIDi0C
GetRandomString: tpZIDi0C
GetRandomFileName: smb1u03pvyf
GetRandomFileName: 2ccre5kihis
GetRandomFileName: 24thz5is1pj
GetRandomFileName: ni0z42lexag
GetRandomFileName: 1u11tcvd3qv
GetRandomFileName: vtiqp2sevwy
GetRandomFileName: y2jhumy1hcx
GetRandomFileName: 5o0gsyronpk
GetRandomFileName: m0zva3mhdfn
GetRandomFileName: 2a2dzcdkpbl