Create your own service in ubuntu

Create a service and set it to boot level at systems starts like how does apache2 service starts by default in ubuntu when  linux system boots

Usage you could create your own shell script that need to be used as service to start stop kill or whatever

Realtime examples are apache2,mysql, mongo, chrome,skype and every processes

 

Steps  

1. Switch to sudo user by

sudo su

2. Navigate to /etc/init.d

Ob_flush , ob_start ,ob_get_contents, ob_end_clean, ob_end_flush with real time example

Let see the Functions first then will see the real world example

ob_start is to start buffer the output 

ob_flush is to flush the buffered output (that means it will delivers the output here which is buffered when the ob_start is initiated)

ob_end_flush is to flush and ends the buffering

ob_end_clean is to clean the buffered output content ends the buffering

ob_get_contents is to get the buffered output content

 

Exception: Serialization of 'Closure' is not allowed hybridauth linkedin

Hybridauth Linkedin not working phalcon

Steps to fix  it 

1. Navigate to the libraries folder

2. hybridauth/Hybrid/thirdparty/LinkedIn/LinkedIn.php

3. At line 126 change to 
const _URL_REQUEST                 = 'https://api.linkedin.com/uas/oauth/requestToken?scope=r_basicprofile+r_emailaddress+rw_nus';

const _URL_REQUEST                 = 'https://api.linkedin.com/uas/oauth/requestToken?scope=r_basicprofile+r_emailaddress+w_share'; 

That is it.

Still problem

Mediator Pattern simple design Example

Mediator Pattern  Example in PHP  


Let me tell you, Design patterns are some patterns that were used and implemented in many projects for reusability of the code, specific to some logics and concepts, which were successfully achieved the purpose.

So now programmers are implementing the design patterns for their projects.

Say for example mediator pattern is used to communicate effectively between the classes.

Say in other ways

How to configure basic cart module

Basic cart is a very simple shopping cart / checkout process for Drupal, that just sends 2 emails after each order. Along with the shopping cart, this module also provides a block where you can view your cart's content. It's ideal for small websites with only a few products or other content types being sold, for example touristic offers.

 

We have added how to videos, to configure module and create views and orders with it.

Module code Ported git hub link here

Null Coalesce Operator

What is Null Coalesce Operator which is newly introduced in php 7 ?

// ?? operator

$name = $firstName ??  "Guest";

if the value is set to not null or if value exist in the left it will return the left side value ($firstname),

if the value is null and not defined in left it will return the right side value ("Guest"),

Note: it will not through notice if $firstName variable is not defined or non-existent.

 

And you know what it is equivalent to 

Spaceship operator

What is Spaceship Operator which is newly introduced in php 7

// <=> Space ship Operators

$compare = 2 <=> 1
2 < 1? return -1
2 = 1? return 0
2 > 1? return 1

When its a combination 3 operators.less than, equals and greater than,

When the value on the left is less than the value on the right, it will return -1,

When the value on the left and right is equal it will  return 0,

Virtual hosting LocalHost linux OS ubuntu 14.04

Setting virtual hosting in localhost machine, (Used Apache  linux OS ubuntu 14.04)
 

site1.com 
site2.com 

Assume that I have two sites placed in /var/www/html, site1 at  /var/www/html/site1 and site2 /var/www/html/site2

Now I have access to my site by navigating through browser http://localhost/site1 and  http://localhost/site2

Now I wish to access my two sites in my local machine by site1.com and site2.com 

 

Let see the steps