Git initialization, branching, merging, conflict resolution

//initialize git
git init

//clone or download repository
git clone

// pull from remote master
git pull origin master

//create a new branch on local named my_changes_branch
git checkout -b my_changes_branch

//list all the branches with * on current working branch
git branch

//move to master branch
git checkout master

//add the file to push to remote
git add abc.php

//commit and add comments
git commit -m "My first commit"

//push the changes to my_changes_branch or push the branch my_changes_branch
git push origin my_changes_branch

//merge into master

git checkout master
git merge my_changes_branch

Solving conflict

//pull from remote
git pull origin my_changes_branch

Now open the file that has conflict and make the final changes where git has added the comments.

//add the file to push
git add abc.php

//commit and add comments
git commit -m "conflict resolution"

//push the changes to branch
git push origin my_changes_branch

Any suggestions, corrections are welcome.


Import large CSV data via PHP

Importing large data may cause Memory problems or timeout problems, here is how to avoid these problems.

$file = $_FILES['file']['tmp_name'];
        $handle = fopen($file, "r");
        while (($row = fgetcsv($handle, 0, ",")) !== FALSE) {
            // $row contains all the columns in a line in csv
            // insert into students(column1..., column2..., column3....) values($row[0],$row[1],$row[2]........)

Export large data to CSV via PHP

Exporting large data may cause Memory problems or timeout problems, here is how to avoid these problems.

$query = $this->db->query("select * from students where (DATE(order_date) between '$start' and '$end') ");
                $filename = "reports.csv";
                header('Content-type: application/csv');
                header('Content-Disposition: attachment; filename='.$filename);

                $fp = fopen('php://output', 'w');
                $fields = $query->list_fields();
                foreach($fields as $field){
                        $header[] = $field;
                fputcsv($fp, $header);
                foreach ($query->result_array() as $data) {
                        //$fp = fopen('php://output', 'a');
                        fputcsv($fp, $data);

KML Files not working on Google Maps

Here is a list of problems that may be the cause of problem :

1) Kml Path – Double check the path of file and make sure the file exists.
2) Missing mime types – You need to check for “KML” or “KMZ” mime type, if they are defined there on your server, if they are not then add

   .kml   application/
   .kmz   application/

3) If none of above – The KML can’t be accessed since it’s on your local machine and google can’t access that since it doesn’t know how to get to localhost:8080

Hope it helps someone !

Run a URL from command prompt without opening browser – windows

Here are the steps :

1) Download wget from

2) Paste the following and change the url

 "C:\Program Files (x86)\GnuWin32\bin\wget.exe"

“C:\Program Files (x86)\GnuWin32\bin\wget.exe” is the path of wget executable file, you don’t need to type the full path if you defined path variable already.
You can simply do


In case you are doing task scheduling , then create a file and paste the code from step 2, save file as xyz.bat and select this file as trigger in task scheduler.