Sunday, September 6, 2020

Phpmyadmin installation for Deepin/ debian linux

 https://phoenixnap.com/kb/how-to-install-phpmyadmin-on-debian-10

Phpmyadmin localhost cant access issue solved

in apache2 config file 

$cfg['Servers'][$i]['auth_type'] = 'config';

$cfg['Servers'][$i]['username'] = 'root';
$cfg['Servers'][$i]['password'] = '';



virtual host setup for linux

 I have been doing Javascript programming for last 2 months, and haven’t worked on any Laravel application in that time. And when, on this weekend, I tried installing a laravel application, I forgot how to create the virtual host file for it. Because for every application, I like to use a domain, and NOT localhost:port. And I will tell you why we need to do make a domain for your applications.

Why do we need a domain?

As good as the php artisan serve command is, it is not going to be responsible for running your application in production mode.

If you have a virtual host setup for your application, let’s say test.site, it will tell your apache server in your machine to act as your server for your application, and you now don’t need to run the serve command and your application is still running.

And the serve command will try to run your application with it’s own settings, and when you move to a server, you will end up with many requirements that you need in order to host your application, and you wouldn’t know about that until you are actually installing your application on a real server.

So, having a real server on your side and running your application on it, gives you a heads up, on what would you need in order to run your application on a real server.

Let’s start with creating a virtual host file.

Virtual Host

It is just a symlink to your application which can be accessed via your link, in this case, test.site .

You can find these files inside your /etc/apache2/sites-available folder.

For example let’s create a virtual host file for a laravel application kept in /var/www/html/test

First go to, /etc/apache2/sites-available/ , copy 000-default.conf file or create a new file at that location with the name of the domain you want, i.e., test.site.conf .

Now, for the content of this file, I have created a ,

<VirtualHost *:80>
ServerAdmin admin@server.in
ServerName server.in
ServerAlias server.in
<Directory /var/www/html/project/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
DocumentRoot /var/www/html/project/public/
ErrorLog /var/www/html/project/error.log
CustomLog /var/www/html/project/access.log combined
</VirtualHost>

 from which you can copy the content and paste in the file. Now you can replace the things as you desire.

ServerAdmin — It can be any email, I keep admin@domain.com

ServerName and ServerAlias — It needs to be the url you want, i.e., test.site

You can replace the project with the name of the application i.e., test .

Now you can save the file.

Now you need to tell apache that this conf file ready to be served, so you need to run this command:

sudo a2ensite test.site.conf

sudo service apache2 restart

dont forget to host the domain in host file

sudo nano /var/etc/hosts

update 127.0.1.1 yournewdomain.test (server alice)

a2ensite generally comes with apache installation. But you can install it externally as well.

And also you need to check if rewrites are enabled on the server. This is not the default setting, so you need to enable it.

You can enable the setting by running below command:

sudo a2enmod rewrite

sudo service apache2 restart

This rewrite module will help run the links on your server. By that I mean, when you don’t run above command, other than the homepage, no other link in your application will work and you will get this error.

Image for post

When you enable the rewrite module, it checks the .htaccess file and run all the links.

Now, there is just one step remaining, you need to add an entry in /etc/hosts file like below

127.0.0.1 test.site

This will tell the server, if any request comes from test.site you need to find its settings in conf file(if you find any) and run the appropriate application.

That’s it, now you can create a virtual host file of your own and run your applications like the way any server would do it.

Conclusion

Making a virtual host for you laravel applications can be really good for you in the long run. You can easily install your application on any apache server.

You now don’t need to run php artisan serve . Your application will directly be running and now you have some magic to show to your colleagues.

Happy learning….

https://medium.com/@bvipul/creating-virtual-host-on-linux-machine-for-your-laravel-applications-the-mighty-guide-70e2c17c0ab7

Thursday, September 3, 2020

PHP vs. Node.js

 


PHP and Node.js are both used for the server side development and thus have become a competitor for each other. Below are some differences based on different parameters to understand the two and make decision between the two giants.


https://www.geeksforgeeks.org/php-vs-node-js/

Npm Vs Yarn

 Fetching packages

  • npm: npm fetches dependencies from the npm registry during every ‘npm install‘ command.
  • Yarn: yarn stores dependencies locally, and fetches from the disk during a ‘yarn add‘ command (assuming the dependency(with the specific version) is present locally).

Commands changed in yarn after npm

COMMANDNPMYARN
Install dependenciesnpm installyarn
Install packagenpm install package_name
npm install package_name@version_number
yarn add package_name
yarn add package_name@version_number
Uninstall packagenpm uninstall package_nameyarn remove package_name
Install dev packagenpm install package_name –save-devyarn add package_name –dev
Update dev packagenpm update package_name
npm update package_name@version_number
yarn upgrade package_name
yarn upgrade package_name@version_number
View packagenpm view package_nameyarn info package_name
Global install packagenpm install -g package_nameyarn global add package_name

Commands same for npm and yarn:

NPMYARN
npm inityarn init
npm run [script]yarn run [script]
npm listyarn list
npm testyarn test
npm linkyarn link
npm login or logoutyarn login or logout
npm publishyarn publish

Laravel boiler plate

 https://github.com/rappasoft/laravel-boilerplate?fbclid=IwAR1TvlPxfY5vRSaEO2g_6lUpaNvHzAYPWNJtRocBjnktz7AxaxtZnqOSzK4

Tuesday, September 1, 2020

Laravel course materials


INTRODUCTION

- Introduction to Laravel.

- Course Outline.

- Familiarise with real world web development.

OOP & DESIGN PATTERNS IN PHP

- Basic Object Oriented Programming Concepts

- Why we need design patterns

- The SOLID design principles

- Creational Design Patterns

- Design patterns (Factory, Abstract Factory, Builder Prototype, Singleton, Prototype, Facades)


SETTING UP LARAVEL ENVIRONMENT

The "Conventional" Way   - WAMP/XAMPP

- Composer

- Apache

- MYSQL

- Redis

Using Docker (Bonus)

- DOCKER

- NGINX

- MYSQL

- PHP

- Redis

- LINUX

Introduction to Version Controlling System

- Git

- Github  Introduction to AWS

- Free tier account in AWS

- AWS Basics (Regions, Availability Zones, IAM, EC2, ELB)

- SSH into your own EC2 instance


UNDERSTANDING LARAVEL ARCHITECTURE CONCEPTS

- Request Lifecycle

- Service Container

- Service Providers

- Facades

- Contracts


SIMPLE TODO APP USING BLADE & BOOTSTRAP

- Database schema design

- Create database tables using migrations

- Configuring Models & Relations

- Web Routing

- Middleware

- Controller

- Authentication

- CRUD with Eloquents & Query Builder

- Views

- Frontend development with blade and JS/JQuery & bootstrap

- Notifications

- Settings


BUILDING AN INSTAGRAM CLONE PART 1 (SYSTEM ANALYSIS)

- Requirements assessment

- Capacity estimations

- Highlevel system & Database design

- Component Design

- Reliability & Consistency

- Performance Optimization Evaluation


BUILDING AN INSTAGRAM CLONE PART 2 (DATABASE AND MODEL CONFIGURATION)

- Schema Design

- Creating migrations using schema definition

- Create and setting up models with relations


BUILDING AN INSTAGRAM CLONE PART 2 (API DEVELOPMENT)

API development in Laravel  API Authentication

- OAuth

- Passsport

- Access Tokens  Basic API Stuffs

- Routing - API validations & Error Responses  Users API

- Sign Up

- Login

- Email Verification (with AWS SES)

- Password Reset (AWS SES)

- Follow/Unfollow user

- User Profile  Posts API

- Creating posts - Uploading Images (with AWS S3)

- Optimisation 1: Queue Post Creation (with AWS SQS)

- Fetching posts

- Optimisation 2: Paginate posts

- Rank posts

- Optimisation 3: Schedule post ranking algorithm

- Optimisation 4: Query Caching with Redis

- Post Details  Reactions API - Reaction CRUD

- Count Reactions/Post in post list api (Like/Comments)

- Load Reactions in Posts (Dashboard)

- Load paginated comments in post details


BUILDING AN INSTAGRAM CLONE PART 3 (FRONTEND DEVELOPMENT)

- Typescript Basics

- Single Page Application (SPA) vs Server Side Rendering (SSR)

- Setting up SSR with express and nodejs

- Authentication & cookie management

- Express Routing

- Setting up Vue CLI & Vuetify

- Setting up CSS preprocessor (SCSS)

- Configuring API client

- Posting and fetching data with api client

- Component Design

- Data management with VUEX

- Front end Development

- Sing Up/Login Page

- Dashboard with infinite scroll pagination

- Profile Page

- Notifications

- Inbox

- Testing (Unit, E2E)

- Bundling (Webpack) & Production Build

- Continuous integration with CIRCLE CI


DEPLOYMENT AND PERFORMANCE OPTIMISATION

- Deploying in EC2 with manual configuration

- Load Balancing with AWS ELB


CONCLUSION

- Real life software development scenario

- Practical scenario of Agile based development

- Software development etiquettes & manners