Friday, September 25, 2020

Git - Delete local branches - which are not exist in remote

 

Copy Paste this on terminal.

git fetch --all -p; git branch -vv | grep ": gone]" | awk '{ print $1 }' | xargs -n 1 git branch -D

Wednesday, August 12, 2020

Angular CLI- Create Component

 


component

ng generate component <name> [options]
ng g component <name> [options]

Creates a new generic component definition in the given or default project.

Refer:https://angular.io/cli/generate

OR 


In command prompt type

ng generate component YOURCOMPONENTNAME

There are even shorthands for this: the commands generate can be used as g and component as c:

ng g c YOURCOMPONENTNAME

you can use ng --helpng g --help or ng g c --help for the docs.


Refer: https://stackoverflow.com/questions/44151427/how-to-create-a-new-component-in-angular-4-using-cli

Tuesday, August 11, 2020

Shani Chalisa

JAI SHANI DEV


Jay Ganesh Girija Suvan,

Mangal Karan Kripaal,
Deenan Ke Dukh Door Kari,
Kijei Naath Nihaal.
Jay Jay Shri Shanidev Prabhu,



Sunahu Vinay Maharaaj,
Karahu Kripa He Ravi Tanay,

Raakhahu Jan Ki Laaj.


Jayati Jayati Shanidev Dayaala,
Karat Sada Bhaktan Pratipaala.
Chaari Bhuja, Tanu Shyaam Virajei,
Maathe Ratan Mukut Chhavi Chhajei.


Param Vishaal Manohar Bhaala,
Tedhi Drishti Bhrakuti Vikaraala.
Kundal Shravan Chamaacham Chamake,


Hiye Maal Muktan Mani Damakei.
Kar Me Gadaa Trishul Kuthara,

Pal Biich Karei Arihi Sanhaara.
Pingal, Krishno, Chhaaya, Nandan,

Yam, Konasth, Raudra, Dukh Bhanjan.


Sauri, Mand Shani, Dash Naama,

Bhaanu Putra Pujahi Sab Kaama.


Jaapar Prabhu Prasann Havei Jaahi,

Rankahu Raav Karei Kshan Maahi.


Parvatahu Trin Hoi Nihaarat,

Trinahu Ko Parvat Kari Daarat.
Raaj Milat Van Raamahi Dinhayo,

Kai keihu Ki Mati Hari Linhayo.


Vanahu Me Mrig Kapat Dikhaai,
Maatu Jaanaki Gai Churaai.
Lashanahi Shakti Vikal Karidaara,

Machiga Dal Me Haahaakaara.


Raavan Ki Gati-Mati Bauraai,

Ramachandra So Bair Badhaai.
Diyo Keet Kari Kanchan Lanka,

Baji Bajarang Bir Ki Danka.


Nrip Vikram Par Tuhi Pagu Dhaara,

Chitra Mayoor Nigali Gai Haara.
Haar Naulakha Laagyo Chori, Haath Pair Daravaayo Tori.


Bhaari Dasha Nikrasht Dikhaayo,

Telahi Ghar Kolhu Chalvaayo.
Vinay Raag Dipak Mah Kinhayo,

Tab Prasann Prabhu Hvei Sukh Dinhayo.


Harishchandra Nrip Naari Bikaani,
Aapahu Bhare Dom Ghar Paani.
Taise Nal Par Dasha Siraani,

Bhunji-Meen Kud Gai Paani.


Shri Shankarahi Gahyo Jab Jaai,

Paaravati Ko Sati Karaai.
Tanik Vikalokat Hi Kari Reesa,

Nabh Udi Gayo Gaurisut Seesa.


Paandav Par Bhai Dasha Tumhaari,

Bachi Dropadi Hoti Ughaari.
Kaurav Ke Bhi Gati Mati Maarayo,

Yuddh Mahabharat Kari Darayo.


Ravi Kah Mukh Mah Dhari Tatkaala,

Lekar Kudi Parayo Paataala.
Sheesh Dev-Lakhi Vinati Laai,

Ravi Ko Mukh Te Diyo Chhudaai.


Vaahan Prabhu Ke Saat Sujaana,

Jag Diggaj Gardabh Mrig Svaana.
Jambuk Sinh Aadi Nakh Dhaari,
So Phal Jyotish Kahat Pukaari.


Gaj Vaahan Lakshmi Grih Aavei,
Hay Te Sukh Sampatti Upajaavei.
Gardabh Haani Karei Bahu Kaaja,

gar kar Singh Siddhakar Raaj Samaaja.


Jambuk Buddhi Nasht Kar Daarei,

Mrig De Kasht Praan Sanhaarei.
Jab Aavahi Svaan Savaari,
Chori Aadi Hoy Dar Bhaari.


Taisahi Chaari Charan Yah Naama,

Svarn Lauh Chaandi Aru Taama.
Lauh Charan Par Jab Prabhu Aavei,
Dhan Jan Sampatti Nasht Karaavei.


Samta Taamra Rajat Shubhakaari,

Svarn Sarvasukh Mangal Bhaari.
Jo Yah Shani Charitra Nit Gaavei,

Kabahu Na Dasha Nikrisht Sataavei.


Adbhut Naath Dikhaavei Leela,

Karei Shatru Ke Nashi Bali Dhila.
Jo Pandit Suyogya Bulavaai,

Vidhivat Shani Grah Shaanti Karaai.


Peepal Jal Shani Divas Chadhaavat,

Deep Daan Dei Bahu Sukh Paavat.
Kahat Ram Sundar Prabhu Daasa,
Shani Sumirat Sukh Hot Prakaasha.

Doha
Path Shanishchar Dev Ko,

Ki Ho Bhakt Taiyaar,
Karat Path Chalis Din,

Ho Bhavasaagar Paar.


Karma is not recognized as the internal or external command

 

Solution:

npm install -g karma-cli



Refer: https://github.com/angular/angular.js/issues/12023

'npm' is not recognized as internal or external command, operable program or batch file

 Add environment variable 


C:\Program Files\nodejs\

To the end of your Path variable on the "User variable" section of the Environment Variables on the System Properties.

After that, reopen your command prompt and type (run cmd as admin.)

         npm


  1. Open the Control Panel (Click the Start button, then click Control Panel)
  2. Click User Accounts
  3. Click Change my environment variables
  4. Select PATH and click the Edit... button
  5. At the end of the Variable value, add ;C:\Program Files\nodejs
  6. Click Ok on the "Edit User Variable" window, then click Ok on the "Environment Variables" window
  7. Start a command prompt window (Start button, then type cmd into the search and hit enter)
  8. At the prompt (C:\>) type npm and hit enter; you should now see some help text (Usage: npm <command> etc.) rather than "npm is not recognized..."



ExecutionPolicy script is not recognized as an internal or external command

 


Fix : Run the command from PowerShell! (PowerShell as Administrator )


If above solution does not work - try this 


Dont work for me: and in cmd, and powershell, in all cases script was runned with admin permission, but I get the same error.
I`m also try to run it from npm folder where its located.

PS C:\Users\mishelen\AppData\Roaming\npm> npm-windows-upgrade
npm-windows-upgrade 0.5.1
? This tool will upgrade npm. Do you want to continue? Yes
Scripts cannot be executed on this system.
To fix, run the command below as Administrator in PowerShell and try again:
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
Refer: https://github.com/felixrieseberg/npm-windows-upgrade/issues/35


Not able to connect ssh - for AWS server - (error). - keypair.perm permission deny OR keypair.pem does not exist?

 


Solution to below issue ( in Mac)


Could not find /Users/keypairs/key-pair.pem

Connecting to: server  at IP 90.xx.x.xxx with keypair key-pair

Warning: Identity file /Users/key-pair.pem not accessible: No such file or directory.

ec2-user@90.xx.x.xxx : Permission denied (publickey).



Try this :
1. In terminal - Go to the path where the "key-pair.pem" is sitting.
2. Check the permissions - just why typing the command - 
            c:/Users/keypairs>   ls -la
3. Run the command - 
          c:/Users/keypairs>   chmod 400
or       c:/Users/keypairs>  chmod 600



This should resolve the issue-- At least this worked for me!



Monday, August 10, 2020

Check a String Contains a Substring in JavaScript

 



Options : Use the indexOf() Method

The simplest and fastest way to check whether a string contains a substring or not in JavaScript is the indexOf() method. This method returns the index or position of the first occurrence of substring within the string, otherwise, it returns -1 if no match found. Here is an example:



  • <script>
  •     // Sample string
  •     var str = "The quick brown fox jumps over the lazy dog."
  •     
  •     // Check if the substring exists inside the string
  •     var index = str.indexOf("fox");    
  •     if(index !== -1){
  •         alert("Substring found!");
  •     } else{
  •         alert("Substring not found!");
  •     }
  • </script>




In ES6 you can use the includes() method to check if a contains a substring. This method simply returns true or false instead of the index. Let's check out an example:



  • <script>
  •     // Sample string
  •     var str = "The quick brown fox jumps over the lazy dog."
  •     
  •     // Check if string contains substring
  •     if(str.includes("fox")){
  •         alert("Substring found!");
  •     } else{
  •         alert("Substring not found!");
  •     }
  • </script>


Check out the tutorial on JavaScript ES6 features to learn about new features introduced in ES6.

Further, you can use the search() method to search a particular piece of text or pattern (using regular expression) inside a string. Like indexOf() method the search() method also returns the index of the first match, and returns -1 if no matches were found.




  • <script>
  •     // Sample string
  •     var str = "Color red looks brighter than color blue."
  •     
  •     // Search the string for a match
  •     var index = str.search(/color/i);  
  •     if(index !== -1){
  •         alert("Substring found!");
  •     } else{
  •         alert("Substring not found!");
  •     }
  • </script>

Health Benefits of Cashews

  Benefits of Cashews. Healthy food is an integral part of healthy body. Regular exercises such as Yoga and healthy diet is important to...