Friday, October 21, 2016

Installing LARAVEL 5.3 in windows

Server Requirements
  • PHP >= 5.6.4
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension
Installing via Composer

download and install https://getcomposer.org/download/

then go to your command line /cmd and type

composer global require "laravel/installer"

Go to your htdocs and create a project by typing

composer create-project --prefer-dist laravel/laravel blog

type this to run the local server of your laravel application

php artisan serve

now go to http://localhost:8000

Done! You may now proceed to configure your app.

Tuesday, September 13, 2016

how to install TWRP (team win recovery pro) to your MI3

download the following files.

https://dl.twrp.me/cancro/twrp-3.0.2-0-cancro.img.html (twrp.img)

https://androiddatahost.com/265a2 (tools to flash via fastboot)

Extract minimal_adb_fastboot_v1.3.1.zip and install

after that copy twrp-3.0.2-0-cancro in the folder location where adb installed and rename it as twrp.img 

usually C:\Program Files (x86)\Minimal ADB and Fastboot

go to fastboot mode of your MI3 phone, press power and volume down

if you see the logo of android connect your phone into your computer.

go to C:\Program Files (x86)\Minimal ADB and Fastboot click shift + right click and click "Open command window here"

Type 
fastboot devices
if you see device appear the computer successfully see your device.

then type
fastboot flash recovery twrp.img


done! go to your recovery mode.

Thursday, February 11, 2016

Get the dates inside the two date in PHP (YYYY-MM-DD)

<?php
function createDateRangeArray($strDateFrom,$strDateTo)
{
    // takes two dates formatted as YYYY-MM-DD and creates an
    // inclusive array of the dates between the from and to dates.

    // could test validity of dates here but I'm already doing
    // that in the main script

    $aryRange=array();

    $iDateFrom=mktime(1,0,0,substr($strDateFrom,5,2),     substr($strDateFrom,8,2),substr($strDateFrom,0,4));
    $iDateTo=mktime(1,0,0,substr($strDateTo,5,2),     substr($strDateTo,8,2),substr($strDateTo,0,4));

    if ($iDateTo>=$iDateFrom)
    {
        array_push($aryRange,date('Y-m-d',$iDateFrom)); // first entry
        while ($iDateFrom<$iDateTo)
        {
            $iDateFrom+=86400; // add 24 hours
            array_push($aryRange,date('Y-m-d',$iDateFrom));
        }
    }
    return $aryRange;
}
$array = createDateRangeArray('2015-01-01','2015-01-10');
foreach($array as $dates){
    echo "'".$dates."'";
    echo "<br>";
}

?>


Sample output:
'2015-01-01'
'2015-01-02'
'2015-01-03'
'2015-01-04'
'2015-01-05'
'2015-01-06'
'2015-01-07'
'2015-01-08'
'2015-01-09'
'2015-01-10'
 

Thursday, February 4, 2016

Installing FFMPEG in CENTOS & ffmpeg-php

# vi /etc/yum.repos.d/dag.repo

click INSERT key and add this line:

[dag]
name=DAG RPM Repository
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1


save it! :wq!

# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
# yum update
# yum install ffmpeg ffmpeg-devel ffmpeg-libpostproc

# ffmpeg

 

done installing ffmpeg.

All we need to do is to install ffmpeg-php

# yum install php-gd php-devel 
1. Download the ffmpeg-php
2. Extract the archive:
# tar -xjf ffmpeg-php-X.x.x.tbz2
# cd ffmpeg-php-X.x.x/
# phpize
# ./configure
# make
# make install
# echo 'extension=ffmpeg.so' >> /etc/php.ini

now restart your httpd
# service httpd restart
 
now check your phpinfo and search ffmpeg.


 

Done, You can now use ffmpeg in your php application.

:) enjoy !



Installing DJANGO in CentOS release 6.7 (Final)

You need internet connection in your server.

# cd /opt/
# wget http://mirrors.nl.eu.kernel.org/fedora-epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -Uvh epel-release-6-8.noarch.rpm

# rm epel-release-6-8.noarch.rpm -f

Now install python but most of CENTOS has installed python by default
# yum install python
# yum install Django

Now this is how to check the version after you successfully installed it.

# python
>>> import django
>>> print djnago.get_version()

You may now create a project
# django-admin startproject mysite
# cd mysite/

# python manage.py runserver

by default this will run in port 8000
If you want to run in other port and by IP you may type this.

# python manage.py runserver 192.168.1.85:8001

 

Done! :)

How to kill all processes via grep in once (CENTOS)

Run this command.

sample process is the httpd

# ps aux | grep 'httpd' | grep -v grep | awk '{print $2}'

This will output all process ID only.

Then run this to kill all processes.


# kill -9 `ps aux | grep 'httpd' | grep -v grep | awk '{print $2}'`

Done.