<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Pasindu Dewviman</title>
    <description>The latest articles on Forem by Pasindu Dewviman (@pasindu_tsx).</description>
    <link>https://forem.com/pasindu_tsx</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1703877%2Fa86ac44a-d38a-4360-87ed-f5b8ca234108.jpg</url>
      <title>Forem: Pasindu Dewviman</title>
      <link>https://forem.com/pasindu_tsx</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/pasindu_tsx"/>
    <language>en</language>
    <item>
      <title>Mastering Fitts’s Law: Designing for Speed and Accuracy</title>
      <dc:creator>Pasindu Dewviman</dc:creator>
      <pubDate>Thu, 12 Mar 2026 15:41:49 +0000</pubDate>
      <link>https://forem.com/pasindu_tsx/gemini-saidmastering-fittss-law-designing-for-speed-and-accuracy-42m7</link>
      <guid>https://forem.com/pasindu_tsx/gemini-saidmastering-fittss-law-designing-for-speed-and-accuracy-42m7</guid>
      <description>&lt;p&gt;In the world of UI/UX design, Fitts’s Law is a fundamental principle used to predict human movement and interaction. Originally proposed by psychologist Paul Fitts in 1954, it describes the relationship between the time it takes to move to a target and the physical characteristics of that target.&lt;/p&gt;

&lt;p&gt;For digital designers, this law is the secret to creating interfaces that feel "fast" and "effortless."&lt;/p&gt;

&lt;h2&gt;
  
  
  The Core Concept
&lt;/h2&gt;

&lt;p&gt;Fitts's Law can be summarized by two main variables:&lt;/p&gt;

&lt;p&gt;Distance: The farther away a target is from the user's current pointer (or thumb) position, the longer it takes to reach.&lt;/p&gt;

&lt;p&gt;Size: The smaller a target is, the more precision is required, which increases the time and mental effort needed to click or tap it.&lt;/p&gt;

&lt;p&gt;In simple terms: Large targets that are close to the user are the easiest to hit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Practical Applications for Modern Design
&lt;/h2&gt;

&lt;p&gt;To build a high-performing product, you should apply Fitts's Law in the following ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Optimize Touch Targets for Mobile&lt;br&gt;
Finger-driven interfaces require larger targets than mouse-driven ones. According to industry standards (like Apple’s Human Interface Guidelines), a touch target should be at least 44x44 pixels. This prevents "fat-finger" errors where a user accidentally taps the wrong button.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Utilize the "Thumb Zone"&lt;br&gt;
Most users navigate mobile devices with one hand. Place high-frequency actions—like "Search," "Add to Cart," or "Next"—within the bottom third of the screen. This area is the most accessible for the thumb, reducing the "travel distance" and making the app feel more responsive.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Group Related Actions&lt;br&gt;
If a user fills out a form, the "Submit" button should be placed immediately following the last input field. Forcing a user to move their cursor or hand to the opposite side of the screen creates unnecessary friction and slows down the workflow.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Leverage "Infinite" Targets&lt;br&gt;
In desktop design, the edges and corners of the screen act as "infinite targets." This is because a user can throw their mouse toward the corner without worrying about overshooting. This is why the Start Menu in Windows or the Apple Menu in macOS are placed in corners—they are the fastest targets to hit.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Key Takeaway
&lt;/h2&gt;

&lt;p&gt;Fitts’s Law isn't about making every button giant. It is about strategic sizing and placement. By making critical actions large and placing them in "high-comfort" zones, you reduce the physical and mental effort required to use your product.&lt;/p&gt;

</description>
      <category>ui</category>
      <category>ux</category>
      <category>design</category>
      <category>uidesign</category>
    </item>
    <item>
      <title>Jakob’s Law in UI/UX Design</title>
      <dc:creator>Pasindu Dewviman</dc:creator>
      <pubDate>Wed, 11 Mar 2026 16:21:21 +0000</pubDate>
      <link>https://forem.com/pasindu_tsx/jakobs-law-in-uiux-design-1330</link>
      <guid>https://forem.com/pasindu_tsx/jakobs-law-in-uiux-design-1330</guid>
      <description>&lt;p&gt;Jakob’s Law is a very important rule in digital design. It states that users spend most of their time on other websites. Because of this, they expect your website or app to work in the same way as all the other ones they already know.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Power of Familiarity
&lt;/h2&gt;

&lt;p&gt;When people visit a new website, they bring their past experiences with them. If your design uses standard patterns, users do not have to think hard to understand it. If you try to be too unique with basic features, users will get confused and might leave.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Apply Jakob’s Law
&lt;/h2&gt;

&lt;p&gt;You can make your designs much more user-friendly by following these ideas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use Standard IconsA magnifying glass means search. A shopping cart means checkout. Do not change these common symbols because users instantly know what they mean.&lt;/li&gt;
&lt;li&gt;Place Elements Where ExpectedPeople expect the main menu to be at the top or on the left side. They expect clicking the main logo to take them back to the home page. Keep these basic structures the same.&lt;/li&gt;
&lt;li&gt;Do Not Reinvent the WheelIt is good to be creative with your colors, images, and brand message. However, the way a user navigates and interacts with your site should remain standard and familiar.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Building a familiar interface helps users feel safe and confident. When they do not have to learn how to use your site, they can focus entirely on your content or product.&lt;/p&gt;

</description>
      <category>ui</category>
      <category>ux</category>
      <category>design</category>
      <category>software</category>
    </item>
    <item>
      <title>Understanding Hick’s Law in UI/UX Design</title>
      <dc:creator>Pasindu Dewviman</dc:creator>
      <pubDate>Tue, 10 Mar 2026 13:55:15 +0000</pubDate>
      <link>https://forem.com/pasindu_tsx/understanding-hicks-law-in-uiux-design-17nj</link>
      <guid>https://forem.com/pasindu_tsx/understanding-hicks-law-in-uiux-design-17nj</guid>
      <description>&lt;p&gt;Hick’s Law is a psychological principle used in design to improve user experience. It states that the time it takes for a person to make a decision increases with the number and complexity of choices available. In simple terms, more options lead to more confusion and slower action.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem of Choice Overload
&lt;/h2&gt;

&lt;p&gt;When a user visits a website or opens an app, their brain has a limited amount of processing power. This is called cognitive load. If you present them with a long list of menu items or dozens of buttons at once, they might feel overwhelmed. This often results in "analysis paralysis," where the user decides to do nothing and leaves the site.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Apply Hick’s Law
&lt;/h2&gt;

&lt;p&gt;You can make your designs more effective by following these simple steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Reduce the Number of Options&lt;br&gt;
Remove unnecessary buttons or links. Only show the most important actions to the user.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Break Down Complex Tasks&lt;br&gt;
If a process is long, like a checkout or a registration form, break it into smaller steps. This makes the task feel less intimidating.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Categorize Information&lt;br&gt;
Use menus and sub-menus. Grouping similar items together helps users find what they need without looking at every single option.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Highlight Recommended Actions&lt;br&gt;
Use color or size to guide the user toward the "next step" you want them to take.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When to Use It&lt;br&gt;
Hick’s Law is most important when users need to act quickly, such as during a checkout process or when navigating a dashboard. However, do not over-simplify to the point where the user cannot find what they need. The goal is to find a balance between providing enough information and keeping the interface clean.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;By minimizing choices, you reduce the mental effort required from your users. This leads to a faster, more enjoyable experience and increases the chances of them completing a task.&lt;/p&gt;

</description>
      <category>ui</category>
      <category>ux</category>
      <category>uidesign</category>
      <category>design</category>
    </item>
    <item>
      <title>GitHub හි පරණ Commit එකක් නැවත ලබාගන්නේ කොහොමද?</title>
      <dc:creator>Pasindu Dewviman</dc:creator>
      <pubDate>Sun, 08 Mar 2026 12:25:54 +0000</pubDate>
      <link>https://forem.com/pasindu_tsx/github-hi-prnn-commit-ekk-naevt-lbaagnnee-kohomd-7f9</link>
      <guid>https://forem.com/pasindu_tsx/github-hi-prnn-commit-ekk-naevt-lbaagnnee-kohomd-7f9</guid>
      <description>&lt;p&gt;වැඩ කරගෙන යන අතරතුර අත්වැරදීමකින් වැදගත් Branch එකක් Delete වුණොත් හෝ වැරදි Commit එකක් නිසා කේතය (Code) අවුල් වුණොත් මොකද කරන්නේ? ගොඩක් දෙනෙක් හිතන්නේ ඒ දත්ත සදහටම නැති වුණා කියලා.&lt;/p&gt;

&lt;p&gt;නමුත් Git Reflog හරහා ඔබට නැති වූ ඕනෑම දෙයක් නැවත ලබාගන්න පුළුවන්.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;මැකුණු Branch එකක් නැවත ලබා ගැනීම
ඔබ වැදගත් Branch එකක් Delete කළත්, Git විසින් එහි අවසාන තොරතුරු ටික කාලයකට මතක තබා ගන්නවා. එය නැවත ලබාගන්න මේ පියවර අනුගමනය කරන්න:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;✅ මුලින්ම ඔබේ Terminal එකේ git reflog ලෙස Type කරන්න.&lt;br&gt;
එවිට ඔබට ඔබ කළ සියලුම ක්‍රියාකාරකම් වල ලැයිස්තුවක් (History) දැකගන්න ලැබෙයි.&lt;/p&gt;

&lt;p&gt;✅ එහි ඔබ Delete කළ Branch එකේ තිබූ අවසාන Commit එකට අදාළ Commit ID (උදා: e3a4f52) එක සොයාගන්න.&lt;/p&gt;

&lt;p&gt;✅ දැන් පහත Command එක භාවිතා කර නව Branch එකක් සාදා ගන්න: git checkout -b [new-branch-name] [commit-id]&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;පරණ Commit එකකට ආපසු යන්නේ කොහොමද?
ඔබ කළ අලුත් වෙනස්කම් (Changes) නිසා Project එකේ Errors එනවා නම්, ඔබට ඉතා පහසුවෙන් කලින් තිබූ හොඳ තත්වයකට (Previous Commit) ආපසු යන්න පුළුවන්.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;✅ පරීක්ෂා කිරීමට (Temporary Check): ඔබට නිකම්ම ඒ පරණ Code එක බලන්න විතරක් ඕනේ නම්: git checkout [commit-id]&lt;/p&gt;

&lt;p&gt;✅ සම්පූර්ණයෙන්ම ආපසු හැරවීමට (Permanent Reset): ඔබට අලුත් වෙනස්කම් සියල්ල මකා දමා පරණ Commit එකටම යන්න ඕනේ නම්: git reset --hard &lt;a href="//%E0%B6%85%E0%B7%80%E0%B6%B0%E0%B7%8F%E0%B6%BB%E0%B6%AB%E0%B6%BA:%20%E0%B6%B8%E0%B7%99%E0%B7%84%E0%B7%92%E0%B6%AF%E0%B7%93%20%E0%B6%85%E0%B6%BD%E0%B7%94%E0%B6%AD%E0%B7%92%E0%B6%B1%E0%B7%8A%20%E0%B6%9A%E0%B7%85%20%E0%B7%83%E0%B7%92%E0%B6%BA%E0%B6%BD%E0%B7%94%E0%B6%B8%20Save%20%E0%B6%B1%E0%B7%9C%E0%B6%9A%E0%B7%85%20%E0%B7%80%E0%B7%99%E0%B6%B1%E0%B7%83%E0%B7%8A%E0%B6%9A%E0%B6%B8%E0%B7%8A%20%E0%B6%B8%E0%B7%90%E0%B6%9A%E0%B7%93%20%E0%B6%BA%E0%B6%B1%E0%B7%94%20%E0%B6%87%E0%B6%AD."&gt;commit-id&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;කල්පනා කළ යුතු කරුණු:&lt;br&gt;
git reflog මගින් දත්ත පෙන්වන්නේ සීමිත කාලයකට පමණි (සාමාන්‍යයෙන් දින 30-90).&lt;/p&gt;

&lt;p&gt;වැදගත් වෙනස්කම් කිරීමට පෙර සැමවිටම වෙනත් Branch එකක් භාවිතා කරන්න.&lt;/p&gt;

&lt;h1&gt;
  
  
  GitHub #GitTips #SoftwareEngineering #Coding #Sinhala #GitReflog #WebDevelopment
&lt;/h1&gt;

</description>
      <category>github</category>
      <category>git</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Guarding the Sinhala Web: Building Suba Bhas with Google Gemini</title>
      <dc:creator>Pasindu Dewviman</dc:creator>
      <pubDate>Tue, 03 Mar 2026 05:10:06 +0000</pubDate>
      <link>https://forem.com/pasindu_tsx/guarding-the-sinhala-web-building-suba-bhas-with-google-gemini-ojf</link>
      <guid>https://forem.com/pasindu_tsx/guarding-the-sinhala-web-building-suba-bhas-with-google-gemini-ojf</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/mlh/built-with-google-gemini-02-25-26"&gt;Built with Google Gemini: Writing Challenge&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built with Google Gemini
&lt;/h2&gt;

&lt;p&gt;The Suba Bhas is a browser extension and AI-powered filter designed to make the internet a safer space for Sinhala speakers. It acts as a real-time "shield" that detects offensive language and hate speech on web pages and automatically blurs it out.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Problem: Online toxicity in local languages like Sinhala often goes undetected by global moderation tools.&lt;/li&gt;
&lt;li&gt;The Tech: I built a Flask-based backend to serve a Bi-LSTM model trained on the SOLD (Sinhala Offensive Language Dataset).&lt;/li&gt;
&lt;li&gt;Gemini's Role: I used Google Gemini to help architect the system, debug the complex JavaScript for the DOM observer (which scans the text in real-time), and refine the logic for dynamic keyword extraction. Gemini was also instrumental in helping me translate technical concepts between the Python backend and the Chrome extension frontend.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;Github Link - [&lt;a href="https://github.com/itspasindu/Suba-Bas-Project" rel="noopener noreferrer"&gt;https://github.com/itspasindu/Suba-Bas-Project&lt;/a&gt;]&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;Building this was a massive learning curve. I improved my skills in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;atural Language Processing (NLP): Handling the unique nuances of the Sinhala script and offensive context.&lt;/li&gt;
&lt;li&gt;Full-Stack Integration: Connecting a JavaScript extension to a Python Flask API seamlessly.&lt;/li&gt;
&lt;li&gt;Soft Skills: I learned the importance of "ethical AI"—designing tools that protect users without over-censoring helpful content.&lt;/li&gt;
&lt;li&gt;Unexpected Lesson: I realized how difficult real-time web scraping can be when you're trying to blur text without slowing down the user's browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Google Gemini Feedback
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The Good: Gemini was incredibly fast at suggesting fixes for my Flask routes and helped me understand how to handle CORS issues between the extension and the server. It acted like a senior developer sitting right next to me.&lt;/li&gt;
&lt;li&gt;The Friction: Sometimes, when I asked about specific Sinhala NLP libraries, Gemini would occasionally suggest generic English-centric models. I had to be very specific in my prompts to ensure the AI understood I was working with a low-resource language like Sinhala.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devchallenge</category>
      <category>geminireflections</category>
      <category>gemini</category>
    </item>
    <item>
      <title>The burning AWS UAE facility, showing the physical impact of the attack on the "mec1-az2" zone.</title>
      <dc:creator>Pasindu Dewviman</dc:creator>
      <pubDate>Tue, 03 Mar 2026 04:54:03 +0000</pubDate>
      <link>https://forem.com/pasindu_tsx/the-burning-aws-uae-facility-showing-the-physical-impact-of-the-attack-on-the-mec1-az2-zone-17md</link>
      <guid>https://forem.com/pasindu_tsx/the-burning-aws-uae-facility-showing-the-physical-impact-of-the-attack-on-the-mec1-az2-zone-17md</guid>
      <description>&lt;p&gt;Amazon Web Services (AWS) is currently racing to restore power to its Middle East infrastructure after "unidentified objects" struck a key data center in the United Arab Emirates on Sunday, sparking a massive fire and knocking critical services offline.&lt;/p&gt;

&lt;p&gt;❗The Incident: Direct Hit on 'mec1-az2'&lt;br&gt;
At approximately 4:30 AM local time on March 1, AWS confirmed that its facility in the ME-CENTRAL-1 region (UAE) was impacted by external objects. The strike triggered immediate sparks and a fire within the building.&lt;/p&gt;

&lt;p&gt;To ensure the safety of emergency crews, the local fire department ordered a complete shutdown of all electrical systems and backup generators. This effectively "blacked out" Availability Zone mec1-az2, causing an immediate ripple effect across the global digital economy.&lt;/p&gt;

&lt;p&gt;While AWS has officially used the neutral term "objects," the incident occurred during a night of heavy military escalation.&lt;/p&gt;

&lt;p&gt;❗Retaliatory Strikes: The strike coincided with a barrage of Iranian missiles and drones targeting the UAE and other Gulf states.&lt;/p&gt;

&lt;p&gt;❗Wider Disruption: By Monday morning, AWS reported "localized power issues" in its Bahrain region (ME-SOUTH-1) as well, suggesting the conflict is physically straining the backbone of the regional internet.&lt;/p&gt;

&lt;p&gt;❗Historic Precedent: Analysts note this may mark the first time a major U.S. "hyperscale" data center has been directly knocked offline by military kinetic action.&lt;/p&gt;

&lt;p&gt;❗Global and Local Impact&lt;br&gt;
The outage has paralyzed services for thousands of customers:&lt;/p&gt;

&lt;p&gt;❗Banking &amp;amp; Finance: Major regional institutions, including Abu Dhabi Commercial Bank, reported significant disruptions to mobile and online banking apps.&lt;/p&gt;

&lt;p&gt;❗AI &amp;amp; Tech: Traffic for global AI platforms like Claude (Anthropic) was rerouted, leading to increased latency and "network spikes" as data was forced through servers in Europe and the US.&lt;/p&gt;

&lt;p&gt;❗Service Failures: Core AWS services, including EC2 (virtual servers), S3 (storage), and Lambda, saw high error rates. Launching new instances in the UAE region remains impossible as of Monday afternoon.&lt;/p&gt;

&lt;p&gt;AWS engineers are currently awaiting safety clearance to re-energize the facility. The company warned that full restoration will take "at least a day," as cooling, power systems, and physical hardware must be inspected for structural damage before being brought back online.&lt;/p&gt;

&lt;p&gt;"This incident highlights that while the cloud feels virtual, it lives in physical buildings that are vulnerable to the realities of war," said one regional tech analyst.&lt;/p&gt;

&lt;p&gt;AWS continues to advise all customers to move their workloads to unaffected regions like Europe (Ireland) or US-East until the ME-CENTRAL-1 region is fully stabilized.&lt;/p&gt;

&lt;h1&gt;
  
  
  aws #awsdown #cluade #galfwar #MiddleEastConflict #UAE #Bahrain #AWSOutage #CloudSecurity #DataCenterFire #Geopolitics
&lt;/h1&gt;

</description>
      <category>aws</category>
      <category>networking</category>
      <category>cloudsecurity</category>
      <category>dataengineering</category>
    </item>
    <item>
      <title>Understanding WebSockets</title>
      <dc:creator>Pasindu Dewviman</dc:creator>
      <pubDate>Sun, 01 Feb 2026 15:18:48 +0000</pubDate>
      <link>https://forem.com/pasindu_tsx/understanding-websockets-ac7</link>
      <guid>https://forem.com/pasindu_tsx/understanding-websockets-ac7</guid>
      <description>&lt;p&gt;WebSockets are a technology that helps computers talk to each other in real-time. If you have ever used a chat app, watched a live sports score update without refreshing the page, or played a multiplayer game online, you have likely used WebSockets.&lt;/p&gt;

&lt;p&gt;They allow a user's web browser and a server to keep a connection open constantly. This lets them send messages back and forth instantly.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the Standard Web Works (HTTP)
&lt;/h2&gt;

&lt;p&gt;To understand why WebSockets are special, we first need to look at how the web normally works. This is called HTTP.&lt;/p&gt;

&lt;p&gt;Think of HTTP like sending a letter.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client (your browser) sends a request (the letter) to the server asking for information.&lt;/li&gt;
&lt;li&gt;The server receives the request, finds the information, and sends a response back.&lt;/li&gt;
&lt;li&gt;Once the response is sent, the connection closes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want new information, you have to send another letter. This is safe and reliable, but it is slow for things that need to happen instantly.&lt;/p&gt;

&lt;h2&gt;
  
  
  The WebSocket Difference
&lt;/h2&gt;

&lt;p&gt;WebSockets work differently. Instead of sending a letter, think of WebSockets like a phone call.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client calls the server.&lt;/li&gt;
&lt;li&gt;The server answers.&lt;/li&gt;
&lt;li&gt;Now, both sides can talk and listen at the same time.&lt;/li&gt;
&lt;li&gt;The line stays open until one side decides to hang up.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because the line stays open, the server does not have to wait for the client to ask for updates. If the server has new data (like a new chat message), it can push it to the client immediately.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the Connection Starts
&lt;/h2&gt;

&lt;p&gt;A WebSocket connection starts with a standard HTTP request. This is often called the "handshake."&lt;/p&gt;

&lt;p&gt;The client sends a normal request to the server but adds a special note asking to upgrade the connection to a WebSocket.&lt;/p&gt;

&lt;p&gt;If the server agrees, it sends back a confirmation code.&lt;/p&gt;

&lt;p&gt;The standard HTTP connection switches over to a WebSocket connection.&lt;/p&gt;

&lt;p&gt;From that moment on, the heavy rules of HTTP are dropped. Data flows freely and quickly between the two.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to Use WebSockets
&lt;/h2&gt;

&lt;p&gt;WebSockets are best for applications where speed is the most important factor.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chat Applications: Messages need to appear instantly for everyone in the room.&lt;/li&gt;
&lt;li&gt;Live Sports Tickers: Scores must update the second a goal is scored.&lt;/li&gt;
&lt;li&gt;Multiplayer Games: Players need to see where other players are moving in real-time.&lt;/li&gt;
&lt;li&gt;Collaborative Editing: When two people write on the same document (like Google Docs), they need to see each other's typing immediately.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;WebSockets changed the internet from a place where you request information to a place where information flows to you. By keeping a permanent channel open between the user and the server, developers can build fast, interactive experiences that feel immediate.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>backend</category>
      <category>programming</category>
      <category>networking</category>
    </item>
    <item>
      <title>How Your Computer Actually Reads Code: The Magic of Abstract Syntax Trees</title>
      <dc:creator>Pasindu Dewviman</dc:creator>
      <pubDate>Sun, 18 Jan 2026 05:43:23 +0000</pubDate>
      <link>https://forem.com/pasindu_tsx/how-your-computer-actually-reads-code-the-magic-of-abstract-syntax-trees-3d1f</link>
      <guid>https://forem.com/pasindu_tsx/how-your-computer-actually-reads-code-the-magic-of-abstract-syntax-trees-3d1f</guid>
      <description>&lt;p&gt;When we write code, we see lines of text. We see keywords, brackets, and variable names. But when a computer looks at that same code, it sees something completely different. It does not read top-to-bottom like a human reads a book. Instead, it turns that text into a structure called an Abstract Syntax Tree, or AST.&lt;/p&gt;

&lt;p&gt;If you have ever wondered how tools like Prettier format your code automatically, or how compilers turn high-level languages into machine code, the answer usually lies in the AST.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is an Abstract Syntax Tree?
&lt;/h2&gt;

&lt;p&gt;An AST is a data structure that represents the logic of your code in a tree format.&lt;/p&gt;

&lt;p&gt;Think of a sentence in English. You can diagram that sentence by breaking it down into a subject, a verb, and an object. An AST does the same thing for programming languages. It breaks a line of code down into its essential parts.&lt;/p&gt;

&lt;p&gt;It is called "Abstract" because it throws away details that do not affect the logic, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Whitespace (spaces and tabs)&lt;/li&gt;
&lt;li&gt;Comments&lt;/li&gt;
&lt;li&gt;Parentheses (the tree structure itself shows the order of operations)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Visualizing the Tree
&lt;/h2&gt;

&lt;p&gt;Imagine a simple math operation: &lt;code&gt;5 + 3 * 6&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If a computer read this strictly left-to-right, it might calculate &lt;code&gt;5 + 3&lt;/code&gt; first, which is wrong. We know that multiplication happens before addition.&lt;/p&gt;

&lt;p&gt;An AST solves this by creating a hierarchy. The multiplication &lt;code&gt;3 * 6&lt;/code&gt;becomes a branch that sits deeper in the tree than the addition. The computer solves the deeper branches first.&lt;/p&gt;

&lt;h2&gt;
  
  
  In this tree:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The root node is the Addition (+).&lt;/li&gt;
&lt;li&gt;The left child is the number 5.&lt;/li&gt;
&lt;li&gt;The right child is another operation, the Multiplication (*).&lt;/li&gt;
&lt;li&gt;That multiplication node has two children: 3 and 6.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This structure makes it impossible for the computer to get the order of operations wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  From Text to Tree
&lt;/h2&gt;

&lt;p&gt;The process of creating an AST generally happens in two main steps:&lt;/p&gt;

&lt;p&gt;Lexical Analysis (Scanning) The compiler reads your raw code string and breaks it into a list of "tokens." A token is a tiny unit of meaning, like a keyword, an operator, or a variable name. It is like taking a sentence and chopping it into individual words.&lt;/p&gt;

&lt;p&gt;Syntax Analysis (Parsing) The parser takes that list of tokens and arranges them into the tree structure. It validates that the tokens follow the rules of the language. If you miss a semicolon or use a keyword wrong, this is usually where the "Syntax Error" happens.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Should You Care?
&lt;/h2&gt;

&lt;p&gt;You might think ASTs are only for people who build compilers. However, if you are a modern developer, you likely use tools powered by ASTs every single day.&lt;/p&gt;

&lt;p&gt;Linters (like ESLint) Linters do not just scan your code for text matches. They turn your code into an AST to understand the logic. This allows them to spot complex errors, like a variable that is defined but never used, or a function that returns the wrong value.&lt;/p&gt;

&lt;p&gt;Formatters (like Prettier) Prettier ignores your original style. It takes your code, builds an AST, and then prints the code back out from scratch using its own rules. This is why it can fix your indentation perfectly every time.&lt;/p&gt;

&lt;p&gt;Transpilers (like Babel) When you write modern JavaScript but need it to run on old browsers, Babel uses an AST. It parses your modern code into a tree, changes the nodes that old browsers do not understand into nodes they do understand, and then turns that tree back into code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;The Abstract Syntax Tree is the bridge between human-readable text and machine-executable logic. It is the hidden backbone of modern software development. Understanding it helps you understand how your tools work and how to write better, cleaner code.&lt;/p&gt;

&lt;p&gt;Next time you see a syntax error or watch your code auto-format, remember: it is all thanks to the tree.&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>beginners</category>
      <category>computerscience</category>
      <category>programming</category>
    </item>
    <item>
      <title>Why MCP Servers Change Everything</title>
      <dc:creator>Pasindu Dewviman</dc:creator>
      <pubDate>Mon, 05 Jan 2026 11:59:09 +0000</pubDate>
      <link>https://forem.com/pasindu_tsx/why-mcp-servers-change-everything-48ne</link>
      <guid>https://forem.com/pasindu_tsx/why-mcp-servers-change-everything-48ne</guid>
      <description>&lt;p&gt;We all know that AI models like Claude and ChatGPT are powerful. They can write code, summarize books, and answer complex questions. But they have a big problem.&lt;/p&gt;

&lt;p&gt;They are blind to your actual work.&lt;/p&gt;

&lt;p&gt;Your AI does not know what is in your database. It cannot see your company’s internal documents. It cannot check your latest code commit on GitHub. Until now, connecting AI to your data required writing complex, custom code for every single tool.&lt;/p&gt;

&lt;p&gt;This is where the Model Context Protocol (MCP) comes in. It is being called the "USB-C for AI applications," and it is going to change how we build software.&lt;/p&gt;

&lt;p&gt;🤖 The Problem: AI is Isolated&lt;br&gt;
Imagine hiring a brilliant assistant but locking them in an empty room. They have read every book in the world, but they cannot see the files on your desk. If you want them to do a task, you have to describe every detail manually.&lt;/p&gt;

&lt;p&gt;This is how most AI works today. It is isolated from your data.&lt;/p&gt;

&lt;p&gt;Developers usually fix this by building "pipelines" to feed data into the AI. But this is hard work. You have to build a different pipeline for Google Drive, another for Slack, and another for your SQL database. If you change your AI model, you often have to rebuild everything.&lt;/p&gt;

&lt;p&gt;🤖 The Solution: MCP Servers&lt;br&gt;
MCP stands for Model Context Protocol. It is an open standard that lets AI models talk to data sources in a universal language.&lt;/p&gt;

&lt;p&gt;Think of it like a universal plug.&lt;/p&gt;

&lt;p&gt;Before MCP: You build a specific connector to link Claude to your Postgres database.&lt;/p&gt;

&lt;p&gt;With MCP: You install a "Postgres MCP Server." Now, Claude can read the database. But so can any other AI tool that supports MCP.&lt;/p&gt;

&lt;p&gt;You build the connection once, and it works everywhere.&lt;/p&gt;

&lt;p&gt;🤖 How It Works Simply&lt;br&gt;
The system has three parts working together:&lt;/p&gt;

&lt;p&gt;The Host: This is the app you are using, like the Claude Desktop app or an IDE like Cursor.&lt;/p&gt;

&lt;p&gt;The Client: This connects the Host to the Server.&lt;/p&gt;

&lt;p&gt;The Server: This is the special bridge. It sits on top of your data (like your files or database) and translates it so the AI can understand it safely.&lt;/p&gt;

&lt;p&gt;🤖 Why Developers Are Excited&lt;br&gt;
This standard solves the biggest headache in AI development: Context.&lt;/p&gt;

&lt;p&gt;Build Once, Use Everywhere If you write an MCP server for your company's internal API, you can use it with different AI agents instantly. You do not need to rewrite the integration when a new, better AI model comes out.&lt;/p&gt;

&lt;p&gt;Real-Time Data The AI is not just guessing based on old training data. It is looking at your live data. If you ask, "What is the latest error in the logs?" the MCP server lets the AI look at the actual logs right now.&lt;/p&gt;

&lt;p&gt;Better Security You do not have to upload all your data to the AI company's cloud. The MCP server runs locally on your machine or your infrastructure. You control exactly what the AI can and cannot see.&lt;/p&gt;

&lt;p&gt;🤖 The Future of "Agentic" AI&lt;br&gt;
We are moving away from AI that just talks to us. We are moving toward "Agents"—AI that can take action.&lt;/p&gt;

&lt;p&gt;For an Agent to be useful, it needs tools. It needs to be able to search the web, read a file, or query a database. MCP provides those tools in a standard way.&lt;/p&gt;

&lt;p&gt;In the near future, you will not just chat with an AI. You will tell it, "Check the inventory database and email the supplier if we are low on stock."&lt;/p&gt;

&lt;p&gt;Because of MCP servers, the AI will actually be able to do it.&lt;/p&gt;

</description>
      <category>cloud</category>
      <category>mcp</category>
      <category>backend</category>
      <category>linux</category>
    </item>
    <item>
      <title>Securing React Application</title>
      <dc:creator>Pasindu Dewviman</dc:creator>
      <pubDate>Sun, 28 Dec 2025 13:22:42 +0000</pubDate>
      <link>https://forem.com/pasindu_tsx/securing-react-application-2m1n</link>
      <guid>https://forem.com/pasindu_tsx/securing-react-application-2m1n</guid>
      <description>&lt;p&gt;React Application එකක් හදනකොට අපි ගොඩක් වෙලාවට Performance සහ UI එක ගැන වද උනාට, Security පැත්ත ගැන හිතනවා මදි නේද? 🤔&lt;/p&gt;

&lt;p&gt;React කියන්නේ safe framework එකක් තමයි, ඒත් අපි නොදැනුවත්වම කරන පුංචි වැරදි නිසා මුළු application එකම අනතුරේ වැටෙන්න පුළුවන්. 2025 දී React App එකක් Secure කරගන්න නම් මේ දේවල් අනිවාර්යයෙන්ම බලන්න ඕන. 👇&lt;/p&gt;

&lt;p&gt;🔐 1. dangerouslySetInnerHTML පාවිච්චිය සීමා කරන්න React වලින් XSS (Cross-Site Scripting) නවත්වන්න default protection එකක් දෙනවා. හැබැයි ඔයා manual HTML render කරන්න dangerouslySetInnerHTML පාවිච්චි කරනවා නම්, අනිවාර්යයෙන්ම DOMPurify වගේ library එකක් පාවිච්චි කරලා ඒ content එක sanitize කරගන්න. නැත්නම් hacker කෙනෙක්ට ලේසියෙන්ම malicious scripts run කරන්න පුළුවන්.&lt;/p&gt;

&lt;p&gt;🛡️ 2. Authentication Tokens පරිස්සම් කරන්න (LocalStorage vs. Cookies) JWT Tokens හෝ Session ID කවදාවත් localStorage එකේ save කරන්න එපා. XSS attack එකකදී attackers ලට ලේසියෙන්ම localStorage access කරන්න පුළුවන්. ඒ වෙනුවට HttpOnly Cookies පාවිච්චි කරන්න. ඒක ගොඩක් ආරක්ෂිතයි.&lt;/p&gt;

&lt;p&gt;🔗 3. URL Based Attacks වලින් ප්‍රවේශම් වෙන්න User කෙනෙක් input කරන link එකක් කෙලින්ම a tag එකේ href එකට දානකොට පරිස්සම් වෙන්න. කෙනෙක්ට පුළුවන් javascript:alert('Hacked') වගේ malicious code එකක් ඒ හරහා execute කරන්න. හැමවිටම link එක http හෝ https වලින් පටන් ගන්නවද කියලා validate කරන්න.&lt;/p&gt;

&lt;p&gt;📦 4. Dependencies Update කරලා තියාගන්න React වල විතරක් නෙවෙයි, අපි පාවිච්චි කරන third-party libraries වලත් vulnerabilities තියෙන්න පුළුවන්. නිතරම npm audit run කරලා බලන්න. පරණ වෙච්ච packages (outdated dependencies) අප්ඩේට් කරගන්න.&lt;/p&gt;

&lt;p&gt;backend එකේ validation නැතුව කවදාවත් client-side validation මත විතරක් යැපෙන්න එපා. Frontend එක කොච්චර secure කරත්, Backend එකේ security එක තමයි වැදගත්ම දේ! 💯&lt;/p&gt;

&lt;h1&gt;
  
  
  ReactJS #WebSecurity #CyberSecurity #SoftwareEngineering #WebDevelopment #CodingLife #SinhalaTech
&lt;/h1&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>cybersecurity</category>
      <category>reactnative</category>
    </item>
    <item>
      <title>Building a REST API in Go (Golang)</title>
      <dc:creator>Pasindu Dewviman</dc:creator>
      <pubDate>Wed, 24 Dec 2025 17:30:54 +0000</pubDate>
      <link>https://forem.com/pasindu_tsx/building-a-rest-api-in-go-golang-ckk</link>
      <guid>https://forem.com/pasindu_tsx/building-a-rest-api-in-go-golang-ckk</guid>
      <description>&lt;p&gt;Go, also known as Golang, is renowned for its simplicity, performance, and built-in concurrency support, making it an excellent choice for building RESTful APIs. Companies like Docker, Kubernetes, and Uber rely on Go for high-performance backend services. In 2025, Go continues to dominate API development due to its efficiency and robust ecosystem.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a REST API?
&lt;/h2&gt;

&lt;p&gt;REST (Representational State Transfer) is an architectural style for designing networked applications. It uses standard HTTP methods to perform CRUD operations on resources:&lt;/p&gt;

&lt;p&gt;GET: Retrieve a resource&lt;br&gt;
POST: Create a resource&lt;br&gt;
PUT/PATCH: Update a resource&lt;br&gt;
DELETE: Delete a resource&lt;/p&gt;

&lt;p&gt;Resources are identified by URLs (e.g., /users/123), and responses are typically in JSON format.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why Choose Go for REST APIs?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Performance: Compiled to machine code with low latency and high throughput.&lt;/li&gt;
&lt;li&gt;Concurrency: Goroutines handle thousands of requests efficiently.&lt;/li&gt;
&lt;li&gt;Standard Library: net/http provides everything needed for basic servers.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Options for Building REST APIs in Go
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Standard Library (net/http)
Ideal for learning or lightweight APIs. Go 1.22+ improved ServeMux with method-specific routing (e.g., HandleFunc("GET /users", handler)).
Example basic server:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main

import (
    "encoding/json"
    "net/http"
)

type User struct {
    ID   int    `json:"id"`
    Name string `json:"name"`
}

var users = []User{{ID: 1, Name: "Alice"}}

func getUsers(w http.ResponseWriter, r *http.Request) {
    if r.Method != http.MethodGet {
        http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
        return
    }
    w.Header().Set("Content-Type", "application/json")
    json.NewEncoder(w).Encode(users)
}

func main() {
    mux := http.NewServeMux()
    mux.HandleFunc("GET /users", getUsers)
    http.ListenAndServe(":8080", mux)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Building a Simple REST API with Gin
&lt;/h2&gt;

&lt;p&gt;Let's create a basic user management API.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Setup:Bashgo mod init rest-api-example&lt;br&gt;
go get github.com/gin-gonic/gin&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Code (main.go):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main

import (
    "net/http"

    "github.com/gin-gonic/gin"
)

type User struct {
    ID   int    `json:"id"`
    Name string `json:"name"`
}

var users = []User{{ID: 1, Name: "Alice"}}

func main() {
    r := gin.Default()

    r.GET("/users", getUsers)
    r.GET("/users/:id", getUser)
    r.POST("/users", createUser)

    r.Run(":8080")
}

func getUsers(c *gin.Context) {
    c.JSON(http.StatusOK, users)
}

func getUser(c *gin.Context) {
    id := c.Param("id")
    // Parse and find user...
    c.JSON(http.StatusOK, gin.H{"id": id})
}

func createUser(c *gin.Context) {
    var newUser User
    if err := c.BindJSON(&amp;amp;newUser); err != nil {
        c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
        return
    }
    users = append(users, newUser)
    c.JSON(http.StatusCreated, newUser)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>go</category>
      <category>webdev</category>
      <category>programming</category>
      <category>api</category>
    </item>
    <item>
      <title>Golang Concurrency සරලව - Buffered Channels</title>
      <dc:creator>Pasindu Dewviman</dc:creator>
      <pubDate>Tue, 23 Dec 2025 14:14:57 +0000</pubDate>
      <link>https://forem.com/pasindu_tsx/golang-concurrency-srlv-buffered-channels-3bic</link>
      <guid>https://forem.com/pasindu_tsx/golang-concurrency-srlv-buffered-channels-3bic</guid>
      <description>&lt;p&gt;අද අපි බලමු වැදගත් කොටසක් වන Buffered Channels ගැන. මේකත් අපි අපේ සුපුරුදු "කුස්සියේ උදාහරණයෙන්" (Kitchen Analogy) තේරුම් ගනිමු.&lt;/p&gt;

&lt;p&gt;සාමාන්‍ය Channel එකේ ගැටලුව (Unbuffered Channels)&lt;br&gt;
අපි කලින් ඉගෙන ගත්ත සාමාන්‍ය Channel එකක් හරියට අතින් අතට බඩු මාරු කරනවා වගේ වැඩක්.&lt;/p&gt;

&lt;p&gt;Chef (Sender): පීසා එකක් හැදුවොත්, වේටර් (Receiver) ඇවිත් ඒක අතට ගන්නකම් Chef ට ඒක අතේ තියාගෙන බලන් ඉන්න වෙනවා (Block වෙනවා).&lt;/p&gt;

&lt;p&gt;වේටර් ආවේ නැත්නම්, Chef ට ඊළඟ පීසා එක හදන්න බැහැ. කුස්සිය හිරවෙනවා.&lt;/p&gt;

&lt;p&gt;විසඳුම: Buffered Channels (බෆර්ඩ් චැනල්ස්) 📦&lt;br&gt;
Buffered Channel එකක් කියන්නේ හරියට කුස්සියේ තියෙන කෑම මේසයක් වගේ. වේටර් එනකම් බලන් ඉන්නේ නැතුව, Chef ට පුළුවන් හදපු කෑම පිඟන් ටික මේසෙ උඩින් තියලා දිගටම උයන්න.&lt;/p&gt;

&lt;p&gt;Go වලදී අපි මේකට "Buffer Capacity" (ධාරිතාව) කියලා කියනවා.&lt;/p&gt;

&lt;p&gt;Code Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main

import "fmt"

func main() {
    // අපි මේසයක් හදනවා පීසා 3ක් තියන්න පුළුවන් (Capacity = 3)
    // දැන් Chef ට වේටර් නැති වුනත් පීසා 3ක් මේකේ තියන්න පුළුවන්.
    kitchenTable := make(chan string, 3)

    // පීසා මේසෙට යවනවා (Send)
    kitchenTable &amp;lt;- "Pizza 1"
    kitchenTable &amp;lt;- "Pizza 2"
    kitchenTable &amp;lt;- "Pizza 3"

    fmt.Println("Chef: මම පීසා 3ම හැදුවා. වේටර් තාම නෑ, ඒත් මම හිරවෙලා නෑ!")

    // 4 වෙනි එකක් දාන්න ගියොත් විතරක් Chef හිරවෙනවා (මොකද මේසෙ ඉඩ ඉවරයි).
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;මේ නිසා අපේ ප්‍රෝග්‍රෑම් එක වඩාත් කාර්යක්ෂම වෙනවා. මොකද යවන කෙනාට (Sender) ගන්න කෙනා (Receiver) එනකම් හැම වෙලාවෙම බලන් ඉන්න ඕනේ නැහැ.&lt;/p&gt;

&lt;p&gt;Channel එක වසා දැමීම (Closing Channels) 🚪&lt;br&gt;
කුස්සියේ වැඩ ඉවර වුනාම Chef අනිවාර්යයෙන්ම කියන්න ඕනේ "අදට වැඩ ඉවරයි, කුස්සිය වහනවා" කියලා. නැත්නම් වේටර්ලා (Receivers) රෑ එළි වෙනකම් හිස් කුස්සිය දිහා බලාගෙන ඉඳීවි (Deadlock).&lt;/p&gt;

&lt;p&gt;Go වලදී අපි මේකට close() function එක පාවිච්චි කරනවා.&lt;/p&gt;

&lt;p&gt;වැදගත්ම දේ: අපි Channel එකක් close කළාම, ගන්න කෙනාට (Receiver) දැනගන්න පුළුවන් "ආහ්! තව දත්ත එන්නේ නෑ" කියලා.&lt;/p&gt;

&lt;p&gt;මේ සඳහා අපිට Range Loop එකක් පාවිච්චි කරන්න පුළුවන්.&lt;/p&gt;

&lt;p&gt;Code Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main

import "fmt"

func main() {
    orderQueue := make(chan string, 2)
    // Chef වෙනම වැඩ පටන් ගන්නවා (Goroutine)
    go func() {
        orderQueue &amp;lt;- "Burger"
        orderQueue &amp;lt;- "Fries"

        // වැඩ ඉවරයි! කුස්සිය වහනවා.
        close(orderQueue) 
        fmt.Println("Chef: කුස්සිය වැහුවා (Channel Closed)")
    }()

    // වේටර්: Channel එක close වෙනකම් එන හැම දේම ගන්නවා
    for order := range orderQueue {
        fmt.Println("Received:", order)
    }
    fmt.Println("Waiter: හරි, වැඩ ඉවරයි. මම ගෙදර යනවා.")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Received: Burger&lt;br&gt;
Received: Fries&lt;br&gt;
Chef: කුස්සිය වැහුවා (Channel Closed)&lt;br&gt;
Waiter: හරි, වැඩ ඉවරයි. මම ගෙදර යනවා.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;වැදගත් කරුණු (Summary)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Buffered Channels (make(chan type, capacity)): දත්ත කිහිපයක් ගබඩා කර තැබිය හැකි Channels වේ. මෙය Sender සහ Receiver අතර තදබදය අඩු කරයි.&lt;/li&gt;
&lt;li&gt;Closing Channels (close(ch)): දත්ත යවා අවසන් බව Receiver ට දැනුම් දීමට භාවිතා කරයි.&lt;/li&gt;
&lt;li&gt;Range Loop (for msg := range ch): Channel එක close වන තුරු දිගටම දත්ත ලබා ගැනීමට මෙය භාවිතා කරයි.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>go</category>
      <category>gosinhala</category>
      <category>programming</category>
      <category>backend</category>
    </item>
  </channel>
</rss>
