Sunday, October 13, 2019

multiple node version using nvm and cURL defination


nvm stands for Node Version Manager. As the name suggests, it helps you manage and switch between different Node versions with ease. It provides a command line interface where you can install different versions with a single command, set a default, switch between them and much more.

important command
-- nvm ls
-- nvm use 12.16.3 (bjit office)
-- nvm use 12.8.0 (bjit office)

Please run the nvm in vs code/ specific folder

REf:
  1. https://computingforgeeks.com/how-to-run-multiple-versions-of-node-js-on-linux/

cURL
cURL is a computer software project providing a library and command-line tool for transferring data using various protocols. It was first released in 1997. The name stands for "Client URL". The original author and lead developer is the Swedish developer Daniel Stenberg

Basic of react and interview question

Friday, October 11, 2019

Ngrx


NGRX:
Generally, it's a pattern for controlling the state of an application, and the flow of data throughout the appliction.


NgRx App State Management

Let’s look at the NgRx implementation — there are several components to understand.
  • Store: Store is what holds the app's state. 
  • Action: A unique event dispatched from components and services that describe how the state should be changed. For example, ‘Add Customer’ can be an action that will change the state (i.e. add a new customer to the list).
  • Reducer: All the state changes happen inside the reducer; it responds to the action and, based on that action, it will create a new immutable state and return it to the store.
  • Selector: Selector is a function used for obtaining a part of the state from the store.
  • Effect: A mechanism that listens for dispatched actions in an observable stream, processes the server response, and returns new actions either immediately or asynchronously to the reducer to change the state. Please note that we are not using effect in this example app.

Ref:
  1. https://blog.angularindepth.com/how-to-start-flying-with-angular-and-ngrx-b18e84d444aa
  2.  https://dzone.com/articles/angular-app-state-management-with-ngrx (VVI basic example)
  3. https://stackoverflow.com/questions/57563867/ngrx-pass-payload-through-dispatch-method-to-update-store 
  4. https://medium.com/@RupaniChirag/simple-angular-app-using-ngrx-8-store-and-effects-factory-methods-f3423b9f6d3b (effect very simpel and easy)

Thursday, October 3, 2019

Angular interview question

What’s the difference between agile, CI/CD, and DevOps?

Agile:
Agile is most popular software development process in software industry. Agile is a flexible software development methodology, involving a large number of various iterations.

Pros:

  1. Adaptive approach that responds to changes favorably
  2. Allows for direct communication to maintain transparency
  3. Improved quality by finding and fixing defects quickly and identifying expectation mismatches early.

Cons:

  1. Focuses on working with software and lacks documentation efficiency
  2. Chances of getting off-track as outcome are not clear


Continuous integration/continuous delivery (CI/CD)


Continuous integration (CI) is a software engineering practice where members of a team integrate their work with increasing frequency. In keeping with CI practice, teams strive to integrate at least daily and even hourly, approaching integration that occurs “continuous-ly.”


Continuous delivery (CD) is to packaging and deployment what CI is to build and test. Teams practicing CD can build, configure, and package software and orchestrate its deployment in such a way that it can be released to production in a software-defined manner (low cost, high automation) at any time.


Development : our account / north--vergenia
Stagging: client account / north--vergenia
Production: client-account / ireland


code commit : AWS CodeCommit is a version control service hosted by Amazon Web Services
code build
code deploye : CodeDeploy is a deployment service that automates application deployments to Amazon EC2 instances
code pipeline : AWS CodePipeline is a continuous delivery service you can use to model, visualize, and automate the steps required to release your software.

Continuous Integration and Continuous Delivery Model
-----------------------------------------------------------------------------------
Create a CodeCommit repository
Access the CodeCommit repository from developer machine
Design a code delivery model using CodeCommit, CodeDeploy, CodePipeline




Scrum

Scrum is the most popular agile development framework because it is relatively simple to implement.



In scrum, a small team is led by a scrum master whose main job is to clear away all obstacles to work getting done more efficiently. The team works in short cycles of 2 weeks called “sprints,” though the team members meet daily to discuss what’s been done and where there are any roadblocks that need clearing. This methodology allows for quick development and testing, especially within small teams.
Scrum is a framework for project management that emphasizes teamwork, accountability and iterative progress toward a well-defined goal. The three pillars of Scrum are transparency, inspection and adaptation

Scrum master: This team member serves as a facilitator. The Scrum master is responsible for ensuring that Scrum best practices are carried out and the project is able to move forward.

The Scrum process



Daily Scrum . The Daily Scrum is a short stand-up meeting that happens at the same place and time each day. At each meeting, the team reviews work that was completed the previous day and plans what work will be done in the next 24 hours. This is the time for team members to speak up about any problems that might prevent project completion.

Sprint Planning Meeting. A Sprint refers to the time frame in which work must be completed, and it's often 30 days. Everyone participates in setting the goals, and at the end, at least one increment -- a usable piece of software -- should be produced.
Sprint Review. This is the time to show off the increment.

REF:




Monday, September 23, 2019

Sunday, June 2, 2019

Docker



Images:
The file system and configuration(read-only) application which is used to create containers. More detail.

Containers
These are running instances of Docker images.

Docker daemon -
The background service running on the host that manages the building, running and distributing Docker containers.

Docker client -
The command line tool that allows the user to interact with the Docker daemon.

Docker Store
Store is, among other things, a registry of Docker images. You can think of the registry as a directory of all available Docker images.




image and container according to OOP
An image is to a class as a container to an object.
A container is an instance of an image as an object is an instance of a class


image is read only: how do we chagne it
--  we dont directly
-- we create new image from that images
-- we make changes to that containers
-- when we are statisfied with this chagnes, then we transform them into new layer
-- a new image is create by stacking the new layer on the top of the old image


image can be created by docker commit and docker build and docker import


Docker commands:
  1. docker images
  2. docker rmi image_name
  3.  docker images -q
  4. docker ps /docker ps -a
  5. docker ps -a -q //only show id
  6. docker start/stop/restart/kill/pause
  7. docker rm container_name  
  8. Docker search Ubuntu -s 5
  9. docker run -it <image name or image id> /bin/bash
    1. docker run -it ubuntu /bin/bash  //create ubuntu container and open a bas
    2. exit  //exit command to out from the bash
  10. docker build -t my_image dir_with_dockerfile (Build Dockerfile: )
  11. docker-machine ip
  12.  
  13. docker version
  14. docker info


     
docker container run my_imageCreate a new container and start it. It also has a lot of options. Let’s look at a few.

docker container run -i -t -p 1000:8000 --rm my_image

-i is short for --interactive. Keep STDIN open even if unattached.
-tis short for--tty. Allocates a pseudo terminal that connects your terminal with the container’s STDIN and STDOUT.

You need to specify both -i and -t to then interact with the container through your terminal shell.

-p is short for --port. The port is the interface with the outside world.1000:8000 maps the Docker port 8000 to port 1000 on your machine. If you had an app that output something to the browser you could then navigate your browser to localhost:1000 and see it.


Difference between virtual machine implementation and container based implementation



Docker Compose

Docker Compose is used to run multiple containers as a single service. For example, suppose you had an application which required NGNIX and MySQL, you could create one file which would start both the containers as a service without the need to start each one separately.

What is Docker Compose

Most projects build architectures that involve more that one architecture component. Even the simplest hobby project will probably be built with a database and an application server of some kind. For example, the popular Wordpress stack consists of a Wordpress installation and a MySQL database instance.


If your application needs multiple components, i.e. multiple containers for differenct purposes, you need some tool to define the containers involved in your application stack and how these containers work together.
I don’t want to make this article confusing for beginners, so we’ll stay with the below definition for the first example and we’ll add more details later in this post:
Docker Compose is the toolkit provided by Docker to build, ship and run multi-container applicatoins.

compose Ref: 
  1. https://takacsmark.com/docker-compose-tutorial-beginners-by-example-basics/
  2. https://www.linode.com/docs/applications/containers/how-to-use-docker-compose/
  3. https://tecadmin.net/tutorial/docker/docker-compose/ (VVI)




****************************************
docker <management command> command
ex docker container run
prev docker run

docker container run --publish 80:80 nginx
docker container run --publish 80:80 --detach nginx //fro detach nginx run in background

docker container top  // process list in one container
docker container inspect //detail of one container configs
docker container stats // performance stat of all container


Doker interview question:
https://www.educba.com/docker-interview-questions/



References:
  1. https://stackoverflow.com/questions/23735149/what-is-the-difference-between-a-docker-image-and-a-container
  2. https://www.youtube.com/watch?v=DgoKjlDteEA&list=PLea0WJq13cnDsF4MrbNaw3b4jI0GT9yKt (VVI)
  3. https://www.tutorialspoint.com/docker/ 
  4. https://towardsdatascience.com/15-docker-commands-you-should-know-970ea5203421
  5.  https://tecadmin.net/tutorial/docker/docker-introduction/ (VVI)
  6. https://www.udemy.com/docker-mastery/ (good online udemy course)
https://appdividend.com/2018/04/13/how-to-setup-node-express-and-mongodb-in-docker/  (nodejs mongodb docker setup)

Autoboxing and Unboxing

  Autoboxing  is the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper cl...