Angular2 Heroes Tutorial

Here I will be going to show you complete steps for
learning Angular2 Heroes Tutorial from Start to end.
I have followed official documentation and created following git repository

Prerequisite: Node.js

  1. Clone this git repository
  2. cd to_cloned_directory
  3. run command npm install
  4. run command npm start

For one by one tutorial parts please check releases


How to Export Mongo collection without mongoexport command

As we know we can export mongo collection or mutliple collections using mongoexport command
but sometime you don’t have access for mongoexport command for given user.
So you can export mongo collection without using mongoexport command as below.
1. Rurn following command in shell

mongo | tee collection.json

2. And then run following command


3. Now open file collection.json file and remove extra lines from file(like use db statements etc or command itself)
from start and end of file

How to use Nginx as reverse proxy for Node apps?

First we need to do followings
1. Create Node App
2. Create Nginx server block
3. Update hosts file
4. Restart Nginx

1. Create Node App
Already I have node app that is running on http://localhost://3000
So start with second point.
2. Create nginx server block
Run following command on terminal

sudo nano /etc/nginx/sites-available/{}

And put following contents

server {
    listen 80;


    location / {
        proxy_set_header X-Real-IP $remote_addr; 
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_set_header Host $http_host; 
        proxy_set_header X-NginX-Proxy true; 

        proxy_pass http://localhost:3000/; 
        proxy_redirect off; 

        # Socket.IO Support 
        proxy_http_version 1.1; 
        proxy_set_header Upgrade $http_upgrade; 
        proxy_set_header Connection "upgrade"; 

and press control+o and then control+x to save & close file
Now run following command on terminal to create symlink

sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/ 

3. Update hosts file

sudo nano /etc/hosts

put following line at bottom of this file
and press control+o and then control+x to save & close file
4. Restart Nginx

sudo service nginx restart

Git Ignore File mod changes

I was working with git and facing file mod changes issues every time.
Then i google it and found a way to ignore file mod changes as below
Run following command to ignore file mod changes

git config core.fileMode false

If you want to run this globally for current logged in user then run following command
in terminal

git config --global core.filemode false

How to do authorization in laravel 5.2?

Its very simple and can be done very easily.
In this tutorial we will look into followings:
How to define Abilities?
How to check Abilities?

  • Via The Gate Facade
  • Via The User Model
  • Within Blade Templates
  • Within Form Requests

What are policies?

How to check abilities/policies in Controller?

Before going to start tutorial just create Place Controller and Place model

php artisan make:controller PlaceController
php artisan make:model Place

How to define Abilities?
Ability means what user can do, operations permitted by user.
You can define abilities in your AuthServiceProvider boot method as below:
Continue reading How to do authorization in laravel 5.2?

How to recover mysql root password

If you are using linux then you can do this very easily
I have not done this on windows machine
First of all get path of mysqld
run following command


And it will output like this
Remember path can be changed
now stop mysql server using following command

sudo service mysql stop

now start mysql with option –skip-grant-tables, –skip-networking as below

sudo /usr/sbin/mysqld --skip-grant-tables  --skip-networking &

Now open new terminal
and run following commands

sudo mysql
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');