<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rajesh Pillai on Medium]]></title>
        <description><![CDATA[Stories by Rajesh Pillai on Medium]]></description>
        <link>https://medium.com/@rajeshpillai1996?source=rss-d557c944ec99------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*laIW-urOk4VJXGrZq9Vnzw.jpeg</url>
            <title>Stories by Rajesh Pillai on Medium</title>
            <link>https://medium.com/@rajeshpillai1996?source=rss-d557c944ec99------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 22:11:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rajeshpillai1996/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Integrate Angular with ASP.NET MVC Core]]></title>
            <link>https://medium.com/@rajeshpillai1996/integrate-angular-with-asp-net-mvc-core-3f7c0f7a4091?source=rss-d557c944ec99------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f7c0f7a4091</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[aspnetcoremvc]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Rajesh Pillai]]></dc:creator>
            <pubDate>Tue, 25 Aug 2020 21:33:41 GMT</pubDate>
            <atom:updated>2020-08-25T21:52:04.861Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>There is tip at the last of this article. I hope you guys don’t miss it.</strong></p><p>All of us know that we use Angular for client side and ASP.NET MVC Core for server side. When we compile and run Angular project it run in default host (<a href="https://localhost:44373/">http://localhost:4</a>200/) were we can see the client side changes and when we compile and run ASP.NET MVC Core then it run on different host like (<a href="https://localhost:44373/">https://localhost:44373/</a>) here we can see server side changes.</p><p>By this different hosting you end up with CORS Error were you have to enable CORS in server side(ASP.NET MVC Core) which ensure that Client side(Angular) URL is safe. <a href="https://medium.com/@rajeshpillai1996/what-is-cors-enable-how-to-use-it-in-asp-net-mvc-core-c0048e99b6d9">Do you want know more about CORS?</a>. So, is this a good approach?. yeah it is good for a project where you have common API’s shared with Multiple Application.</p><p>Projects like where API’s are shared with only one application there you can integrate your client side with server side. When server side(ASP.NET MVC Core) code runs, on that URL my first hit goes to client side (Angular) from there you can perform (HttpGet, HttpPost, HttpPut, HttpDelete) operation to server side(ASP.NET MVC Core).</p><p>Before integration we need to understand what is</p><p><strong>ng serve </strong>— this command is intentionally for fast, local and iterative developments and also for builds, watches and serves the application from a local CLI development server. Also, if you running the angular app using ng serve and if you make changes to your app, the changes are captured and reflected instantaneously on the UI. It does not writes the generated build to output folder.</p><p><strong>ng build</strong> — this command is intentionally for building the apps and deploying the build and it writes the generated build to output folder.</p><p><strong>deployUrl — </strong>this command is use to append the root folder path on generated build script.</p><p>In two ways you can use deployUrl</p><ol><li>directly from command like this (<strong>ng build — deploy-url=/&lt;Folder Name&gt;/dist/&lt;Folder Name&gt;/</strong>)</li><li>you can add an entry in angular.json file like in below image</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*49CfZYXz3ZezmaN_05_mBA.png" /></figure><p><strong>“deployUrl”: “/&lt;Folder Name&gt;/dist/&lt;Folder Name&gt;/”</strong></p><p>Lets integrate now</p><p><strong>Step 1:</strong> Build your angular project instead of (<strong>ng serve</strong>) do (<strong>ng build</strong>) with <strong>deployUrl</strong>. By doing this you can see that dist folder is created on your angular project directory. Copy index.html from <strong>dist/&lt;Folder Name&gt;/index.html</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jeNkzZ_Ci1rQYM7UCyEYdw.png" /></figure><p>In above image you can see the index.html changes, copy that.</p><p>step 2: Paste the copied index.html to you ASP.NET MVC core index.cshtml file, you will be wondering that where should i suppose to paste. For example in below image you can see.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*EkJ7quF-fHJY8ufoottZNw.png" /></figure><p>There will we be one HomeController in your Controller Folder open that and go Index action and Go to view and paste the code or you can create your own view page and paste there and do the changes in startup.cs for routing to load default page. Change <strong>pattern: {controller=Home}/{action=Index}/{id?}</strong> to your created controller action to load it default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*noT2hjnZskKRgBy6QnWKcg.png" /></figure><p>by this much changes your integration is done.</p><p>Also there is another way to integrate Angular with MVC Core. There is no need to copy the index.html file, instead of this you can do the following changes in HomeController → Action Index method i shown in the below image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jk6qteGRNsQKtAU42FNorA.png" /></figure><p>Change the marked path to your Angular dist path that’s it. You done with the integration.</p><p>If you are new to programming then one of the best way is to learn programming with project following we have one such video which demonstrate practical using Angular 10: -</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FFV2MXOygDTM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DFV2MXOygDTM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FFV2MXOygDTM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca5ba7af39a4eaa2dfb217bd81dbfb8f/href">https://medium.com/media/ca5ba7af39a4eaa2dfb217bd81dbfb8f/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f7c0f7a4091" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use groupBy Operator by RXJS]]></title>
            <link>https://medium.com/@rajeshpillai1996/how-to-use-groupby-operator-by-rxjs-33112316d1c2?source=rss-d557c944ec99------2</link>
            <guid isPermaLink="false">https://medium.com/p/33112316d1c2</guid>
            <category><![CDATA[rxjs-6]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[angular-9]]></category>
            <dc:creator><![CDATA[Rajesh Pillai]]></dc:creator>
            <pubDate>Sat, 02 May 2020 16:09:33 GMT</pubDate>
            <atom:updated>2020-05-02T16:09:33.742Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-guJ0fZkb47BYwpNg2Gesg.jpeg" /></figure><p>In your project at some point you need to do groupBy at client side, but end up nothing. So, by using RXJS Operator you can achieve that. How to use groupBy operator ? let’s have look. Only four things you need to remember [From → groupBy →mergeMap →subscribe ]</p><p>from → From converts various other objects and data types into observables.</p><p>groupBy → It groups the repeated object from the list.</p><p>mergeMap → MergeMap converts all repeated object to an array.</p><p>subscribe → Subscription is an object that represents a disposable resource.</p><p>pipe → It’s a method on observable which is used for composing operators.</p><p>observable → Observables are lazy push collection of multiple values. Which push single or multiple value on subscribe.</p><p>In below image you can see how i grouped sample array list. when you subscribe you will get grouped array</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aRN-JtOqXCG1fVoAcPPkSw.png" /></figure><p>If you are new to programming then one of the best way is to learn programming with project following we have one such video which demonstrate practical using Angular 9: -</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FFV2MXOygDTM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DFV2MXOygDTM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FFV2MXOygDTM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca5ba7af39a4eaa2dfb217bd81dbfb8f/href">https://medium.com/media/ca5ba7af39a4eaa2dfb217bd81dbfb8f/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33112316d1c2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ClickOutside directive with Angular 9]]></title>
            <link>https://medium.com/@rajeshpillai1996/clickoutside-directive-with-angular-9-46d21506025e?source=rss-d557c944ec99------2</link>
            <guid isPermaLink="false">https://medium.com/p/46d21506025e</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[angular-9]]></category>
            <dc:creator><![CDATA[Rajesh Pillai]]></dc:creator>
            <pubDate>Sun, 26 Apr 2020 16:49:39 GMT</pubDate>
            <atom:updated>2020-04-26T16:49:39.326Z</atom:updated>
            <content:encoded><![CDATA[<p>In your project you may used menus, drop-down list, pop-ups, Context menus. When you open one of these it stays open until you close, by this you end up with some consequences like first close the previous and then head further. So, it means that it doesn’t remove component from DOM. We need to remove component from DOM if the user clicks anywhere outside of it.</p><p>So, how do we solve this problem, by creating a simple directive. Before we head to create directive, first need to understand about directive.</p><h3>what is directive?</h3><p>→ There are three types of directive</p><p>&gt; Component directives: Elements directive with templates</p><p>&gt; Structural directives: Adding or Removing DOM Element</p><p>&gt; Attribute directives: Modifying DOM element behavior or appearance</p><p>In our case we need to modify behavior of DOM element (Attribute directive). We will define an attribute selector in our component using @Directive attribute.</p><blockquote>import {Directive} from ‘@angular/core’</blockquote><blockquote>@Directive({selector: ‘[clickoutside]’})</blockquote><blockquote>export class ClickOutsideDirective{</blockquote><blockquote>}</blockquote><p>We will use selector “clickoutside” in our html tag, like i have used in below html tag.</p><blockquote>&lt;ul (clickoutside)= “expand=false”&gt;&lt;/ul&gt;</blockquote><p>Inside that component we going to handle click events for that we need @Output and @HostListener property. @Output is use to emit the changes. @HostListener is use to listen the outside click event. ElementRef is use to get targetElement value.</p><blockquote>import {Directive, ElementRef, HostListener, Output, EventEmitter} from @angular/core’</blockquote><blockquote>@Directive({selector: ‘[clickoutside]’})</blockquote><blockquote>export class ClickOutsideDirective{</blockquote><blockquote>constructor(private _elementRef: ElementRef) { }</blockquote><blockquote>@Output(‘clickoutside’) clickoutside: EventEmitter&lt;any&gt; = new EventEmitter();</blockquote><blockquote>@HostListener(‘document:click’, [‘$event.target’])onMouseEnter(targetElement) {</blockquote><blockquote>const clicked = this._elementRef.nativeElement.contains(targetElement);</blockquote><blockquote>if (!clicked) {</blockquote><blockquote>this.clickoutside.emit(null);</blockquote><blockquote>}</blockquote><blockquote>}</blockquote><blockquote>}</blockquote><p>Last declare ClickOutsideDirective in your module and thats it.</p><p>If you are new to programming then one of the best way is to learn programming with project following we have one such video which demonstrate practical using Angular 9: -</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FFV2MXOygDTM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DFV2MXOygDTM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FFV2MXOygDTM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca5ba7af39a4eaa2dfb217bd81dbfb8f/href">https://medium.com/media/ca5ba7af39a4eaa2dfb217bd81dbfb8f/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46d21506025e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is RouteReuseStrategy ? How to cache components with Angular RouteReuseStrategy ?]]></title>
            <link>https://medium.com/@rajeshpillai1996/what-is-routereusestrategy-how-to-cache-components-with-angular-routereusestrategy-82da7790cd2b?source=rss-d557c944ec99------2</link>
            <guid isPermaLink="false">https://medium.com/p/82da7790cd2b</guid>
            <category><![CDATA[angular8]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Rajesh Pillai]]></dc:creator>
            <pubDate>Mon, 18 Nov 2019 21:12:34 GMT</pubDate>
            <atom:updated>2019-11-18T21:12:34.297Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is RouteReuseStrategy ? How to cache components with Angular RouteReuseStrategy ?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hF5DHSTVEHCitdPCPYhtdg.png" /></figure><p><strong>RouteReuseStrategy : </strong>In simple sentence it caches the components and prevent it from reload the components again and again.</p><p>While in angular to navigate from one page to another page, we have an concept called Routing. By using this we can redirect from one page to another. so, when we navigate to another page it doesn’t store the previous page values. And when we come back to previous page it reload the whole page again. By this we end up with performance issue.</p><p>for example in our project we have a search page where we load thousands of records or many more. so, it take bit long time to load the page. And we navigate from page to page then it reload again and again. At some point we thought that why the page is loading again and again . I don’t want to load the page, if it already loaded then get it from some cache memory and reuse it.</p><p>For this scenario we will be using <strong>RouteReuseStrategy </strong>which is the part ‘ @angular/router ’</p><p><strong>How does it work ?</strong></p><p><strong>RouteReuseStrategy </strong>interface contain five methods:</p><p><em>. shouldReuseRoute : </em>This method get called every time when we navigate between routes. There are two type future and current .The Future is the route we are leaving and Current is the route we are landing.</p><p>. <em>shouldAttach</em>: This method is called for the route just opened when we land on the component of this route.</p><p><em>. retrieve</em>: This method is called if <em>shouldAttach </em>returns TRUE.</p><p>. <em>shouldDetach</em>: It is invoked when we <strong>leave the current</strong> <em>route</em>.</p><p><em>. store</em>: This method is invoked only if the <em>shouldDetach </em>returns true.</p><p>Below i pasted the code where you can go through it and steps for creating it.</p><blockquote><strong>Step 1: Create an RouteReuseService.ts and add the below code in it.</strong></blockquote><blockquote>import {</blockquote><blockquote>RouteReuseStrategy,</blockquote><blockquote>ActivatedRouteSnapshot,</blockquote><blockquote>DetachedRouteHandle,</blockquote><blockquote>RouterModule,</blockquote><blockquote>Routes,</blockquote><blockquote>UrlSegment</blockquote><blockquote>} from ‘@angular/router’;</blockquote><blockquote>export class RouteReuseService implements RouteReuseStrategy {</blockquote><blockquote>private handlers: { [key: string]: DetachedRouteHandle } = {};</blockquote><blockquote>shouldDetach(route: ActivatedRouteSnapshot): boolean {</blockquote><blockquote>if (!route.routeConfig || route.routeConfig.loadChildren) {</blockquote><blockquote>return false;</blockquote><blockquote>}</blockquote><blockquote>let shouldReuse = false;</blockquote><blockquote>console.log(‘checking if this route should be re used or not’, route);</blockquote><blockquote>if (route.routeConfig.data) {</blockquote><blockquote>route.routeConfig.data.reuse ? shouldReuse = true : shouldReuse = false;</blockquote><blockquote>}</blockquote><blockquote>return shouldReuse;</blockquote><blockquote>}</blockquote><blockquote>store(route: ActivatedRouteSnapshot, handler: DetachedRouteHandle): void {</blockquote><blockquote>console.log(‘storing handler’);</blockquote><blockquote>if (handler) {</blockquote><blockquote>this.handlers[this.getUrl(route)] = handler;</blockquote><blockquote>}</blockquote><blockquote>}</blockquote><blockquote>shouldAttach(route: ActivatedRouteSnapshot): boolean {</blockquote><blockquote>console.log(‘checking if it should be re attached’);</blockquote><blockquote>return !!this.handlers[this.getUrl(route)];</blockquote><blockquote>}</blockquote><blockquote>retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle {</blockquote><blockquote>if (!route.routeConfig || route.routeConfig.loadChildren) {</blockquote><blockquote>return null;</blockquote><blockquote>};</blockquote><blockquote>return this.handlers[this.getUrl(route)];</blockquote><blockquote>}</blockquote><blockquote>shouldReuseRoute(future: ActivatedRouteSnapshot, current: ActivatedRouteSnapshot): boolean {</blockquote><blockquote>let reUseUrl = false;</blockquote><blockquote>if (future.routeConfig) {</blockquote><blockquote>if (future.routeConfig.data) {</blockquote><blockquote>reUseUrl = future.routeConfig.data.reuse;</blockquote><blockquote>}</blockquote><blockquote>}</blockquote><blockquote>const defaultReuse = (future.routeConfig === current.routeConfig);</blockquote><blockquote>return reUseUrl || defaultReuse;</blockquote><blockquote>}</blockquote><blockquote>getUrl(route: ActivatedRouteSnapshot): string {</blockquote><blockquote>if (route.routeConfig) {</blockquote><blockquote>const url = route.routeConfig.path;</blockquote><blockquote>console.log(‘returning url’, url);</blockquote><blockquote>return url;</blockquote><blockquote>}</blockquote><blockquote>}</blockquote><blockquote>}</blockquote><blockquote><strong>Step 2: Add the RouteReuseService in your main module.ts</strong></blockquote><blockquote><strong>providers: [{</strong></blockquote><blockquote><strong>provide: RouteReuseStrategy,</strong></blockquote><blockquote><strong>useClass: RouteReuseService</strong></blockquote><blockquote><strong>}],</strong></blockquote><blockquote><strong>Step 3 : In routing Collection apply this strategy on components to be cached . Like data: {reuse: true} after component separated by coma.</strong></blockquote><blockquote>import { AppComponent } from ‘./app.component’;</blockquote><blockquote>export const MainRoutes = [</blockquote><blockquote>{</blockquote><blockquote>path: ‘’,</blockquote><blockquote>component: AppComponent,</blockquote><blockquote><strong>data: {</strong></blockquote><blockquote><strong>reuse: true</strong></blockquote><blockquote><strong>}</strong></blockquote><blockquote>}, {</blockquote><blockquote>path: ‘Home’,</blockquote><blockquote>component: AppComponent</blockquote><blockquote>}</blockquote><blockquote>]</blockquote><p>Thats it apply it on your project and see the magic.</p><p>If you are new to programming then one of the best way is to learn programming with project following we have one such video which demonstrate practical using Angular 8: -</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FFV2MXOygDTM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DFV2MXOygDTM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FFV2MXOygDTM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca5ba7af39a4eaa2dfb217bd81dbfb8f/href">https://medium.com/media/ca5ba7af39a4eaa2dfb217bd81dbfb8f/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82da7790cd2b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Difference Between Stored Procedure and Function]]></title>
            <link>https://medium.com/@rajeshpillai1996/difference-between-stored-procedure-and-function-ae3cb0c29822?source=rss-d557c944ec99------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae3cb0c29822</guid>
            <category><![CDATA[sql-server]]></category>
            <dc:creator><![CDATA[Rajesh Pillai]]></dc:creator>
            <pubDate>Thu, 29 Aug 2019 05:30:50 GMT</pubDate>
            <atom:updated>2019-08-29T05:30:50.685Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Store Procedure :</strong></p><ol><li>Store procedure can return zero, single and multiple values.</li><li>Procedure can have input and output parameter.</li><li>Procedure cannot be called from function.</li><li>Exception can be handled by try-catch block in a procedure.</li><li>We can use transaction in Procedure.</li><li>Procedure can perform CURD Operation on database.</li><li>Procedure can use temporary tables.</li></ol><p><strong>Function :</strong></p><ol><li>Function can return only single value.</li><li>Function can only have input parameter.</li><li>Function can be called from Stored Procedure.</li><li>We can’t use try-catch block in Function</li><li>We cannot use transaction in Function.</li><li>Function cannot perform CURD Operation on database.</li><li>Function cannot use temporary tables.</li></ol><p>If you are new to SQL Server then we have one such video which demonstrate practical using SQL Server :-</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuGlfP9o7kmY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DuGlfP9o7kmY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FuGlfP9o7kmY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3fb0439b5e4b6944ec1233689811f89e/href">https://medium.com/media/3fb0439b5e4b6944ec1233689811f89e/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae3cb0c29822" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why HTTP is stateless ?]]></title>
            <link>https://medium.com/@rajeshpillai1996/why-http-is-stateless-9d9013f3ca23?source=rss-d557c944ec99------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d9013f3ca23</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Rajesh Pillai]]></dc:creator>
            <pubDate>Thu, 15 Aug 2019 18:00:05 GMT</pubDate>
            <atom:updated>2019-08-19T07:21:34.684Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why HTTP is stateless ?</h3><p>In Case of Statefull when a User Login to website it stores some token for particular user and the token stored in RAM. Suppose 1Lac user login every day RAM storage increase and we need to increase RAM size.</p><p>To overcome this situation the HTTP Stateless comes in picture. In Stateless when user login to our website it also stores some token or cookies but it stores in browser, So that when the same user login to our website it takes Cookies from browser Storage.</p><p>So here is the question if some client wants his website should be statefull for some request or every request. In that case we have something called Session variable and TempData, ViewData.</p><p><strong>Session Variable:</strong> We use Session Variable to store every request till the browser opens. The Life of Session Variable is from browser open till the browser close.</p><p><strong>TempData: </strong>We use TempData for when some Client do not want to store every Request but need three to four request only. In that case TempData comes in the picture. We use TempData in Controller and call keep so that it stores the next request and if do not call keep it doesn’t stores.</p><p><strong>ViewData: </strong>We use View Data to store request but the life of view data is for the controller only.</p><p>If you are new to MVC start with the following must watch video:-</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FLp7nSImO5vk%3Fstart%3D2%26feature%3Doembed%26start%3D2&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DLp7nSImO5vk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FLp7nSImO5vk%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6562626dce5ac8f375e965e7014c4819/href">https://medium.com/media/6562626dce5ac8f375e965e7014c4819/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d9013f3ca23" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is CORS Enable ? How to use it in ASP.NET MVC Core ?]]></title>
            <link>https://medium.com/@rajeshpillai1996/what-is-cors-enable-how-to-use-it-in-asp-net-mvc-core-c0048e99b6d9?source=rss-d557c944ec99------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0048e99b6d9</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Rajesh Pillai]]></dc:creator>
            <pubDate>Fri, 21 Jun 2019 20:05:41 GMT</pubDate>
            <atom:updated>2019-06-22T14:15:44.152Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is CORS Enable ? How to use it in ASP.NET MVC Core ?</h3><p><strong>CORS </strong>Stands for <strong>Cross-Origin</strong> Resource Sharing. It is a W3C Standard that allows a server to relax the same-policy. Using CORS, a server can explicitly allow some cross-origin requests while rejecting others.</p><p>Let’s get started with creating two projects one called webservice which hosts a Web api controller in<strong> ASP.NET MVC Core</strong> and other one called webclient in <strong>Angular 7</strong>. This two projects are hosted in different server. Lets make a HttpRequest from WebClient to WebService like in below picture .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*azpw_rr1DWul1b8y3TERBg.png" /></figure><p>After the HttpRequest we will get an error stated that your webclient origin has been blocked by CORS policy and No Access-Control-Allow-Origin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*EzAZ07KBK6ysvlnJmiNsOQ.png" /></figure><p>To resolve this cors error we need to put some line of code inside the startup.cs file in ConfigureServices and in Configure methods. Like in the below picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tDPLzxXNWkS7RoM7oKxFIw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*dChP3FGO4jaHFcbvDs4dag.png" /></figure><p>After adding this lines of code in start.cs file we can make HttpRequest from any origin or if we want to pass HttpRequest to particular origin then this also possible by CORS. In below picture we can see that we have added two CorsPolicy for their respected origins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*3vHVvDCJKEbTZN-2-qASjg.png" /></figure><p>In case your basics are still unclear suggesting to play and go through with following ASP.NET MVC core interesting video: -</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fipio9ze57X8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dipio9ze57X8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fipio9ze57X8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ec29f496e80474829eedffcf60b8080f/href">https://medium.com/media/ec29f496e80474829eedffcf60b8080f/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0048e99b6d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Interface ?]]></title>
            <link>https://medium.com/@rajeshpillai1996/what-is-interface-851be4181330?source=rss-d557c944ec99------2</link>
            <guid isPermaLink="false">https://medium.com/p/851be4181330</guid>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Rajesh Pillai]]></dc:creator>
            <pubDate>Fri, 14 Jun 2019 20:01:51 GMT</pubDate>
            <atom:updated>2019-06-14T20:01:51.105Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Interface ?</h3><blockquote>Interface is a contract that defines signature of functionality.</blockquote><p>We create an interface using interface keyword. Just like a class contain properties, methods, events and delegates, But only declaration and no implementation.</p><p>For example we have an interface called ICustomer and inside that i have a method called scan. If we give a body to the method we will get an error stated that <strong>“interface members cannot have a definition”</strong>.So interface members have only declaration and no implementation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*TOvvH6im8Xh0tPlEDO4XgQ.png" /></figure><p>And also interface members are public by default, and they don’t allow explicit access modifiers.we can see it in below picture.The Error state that <strong>“The modifier public is not valid for this item.”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*S2N9S8IzzvBOJ0dnPIcGpQ.png" /></figure><p>Also interface does not contain fields. When you pass fields to an interface it gives you error state that <strong>“Interface cannot contain fields.”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*2ocGmIv1lKCyHnXBUeFutQ.png" /></figure><p>Lets go head now we will create an class Customer. If Customer Class inherits from an interface, it must provide implementation for all the interface members. If not we will get an compiler error. We can see it in below picture that on compile time it gave you an error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*N1nlJVvYDkPVVz-Qg2YvhQ.png" /></figure><p>The error says that you need provide implementation for all the members of an interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*b08mw57YwY8Kha6TQnNROg.png" /></figure><p>So above picture we can see that in an interface contains two methods and when class inherit an interface and also provides an implementation.</p><p>Now we create an instances of the class customer and try to run the code snippet and lets see what will be the output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bo_JUO67Erq8Jttwb8oGbw.png" /></figure><p>So here is the output in the above picture .</p><blockquote><strong>Important point :- </strong>We cannot create an instance of interface because its a half code there is no implementation. But an interface reference variable can point to derived class object.</blockquote><p>In Below Picture we will see how it point to interface reference variable of derived class object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*-H2eKknJ-xCmMwbQnOwXNw.png" /></figure><p>Lets go head and see if we have two interface like ICustomer1 and ICustomer2 inside there will be some methods. We can see it below picture</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/419/1*Hvo4P2yPnNCZv8ffxdos2w.png" /></figure><p>when class inherits the interfaces it inherits both the interfaces .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*0SEiSRCjCNTU2FmjUZPmWw.png" /></figure><p>Also we need to provide implementations for both the methods from an interface</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*FCirVxscIKPqm--3xIEHag.png" /></figure><p>if we don’t want to inherit both the interface in that case what we can do first ICustomer2 will inherit ICustomer1 like this in below picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*oxIGOfo2MfVEvtZiFJ4toA.png" /></figure><p>Then class Customer will inherit ICustomer2 and implements methods of two interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*x3UokANoshHKw9YwL5lCTQ.png" /></figure><p>If we run this will get same output like in previous picture. So here ends the basic of interface in next article we will see Explicit interfaces implementation.</p><p>If you are new to programming then one of the best way is to learn programming with project following we have one such video which demonstrate practical using C# and .NET: -</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FUI2RRcsR83s%3Ffeature%3Doembed&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DUI2RRcsR83s&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FUI2RRcsR83s%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d337464fe53857789bf21dbd5dfbdab2/href">https://medium.com/media/d337464fe53857789bf21dbd5dfbdab2/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=851be4181330" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Abstract classes?]]></title>
            <link>https://medium.com/@rajeshpillai1996/what-is-abstract-classes-4dc3d1bf6e1b?source=rss-d557c944ec99------2</link>
            <guid isPermaLink="false">https://medium.com/p/4dc3d1bf6e1b</guid>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Rajesh Pillai]]></dc:creator>
            <pubDate>Thu, 06 Jun 2019 09:46:25 GMT</pubDate>
            <atom:updated>2019-06-06T10:30:50.414Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Abstract is a thought were we used it in class as a keyword. Abstract keyword are used to create a abstract classes.</blockquote><p>For example i made a class called supplier .</p><h3><strong>class supplier {</strong></h3><h3><strong>}</strong></h3><p>this is a non abstract class,so to make it as abstract then we use abstract keyword in class like this in below code.</p><h3><strong>abstract class supplier{</strong></h3><h3><strong>}</strong></h3><blockquote>An abstract class can only be used as a base class. what exactly it mean?</blockquote><p>For Example you have a two classes called employeeMonthSalary and employeeDaySalary. In Both classes you have some fields like Id, FirstName and LastName, etc . So if you want to add one more field like MiddleName then you need to add it in both the classes. you will waste your time in changing fields in both the places . For that you can make a BaseEmployee class and add those fields or methods which are common in both the classes. So you don’t need add new common fields or methods in every classes just add it in base class and it will take care off it.</p><blockquote>An abstract class may contain abstract members(Properties, Methods and Events).</blockquote><p>In my supplier abstract class i added one method called scan which is non abstract method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*NkSRp1Q02PUl96Kw29XpDA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*zf0n01UfHfPTV8_yy-uq_w.png" /></figure><p>To make it as abstract will add abstract keyword in that method. Once i added the abstract keyword it gives you a compile error stating that “ cannot declare a body because it is marked as abstract”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*oVhb79s4eV5Qk_bInU8dZQ.png" /></figure><p>so any abstract members cannot have implementation basically it is incomplete. Because abstract class cannot have implementation for all the members.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*_KQu-e9b0bMAmYIfhWlPlg.png" /></figure><p>And you cannot create an instance of abstract class.They only be used as base class for other classes.</p><p>For example i have class called program which inherit from supplier class</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*vqcN6X2xO71Tou3W3lNTMA.png" /></figure><p>When you inherit a abstract class in non abstract class then you will get an error stated as <strong>“Base class ‘supplier ’ is less accessible than class program” </strong>and<strong> “ ‘program’ does not implement inherited abstract member ‘supplier.scan()’ ”.</strong></p><blockquote><strong>The first error says that you need to make abstract class public.</strong></blockquote><blockquote><strong>The Second error says that provide implementation for all the abstract members inherited from base abstract class.</strong></blockquote><p>If you don’t want to implement all the methods then just make program class as abstract class so that you can use which method you want to implement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*AfDYkSHpp5OjeeP920HMwA.png" /></figure><p>in above picture you guys can see that i made program class as abstract class so that it didn’t give any compile error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*_XzeOrBcJxOh5kjC09Fz6Q.png" /></figure><p>And if you want to call that then you will create an instance of the program class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*we2Psic0k3IB1ZXrI0U-RA.png" /></figure><p>You can either do this or you can create an instance of abstract class, remember you can’t create an instance of abstract class but an abstract class reference variable can point to derived class object. what we can do instead of program class will use supplier class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*3r3NOb3o2o0GuKWgMR9sdg.png" /></figure><p>Like this can you can use the abstract class in your program and the final output of this program is here in below picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XBWYr4Y-IofGRHSEY3OcJQ.png" /></figure><p>If you are new to programming then one of the best way is to learn programming with project following we have one such video which demonstrate practical using C# and .NET: -</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FUI2RRcsR83s%3Ffeature%3Doembed&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DUI2RRcsR83s&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FUI2RRcsR83s%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d337464fe53857789bf21dbd5dfbdab2/href">https://medium.com/media/d337464fe53857789bf21dbd5dfbdab2/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4dc3d1bf6e1b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Abstraction and Encapsulation ? Why we need ?]]></title>
            <link>https://medium.com/@rajeshpillai1996/what-is-abstraction-and-encapsulation-why-we-need-5944ed00b80e?source=rss-d557c944ec99------2</link>
            <guid isPermaLink="false">https://medium.com/p/5944ed00b80e</guid>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Rajesh Pillai]]></dc:creator>
            <pubDate>Wed, 05 Jun 2019 13:09:21 GMT</pubDate>
            <atom:updated>2019-06-06T09:40:54.248Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Abstraction and Encapsulation ? Why we need ?</h3><p><strong>Abstraction :-</strong></p><blockquote>Show only necessary things and hidding unnecessary things. Means what ?</blockquote><p>Lets see it in detail about Abstraction .</p><p>You have an SupplierModel Class in that you have some fields like SupplierId,SupplierName, SupplierCode ,SupplierAddress and some methods or functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*eEdXB7zVAYObOY7NPyfT2g.png" /></figure><p>Like is have some methods ValidateSupp and CheckRoute. If i want to use this model class in some of the method , so what we do create an object of the model and using that object in method for declare the field which we want. In SupplierModel i made all the fields and methods to public because of that when you create an object of that class and you can inherit all the properties of that class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*Lkp6tI1_bzMpbA49MGjIPg.png" /></figure><p>In Above picture you can see that in the <strong>IntelliSense </strong>it shows me all the fields and methods . what if you want only fields and don’t want methods . In that case what we can do change the field public to private of which field you want to hide . In my case i changed ValidateSupp and CheckRoute to private .you see in below picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s4PSrBbxcmq2ffTDhkdKtA.png" /></figure><p>I made ValidateSupp and CheckRoutes to private. so now we can’t inherit the method which are private.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*59yPy0tCHlrumGy27yhlAA.png" /></figure><p>So we can see that in the <strong>IntelliSense</strong> it doesn’t shown those Methods which are private and shows only the fields. And this is all about Abstraction .</p><p>Now we go for Encapsulation.</p><p><strong>Encapsulation</strong> :- Encapsulation is hidding the code and data in single unit to protect the data from outer world. For example in Supplier class i have three method like Add, Validate and AddToDB. From that two methods are private.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*99FMklnfHmACke0CUTVowg.png" /></figure><p>In below picture we can see that in intellisense only the AddSupplier method is shown because of that private field we declare.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XtK02-k9SMn58lSHW20QGQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*tdvR_HlPzvq1eu3c9zeq-A.png" /></figure><blockquote>Difference Between Abstraction and Encapsulation</blockquote><p><strong>Abstraction:-</strong></p><ol><li>Abstraction solves the problem in the Design level.</li><li>Abstraction is used to hidding the data and shows only necessary data.</li><li>Abstraction is outer layer in terms of design.</li><li>For example :- If you have smart phone, the outer look phone is only display screen and key buttons.</li></ol><p><strong>Encapsulation:-</strong></p><ol><li>Encapsulation solves the problem in the Implementation level.</li><li>Encapsulation is used to hiding the code and data from outer world.</li><li>Abstraction is inner layer in terms of implementation.</li><li>For Example :- If you have smart phone and the inner look of phone like motherboard, camera, connect wires, etc.</li></ol><p>If you are a new OOP learner also see below one fine C# and .NET project oriented video series practical for beginners: -</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FUI2RRcsR83s%3Ffeature%3Doembed&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DUI2RRcsR83s&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FUI2RRcsR83s%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d337464fe53857789bf21dbd5dfbdab2/href">https://medium.com/media/d337464fe53857789bf21dbd5dfbdab2/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5944ed00b80e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>