Posts

Linux 'nohup' command

  That's what makes Linux so good: you put in something, and that effort multiplies. It's a positive feedback cycle.                ----- Linus Torvald   nohup is a POSIX command which means "no hang up". Its purpose is to execute a command such that it ignores the HUP (hangup) signal and therefore does not stop when the user logs out. An output that would normally go to the terminal goes to a file called nohup.out, if it has not already been redirected. The first of the commands below starts the program abcd in the background in such a way that the subsequent logout does not stop it.                                  $ nohup abcd &                                  $ exit On Linux, running a job with  nohup  automatically clos...

WebDriverIO installation

  webdriverIO setup and installation commands: -- npm init -- npm install webdriverio --save-dev -- npm install @wdio/cli -- npx wdio config -- npm install chai --save-dev -- npm install chai-webdriverio --save-dev -- npm install local-runner --save-dev Allure Report https://khyatisehgal.wordpress.com/2020/08/14/generating-allure-reports-in-webdriverio/

Pizza cut problem

 What is the maximum number of pieces possible for n cuts in a pizza? class MaxPieces {             // Function for finding maximum pieces      // with n cuts.      static int findMaximumPieces( int n)      {          return 1 + n * (n + 1 ) / 2 ;      }             // Driver Program to test above function      public static void main(String arg[])      {                     System.out.print(findMaximumPieces( 3 ));      } }

Mask all the characters except last 4 digit/character

  Questions: WAP to mask all the character of string except last 4 characters Eg: 12324324234354            ########## 4354        1213                                                               1223          1                                                                      1     spotify                                      ###tify Solution:           ...

Get first non-repeating Letter

import java.util.HashMap ; import java.util.LinkedHashMap ; import java.util.Map ; import java.util.HashMap ; import java.util.LinkedHashMap ; import java.util.Map ; public class Check { public static String firstNonRepeatingLetter ( String str) { String val= null ; char [] var =str.toCharArray(); LinkedHashMap < Character , Integer > map = new LinkedHashMap<>(); for ( int i= 0 ;i< var . length ;i++){ if ( map .containsKey( var [i])){ map .put( var [i], map .get( var [i])+ 1 );} else { map .put( var [i], 1 ); } } for ( Map . Entry < Character , Integer > entry : map .entrySet()){ if ( entry .getValue()== 1 ) { val = Character . toString ( entry .getKey()); break ; } } return val; } public static void main ( String [] args) { System . out .println( firstNonRepea...

Docker commands

List all images in docker-engine docker ps -a Delete image from the local image store docker image rm alpine:3.4 Run a container from the Alpine docker container run --name web -p 5000:80 alpine:3.9 Stop a running container through SIGTERM docker container stop web Stop a running container through SIGKILL docker container kill web List the running containers  docker container ls Print the last 100 lines of a container’s logs docker container logs --tail 100 web(container name) List the networks docker network ls   

Maven multi module projects

A multi-module project is built from an aggregator POM that manages a group of submodules. In most cases, the aggregator is located in the project's root directory and must have packaging of type pom. Now, the submodules are regular Maven projects, and they can be built separately or through the aggregator POM. By building the project through the aggregator POM, each project that has a packaging type different than pom will result in a built archive file. Parent POM Maven supports inheritance in a way that each pom.xml file has the implicit parent POM, it's called Super POM and can be located in the Maven binaries. These two files are merged by Maven and form the Effective POM. Hence, we can create our own pom.xml file which will serve us as the parent project. Then, we can include there all configurations with dependencies and set this as the parent of our child modules, so they'll inherit from it. Besides the inheritance, Maven provides the notion of aggregation. Parent ...