Top Mostly Used Git Commands

************************** Git clone a Repository ****************** git clone <repository_url> ************************ Check git branch ********************* git branch ************************ Git Create Branch ************* Git checkout -b <branch-name> ************************ Checkout to another branch ************* Git checkout <branch-name> ************************ Make your file same as git repository ************* Git checkout <file-name> -> for all files :- Git checkout . ************************* Git commit command ********************* git add . [for all files] git commit -m “your comment” ************************* Git push command ********************** git push origin <your-branch-name> *********************** Git pull command ************************ git pull origin <your-branch-name> *********************** Git…

List of Top Docker Commands in Linux

Docker works just like Git. you have to always take a pull for latest image. ****************************** Docker install ****************** sudo apt-get update sudo apt-get install docker.io **************************** Check docker installed or not ************* docker ps -a ************************* Login to AWS container via command line ************  $(aws ecr get-login –no-include-email –region us-east-1) get-login [–registry-ids <value> [<value>…]] [–include-email | –no-include-email] **************************** pull the docker image ************* docker pull your-server.us-east-1.amazonaws.com/aws_repository ************************** Docker push image ************************************** -> commit your changes first docker commit <your-container-name> your-server.us-east-1.amazonaws.com/aws_repository:v2.2 (v2.2 is the tagging  version) -> Now run push…

How To Remove Docker Images ?

Removing Docker Images Remove one or more specific images Use the docker images command with the -a flag to locate the ID of the images you want to remove. This will show you every image, including intermediate image layers. When you’ve located the images you want to delete, you can pass their ID or tag to docker rmi: List: docker images -a Remove: docker rmi Image Image

Difference Between DDL and DML?

DML DML statements are SQL statements that manipulate data. DML stands for Data Manipulation Language. The SQL statements that are in the DML class are INSERT, UPDATE and DELETE. Some people also lump the SELECT statement in the DML classification. DML example SQL statements are below – SELECT – retrieve data from the a database INSERT – insert data into a table UPDATE – updates existing data within a table DELETE – Delete all records from a database table MERGE – UPSERT operation (insert or update) CALL – call a…

How To Integrate Facebook PHP SDK With Laravel 5.4

Facebook SDK Laravel integration image

In this article, I am explaining a simple process to set up the Facebook Marketing SDK using a PHP Artisan Command with Laravel 5.4. You can retrieve campaigns or ad account data by setting up a cron job with the created command or running it directly in the terminal. First, edit the composer.json file in the project’s root folder to include the Facebook SDK: { “require”: { “facebook/php-business-sdk”: “3.1.*” } } Next, run composer update in the terminal to pull the SDK into the vendor folder: php composer.phar install –no-dev…

Laravel Advanced how to pass variable into nested where function?

When using a variable inside a Closure scope, you must use the “use” keyword to pass the variable into the Closure: foreach ($user->locations as $location) { $r = TableName::where(‘id’, ‘<>’, $this->id) ->where(function ($q) use ($code) { // SEE HERE $q->where(‘name’, $code) ->orWhere(‘alias’, $code); }) ->get(); } If you have an array variable like $requestParam[‘name’], you need to define it before the query statement: $name = $requestParam[‘name’]; $lastRecordResult = YrModel::where(‘type’, self::table) ->where(function ($q) use ($name) { $q->where(‘name’, $name) ->orWhere(‘alias’, $name); }) ->where(‘t_id’, $requestParam[‘t_id’]) ->where(‘v_id’, $requestParam[‘v_id’]) ->count();

Get A Insert Query Statement For All Rows in MySql

MySQL insert query tutorial image

This is a common thing that usually required for back end programming.  Sometimes we need all rows of a table as an query statement just like – INSERT INTO MyTable(ID,Col1,Col2,Col3) VALUES (100,’some vlaue’,’some value’,’2018-10-20′); So the question is “How do we get the insert query statement for this easily ?” Here I am gonna write a simple PHP function by that you can get the insert query statement for all rows in a table :- <?php function makeInsertQuery($mysqli,$table, $where=null) { $sql=”SELECT * FROM `{$table}`”.(is_null($where) ? “” : ” WHERE “.$where).”;”;…

MySQL Group By Day, Month Or Year

MySQL Group By tutorial image

Most frequently occurred problem that is faced by developers.  Here I am gonna explain you for the query Group by Day, Month or Year in MySQL. Using the DATE_FORMAT operator, you can easily group the timestamp, date or datetime column using any format you want. For example, I needed to group rows that were added on the same day. Here is my query: select count(*), DATE_FORMAT(created_at,”%Y-%m-%d”) as created_day FROM widgets GROUP BY DATE_FORMAT(created_at,”%Y-%m-%d”) This query will give you result like this : count(*) | created_day 126 | 2012-04-12 168 |…

How To Setup Cron Job on AWS

AWS cron job setup image

Cron job is a process to run a page automatically in background without interrupting user. You can execute a page automatically at any time on daily basis by setting up a cron job.        I have already explained about setting up a cron job on godaddy server in one of my article. So now here I am going to explain a step by step process for setting up cron job in AWS too for ubuntu users. Process to Setting Up AWS Cron:- Step #1. Login to your AWS instance through Terminal by…

Top PHP7 Interview Questions And Answers for Freshers & Experienced

PHP7 interview questions image

This article shows up top frequently asked PHP7 interview questions and answers for PHP Developers, This list of PHP interview questions and answers will be helpful for PHP programmers. Question #1 – How array_walk function works in PHP? It is used to update the elements/index of original array. How: in array_walk, two parameter are required.  original array An callback function, with use of we update the array.  Question #2 – How to achieve Multilevel inheritance in PHP7? //base class class a{} //parent class extend the base class class bextends a{} //chid…