Posts

Showing posts from September, 2021

Use SCSS with ASP.NET Core 5.x or 3.X

Image
Here we will see how we can use SCSS or SASS with ASP.NET Core 3.X or 5.X Here is the step to step guide for using SCSS in ASP.NET Core. Step 1: Install sass as global using npm: npm install --global sass Bash Copy Step 2: Create a new ASP.NET Core project , choose MVC or Razor Pages Add a SCSS file to the Web app, here I have added test.scss to the wwwroot/css folder. Add the following lines to the .csproj file to enable SCSS to CSS compilation in the web app. For  node-sass  and  ruby-sass  write this: sass --no-source-map $( ProjectDir ) wwwroot/css/test2.scss $( ProjectDir ) wwwroot/css/test2.css Bash Copy If you're using  dart-sass If you're using dart-sass the usage is --no-source-map sass --no-source-map $( ProjectDir ) wwwroot/css/test2.scss $( ProjectDir ) wwwroot/css/test2.css Bash Copy   < Target Name = " ScsstoCss " BeforeTargets = " Build " > < Exec Command = " mkdir $(ProjectDir)wwwroot/css " Condition = " !Exist

Find Duplicate files by computing Hash in C#

Image
 Here we will try to find the duplicate files by its content in it with computing its hash. If you copy the file several times and change the file name still it will scan and can detect that its a duplicate file. I will use .NET 5 and C# 9 here. let me show you how ​ using System ; using System . IO ; using System . Linq ; using System . Security . Cryptography ; using System . Text ; namespace DupTest { class Program { static void Main ( ) { //Your path here string dir = @"C:\Users\priti\Documents\Microsoft.WindowsSoundRecorder_8wekyb3d8bbwe!App\Sound recordings" ; var fileinfos = Directory . GetFiles ( dir ) . Select ( x = > new { FileName = x , Hash = GetStringFromBytes ( GetHashValue ( x ) ) } ) ; var group_infos = fileinfos . GroupBy ( x = > x . Hash ) . ToList ( ) ; foreach ( var g in group_infos ) {