Skip to main content

Posts

Add Godaddy SSL Certificate to IIS 10 Server | Rekey

How to Add Godaddy SSL Certificate to IIS 10 (Full 2024 Guide)? Installing Godaddy SSL Certificate on IIS 10 Server? Rekey and Install SSL Certificate in IIS 10 Server? Manually Install an SSL Certificate on my IIS 10 Server? Download the SSL Certificate from GoDaddy: ·         Go to your GoDaddy account and navigate to the SSL Certificates section. ·         Find your issued SSL certificate and click Download. ·         Choose the correct server type from the dropdown and download the certificate files (usually a .crt file). Create the .pfx file using the below OpenSSL command prompt: openssl pkcs12 -export -out certificate.pfx -inkey generated-private-key.txt -in 530276e452e0d3fb.crt -certfile 530276e452e0d3fb.crt As per above command: ·         Downloaded the 'Generated Private Key' text file: generated-private-key.txt ·         Download CRT file:   530276e452e0d3fb.crt ·         New PFX file that will create in the folder with certificate name (as per y
Recent posts

Odd Even Numbers 1 to 10 program in c#

 Question on the Odd-Even Numbers 1 to 10 program in c# 1. Print all even numbers from 1 to 10  2. Print the sum of all odd numbers from 1 to 10 3. Print all numbers from 1 to 10 that are divisible by 3 Explanation: Even Numbers:  The program uses a  for  loop to iterate through numbers from 1 to 10. It checks if a number is even using  i % 2 == 0  and prints it if true. Sum of Odd Numbers:  The program calculates the sum of odd numbers by checking if a number is odd using  i % 2 != 0  and adding it to the  sumOfOdds   variable. Numbers Divisible by 3:  The program checks each number from 1 to 10 to see if it's divisible by 3 using  i % 3 == 0  and prints it if true. Example, class EvenOddNumber {     static void Main()     {         // 1. Print all even numbers from 1 to 10         Console.WriteLine("Even numbers from 1 to 10:");         for (int i = 1; i <= 10; i++)         {             if (i % 2 == 0)             {                 Console.WriteLine(i);            

Promises in JavaScript | Promises in JavaScript are a powerful way to handle asynchronous operations.

Promises in JavaScript are a powerful way to handle asynchronous operations. They represent a value that may be available now, or in the future, or never. Promises provide a cleaner and more intuitive way to work with asynchronous code compared to traditional callback-based approaches. Basics of Promises A Promise object represents an asynchronous operation's eventual completion (or failure) and its resulting value.  Promises can be in one of three states: Pending : The initial state. Neither fulfilled nor rejected. Fulfilled : The operation completed successfully. Rejected : The operation failed. Creating a Promise: You create a new Promise using the Promise constructor, which takes a function (called the executor function) that has two parameters: resolve and reject . //Promises in JavaScript - Promises in JavaScript are a powerful way to handle asynchronous operations. //Promises can be in one of three states: //Pending: The initial state. Neither fulfilled nor rejected. //

To count the number of vowel characters in a string using JavaScript

//To count the number of vowel characters in a string using JavaScript let message = 'Hello w0rld' ; let vowels = 'aeiou' let count = 0 //solution 1 for ( let chr of message ){     if ( vowels . includes ( chr )){     count = count + 1 ;    }   } console . log ( "Solution1: " + count ); //solution 2 function countVowels ( data ){   let count = 0 ;   data . split ( '' ). forEach ( x => {     if ( vowels . includes ( x )){         count = count + 1 ;     }   });   return count ; } let countVowel = countVowels ( message ); console . log ( "Solution2: " + countVowel );

Count a vowels from a given string in sql server

 To count the number of vowels in a given string in SQL Server , you can use a combination of CHARINDEX and WHILE loop Example, /* Count a vowels from a given string in sql server */ DECLARE @stringHello VARCHAR(1000) ='Hello world example' DECLARE @vowel TABLE(  id INT IDENTITY(1,1) ,  vowels VARCHAR(1) ) INSERT INTO @vowel SELECT 'a' INSERT INTO @vowel SELECT 'e' INSERT INTO @vowel SELECT 'i' INSERT INTO @vowel SELECT 'o' INSERT INTO @vowel SELECT 'u' DECLARE @i INT=1 DECLARE @count INT = (SELECT COUNT(1) FROM @vowel) DECLARE @vowelCount INT=0 WHILE(@i <=@count) BEGIN    IF( SELECT CHARINDEX( (SELECT vowels FROM @vowel WHERE id= @i)  ,@stringHello )  )>0 BEGIN SET @vowelCount = @vowelCount +1 END SET @i =@i+1 END SELECT @vowelCount AS VowelsCharCount

create a custom prototype in JavaScript

  * JavaScript implements inheritance by using objects. Each object has an internal link to another object called its prototype. * Prototypes are hidden objects that are used to share the properties and methods of a parent class to child classes. Live result:-  https://playcode.io/1943770 /* Find the age greater than 10 from an array of age */ var age = [ 10 , 11 , 2 , 1 , 20 ]; /*Solution 1 with .filter() function*/ let result = age . filter ( function ( a ){   return a > 10 }); console . log ( 'Age greater than 10 : ' , result ); /*Solution 2 using custom prototype method ' showAgeGreaterThan10' */ Array . prototype . showAgeGreaterThan10 = function () {   return (       age . filter ( function ( val ){       return val > 10     })  ) }; console . log ( 'Custom prototype :' , age . showAgeGreaterThan10 ());

shallow copy vs deep copy JavaScript

 In JavaScript, this is often achieved using methods like - Object.assign({}, originalObject) or  {...originalObject} Live result URL:-   https://playcode.io/1944513 //Deep and Shallow Copy in JavaScript //Example 1 let x = 'Hello world' ; let y = x ; console . log ( "x is : " , x ); console . log ( "y is : " , y ); //Example 2 let obj = {   name : 'Anil' } let obj1 = obj ; obj1 . name = 'Reena' ; console . log ( "obj is : " , obj ); console . log ( "obj1 is : " , obj1 ); //Example 3 let objA = {   name : 'Anil A' } let objB = Object . assign ({}, objA ); //Type 1: this is called a 'Shallow Copy'. It copies the memory location. Also, it copies only the main object. //OR let objB ={...objA} //Type 2: this is also called a 'Shallow Copy'. It copies the memory location. Also, it copies only the main object. objB . name = 'Reena B' ; console . log ( "objA is : " , objA ); c

Prototype Inheritance in JavaScript | Prototype chain in JavaScript

* Inheritance and the prototype chain - JavaScript.  * JavaScript implements inheritance by using objects. Each object has an internal link to another object called its prototype. * Prototypes are hidden objects that are used to share the properties and methods of a parent class to child classes. live result link:-  https://playcode.io/1943752 /* * Inheritance and the prototype chain - JavaScript.    * JavaScript implements inheritance by using objects. Each object has an internal link to another object called its prototype.    * Prototypes are hidden objects that are used to share the properties and methods of a parent class to child classes. */ var obj1 = {   id : 1 ,   name : "Anil" ,   isActive : true ,   age : 39 } var obj2 = {   address : 'Gaur City 2' ,   pin : 201306 ,   __proto__ : obj1 } console . log ( obj2 );

Closure in JavaScript | lexical scope | lexical scope vs closure

A closure gives you access to an outer function's scope from an inner function. A closure is a function having access to the parent scope, even after the parent function has closed. See the live result:-  https://playcode.io/1941383 //Clousure var sum = function ( a ){       console . log ( "Live Clousure views - " + a );       var c = 2 ;       return function ( b ){         return a + b + c; //lexical scope       } } //this function execute two times - one is - sum(1) and other one is - sumAgain(3) //the value of a=1 and c=3 will be presist in the mermory. One call to sumAgain(3) then the result will be 6 (1+3+2) //that is called closure   var sumAgain = sum ( 1 ); //calling and set the value of a=1 and c=2 in the memorey console . log ( sumAgain ( 3 )); //calling with value b=3. Now the result will be 6

JavaScript for-loop, forEach, Map, Filter and Sort Functions | forEach() .map(), .filter() .sort()

//Exploring for-loop, forEach, Map, Filter & Sort Functions //Write the code to get the array of names from the given array of users //pick only active users //sort users by age ascending Result URL link:  https://playcode.io/1943698 When you loop through (or iterate through) an array, the first thing you think of is probably a for loop,   .forEach() , .map(), and .filter() are all just other ways of iterating through arrays to perform a specific task on each array element and are called methods. //Exploring for-loop, forEach, Map, Filter & Sort Functions //Write the code to get the array of names from the given array of users //pick only active users //sort users by age ascending var users = [   { id : 1 , name : 'Anil' , isActive : true , city : 'Noida' , age : 39 },   { id : 2 , name : 'Alok' , isActive : true , city : 'GR Noida' , age : 40 },   { id : 3 , name : 'Sunil' , isActive : false , city : 'Delhi' , age : 29 },   {