Featured

Permutation and Combination

Permutation - position (order) matters. = N! / (N - r)!. Building words with {a,b,c} are also permutation problem with r = {1,2,3..N} Combination - position (order) doesn't matter = N! / (N - r)! * r! . Combination is a part of Permutation set. All possible combination means, generating combination for r = {0,1.. … Continue reading Permutation and Combination

Binary Left Shift << and Right Shift >>

Binary Left Shift << When shifting left, the most-significant bit is lost, and a 0 bit is inserted on the right end. Left shift is equivalent to multiplying the bit pattern by 2k (if we are shifting k bits). 10 << 2  = 10 * 22 = 10 * 4 = 40 10 << 3 = 10 … Continue reading Binary Left Shift << and Right Shift >>

JWT prevents hot linking to your media

Imagine you have some media files published (static http(s) links) on your website for targeted customers, which have been very popular recently. Other sites (search engine) started finding links of your media and putting it on their websites or people started sharing your media links with others. Suddenly you see surge of download on your … Continue reading JWT prevents hot linking to your media

Configure Nginx as a web server and reverse proxy for Nodejs application on Azure Windows

Introduction: NodeJs applications are "Single threaded Event Loop" i.e there is a single thread listening to all incoming requests. On receiving a request, it immediately publish it to its internal "event queue" and is ready to receive the next request. It also polls event queue for any pending tasks and processes Non-blocking I/O tasks. For … Continue reading Configure Nginx as a web server and reverse proxy for Nodejs application on Azure Windows