Saturday, June 26, 2021

A lightweight API Client for web api development

 Postman is a well know API client for web development, it provide us with rich feature for us to test and debug the web api application.

here is another lightweight one and simple UI for api development. it is light, fast and handy for web api development.

you can grab a copy for windows environment

https://insomnia.rest/download





quick understand MongoDB from the Relational Database aspect

the following table should really help if you are coming from the relational Database and new to NoSQL.

 it will help you to learn NoSQL structure.

Relational DB

MongoDB

Database

Database

Table

Collection

Row

Document

Index

Index

Join

$Lookup

Foreign Key

Reference


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]);

        }

    }

}