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

Share

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 :- https://stackoverflow.com/questions/41669787/how-to-change-parent-variable-from-children-component/51384602#51384602

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! 🙂

Share

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).

declare(strict_types=1);
function getTotal(int ...$ints)
{
return array_sum($ints);
}

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

The above will give you this,

int(264)

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

Share

CSV to DataTables, WordPress plugin

 

Update! The plugin has been approved by WordPress and it is currently available to download within the extensions directory – https://wordpress.org/plugins/aj-csv-to-datatable

Hi tech heads,

Today, I got the opportunity to create my first ever WordPress plugin. Well, this wasn’t quite planned like this but somehow I ended up creating my own WordPress plugin. Since few days, I badly wanted to show CSV data in a DataTable (yes, in Allan’s DataTables) within WordPress. So, I browsed the WordPress extensions page and found an interesting, easily configurable plugin “csv-to-sortable” which uses the JS sortable library. That is a decent plugin and does the job very well, but I wanted use DataTable instead. (Maybe I am in deep love with DataTables). I got extremely inspired by this plugin and then I decided to create a similar looking WordPress plugin so it can use DataTables to present data. I have submitted this plugin to WordPress plugins and it is currently being reviewed. However, if you want to get your hands dirty with this, before WordPress finish reviewing, then here it is.

Link to download the plugin – http://e-innoving.com/samples/wp-plugins/AJ-CSV-to-DataTable.zip

I have created a new repository in GitHub for this plugin so anyone can see what’s happening inside. Click on the link below to view the repository. Installation and usage details are also mentioned inside the GitHub page.

AJ-CSV-to-DataTable in GitHub

Continue reading

Share

Six signs of a passionate Software Developer

Hi All,

In this post I am going to tell you six signs of a passionate software developer. These six signs are purely based on the personal experience and you might still find one or more mutual points 🙂

1). You are a full time Software Developer, working Monday – Friday 9AM to 5PM but still can’t get your head away from coding even during weekends. You tend to find alternatives, better approaches and different techniques, for a function you wrote at work on Friday during the weekend. This is a clear sign that you are passionate about what you are doing.

2). You are at a party or a gathering but in your mind you are trying to memorise a foreign key / index that you knew it was kind not okay from the time you drew it in the ERD. You are restless until you figure out the most perfect / logical alternative. Another similar instance is, you named a foreign key / index which is very long and you think it might cause issues in different database platforms (exceeding the allowed character limit), so you are cutting letters in your mind.

3). You can’t concentrate on newspapers while travelling to / from work in a public transport. Apparently you want to browse a generic technology article on TechRadar or hunt down latest cool updates in your programming language ./ framework.

4). You badly want to reply your friend who said his programming language / framework is much more scalable and reliable than yours. Back in your mind you are collecting facts to prepare and strengthen your answer to blow off when you meet him next time. Continue reading

Share