Posts

PostgreSQL Commands

  Select Statement   select * from users;  - Selects all column select username from users;  - Selects only username column    select * from users limit 10;  - Selects only first 10 records Here column name is case insensitive  e.g username = USERNAME Columns name with space in between must be same as what is stored in database  e.g.  “User Name” is not equal to “user name”. You should enter “User Name” in query Where Filter   select * from users where country=’europe’;  - Selects all column from users table whose country column values is europe select * from users where country=’europe’ limit 10; - Selects first 10 records from users table whose country column values is europe select * from users where “Annual Salary” > 10000; Use logical operator on number columns to perform numeric operations select * from users where Extract(Year from to_date(birthdate, “MM/DD/YYYY”))=2015 limit 10; Selects first 10 users whose birt...

Understanding a Dockerfile

Image
  Understanding a Dockerfile Dockerfile describes exactly how the docker image should be constructed. It is made up of various instructions such as  FROM, RUN, COPY, and WORKDIR. FROM : Image to use as its starting point. Our Image is based on ruby:2.6 RUN : Tells Docker to execute commands apt-get : Linux command to install software -y : Answers YES to any prompts -qq  : Enables QUIET mode to reduce printed output Installs nodejs - A prerequisite of running Rails  --no-install-recommends : Not to install other non essential packages We don't need sudo here because commands inside the container by default runs by root user COPY . /usr/src/app/  Copy all files from current directory (.) to /usr/src/app Copies Rails application into container at /usr/src/app Source path is depends on where our Dockerfile is located WORKDIR /usr/src/app :  Container default working directory is / Change working directory to /usr/src/app RUN bundle install :  Executes from...

Rails Application with Docker

Image
Creating Rails App We are creating a rails application without installing rails on our system Create a folder on machine where we want to create Rails app Linux  mkdir ~/docker_rails cd  ~/docker_rails Windows  mkdir docker_rails cd docker_rails Create docker container based on image ruby:2.6   docker run -i -t --rm -v ${PWD}:/usr/src/app ruby:2.6 bash   Where docker run creates a container -i -t OR  -it :    --rm : It's a throwaway container  -v Mounts volume to share local system with container  ${PWD} :  Unix environment variable pointed to current directory Windows user should give current directory path as below docker run -i -t --rm -v C:/Users/amrut/OneDrive/Desktop/Amruta/docker_rails :/usr/src/app ruby:2.6 bash   ${PWD}:/usr/src/app : Mount the current directory inside the container at /usr/src/app Ruby:2.6 Reference docker image bash   After running this command , we can see  root@05d3878962ce:/# This shows...

PERSONAL ACCESS TOKEN ON GITHUB

Image
  PERSONAL ACCESS TOKEN ON GITHUB  PURPOSE While doing git clone or git pull if you face and issue and getting below error  remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. You have to create a personal access token with your git handle. Authentic in terminal with this PAT ( personal access token) REASON While doing any git operation, now GitHub is  not accepting authentication with password  You need to add PAT. Follow below steps to create PAT and authenticate on your local machine STEPS  CREATE PERSONAL ACCESS TOKEN Login to GitHub from the browser. Go to Settings - > Developer setting -> Personal access token -> Create new token Authenticate Full out required fields Select expiration period We want to access the repository from the command line. For this don't forget to  select "repo" option Click "Generate token" Copy generated token. Your tokens are like your password...