Friday, 4 September 2020

Installing Docker and Minikube

 

install docker-

 

sudo apt install docker.io

 

set user to docker group:-

sudo gpasswd -a  {user} docker

 

imp commands:-

docker image ls

docker container ls

docker run -p 80:80 -d richardchesterwood/k8s-fleetman-webapp-angular:release0-5

docker stop <containerId>

docker rm <containerId>

 

running mysql with storage persist scenario:

 

docker run --name sampleDockerDB -p 3306:3306 -e MYSQL_ROOT_PASSWORD=pass -d mysql:5

 

docker exec -it 3e bash

mysql -p{password}  `Comment:#no space after -p`

show databases;

apart from its internal file system, mysql stores data on actual hardware:

 

docker container inspect <containerId>

 

docker volume ls  `to list volumes mounted on actual hardware not docker image`

 

set default local volume to persist data:-

 

docker run --name viksDB -v mydata:/var/lib/mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=pass -d mysql:5

 

 

---------------------

 

- Starting with running minikube locally

 

https://kubernetes.io/docs/tasks/tools/install-minikube/

 

check if virtualization is supported on Linux,run the following command and verify that the output is non-empty:

grep -E --color 'vmx|svm' /proc/cpuinfo

 

 

Minikube also supports a --driver=none option that runs the Kubernetes components on the host and not in a VM. Using this driver requires Docker and a Linux environment but not a hypervisor.

 

Install kubectl

curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/linux/amd64/kubectl

 

Make the kubectl binary executable.

 

chmod +x ./kubectl

 

Move the binary in to your PATH.

 

sudo mv ./kubectl /usr/local/bin/kubectl

 

Test to ensure the version you installed is up-to-date:

 

kubectl version --client

 

Install Minikube via direct download

 

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \

  && chmod +x minikube

sudo mv ./minikube /usr/local/bin/minikube

 

minikube start --vm-driver=none

 

(optional):-

 

minikube addons list

 

minikube addons enable dashboard

 

to get minikube dashboard url:-

 

minikube dashboard --url

 

access url in local machine using ssh tunnel:-

ssh -L 8081:localhost:42441 ubuntu@192.168.0.102

 

optional:

access docker within minikube

minikube docker-env

 

# To point your shell to minikube's docker-daemon, run:

# eval $(minikube -p minikube docker-env)

 

minikube ip

installing proper MINT and saving the vdi in safe location

 Mouse Scroll:-

 

sudo apt-get install imwheel && wget http://www.nicknorton.net/mousewheel.sh && chmod +x mousewheel.sh && ./mousewheel.sh

 

Use the usermod command to add the user to the sudo/root group:

 

adduser <username>

usermod -aG sudo <username>

userdel <username>

 

 

To Enable Snap in Linux Mint 20,

 

    Open terminal as root.

    Type the following command: # rm /etc/apt/preferences.d/nosnap.pref.   This will enable Snap.

    Now, update the package cache for apt with this command: # apt update

    Finally, install the snapd package: # apt install snapd

sudo snap install snap-store

 

Shared Folders:-

In Ubuntu, you need to add your username to the vboxsf group, using the adduser/addgroup command in terminal (sudo adduser <username> vboxsf), then logout and log back in, or reboot.

 

Move “Show Applications” right to left of the Dock:

 

“gsettings set org.gnome.shell.extensions.dash-to-dock show-apps-at-top true”

 

Friday, 1 June 2018

GIT Bash in windows



The advantage of installing git is that you will get git UI and git bash.
and you can right click and get git bash in whichever folder you want.

Useful commands:-

cd /c/           ---- it will take you to c folder
cd .. ---- it will take you to parent folder 1 step
ls ----  list all files
ls -a ---- list all hidden files too

Thursday, 26 October 2017

Machine Learning Notes




Machine learning notes on Clustering

Clustering:
  The method of identifying similar groups(patterns) of data in a dataSet is called clustering.
  clustering can be divided into two subgroups :
      Hard Clustering
      Soft Clustering

    Types of clustering algorithms:

    Connectivity models:
    Centroid models:
      K-Means clustering algorithm
    Distribution models:
      example:- Normal, Gaussian
    Density Models:

    K-Means clustering algorithm:
 

   










Hierarchical Clustering:

Applications:-

·        Recommendation engines
·        Market segmentation
·        Social network analysis
·        Search result grouping
·        Medical imaging

·        Image segmentation

Monday, 25 September 2017

Intro to Machine learning:python setup

Tried many versions/flavours of python but this is finally working:

while setting up python for machine learning.
I followed the below steps :-
Install python-2.7.13.msi
• set PATH=C:\Python27
• set PATH=C:\Python27\Scripts
Downloaded:- • numpy-1.13.1+mkl-cp27-cp27m-win32.whl 
                       • scipy-0.18.0-cp27-cp27m-win32.whl
Installing numpy: pip install numpy-1.13.1+mkl-cp27-cp27m-win32.whl
Installing scipy: pip install scipy-0.18.0-cp27-cp27m-win32.whl
You can test the correctness using below cmds:-
>>> import numpy
>>> import scipy
>>> import sklearn
>>> numpy.version.version
'1.13.1'
>>> scipy.version.version
'0.19.1'
>>>

Good things of doing this course:-

  • Helped me in beliving that I can learn Machine Learning.
  • Very interactive,you will not get bored
  • Nice simple exercises,me being new to python running my code in python is very Joyful.
  • Andrew's classes were very therotic and mathematical,one needs great concentration in understanding those concepts.

Friday, 22 September 2017

Dive in to Python world from Java


 Personal review:-

  •  python is very easy to learn if you are coming from java background.
  • Like Java, python is very vast,Target what you want to learn. For me I needed python knowledge as I am starting working on Machine Learning.
    • It has lot of math tools n libraries required for Machine Learning

Thursday, 21 September 2017

Hibernate short notes


  • Transient
  • Persistance
  • Detached


Save() - hibernate function,it will return generated key
Persist() - JPA function works same as save(),return type is void
Merge() - JPA function,return type is void
Update() - hibernate function
saveOrupdate() - hibernate function


Different between session.get() and session.load():-

Actually, both functions are use to retrieve an object with different mechanism, of course.

1. session.load()
• It will always return a “proxy” (Hibernate term) without hitting the database. In Hibernate, proxy is an object with the given identifier value, its properties are not initialized yet, it just look like a temporary fake object.
• If no row found , it will throws an ObjectNotFoundException.
2. session.get()
• It always hit the database and return the real object, an object that represent the database row, not proxy.
• If no row found , it return null.

Wednesday, 20 September 2017

Spring Notes

Bean Scopes in Spring:

singleton

prototype

request

session

global-session

Good question: How spring Handles singleton?
https://stackoverflow.com/questions/42376756/how-spring-singleton-scope-for-dao-class-works-internally

Notes on Singleton Pattern and Immutable Objects

Where exactly the Singleton Pattern is used in real application?

  • ·       Logger
  • ·       DB Connection

 A Strategy for Defining Immutable Objects

  1. Don't provide "setter" methods — methods that modify fields or objects referred to by fields.
  2. Make all fields final and private.
  3. Don't allow subclasses to override methods. The simplest way to do this is to declare the class as final. A more sophisticated approach is to make the constructor private and construct instances in factory methods.
  4. If the instance fields include references to mutable objects, don't allow those objects to be changed:
    • Don't provide methods that modify the mutable objects.
    • Don't share references to the mutable objects. Never store references to external, mutable objects passed to the constructor; if necessary, create copies, and store references to the copies. Similarly, create copies of your internal mutable objects when necessary to avoid returning the originals in your methods.

Monday, 18 September 2017

Autowiring in Spring

Autowiring can be done on:


  • directly into fields/attributes
  • via explicit setter methods
  • via explicit constructor parameters

Sunday, 17 September 2017

Spring Boot application in AWS

Hosted my first Spring Boot application in AWS today,with mysql DB.

Reference:- https://aws.amazon.com/blogs/devops/deploying-a-spring-boot-application-on-aws-using-aws-elastic-beanstalk/

URL:- http://springbooteb-svk-prod.us-east-2.elasticbeanstalk.com/
 http://springbooteb-svk-prod.us-east-2.elasticbeanstalk.com/people

 Its easier than i expected,though its not a cake walk for beginners, one with prior knowledge of deployment in various scenarios only will be able to succeed in the first go.

Thursday, 14 September 2017

Tools i use for my development


   ☐ Intellij for Core Java development
   ☐ Eclipse for J2EE development
   ☐ Sublime Text for text editing
   ☐ cmDer for cmd prompt alternative
   ☐ heidisql as a DB client
   ☐ chrome browser
   ☐ one note for note taking-online, everything

Wednesday, 13 September 2017

Docker

Started studying about the Docker as the topic is very fascinating.
Developed a spring application n deployed it in the Docker.

Github link:- Docker Sample java Application

docker is nothing but a container to hold your appication and seperating the OS there by many such dockers can run in the same system sharing same OS just the high layer varies.

There's a concept same as Maven called DockerHub,
From where you download all repos i.e images of Java,Tomcat,DB etc and you can also upload your Docker image to the docker.

Docker creates a local repo just like maven .m2 and uses it for later usage.

Steps:
install docker in windows 10 machine
mvn clean install
docker build -t gs-spring-boot-docker-0.1.0 .
docker run -p 8080:8080 gs-spring-boot-docker-0.1.0

What is this Serverless?How is it useful?

I have been seeing this catchy word over the internet so was bit curious to know what exactly it is.

So serverless doesn't exactly mean no need of server,but instead it means that you no need to worry setting up the server n configuring for the whole day as we saw few devOps team guys will be working.

Its just that you embed your server say tomcat or jetty in our own application and running.But for this the application should be as small as possible i.e microservices.

Saturday, 9 September 2017

Lambdas

Lambda basics:-

whay lambdas?
-> helps functional programming

Advantages:-

  • concise code
  • parallel processing

Drawback of oops:
All code blocks should be associated with class and objects.

Lambda Expression examples

(int a) -> a * 2; // Calculate the double of a
a -> a * 2; // or simply without type
(a, b) -> a + b; // Sum of 2 parameters
If the lambda is more than one expression we can use { } and return

(x, y) -> {
int sum = x + y;
int avg = sum / 2;
return avg;
}
A lambda expression cannot stand alone in Java, it need to be associated to a functional interface.

interface MyMath {
    int getDoubleOf(int a);
}

MyMath d = a -> a * 2; // associated to the interface
d.getDoubleOf(4); // is 8

HATEOAS

HATEOAS:- Hypertext As The Engine Of Application State
.
The way of sending the response with links which directs the next possible operations.
{
"name": "Vikram",
"id": 1
"link" [
{
"href":"http://localhost:8080/myApp/1",
"rel":"self"
}
]
}

Richardson maturity Modal:-


Friday, 8 September 2017

Spring Framework Complete

understand the complete flow and add spring security,cloud,log,database change and add an article in dzone. sept 8-10

worked on Spring application pet Clinic accepted as the Reference project for all spring features since 2007.
Github link:- PETCLINIC GITHUB
in Spring site:- link

Its Developed by spring developers and opensource contributors.
Spring-Petclinic is spread accross different repos in github each with different approach to solve the same common requirement.

List of features it explains:-
Spring MVC
  With XMl
  With Annotations+xml
  With JavaConfig
  With JSP UI
  With Thymeleaf UI


Spring Rest - HATEOAS

  With JDBC
  With jpa - EntityManager
  Spring Jpa

For both H2 Database and Mysql.

Spring Rest + Angular JS

Spring boot

Spring Microservices
  Eureka for node register and discovery


Docker 

Kill the process running at port 8080

netstat -a -o -n

taskkill /F /PID 28344

Installing Docker and Minikube

  install docker-   sudo apt install docker.io   set user to docker group:- sudo gpasswd -a   {user} docker   imp commands:- ...