Saturday, March 9, 2019

How to Fix Azure Data Studio Blank / Black Screen

If you are getting a blank screen when launching Azure Data Studio, you don't have to uninstall and reinstall. There a quarky little bug for some systems.



Create a shortcut, right-click and select Properties

in Target add "C:\Users\{username}\AppData\Local\Programs\Azure Data Studio\azuredatastudio.exe" --disable-gpu 
And now you will get the proper default screen. You may have to do this on each version update. This is same trick as Visual Studio Code. 




Friday, March 8, 2019

Duplicate File Finder free tool from Microsoft

Ever need to find duplicate files on your hard-drive for free. There are plenty of tool on the market that make you pay for this feature. 

Well, Microsoft provided Dupfinder to just that, but you may have missed it since it was in a separate developer/administrator add-on. Good news you can still get it for free.

Duplicate File Finder (dupfinder.exe) lets you search a hard disk or a folder for duplicate files and display them in a graphical window. Multiple versions of an application or its sub-components have always been the bane of developers and network administrators. Duplicate File Finder will ease your pain, and shows you version numbers of exes and dlls.

Run in Microsoft Windows 10 Pro 1809 (10.0.17763.348)

Duplicate File Finder (dupfinder.exe) is part of

Windows XP Service Pack 2 Support Tools Download

https://www.microsoft.com/en-us/Download/confirmation.aspx?id=18242


Some other tools that are included (some may not work this is yrs. old);
  • acldiag.exe- manages access control lists
  • activate.exe- Windows product activation
  • apmstat.exe- provides status information on Advanced Power Management (APM) features.
  • bindiff.exe- shows the differences between two binary files
  • bitsadmin.exe- manages the Background Intelligent Transfer Service
  • browstat.exe- a general purpose character-based browser diagnostic tool
  • cabarc.exe- allows users to create, query and extract Windows cabinet (CAB) files.
  • depends.exe- provides way to determine which DLLs an application depends on ( also known as "Dependency Walker")
  • dhcploc.exe- displays the DHCP servers active on your subnet
  • diruse.exe- displays directory size information for NTFS volumes
  • dmdiag.exe- displays system state and configuration information describing disk storage.
  • dupfinder.exe- duplicate file finder
  • efsinfo.exe- displays information about files that are encrypted with Encrypting File System (EFS) on NTFS partitions.
  • extract.exe- a utility that allows you to extract all files or specific files contained within a cabinet (.cab) file
  • filever.exe- displays information on the versions of executable files
  •  ipseccmd.exe- configures Internet Protocol Security (IPSec) policies
  • memsnap.exe- takes a snapshot of the memory resources being consumed by all running processes and writes this information to a log file
  • msicuu.exe- Windows Installer Clean Up Utility
  • msizap.exe- removes either all Windows Installer information for a product or all products installed on a computer
  • netcap.exe- monitors packets on a LAN and writes the information to a log file
  • netdiag.exe- tests the network connectivity
  • netset.exe- used to add, remove, or change the network configuration
  • pfmon.exe- displays the faults that occur while executing a process
  • pstat.exe- gives you information about the processes and drivers that are currently running on your computer.
  • pviewer.exe- process viewer
  • setx.exe- sets environment variables
  • showaccs.exe- enables users to examine the access control lists (ACLs)
  • timezone.exe- Daylight Saving Time Update Utility
  • whoami.exe- displays the user name and security identifier (SID)
  • windiff.exe- shows the differences between specified ASCII text files, or folders containing ASCII text files
  • xcacls.exe- used to set all file-system security options that are accessible in Windows Explorer from the command 

Wednesday, March 6, 2019

C Sharp Get Host IP Address and Share a from UNC path

Here's a function that was surprisingly hard to find GetUNCHostIPAddressShare from a directory path. Support Host IP address as either IPv4 or IPv6 formats.

A UNC Share is defined as "\\host-name\share-name[\object-name]

ie \\2001:4860:4860::8888\share\tail\dir1   returns  \\2001:4860:4860::8888\share 


The string extension method returns "\\host-name\share-name.

Code Listing

using System;
     
public static class Program
{
 const string ShareExtUNCFullPrefix = @"\\?\UNC\";  
 const string ShareExtPrefix = @"\\?\";      
 const string SharePrefix = @"\\";           
 const string DIR = @"\";
 const char  cDIR = '\\';
 const string DIRDOUBLE = @"\\";
 const string COLONDIR = @":\";
 const string COLON = @":";
 const char cCOLON = ':';
 const string DIRSPACE = @"\ ";
 const string SPACEDIR = @" \";
 const string SPACE = @" ";

 public static int IndexOfOccurence(this string s, char match, int occurence)
 {
  int i = 1;
  int index = -1;

  while (i <= occurence && (index = s.IndexOf(match, index + 1)) != -1)
  {
   if (i == occurence)
    return index;

   i++;
  }

  return -1;
 }
 
 /// <summary>
 /// Gets UNC Host and Share from a full UNC path. Cuts 4th backslash from start of path, must have least 1 char between or digit between. Support IPv4 and IPv6.
 /// </summary>
 /// <param name="UNCFullPath">\\host\share returns empty, must end in a backslash</param>
 /// <returns>\\host\share from \\host\share\tail\, \\8.8.8.8\DNS\ also \\?\UNC\ and \\?\ work</returns>
 /// <warn>//fails for one case when "\\?\UNC\share\tail\file.txt", UNC Server Name is named "UNC"</warn>
 /// <author>Metadataconsulting.blogspot.com</warn>
    public static string GetUNCHostIPAddressShare(this string UNCFullPath)
 {
  if (UNCFullPath.StartsWith(DIRDOUBLE))
  {
   string p = UNCFullPath; //local working copy
   
   if (p.StartsWith(ShareExtPrefix))
   {
    p = p.Substring(3, p.Length - 3);
    
    if (p.StartsWith(@"\UNC\")) //fails for "\\?\UNC\share\tail\file.txt" one case
     p = DIRDOUBLE + p.Substring(5, p.Length - 5);
    else
     p = DIR + p;
   } 
   
   //starts with \\h\s is min 
   int idx3rd = (p.Length >= 5 ) ? p.IndexOf(cDIR, 3) : -1; //4th position zero index 

   //Console.WriteLine("p = " + p + " idx3rd=" + idx3rd); //DEBUG

   if (p[0]==cDIR && p[1]==cDIR && Char.IsLetterOrDigit(p[2]) && p.Length >= 5 &&idx3rd > -1 && Char.IsLetter(p[idx3rd+1]) && p.IndexOf(cDIR, idx3rd + 2) > -1)
   {
    int i = p.IndexOfOccurence(cDIR, 4);

    if (i > -1)
     return p.Substring(0, i); //returns empty if i=0
    else
     return string.Empty;

   }
   else
    return string.Empty;
   
   

  }
  else
   return string.Empty;

 }

 public static void Main()
 {
   Console.WriteLine(@"\\2001:4860:4860::8888\share\tail\dir1".GetUNCHostIPAddressShare());
   Console.WriteLine(@"\\8.8.8.8\share\tail\dir1".GetUNCHostIPAddressShare());
   Console.WriteLine(@"\\host\share\tail\dir1".GetUNCHostIPAddressShare());
   Console.WriteLine(@"\\host\share\tail\file.txt".GetUNCHostIPAddressShare());
         Console.WriteLine(@"\\\?\UNC\share\tail\file.txt".GetUNCHostIPAddressShare());
         Console.WriteLine(@"\\h\s\file.txt".GetUNCHostIPAddressShare());
         Console.WriteLine(@"\\h\s\".GetUNCHostIPAddressShare());
         Console.WriteLine(@"\\\s\".GetUNCHostIPAddressShare());
         Console.WriteLine(@"\\h\\".GetUNCHostIPAddressShare());
         Console.WriteLine(@"\\\\\\\\".GetUNCHostIPAddressShare());
         Console.WriteLine(@"\\?\UNC\share\tail\file.txt".GetUNCHostIPAddressShare() + ", 1 failed case - UNC is Server Name");
   
 }
}