Posts

Showing posts from April, 2019

Smart Class in PHP using getter & setter

Hello readers, This article is about smart class in PHP so it will only contain business logic. In another article  Clean Code In PHP , I wrote about clean coding in PHP for beginners. But if you want to go for next level then this article is for you. Every developers must try to be smart in coding. If you have mastered some architecture, then don’t stop there thinking that you have learned smart way of coding. Frankly speaking I’m not smart coder, but yes I always try to apply new techniques to make my code simple and smart. Yes, your code must be simple, there is myth in most of the beginners mind that the developer who writes complex code, which is not easy to understand is smart programmer. But it’s not true. I’ll write more about it in another article. Let’s focus on this article. This article is one step to make class simple and more focused towards its business logic. Let’s take example of class file from article  Clean Code In PHP . <?php class Student {

RGraph Class Library Nuget Package (2.0.0): 3D Pie Chart

Image
This article gives steps for  RGraph Class Library  to create 3D Pie Chart in ASP .NET from dataset. RGraph is free JavaScript Library for creating dynamic charts using HTML5 Canvas tag. For more information about features and examples go to  RGraph Official Web-Site . In this article I’m going to introduce you to RGraph Class Library, which you can download from Nuget Package Manger. I’m going to use RGraph JavaScript library can be downloaded from  here . In many Web Applications there is need of presenting data summary in Pie Chart. Pie Chart allows us to analyse data using proportional sectors. In case of Simple Shop System Application, user can analyse per day sales of products in pie chart to determine the product in demand. Let’s see simple example to create 3D Pie Chart using RGraph. I have referenced some JavaScript files required for 3D pie graph as follows. <script src= "Scripts/jquery-1.10.2.min.js" ></script> <script src= "S

Memoization: Speed up expensive functions in ASP .NET

Image
This article is about Optimizing ASP .NET server side execution using Memoization technique. Before understanding Memoization, let’s discuss the simple but time consuming scenario first. Consider the simple example in ASP .NET Web-form, I want to create Table control populated with list of students and bind that control to asp:panel. The reason to consider this example is it’s really simple but time consuming when data to be populated is increased. Obviously we can populate gridview which in-turn will be rendered as table, but to demonstrate the memoization I’m going to populate data manually. Normally we will create Table WebControl and add TableRow WebControl for each student. First we want simple student entity class,which is as follows. public class Student { public string name { get ; set ; } public string description { get ; set ;} } Then added some method to get TableRow let’s say dataToRow, which is wrapped in HTMLtable class as