<?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 Rashmi Hasinika Gamage on Medium]]></title>
        <description><![CDATA[Stories by Rashmi Hasinika Gamage on Medium]]></description>
        <link>https://medium.com/@wgrashmi98?source=rss-312e409b81af------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*RHFB3iIe2gQsfDdsQ1ik3g.jpeg</url>
            <title>Stories by Rashmi Hasinika Gamage on Medium</title>
            <link>https://medium.com/@wgrashmi98?source=rss-312e409b81af------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 03:45:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@wgrashmi98/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[Data Binding in Angular: A Complete Guide with Examples]]></title>
            <link>https://wgrashmi98.medium.com/data-binding-in-angular-a-complete-guide-with-examples-e4679a55eb92?source=rss-312e409b81af------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4679a55eb92</guid>
            <category><![CDATA[signals-features]]></category>
            <category><![CDATA[data-binding-in-angular]]></category>
            <category><![CDATA[two-way-data-binding]]></category>
            <dc:creator><![CDATA[Rashmi Hasinika Gamage]]></dc:creator>
            <pubDate>Mon, 26 May 2025 03:44:15 GMT</pubDate>
            <atom:updated>2025-05-26T03:44:15.302Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qyOK-B1pq59BK8r7.jpeg" /></figure><p><strong>Data binding</strong> in Angular is a powerful feature that allows seamless communication between the component class and the HTML template. It keeps the view and model in sync automatically, reducing the need for manual DOM manipulation.</p><p>In this article, we’ll explore:</p><ul><li>Traditional data binding methods.</li><li>Two-way binding with ngModel</li><li>Data binding using Angular <strong>signals</strong> (introduced in Angular 16+)</li></ul><h3>Traditional Data Binding in Angular</h3><ol><li><strong>Interpolation</strong> ({{ }})<br>Used to bind data from the component to the view.</li></ol><pre>// app.component.ts<br>export class AppComponent {<br>  title = &#39;Angular Data Binding&#39;;<br>}</pre><pre>&lt;!-- app.component.html --&gt;<br>&lt;h1&gt;{{ title }}&lt;/h1&gt;</pre><p>2. <strong>Property Binding</strong> ([property])</p><p>Binds data to an element’s property.</p><pre>export class AppComponent {<br>  imageUrl = &#39;https://angular.io/assets/images/logos/angular/angular.svg&#39;;<br>}</pre><pre>&lt;img [src]=&quot;imageUrl&quot; alt=&quot;Angular Logo&quot; /&gt;</pre><p>Here, the src attribute is dynamically bound to the imageUrl in the component.</p><p>3. <strong>Event Binding</strong> ((event))</p><p>Handles user events like clicks, input, etc.</p><pre>export class AppComponent {<br>  count = 0;<br><br>  increment() {<br>    this.count++;<br>  }<br>}</pre><pre>&lt;button (click)=&quot;increment()&quot;&gt;Increment&lt;/button&gt;<br>&lt;p&gt;Count: {{ count }}&lt;/p&gt;</pre><p>When the button is clicked, the increment() method updates the count.</p><p>4. <strong>Two-Way Binding</strong> ([(ngModel)])</p><p>Combines property binding and event binding. It allows changes in the UI to reflect in the component and vice versa.</p><p>Two-way binding keeps the data in the component and the UI in sync automatically.</p><pre>export class AppComponent {<br>  username = &#39;&#39;;<br>}</pre><pre><br>&lt;input [(ngModel)]=&quot;username&quot; placeholder=&quot;Enter username&quot;&gt;<br>&lt;p&gt;Hello, {{ username }}&lt;/p&gt;</pre><p><strong><em>To use </em></strong><em>ngModel</em><strong><em>, don&#39;t forget to import </em></strong><em>FormsModule</em><strong><em> in your module</em></strong></p><p>As the user types in the input field, username is updated instantly in the component.</p><h3>Data Binding Using Angular Signals (Angular 16+)</h3><p><strong>Signals</strong> are a new reactive primitive in Angular that make change detection more efficient and explicit. They work similarly to <a href="https://v17.angular.io/guide/observables-in-angular"><em>observables</em></a> or state management but with more direct control.</p><pre>import { Component, signal } from &#39;@angular/core&#39;;<br><br>@Component({<br>  selector: &#39;app-root&#39;,<br>  template: `<br>    &lt;h2&gt;{{ title() }}&lt;/h2&gt;<br>    &lt;input [value]=&quot;name()&quot; (input)=&quot;name.set($any($event.target).value)&quot; /&gt;<br>    &lt;p&gt;Hello, {{ name() }}&lt;/p&gt;<br>    &lt;button (click)=&quot;increment()&quot;&gt;Clicked: {{ count() }}&lt;/button&gt;<br>  `<br>})<br>export class AppComponent {<br>  title = signal(&#39;Angular Signals Binding&#39;);<br>  name = signal(&#39;&#39;);<br>  count = signal(0);<br><br>  increment() {<br>    this.count.update(value =&gt; value + 1);<br>  }<br>}</pre><h3>Traditional Binding vs Signal-Based Binding</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*BDoI-6OhSb9elp24bxMjfg.png" /></figure><h3>When to Use What?</h3><ul><li>Use <strong>traditional binding</strong> for simple applications or forms.</li><li>Use <strong>signals</strong> when:<br>- You want better performance.<br>- You’re avoiding Zone.js.<br>- You want more control over data flow.</li></ul><p>Data binding is a core concept in Angular development that enables dynamic, responsive UI design. While the traditional methods ([property], (event), [(ngModel)]) are still powerful, the introduction of <strong>signals</strong> offers a more modern and reactive way to manage state in Angular applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4679a55eb92" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking the Potential of Entity Framework in .NET]]></title>
            <link>https://wgrashmi98.medium.com/unlocking-the-potential-of-entity-framework-in-net-f7496d38ee36?source=rss-312e409b81af------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7496d38ee36</guid>
            <category><![CDATA[entity-framework]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[dotnet]]></category>
            <dc:creator><![CDATA[Rashmi Hasinika Gamage]]></dc:creator>
            <pubDate>Sat, 09 Mar 2024 13:34:41 GMT</pubDate>
            <atom:updated>2024-03-09T13:34:41.462Z</atom:updated>
            <content:encoded><![CDATA[<h3>Unlocking the Potential of Entity Framework in .NET</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/0*935OJ44d_wNkod71.png" /></figure><p><em>Welcome to the world of .NET development made easy with Entity Framework. Let’s take a journey together to discover how this powerful tool simplifies data handling, its benefits, and when it might not be the best fit for your project. Ready to elevate your coding experience?</em></p><p><em>Let’s get started!</em></p><h4>What is Entity Framework?</h4><p>Entity Framework (EF) is indeed an open-source Object-Relational Mapping<strong> (ORM) framework</strong> developed by Microsoft for .NET applications. It allows developers to interact with databases using .NET objects rather than directly interacting with database tables and SQL queries.</p><p>This abstraction simplifies data access and manipulation by providing a higher-level interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*5koOEBnnO4ht_1t7k5YRHg.png" /></figure><p>Above image shows a layered architecture for a web application and illustrates where the Entity Framework fits into this architecture.</p><p>According to this image, Entity Framework (EF) is an object-relational mapper (ORM) that simplifies the process of working with relational databases. EF acts as a bridge between the object-oriented world of our application and the relational world of the database. Traditionally, applications interact with databases using SQL statements.</p><p>However, SQL can be complex and time-consuming to write. EF allows developers to write code using LINQ (Language Integrated Query), which is a query language that resembles C# syntax. This makes it easier to write and maintain database queries.</p><p><em>Let’s use an </em><strong><em>e-commerce application</em></strong><em> to illustrate the different layers.</em></p><h4>UI (User Interface):</h4><p>This is the part you see and interact with as a customer. Imagine the product listing page where you browse shoes.</p><p>Here, the UI layer would be responsible for displaying the product images, names, prices, and maybe even a shopping cart icon.</p><h4>Business Layer (Business Entities/Domain Classes):</h4><p>This layer sits behind the scenes and handles the core logic of the application.</p><p>Going with the shoe example, the Business Layer might have a class named “Product” that defines the properties of a shoe, such as its name, brand, size, and color. This layer would also be responsible for actions like adding a shoe to your shopping cart or calculating the total price of your order.</p><h4>Data Layer (Entity Framework):</h4><p>This layer handles communication with the database.</p><p><strong>Entity Framework acts as a translator between the object-oriented world (products, carts etc.) in the Business Layer and the relational world (tables, rows) of the database.</strong></p><p>So, when you add a shoe to your shopping cart in the UI, the Business Layer would call upon the Entity Framework to store that information in the relevant database’s table. For an example “shopping_cart” table.</p><h4>Database:</h4><p>This is where all the data is stored permanently. In our example, the database would hold tables for products, customers, shopping carts, and maybe even order history. It can be a MySQL database or any other database management system.</p><p><em>Let’s dive into the practical steps of integrating Entity Framework into our implementation. Get ready to unlock the power of seamless data management in your application with just a few simple configurations.</em></p><p><em>Here are code samples illustrating </em><strong><em>adding a shoe to a cart</em></strong><em> with and without Entity Framework.</em></p><p><strong>Without Entity Framework:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f63ee7f21d337809798e83feb150d8d3/href">https://medium.com/media/f63ee7f21d337809798e83feb150d8d3/href</a></iframe><p>This code snippet shows a <em>ShoppingCartService </em>class with an <em>AddShoeToCart</em> method. It uses a raw SQL statement to insert a new record into the “<em>ShoppingCartItems</em>” table.</p><p><strong>With Entity Framework:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0b57c1dafd22c9efdc063d7842ae4da6/href">https://medium.com/media/0b57c1dafd22c9efdc063d7842ae4da6/href</a></iframe><p>Here, the <em>ShoppingCartService </em>leverages Entity Framework. It creates a new <em>ShoppingCartItem </em>object, adds it to the <em>ShoppingCartItems</em> DbSet (representing a table), and calls<em> SaveChanges</em> to persist the changes.</p><p>Entity Framework translates this operation into the appropriate SQL statements behind the scenes.</p><p><em>Next up, let’s explore why Entity Framework can be a game-changer for our .NET projects. Here are the perks you don’t want to miss</em>.</p><h4>Advantages of using Entity Framework</h4><blockquote><em>EF eliminates the need to write a lot of repetitive code for common CRUD (Create, Read, Update, Delete) operations on our database.</em></blockquote><blockquote><em>Since we are working with C# objects instead of raw SQL, our code becomes easier to understand and maintain for ourselves and other developers.</em></blockquote><blockquote><em>EF provides compile-time type checking for data access code. This helps catch errors early in the development process, leading to more powerful applications.</em></blockquote><p>Here’s a table summarizing the few key points</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d02a424b7de61ff666c7edfeaa9eb876/href">https://medium.com/media/d02a424b7de61ff666c7edfeaa9eb876/href</a></iframe><p><em>Entity Framework (EF) is a powerful tool, but it’s not always the perfect fit for every situation. Here are some scenarios where you might consider alternatives to EF.</em></p><ul><li>If our database schema involves complex relationships, inheritance hierarchies, or functionality not well-supported by Entity Framework, it might become unmanageable to model and query the data effectively.</li><li>If we are working with a legacy system that relies heavily on complex stored procedures, integrating EF may be challenging. While EF can call stored procedures, extensive use might negate some of EF’s benefits.</li></ul><p>In wrapping up, Entity Framework is a powerful tool for .NET developers, making data management easier and coding simpler. However, it’s important to know when it might not be the best fit and explore other options.</p><p><em>By understanding its strengths and weaknesses, you can make smart choices to improve your projects.</em></p><p><em>Here’s to using Entity Framework wisely and navigating the world of software development with confidence!</em></p><p><em>I hope you enjoyed this blog. If you have any doubts. Then please comment them below.</em></p><p><em>Thankyou for visiting my blog…</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7496d38ee36" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simple Calculator Using JavaScript]]></title>
            <link>https://wgrashmi98.medium.com/simple-calculator-using-javascript-c612fcb20247?source=rss-312e409b81af------2</link>
            <guid isPermaLink="false">https://medium.com/p/c612fcb20247</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[web-design]]></category>
            <dc:creator><![CDATA[Rashmi Hasinika Gamage]]></dc:creator>
            <pubDate>Tue, 23 Feb 2021 12:04:59 GMT</pubDate>
            <atom:updated>2021-02-23T14:58:45.261Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nC08ceN6UM6QhScLw8zKsA.jpeg" /></figure><p>Hello ! Everyone…</p><p>Welcome to my blog. In this blog I would like to explain how to create a simple and smart calculator.</p><p>Calculation functionalities are achieved using JavaScript.</p><p>Hey! If you do not have a calculator, No need to worry about that. Come and join with me. Let’s create a calculator.</p><p>Special thing is the logic which we use here is very simple. This calculator will perform basic math operation. Such as addition, subtraction, multiplication and division.</p><p>Basically it consist of two parts.</p><p>—keyboard : for inputting values.</p><p>— display : for displaying user input values and solution.</p><p>Now, you can see a image(figure1) of the calculator below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h-VkE4GakMKPMKjhD0EVnw.png" /><figcaption>figure1 : calculator</figcaption></figure><p>Well, I think, now you get an idea of that calculator.</p><p>If you can not get an idea of above image, Do not worry about that. Now You can see named images (figure2) of this calculator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*WWUtTvB5qcsG6PONfYevJA.png" /><figcaption>figure2 : structure of calculator</figcaption></figure><p>HTML , CSS and JavaScript technologies were used to create this.</p><p>Now look at image(figure3) given below and think about differences among those images logically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*XPEntQQeVAsY-dgxfr58SA.jpeg" /><figcaption>figure3</figcaption></figure><p>So, I hope that you can get an basic idea about definition of HTML, CSS and JavaScript.</p><p>In here, you can refer the format of HTML document which I used.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6ec99087da5af1f916d831e7956cb47b/href">https://medium.com/media/6ec99087da5af1f916d831e7956cb47b/href</a></iframe><p>In this document, <em>&lt;button&gt;</em> tag is used to define clickable buttons and <em>class </em>attribute is used to specify number, operator and empty classes.</p><p>Specially, <em>class </em>attribute<em> </em>is used by JavaScript to access and manipulate elements with the specific class name and it can be also used to point a class name in style sheet/ CSS document.</p><p>Now, CSS technology can be used to style a structure of a calculator create from HTML. As well as, CSS can be converted into an attractive calculator.</p><p>In here, you can refer the format of style sheet which I used.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a63894c8b6e91e029f80c0c8ac4646ae/href">https://medium.com/media/a63894c8b6e91e029f80c0c8ac4646ae/href</a></iframe><p>All calculations are performed by the calculator are done using JavaScript technology.</p><p>In short hand, this calculator does not become a real calculator without using JavaScript.</p><p>Now, let us move your attention to the JavaScript document part by part that is so much valuable.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/70dbf975c2b13910711d6faf011238b8/href">https://medium.com/media/70dbf975c2b13910711d6faf011238b8/href</a></iframe><p>First of all, we need to manipulate the history and output sections.</p><p><em>getHistory () </em>function is used to return the history value and it value can be get using ID and using inner text. And <em>printHistory() </em>is used to print history values. Same logic has used to print to output values.</p><p>Inside the <em>printOutput() </em>function, there is a if else conditional statement. If the value is empty, output is also set to empty by using if statement. Other wise, it is converted to the comma separated values by calling <em>getFormattedNumber()</em> function. That’s why it gives better readability to user.</p><p>Now, let us go to next part of the JavaScript document.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c00be695f17e42643e999dfbccc30f62/href">https://medium.com/media/c00be695f17e42643e999dfbccc30f62/href</a></iframe><p>Inside the <em>getFormattedNumber()</em> function, there is a if statement as <em>if(num==”-”).</em> If number has a minus sign , then return to the empty value because minus sign is identified as an operator by the calculator. To avoid this error we use to this if statement.</p><p>Then, we have used Number method. Number method can be converted string type number into the integer type number. In next step, that number converted to an string value using <em>toLocaleString() </em>function. Then, this string type number is return to as a output value.</p><p>Using <em>reverseNumberFormat() </em>function remove the all dummy text from the calculation.</p><p>Now, let us go to next part of the JavaScript document.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9801529a819271454cf4cfd0a0996ee/href">https://medium.com/media/e9801529a819271454cf4cfd0a0996ee/href</a></iframe><p>Operator class can be used to get the operation. In here, for loop is used to access operators one by one in the list of the operators.</p><p>What would be happened when user clicks the clear button?</p><p>In this calculator clear button(AC) would remove both history and output. Therefore, both history and output values print as empty values.</p><p>Otherwise when user clicks backspace(DEL), only last character would be removed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e24eb67592ff31378a88f02a460ba808/href">https://medium.com/media/e24eb67592ff31378a88f02a460ba808/href</a></iframe><p>Output value is converted to the number format(without commas) using this line. As backspace should not deal with the commas. And also this number that returns by <em>reverseNumberFormat() </em>function again converts into a string using <em>toString() </em>function.</p><p>Then using <em>substr()</em> method, last character can be removed.</p><p>The operators in the calculator does not work if output is empty. So, output should be checked whether it is empty or not empty.</p><p>When the user clicks the equal sign(=), history is evaluated. Then Result is printed in the output section and the history section should be set as empty.</p><p>For other operators such as addition, subtraction, multiplication and division signs, the operator is get add to the history and the output is set as empty.</p><p>Now, let us go to last part of the JavaScript document.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c232cb631395f13109558ec9673aeea/href">https://medium.com/media/6c232cb631395f13109558ec9673aeea/href</a></iframe><p>This part is used to concatenate the numbers that user clicks. If output is an only number, concatenating will be happened and otherwise it won’t be happened.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b5986bde4c61b92f7e909ec5816e2184/href">https://medium.com/media/b5986bde4c61b92f7e909ec5816e2184/href</a></iframe><p>This if statement is used to check whether output is a number or not. When output is a number concatenate the user clicked value to the output value.</p><p>Hey! Readers that’s all…</p><p>We had created our calculator. Now you can use it..</p><p>I hope you enjoyed this blog. If you have any doubts. Then please comment them below.</p><p>Thankyou for visiting my blog…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c612fcb20247" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>