Categories
Continuous Integration/Development Programming Web API

How to step by step implement Continuous Integration and Continuous Development in your software team ?

Fast development and Integration according to David Raleche – Process

 

 

 

QA

  • Introducing new bugs after making a change (No proper regression test)
  • Increase Automation overall
  • Lack of transparency
  • Improve quality and testability
  • No Proper Api documentation (Swagger)

Developers

  • Duplicate code throughout the program
  • Reading or writing code which is difficult to understand (PSR-2)
  • No Peer Programming (Code Review) in place (Pull Request)

 

  • CLEAN CODE

 

  • DRY do not repeat yourself
  • KISS – Keep it Stupid Simple
  • PSR-2 Code Styling
  • PSR-3 Log for debug purposes
  • PSR-4 Comment Code Properly
  • Function no exceeding 40 lines

 

  • No ERRORS

 

  • PHP Code
    • No Errors
    • No Warnings
    • No Notices
  • Unit Testing – 2 per api calls

 

  • CREATE Functional API Test

 

    • 3 positive tests
    • 3 negatives

 

 

  • Final API Documentation (swagger)

 

 

  • Check PHP logs (Nagios)
    • PHP Code
      • No Errors
      • No Warnings
      • No Notices

 

  • Execute Regression Testing

  • Make sure unit testing reach out full Code coverage
Categories
General

what is >/dev/null 2>&1

> is for redirect

/dev/null is a black hole where any data sent, will be discarded

2 is the file descriptor for Standard Error

> is for redirect

& is the symbol for file descriptor (without it, the following 1 would be considered a filename)

1 is the file descriptor for Standard Out

Therefore >/dev/null 2>&1 is redirect the output of your program to /dev/null. Include both the Standard Error and Standard Out.

Much more information is available at The Linux Documentation Project’s I/O Redirection page.

cron will only email you if there is some output from you job. With everything redirected to null, there is no output and hence cron will not email you.

Categories
BEST PHP CODE

List GIT conflicted files

git diff --name-only --diff-filter=U
Categories
BEST PHP CODE Web API

Convert to utf-8 values of an (multi-dimensional) associative array

/**
 * Convert to utf-8 values of an (multi-dimensional) array
 *
 * @param $array
 *
 * @return $array
 */
public function utf8Converter($array)
{
    array_walk_recursive($array, function (&$item, $key) {
        $item = utf8_encode($item);
    });

    return $array;
}
Categories
Nginx Web API

CORS ISSUE NGINX SWAGGER FETCH ERROR SOLUTION – Jeeezzz !

CORS Solution for NGINX SWAGGER

set $origin $http_origin; 

if ($origin !~ '^https?://(docs-mapi)\.4over\.com) {
 set $origin 'https://yourdomain.com';
 }

add_header 'Access-Control-Allow-Origin' "$origin" always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, DELETE, PUT, PATCH, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Access Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, api_key' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
Categories
Technical

Git list of conflicted files

git diff --name-only --diff-filter=U
Categories
Web API

give information regarding yum installed packages

sudo repoquery –list php72-php-pecl-xdebug.x86_64

/etc/opt/remi/php72/php.d/15-xdebug.ini
/opt/remi/php72/root/usr/bin/debugclient
/opt/remi/php72/root/usr/lib64/php/modules/xdebug.so
/opt/remi/php72/root/usr/share/doc/pecl/xdebug
/opt/remi/php72/root/usr/share/doc/pecl/xdebug/CREDITS
/opt/remi/php72/root/usr/share/doc/pecl/xdebug/LICENSE
/opt/remi/php72/root/usr/share/doc/pecl/xdebug/README.rst
/opt/remi/php72/root/usr/share/doc/pecl/xdebug/contrib
/opt/remi/php72/root/usr/share/doc/pecl/xdebug/contrib/tracefile-analyser.php
/opt/remi/php72/root/usr/share/doc/pecl/xdebug/contrib/xt.vim
/opt/remi/php72/root/usr/share/doc/pecl/xdebug/xdebug.ini
/var/opt/remi/php72/lib/pear/pkgxml/php72-php-pecl-xdebug.xml

Categories
Web API

Mysql Tables sizes

select table_schema, sum((data_length+index_length)/1024/1024) AS MB from information_schema.tables group by 1;
Categories
Technical

GIT pull coworker branch

git remote add coworker git://path/to/coworkers/repo.git
git fetch coworker
git checkout --track coworker/foo

This will setup a local branch foo, tracking the remote branch coworker/foo. So when your co-worker has made some changes, you can easily pull them:

git checkout foo
git pull
Categories
BEST PHP CODE Web API

Git Force pull

I think this is the right way:

git fetch --all

Then, you have two options:

git reset --hard origin/master

OR If you are on some other branch:

git reset --hard origin/<branch_name>