Posts

Uninstall all Azure PowerShell Modules

Image
With Azure PowerShell modules changing all the time and the recent introduction of the   PowerShell modules being renamed from AzureRm to Az , you may want to totally uninstall all modules and reinstall to make sure you are using the latest and greatest modules. To do so, the following scripit will go through and cleanup all the Azure(RM)(AD) modules.  Simply open up PowerShell as an Administrator and execute the following PowerShell workflow/commands: workflow Uninstall-AzureModules {     $Modules = @() $Modules += (Get-Module -ListAvailable Azure*).Name    $Modules += (Get-Module -ListAvailable Az.*).Name     Foreach -parallel ($Module in ($Modules | Get-Unique))     {         if($Modules)          {                Write-Output ("Uninstalling: $Module")              Uninstall-Module $Module -Force          }          else          {                Write-Output ("Uninstalling: Module '$Module' is null or empty")          }     } } Uninstall-AzureM

Compress Payload in NodeJS

Image
Compress Payload (response) in NodeJS Compression  in  Node.js  and  Express.js  decreases the amount of downloadable data from a website or app. By using this compression, we can  improve the performance of our Node.js applications  as our  payload size is dramatically reduced above 70% . Compression  generally refers to code that has been modified using a data compression algorithm. Unlike  minification  that ends up providing perfectly valid code, compressed code must be unzipped before use. There are many text compression algorithms, but there are only  3 supported   algorithms for compression  (and  decompression ) of  HTTP requests: Deflate  ( deflate ): Not commonly used. Gzip  ( gzip ): The most widely used compression format for server and client interactions. It is based on the  Deflate  algorithm and is compatible with all current browsers. Brotli  ( br ): A newer compression algorithm that aims to further improve compression ratios, which can result in even faster page load

Simple NodeJs App with MQTT

Image
What is MQTT? MQTT is a lightweight, publish-subscribe network protocol that transports messages between devices. The protocol usually runs over TCP/IP, however, any network protocol that provides ordered, lossless, bi-directional connections can support MQTT. MQTT is used for  data exchange between constrained devices and server applications . It keeps bandwidth requirements to an absolute minimum, handles unreliable networks, requires little implementation effort for developers, and is, therefore, ideal for machine-to-machine (M2M) communication. Node JS Application using MQTT Create a publish file. (pub.js) const mqtt = require ( 'mqtt' ); const client = mqtt . connect ( 'mqtt://broker.hivemq.com' ); client . on ( 'connect' , function (){     setInterval (() => {         const random = Math . random () * 50 ;         console . log ( random )         if ( random > 26 ){             client . publish ( 'ATM01' , 'ATM 01 temperature is &

Hardware assisted virtualization and data execution protection must be enabled in the BIOS

Image
This post is about fixing the error, Hardware assisted virtualization and data execution protection must be enabled in the BIOS which displayed by Docker while running Windows 10. Today while running Docker, it throws an error like this. After few searches, I found the solution for this problem. Enable Hyper V - You can do this by running the following command as administrator. -  dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All Enable Hypervisor with following command -  bcdedit /set hypervisorlaunchtype auto . You should run either one of the above commands. And you need to restart the system to apply the changes. If the problem persist probably Hyper-V on your system is corrupted, so Open in Control Panel > [Programs] > [Windows Features] and completely uncheck all Hyper-V related components. Restart the system. Enable Hyper-V again. Restart. If you see Hyper-V Hypervisor is disabled. This mean that Virtualization support is disabled in the firmware. To enable Virtualiz

JavaScript - ES2017 (aka ES8)

The ES2017 ECMAScript 2017, edition 8 of the ECMA-262 Standard (also commonly called  ES2017  or  ES8 ), was finalized in June 2017. Compared to ES6, ES8 is a small release for JavaScript, but still it introduces very useful features: String padding Object.values() Object.entries() Object.getOwnPropertyDescriptors() Trailing commas in function parameter lists and calls Async functions Shared memory and atomics String padding The purpose of string padding is to  add characters to a string , so it  reaches a specific length . ES2017 introduces two  String  methods:  padStart()  and  padEnd() . padStart ( targetLength [ , padString ] ) padEnd ( targetLength [ , padString ] ) Sample usage: 'abc'.padStart(4) // ' abc' 'abc'.padStart(6) // '   abc' 'abc'.padStart(6,'xyz') // 'xyzabc' 'abc'.padEnd(4) // 'abc ' abc.padEnd(6) // 'abc   ' abc.padend(6,'xyz') // 'a

JavaScript - ES2016 (aka ES7)

The ES2016 ES2016, officially known as ECMAScript 2016, was finalized in June 2016.  ES2016 is a tiny release for JavaScript, containing just two features: Array.prototype.includes Exponentiation Operator Array.prototype.includes() This feature introduces a more readable syntax for checking if an array contains an element. With ES6 and lower, to check if an array contained an element you had to use  indexOf , which checks the index in the array, and returns  -1  if the element is not there. Since  -1  is evaluated as a true value, you could  not  do for example if ( ! [ 1 , 2 ] . indexOf ( 3 ) ) { console . log ( 'Not found' ) } With this feature introduced in ES2016 we can do if ( ! [ 1 , 2 ] . includes ( 3 ) ) { console . log ( 'Not found' ) } Exponentiation Operator The exponentiation operator  **  is the equivalent of  Math.pow() , but brought into the language instead of being a library function. Math . pow ( 4 , 2 ) ==

JavaScript - ES2015 (aka ES6)

The ES2015 Since this long time passed between ES5.1 and ES6, the release is full of important new features and major changes in suggested best practices in developing JavaScript programs. To understand how fundamental ES2015 is, just keep in mind that with this version, the specification document went from 250 pages to ~600. In this blog, we describe the most important changes. Arrow Functions A new  this   scope Promises Generators let   and  const Classes Constructor Super Getters and setters Modules Importing modules Exporting modules Template Literals Default parameters The spread operator Destructuring assignments Enhanced Object Literals Simpler syntax to include variables Prototype super() Dynamic properties For-of loop Map and Set New String methods New Object methods Arrow functions Arrow functions since their introduction changed how most JavaScript code looks (and works). Visually, it’s a simple and welcome change, from: cons