Angular 7 built in attribute directives

Hello all,

Hope you are keeping well ­čÖé In this short post I will be talking about Angular 7’s built in attribuite directives. Most commonly used Angular 7’s built in attribute directives are,

  1. NgClass – is used to add or remove a class or set of css classes
  2. NgStyle – is used to add or remove a HTML style or set of HTML styles
  3. NgModel –┬átwo-way data binding to an HTML form element

Let’s take a look at individual item in detail.

Continue reading


Accessing parent, child, grandchild component variables in Angular 6

Hello all,

I have been working with Angular 6 recently and got a situation where I needed access parent, child and grandchild component variables. After a bit of digging here and there, I found the same question was aksed in SO.

I used ViewContainerRef to access parent, children and grandchildren varibales.

I created a sample StackBlitz project as part of the answer. I thought to share the SO answer and sample StackBlitz project to my website readers.

Link to SO answer :-

If you have any other approaches to handle the same situation, please feel free to share your thoughts in the comments section below.

Thank you! ­čÖé


PHP 7 cool new features

Hello all,

Today, I thought to give you a quick run through about cool new features in PHP 7. PHP 7 has been there for sometime but it is still worth paying some closer look at what it has to offer to the world of PHP development. In this post I will be giving few examples which are exclusively to PHP 7 and onwards. Please note that at the time I write this post PHP 7.2.5 is available to download.

Scalar type declarations

Type declaration tells the type of the arguments needs to be passed when calling a function. Available scalar types are class, self, callable, array, int, string, float, boolean and iterable. (The latter five was introduced as part of PHP 7).

function getTotal(int ...$ints)
return array_sum($ints);

var_dump(getTotal(45, 85, 134));

The above will give you this,


With the strict_types enabled if you call the same function by passing mixed type parameters like this,

var_dump(getTotal("45", '8', 134.4));

This will give you a TypeError,

Fatal error: Uncaught TypeError: Argument 1 passed to getTotal() must be of the type integer, string given, Next TypeError: Argument 2 passed to getTotal() must be of the type integer, string given, Next TypeError: Argument 3 passed to getTotal() must be of the type integer, float given. 

For additional information, the declaration of strict type is per file basis and it will affect function parameter types as well as function return types. Continue reading


Encrypt and Decrypt using OpenSSL in PHP

Hello all,

In this topic, I will be talking about encryption and decryption using OpenSSL in PHP. I will be briefly┬ádiscussing what “two way encryption” is and how to use it in your PHP application using OpenSSL encrypt and decrypt methods with a readily usable example. At the end of this page there will be a zip file where you can download and run the example.

Two way encryption (encryption and decryption) is the simplest way of securely sending some sensitve information over the Internet using a shared secret key. To make things understandble picture this scenario. A web user fills a form with some data and press the submit button. When the form is submitted, data will go from place A to place B. If we send data as it is, anyone (i.e. Spy) has access to data packets can open and see what’s inside. So, before sending data as it is we will use a convertion method (encryption) to transform human readable data┬á(i.e. Plain text) into a human unreadable format (i.e. Cipher text). Then the receiving end will perform a data convertion exercise (decryption) to transform data back to readable format.

(Image URL :-

Continue reading


How to call an Oracle Function in Symfony 2

Hi All,

How are you doing? Seems like my fingers do not want me to stay away from Symfony2 despite the Spring Bank Holiday. ­čÖé

Today, I am going to talk about how to call an Oracle Function in Symfony2. A function (aka stored function) is a collection of SQL statements which is used to perform various different activities within the Database. The good thing about the function is you can write your chunks of SQL inside the function and call it using a name to initiate. I will be focusing on how to call an Oracle Function in Symfony2 and if you would like to know more about Oracle functions please click here.

First, let’s take a look at a sample function which I have created and is saved in Oracle 12c Database.

create or replace 
FUNCTION testFunc123(old_bname IN VARCHAR2) 
      IF old_bname = 'TEST' THEN
          RETURN 'Y';
        RETURN 'N';
      END IF;  

The role of the above created Oracle function is to check whether the value of ‘old_name’ is equal to ‘TEST’ or not. If it is ‘TEST’, then the function will return ‘Y’ otherwise ‘N’. So, now what we going to do is call this function inside a Symfony2 controller. This is really easy, thankfully to wonderful Doctrine2.

Continue reading