• Monday:

##Event Emitter

##Object.create and prototype:

JS inheritance: object prototypes chain: obj has access to several prototypes at different levels. Other objects can also access prototypes of other objects if they points to the same prototypes

##JS .call and .apply: when we invokes an object property with .call/.apply

##ES6 Classes: syntactic sugar way to create function constructor

##JS is synchronous: Node does thing asynchronously, V8 does not. While V8 runs synchronously, Node also does other things simultaneously not just runs the V8 engine. System events in Node are run by libuv which is a library written in C and makes asynchronous non blocking I/O simple

##Streams and buffers

Buffer: a temporary holding spot for data being moved from one place to another. It's intentionally limited in size

Stream: a sequence of data made available overtime

##DOCKER:

docker images = installer -> small size

docker container = installed applications -> when we pass our app around -> pass containers cos' containers contain our data

docker ps -a 
docker run // install images

If there are multiple containers from one image, we cannot remove image. There are 2 ways to remove: remove all containers and force remove

docker rm -f

Install alpine and postgres

sudo docker run -i -t alpine /bin/sh
sudo docker pull postgres:9.6.2-alpine

Installing with sudo docker pull postgres will install the postgres version on ubuntu and debian which is very easy

  • Tuesday:

Add private msg and msg to all to chat room, restyle with flexbox

  • Tuesday afternoon:

Character encoding: stores characters in binary (UTF-8), how m any bits we are using to store that character

Character set: what number is each character presented by (unicode)

#TODO: Express and template, ejs, nunjucks, CSS3 Grids, D3js slides

  • Wednesday morning:

when create data, remember to create master and replica of data

when start a container, the contents of containers and its ports are not automatically exposed

INSTALL pgAdmin 4

sudo apt-get install python-virtualenv
sudo apt-get install python-virtualenv python-pip libpq-dev python-dev
mkdir -p ~/apps/pgadmin4/ 
cd ~/apps/pgadmin4 
virtualenv venv -p /usr/bin/python 
source ./venv/bin/activate
wget https://ftp.postgresql.org/pub/pgadmin3/pgadmin4/v1.3/pip/pgadmin4-1.3-py2.py3-none-any.whl
pip install pgadmin4-1.3-py2.py3-none-any.whl

// if error: src/MD2.c:31:20: fatal error: Python.h: No such file or directory
// install python-dev

sudo apt-get install python-dev
cp ./venv/lib/python/site-packages/pgadmin4/config.py ./venv/lib/python/site-packages/pgadmin4/config_local.py 

// test your installation
python ./venv/lib/python/site-packages/pgadmin4/pgAdmin4.py
// You may be prompted to enter email and password for new user registration

To start pgAdmin 4: remember to run terminal as root

sudo -s // run as root user
cd ~/apps/pgadmin4
source ./venv/bin/activate
python ./venv/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py

Postgresql default user 'postgres'. Can change password. After that you can go to localhost:5050 and create a new server with this user and pwd

$ sudo -u postgres psql postgres
postgres=# \password postgres

// asked to enter new pwd twice

Enter new password: 
Enter it again:

Connect docker postgres to local pgadmin 4

// Pull the latest postgres

docker pull postgres:latest(heavy)
docker pull postgres:9.6.2-alpine

// run the postgres container
// can change user and password as you like

docker run -d -e POSTGRES_USER=user -e POSTGRES_PASSWORD=password123 --name db-test -p 5432:5432 --restart=always postgres

// if more than one container of postgres are running, 5432:5432 might run into ' Error starting userland proxy: listen tcp 0.0.0.0:5432: 
bind: address already in use '
// change '-p 5432:5432' to '-p 5432'
// check running containers
docker ps -a
// get the container ID to run docker inspect command to find container IP
docker inspect --format '{{ .NetworkSettings.IPAddress }}' aac94e1ad279 //change aac94e1ad279 to your container id

// now go to  pgadmin4 local and start a server to your docker IP with username : user and password: password123 as above

Install pgadmin 4 on docker

docker pull fenglc/pgadmin4
// link pgadmin 4 to your docker container of PostgresQL, where test-pgadmin4 is the name for the container of pgadmin 4 and db-test is the name of the PostgresQL container
docker run --name test-pgadmin4 \
           --link db-test:postgres \
           -p 5050:5050 \
           -d fenglc/pgadmin4
  • Thursday morning:

Map a static web to nginx on docker

Create a docker image with dockerfile - deploy a nodejs app as a docker image

Dockerfile is a file that defines the docker image

results matching ""

    No results matching ""