Wednesday, June 23, 2021

best visual studio extension for react developer

 if you are a React developer, you definitely like to have the following extension install in your visual studio. these extensions will easily help you on React application development.

  • Auto Rename Tag
  • Bracket Pair Colorizer
  • ES7 React/Redux/React-Native/JS snippets
  • Highlight Matching Tag
  • Indent-Raibow
  • Tabnine AI Code Completion, autocomplete JavaScript, Python, TypeScript, PHP, Go, Java, Ruby, C/C++, HTML/CSS, C#, Rust, SQL, Bash, Kotlin, React, Swift, Scala, Sass, Perl, Objective C, Node JS, Matla
  • Quokka
  • Paste JSON as code

Sunday, June 20, 2021

How to host an ASP.Net Core Web API in IIS?

 during our development of ASP.Net Web API on visual studio. there is an embedded IIS express with visual studio.

if we want to host the web api in our local IIS. we can follow these steps.


finally my web api application that hosted on IIS is up and running




how to fix the website loading forever in local IIS for windows 10?

 Recently i setup a local IIS for my web api development. however i can complete the configuration, then try to browse the website from browser. it is loading forever and the web page never loaded.

the main cause of the issue is the idle time-out(minutes) had been set to 20 by default.

after I change it to 0 and recycle the app pool, then the website is working and page is loaded.








 

cheer and happy programming



SOLID development principles in brief explanation

 solid development principles is a very popular development methodology. we might encounter an interview question about what is SOLID.

since we usually have less time to prepare for tons of interview question. I try to describes five principles in short.

S: Single Responsibility Principle

Object should only have single single responsibility. best example database persistence vs file persistence

we should not bundle them together.

O: Open and Close Principle

Object is open for extension, but not for modification. for any new enhancement or new feature, we should keep the current interface intact. and extend a new interface base on the current one.

L: Liskov Substitution Principle

the interface take the type of parent, should not break if it takes the type of its child.

I : Interface Segregation Principle

split the interface for each individual client, better than have one generous interface for all. it is better and easy for maintenance.

D: Dependency Inversion Principle

  • High level of object never depends on the low level of object.
  • Abstractions should not depend on details, but details should depend on abstraction.



Saturday, June 19, 2021

how to use hashtable to quickly find the sum of two numbers meet the criteria?

 if there is a number array, we want to find the indexs of two numbers adding together meet the give number.

for an example we have a number array {1, 3,  4,  5, 8} and given 8

the result should be 1 , 3


where is sample code to solve the above issue.

using System;

using System.Collections;

using System.Diagnostics.CodeAnalysis;


namespace hashmap

{

    class Program

    {

        static void Main(string[] args)

        {

            Console.WriteLine("Hello World!");


            int[] numarray = new int[7] { 1, 2, 3, 4 ,5, 6, 8};

            int[] resultArray = new int[2];

            int testNum = 7;

            Hashtable ht = new Hashtable();

            for (int i = 0; i < numarray.Length; i++) {

                int result = 7 - numarray[i];

                if (ht.ContainsKey(numarray[i]))

                {

                    resultArray[0] = i;

                    resultArray[1] = (int)ht[numarray[i]];

                }

                else {

                    ht.Add(result, i);

                }

            }

            Console.WriteLine("position at {0}  {1}", resultArray[0], resultArray[1]);

        }

    }

}


Wednesday, May 5, 2021

how to fix Compiler option noEmitOnError not working with tsc in Typescript?

it is the best practice to use "noEmitOnError" option to prevent typescript compiler to generate the JavaScript file

however the config setting file does not work, when we execute the compiler command. such as the following

tsc myfile.ts 

the output is myfile.js. obviously the compiler did not pick the configuration from the config file. we have to run it expressively 

tsc --noEmitOnError myfile.ts

or force the compile to read from the tsconfig.json file

tsc -p ./tsconfig.json


Sunday, April 11, 2021

how to access Azure Active Directory from other portals?

 we should all know that we can use Azure portal to access the Azure Active directory. after you log into the portal we can click on the Azure Active Directory from the left blade, or type " Azure Active Directory " in the search box to access Azure Active Directory features

However Microsoft also provide tow alternative ways to access the Azure Active Directory with same login credential as we use for azure portal.

here are the two web portals we can use to access Azure Directory.

https://admin.microsoft.com

https://myapps.microsoft.com