<?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 Sivasothy Tharsi on Medium]]></title>
        <description><![CDATA[Stories by Sivasothy Tharsi on Medium]]></description>
        <link>https://medium.com/@sivasothytharsi?source=rss-f1fd2564f7b7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*57lMQaqWVgKRQBGHPtkvqA.jpeg</url>
            <title>Stories by Sivasothy Tharsi on Medium</title>
            <link>https://medium.com/@sivasothytharsi?source=rss-f1fd2564f7b7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 11:10:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sivasothytharsi/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[Getting Started with LangChain: A Complete Beginner’s Guide]]></title>
            <link>https://medium.com/@sivasothytharsi/getting-started-with-langchain-a-complete-beginners-guide-6520866832d6?source=rss-f1fd2564f7b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/6520866832d6</guid>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[langchain-for-beginners]]></category>
            <dc:creator><![CDATA[Sivasothy Tharsi]]></dc:creator>
            <pubDate>Fri, 24 Jul 2026 15:58:58 GMT</pubDate>
            <atom:updated>2026-07-24T15:58:58.616Z</atom:updated>
            <content:encoded><![CDATA[<p>Artificial Intelligence has transformed the way we interact with technology. Tools like ChatGPT can answer questions, write code, summarize documents, and even help with creative writing. But what if you want to build an AI application that can search your company’s documents, query a database, call external APIs, or remember previous conversations?</p><p>A Large Language Model (LLM) alone isn’t enough.</p><p>This is where <strong>LangChain</strong> comes in.</p><p>In this article, we’ll explore what LangChain is, why it exists, and how it helps developers build intelligent AI applications. If you’re new to AI development, this guide is for you.</p><h3>What Is LangChain?</h3><p><strong>LangChain</strong> is an open-source framework that helps developers build applications powered by <strong>Large Language Models (LLMs)</strong>.</p><p>Think of an LLM as the “brain” that understands and generates human language. While it is incredibly powerful, it has limitations. By default, it only knows what it was trained on and cannot interact with external systems on its own.</p><p>LangChain acts as the bridge between an LLM and the outside world. It allows the model to work with documents, databases, APIs, tools, and memory, enabling it to solve real-world problems instead of simply answering general questions.</p><h3>Why Do We Need LangChain?</h3><p>Imagine asking ChatGPT:</p><blockquote><em>“How many products are currently in my company’s inventory?”</em></blockquote><p>An LLM doesn’t have direct access to your company’s database, so it can’t answer this accurately.</p><p>Similarly, if you ask:</p><blockquote><em>“Send an email to my manager.”</em></blockquote><p>The LLM can generate the email content, but it cannot send it by itself.</p><p>These are common limitations of standalone language models:</p><ul><li>They cannot access private or company-specific data by default.</li><li>They cannot query databases.</li><li>They cannot call external APIs on their own.</li><li>They cannot perform actions such as sending emails or booking appointments.</li><li>They do not remember previous conversations unless memory is implemented.</li></ul><p>LangChain solves these challenges by connecting the LLM with external resources and enabling it to perform tasks beyond text generation.</p><h3>How LangChain Works</h3><p>At a high level, the flow looks like this:</p><pre>User<br>   │<br>   ▼<br>LangChain Application<br>   │<br>   ├── Prompt<br>   ├── LLM<br>   ├── Memory<br>   ├── Tools<br>   ├── Retriever<br>   └── Output</pre><p>Instead of sending a user’s question directly to the LLM, LangChain prepares the request, gathers any necessary information, calls the appropriate tools, and then returns a more accurate and useful response.</p><h3>The Core Components of LangChain</h3><p>Let’s look at the building blocks that make LangChain so powerful.</p><h3>1. Large Language Model (LLM)</h3><p>The LLM is the core intelligence behind your application.</p><p>Popular LLMs include:</p><ul><li>OpenAI GPT</li><li>Claude</li><li>Gemini</li><li>Llama</li><li>Mistral</li></ul><p>LangChain doesn’t replace these models. It provides a structured way to use them effectively.</p><h3>2. Prompt Templates</h3><p>Instead of writing prompts manually every time, LangChain allows you to create reusable templates.</p><p>For example, instead of repeatedly writing:</p><blockquote><em>“Explain {topic} in simple terms.”</em></blockquote><p>You can create a template and simply replace {topic} with different values.</p><p>This makes prompts cleaner, reusable, and easier to maintain.</p><h3>3. Memory</h3><p>Normal LLM interactions are often stateless.</p><p>For example:</p><p><strong>User:</strong></p><blockquote><em>My name is Sarah.</em></blockquote><p>Later…</p><p><strong>User:</strong></p><blockquote><em>What’s my name?</em></blockquote><p>Without memory, the model may not remember.</p><p>LangChain introduces memory components that allow applications to retain conversation history, creating more natural and personalized interactions.</p><h3>4. Tools</h3><p>One of LangChain’s most powerful features is its ability to use external tools.</p><p>Examples include:</p><ul><li>Calculators</li><li>Weather APIs</li><li>Search engines</li><li>Databases</li><li>Email services</li><li>Python execution</li><li>Custom APIs</li></ul><p>Instead of guessing an answer, the AI can retrieve real information or perform an actual task.</p><h3>5. Retrievers</h3><p>Suppose your company has thousands of PDF documents.</p><p>Instead of sending every document to the LLM which would be slow, expensive, and often impossible due to context limits, a retriever searches the document collection and returns only the most relevant pieces of information.</p><p>The LLM then generates an answer using this retrieved context.</p><h3>6. Chains</h3><p>Many AI applications require multiple steps.</p><p>For example:</p><pre>User Question<br>      │<br>      ▼<br>Search Database<br>      │<br>      ▼<br>Retrieve Information<br>      │<br>      ▼<br>Generate Response</pre><p>A <strong>Chain</strong> links these individual steps together, creating a structured workflow.</p><h3>7. Agents</h3><p>Unlike predefined chains, <strong>Agents</strong> can make decisions.</p><p>Instead of following a fixed sequence, an agent decides:</p><ul><li>Which tool should I use?</li><li>Should I search documents?</li><li>Should I call an API?</li><li>Should I calculate something first?</li></ul><p>This makes AI applications much more dynamic and flexible.</p><h3>A Real-World Example</h3><p>Imagine you’re building a customer support chatbot.</p><h3>Without LangChain</h3><pre>Customer Question<br>        │<br>        ▼<br>       LLM<br>        │<br>        ▼<br>General Answer</pre><p>The response may sound convincing but could be outdated or inaccurate because the LLM doesn’t know your company’s internal information.</p><h3>With LangChain</h3><pre>Customer Question<br>        │<br>        ▼<br>Search Company Documents<br>        │<br>        ▼<br>Retrieve Relevant Information<br>        │<br>        ▼<br>       LLM<br>        │<br>        ▼<br>Accurate Answer</pre><p>Now the chatbot responds using your organization’s actual documentation, making the answers far more reliable.</p><h3>What Is Retrieval-Augmented Generation (RAG)?</h3><p>One of the most popular AI architectures today is <strong>Retrieval-Augmented Generation (RAG)</strong>.</p><p>Instead of relying solely on the model’s training data, RAG retrieves relevant information before generating a response.</p><p>The workflow looks like this:</p><pre> User Question<br>      │<br>      ▼<br>  Retriever<br>      │<br>      ▼<br>Relevant Documents<br>      │<br>      ▼<br>     LLM<br>      │<br>      ▼<br>   Answer</pre><p>LangChain provides the building blocks needed to implement RAG systems, making it easier to build AI assistants that can answer questions using private knowledge bases.</p><h3>Common Use Cases for LangChain</h3><p>LangChain can be used to build a wide variety of AI applications, including:</p><ul><li>AI chatbots</li><li>Customer support assistants</li><li>Document question-answering systems</li><li>AI research assistants</li><li>Resume screening tools</li><li>SQL assistants</li><li>Knowledge base search systems</li><li>Code assistants</li><li>Personal productivity assistants</li></ul><h3>Why Developers Love LangChain</h3><p>LangChain has become one of the most popular frameworks for AI application development because it offers:</p><ul><li>Easy integration with multiple LLM providers</li><li>Support for Retrieval-Augmented Generation (RAG)</li><li>Built-in conversation memory</li><li>Integration with external tools and APIs</li><li>Flexible workflows using chains and agents</li><li>A large open-source ecosystem</li><li>Extensibility for custom applications</li></ul><p>Rather than writing all the integration logic yourself, LangChain provides reusable components that speed up development.</p><h3>Final Thoughts</h3><p>Large Language Models are incredibly powerful, but they aren’t designed to work alone in real-world applications.</p><p>LangChain extends their capabilities by connecting them with prompts, memory, tools, databases, APIs, and document retrieval systems. This enables developers to build intelligent applications that can reason, retrieve information, and perform useful actions.</p><p>If you’re beginning your AI journey, understanding LangChain is an excellent first step toward building modern AI-powered applications.</p><p>In the next article, we’ll install LangChain, connect it to an LLM, and build our first AI application using Python.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6520866832d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From @Transactional to JpaTransactionManager: Understanding Spring's Transaction Management…]]></title>
            <link>https://medium.com/@sivasothytharsi/from-transactional-to-jpatransactionmanager-understanding-springs-transaction-management-f633b80a88bf?source=rss-f1fd2564f7b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/f633b80a88bf</guid>
            <category><![CDATA[transactional]]></category>
            <category><![CDATA[spring-boot-transaction]]></category>
            <category><![CDATA[transaction-management]]></category>
            <dc:creator><![CDATA[Sivasothy Tharsi]]></dc:creator>
            <pubDate>Thu, 23 Jul 2026 08:05:01 GMT</pubDate>
            <atom:updated>2026-07-23T08:05:01.751Z</atom:updated>
            <content:encoded><![CDATA[<h3>From @Transactional to JpaTransactionManager: Understanding Spring&#39;s Transaction Management Internals</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*6qrk2iQCbJ3Ybulr9zlwOw.png" /></figure><h3>1. Introduction (Hook)</h3><p>Start with a real-world problem.</p><p>Example:</p><blockquote><em>Imagine you’re transferring $100 from one bank account to another.</em></blockquote><blockquote><em>Two database operations must happen:</em></blockquote><ul><li>Deduct $100 from Account A</li><li>Add $100 to Account B</li></ul><blockquote><em>What happens if the first operation succeeds but the second fails?</em></blockquote><blockquote><em>Without transactions, the database becomes inconsistent.</em></blockquote><blockquote><em>This is exactly why Spring provides transaction management.</em></blockquote><blockquote><em>But have you ever wondered what actually happens when you write this?</em></blockquote><pre>@Transactional<br>public void transferMoney() {<br>    ...<br>}</pre><p>It looks like a simple annotation…</p><p>But behind it, Spring executes a surprisingly elegant chain of classes.</p><h3>2. What is a Transaction?</h3><p>Explain</p><ul><li>ACID (only briefly)</li><li>Commit</li><li>Rollback</li></ul><p>Diagram</p><pre>BEGIN<br><br>↓<br><br>Business Logic<br><br>↓<br><br>Success?<br><br>↓<br><br>COMMIT / ROLLBACK</pre><h3>3. The Magic of @Transactional</h3><p>Show</p><pre>@Service<br>public class BankService {<br>    @Transactional<br>    public void transfer() {<br>    }<br>}</pre><p>Then explain</p><blockquote><strong><em>Does @Transactional itself open a transaction?</em></strong></blockquote><p>Answer:</p><p>No.</p><p>It is only metadata.</p><p>Spring reads this annotation.</p><p>Then delegates the work to another component.</p><h3>4. Spring Proxy</h3><p>Explain AOP.</p><p>Diagram</p><pre>Client<br>↓<br>Spring Proxy<br>↓<br>Real Service</pre><p>Then</p><pre>Before Method<br>↓<br>Open Transaction<br>↓<br>Execute Method<br>↓<br>Commit/Rollback</pre><p>Explain that the proxy is why <strong>self-invocation doesn’t work</strong>.</p><h3>5. TransactionInterceptor</h3><p>This is where most articles stop.</p><p>Don’t.</p><p>Explain</p><pre>Proxy<br>↓<br>TransactionInterceptor</pre><p>Its responsibilities</p><ul><li>Read @Transactional</li><li>Find TransactionManager</li><li>Start transaction</li><li>Execute method</li><li>Commit</li><li>Rollback</li></ul><p>Now readers understand WHY TransactionManager exists.</p><h3>6. TransactionManager</h3><p>Now introduce</p><pre>TransactionManager</pre><p>Explain</p><p>Marker Interface</p><p>No methods</p><p>Purpose</p><pre>This object is responsible for transactions.</pre><h3>7. PlatformTransactionManager</h3><p>Now explain</p><p>Why another interface?</p><p>Because Spring supports</p><ul><li>JDBC</li><li>JPA</li><li>Hibernate</li><li>JTA</li><li>Reactive</li></ul><p>Show</p><pre>public interface PlatformTransactionManager {<br>    TransactionStatus getTransaction(...)<br>    commit()<br>    rollback()<br>}</pre><p>Explain each method.</p><h3>8. AbstractPlatformTransactionManager</h3><p>This is where beginners usually get lost.</p><p>Instead explain using</p><p>Cooking analogy</p><p>Imagine every chef has to</p><ul><li>wash vegetables</li><li>heat pan</li><li>cook</li><li>clean kitchen</li></ul><p>Different dishes</p><p>Same workflow.</p><p>So Spring extracted common code.</p><p>Explain Template Method Pattern.</p><p>Show</p><pre>begin()<br>↓<br>prepare<br>↓<br>execute<br>↓<br>commit()<br>↓<br>cleanup</pre><p>Mention</p><p>This class already implements</p><ul><li>propagation</li><li>rollback rules</li><li>synchronization</li><li>cleanup</li><li>nested transaction support</li></ul><p>Subclasses only implement technology-specific code.</p><h3>9. JpaTransactionManager</h3><p>Now explain</p><p>Most Spring Boot developers use</p><pre>JpaTransactionManager</pre><p>Internally</p><pre>EntityManager<br>↓<br>EntityTransaction.begin()<br>↓<br>commit()<br>↓<br>rollback()</pre><h3>10. DataSourceTransactionManager</h3><p>Explain</p><p>If using JDBC</p><p>Spring switches implementation</p><p>Everything else remains identical.</p><h3>11. Complete Hierarchy</h3><p>Now show</p><pre>                              @Transactional<br>                                     │<br>                                     ▼<br>                              Spring Proxy<br>                                     │<br>                                     ▼<br>                         TransactionInterceptor<br>                                     │<br>                                     ▼<br>                          TransactionManager<br>                             (Marker Interface)<br>                                     │<br>                                     ▼<br>                      PlatformTransactionManager<br>                             (Main Interface)<br>                                     │<br>                                     ▼<br>                 AbstractPlatformTransactionManager<br>                          (Template Method)<br>                     ┌─────────────────────────────┐<br>                     ▼                             ▼<br>          JpaTransactionManager      DataSourceTransactionManager<br>                     ▼                             ▼<br>               EntityManager                JDBC Connection<br>                     ▼                             ▼<br>                  Database                   Database</pre><p>This diagram is probably the biggest value of the article.</p><h3>12. Full Execution Flow</h3><p>Now explain exactly what happens.</p><pre>Client<br>↓<br>calls transferMoney()<br>↓<br>Proxy intercepts<br>↓<br>TransactionInterceptor<br>↓<br>PlatformTransactionManager<br>↓<br>AbstractPlatformTransactionManager<br>↓<br>JpaTransactionManager<br>↓<br>EntityManager.begin()<br>↓<br>Business Method<br>↓<br>Success ?<br>↓<br>Commit<br>or<br>Rollback</pre><h3>13. Actual Spring Source Code</h3><p>Now show</p><p>Not entire source.</p><p>Only important methods.</p><p>Like</p><pre>AbstractPlatformTransactionManager.commit()</pre><p>Explain</p><p>Spring already implemented</p><pre>if rollback only<br>↓<br>rollback<br>else<br>↓<br>commit</pre><p>Readers LOVE source code.</p><h3>14. Why So Many Layers?</h3><p>Now explain SOLID.</p><p>Specifically</p><p>Dependency Inversion Principle.</p><p>Spring depends on</p><pre>PlatformTransactionManager</pre><p>Not</p><pre>JpaTransactionManager</pre><p>Advantages</p><ul><li>Easy to extend</li><li>Easy to replace</li><li>Open Closed Principle</li><li>Loose coupling</li></ul><h3>15. Summary</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*UQqU4nixbDgWneOgDWuFtA.png" /></figure><h3>16. Conclusion</h3><p>End with something memorable.</p><p>For example:</p><blockquote><em>The next time you write</em></blockquote><pre>@Transactional</pre><p>remember that this tiny annotation triggers an entire chain of Spring components.</p><p>From proxies and interceptors to abstract classes and concrete transaction managers, Spring combines object-oriented principles and design patterns to make transaction management simple for application developers.</p><p>What looks like a single annotation is actually the result of a carefully designed architecture built on <strong>abstraction</strong>, <strong>inheritance</strong>, <strong>polymorphism</strong>, and the <strong>Template Method</strong> pattern.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f633b80a88bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Tomcat: The Bridge Between Your Java Application and the Web]]></title>
            <link>https://medium.com/@sivasothytharsi/understanding-tomcat-the-bridge-between-your-java-application-and-the-web-9b17caf6e4e3?source=rss-f1fd2564f7b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b17caf6e4e3</guid>
            <category><![CDATA[apache-tomcat]]></category>
            <category><![CDATA[tomcat]]></category>
            <dc:creator><![CDATA[Sivasothy Tharsi]]></dc:creator>
            <pubDate>Wed, 22 Jul 2026 16:00:32 GMT</pubDate>
            <atom:updated>2026-07-22T16:00:32.877Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/715/0*6vKeY2KwH-hxBUZF" /></figure><p>When we start learning Spring Boot, we often hear words like <strong>Tomcat</strong>, <strong>Servlet Container</strong>, <strong>Embedded Server</strong>, and <strong>DispatcherServlet</strong>. These terms can be confusing at the beginning.</p><p>So, let’s understand:</p><ul><li>What is Tomcat?</li><li>Why do we need Tomcat?</li><li>How does Tomcat work with Spring Boot?</li><li>What happens when we send an HTTP request?</li></ul><h3>What is Tomcat?</h3><p><strong>Apache Tomcat is a web server and servlet container that allows Java applications to handle HTTP requests and responses.</strong></p><p>In simple words:</p><blockquote><em>Tomcat is the program that helps your Java application communicate with the outside world.</em></blockquote><p>A normal Java application can execute code, but it does not know how to receive requests from a browser or Postman.</p><p>For example:</p><pre>public class PaymentService {<br>  public void processPayment() {<br>          System.out.println(&quot;Payment completed&quot;);<br>      }<br>}</pre><p>This code works when called from another Java class, but how can a user call it using:</p><pre>POST http://localhost:8080/payment</pre><p>Java itself does not understand HTTP requests.</p><p>This is where Tomcat comes in.</p><p>Imagine you built a restaurant.</p><p>Your kitchen has chefs who prepare food. However, customers cannot directly enter the kitchen and communicate with chefs.</p><p>You need someone to:</p><ul><li>receive customer orders</li><li>take those orders to the kitchen</li><li>bring the prepared food back</li></ul><p>Tomcat works like that waiter.</p><p>The mapping is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*n-zkO1zEHbTrdXMiN_6yNw.png" /></figure><p>The client communicates with Tomcat, and Tomcat communicates with your Java application.</p><h3>How Tomcat Handles a Request</h3><p>Suppose we have a Spring Boot controller:</p><pre>@RestController<br>@RequestMapping(&quot;/payment&quot;)<br>public class PaymentController {<br>    @PostMapping<br>    public String pay() {<br>            return &quot;Payment successful&quot;;<br>    }<br>}</pre><p>A user sends:</p><pre>POST localhost:8080/payment</pre><p>The request flow is:</p><pre>Client<br>  |<br>  | HTTP Request<br>  v<br>Tomcat<br>  |<br>  v<br>DispatcherServlet<br>  |<br>  v<br>PaymentController<br>  |<br>  v<br>PaymentService<br>  |<br>  v<br>Response<br>  |<br>  v<br>Tomcat<br>  |<br>  v<br>Client</pre><h3>What Does Tomcat Actually Do?</h3><h3>1. Listens for HTTP Requests</h3><p>Tomcat opens a port (usually 8080) and waits for incoming requests.</p><p>Example:</p><pre>localhost:8080</pre><p>When a request arrives:</p><pre>GET /users</pre><p>Tomcat receives it.</p><h3>2. Converts HTTP Requests into Java Objects</h3><p>HTTP is just text-based communication.</p><p>Example:</p><pre>POST /payment</pre><pre>{<br>   &quot;amount&quot;:100<br>}</pre><p>Tomcat converts this into Java objects like:</p><ul><li>HttpServletRequest</li><li>HttpServletResponse</li></ul><p>Then it passes them to Spring.</p><h3>3. Manages Servlets</h3><p>Tomcat is called a <strong>Servlet Container</strong> because it manages Java Servlets.</p><p>A Servlet is a Java component that handles HTTP requests.</p><p>In Spring MVC, the main servlet is:</p><pre>DispatcherServlet</pre><p>The relationship is:</p><pre>Tomcat<br>   |<br>   v<br>DispatcherServlet<br>   |<br>   v<br>Controller</pre><p>Tomcat manages the lifecycle of DispatcherServlet:</p><ul><li>Creating it</li><li>Initializing it</li><li>Handling requests</li><li>Destroying it</li></ul><h3>4. Manages Threads</h3><p>A web application can receive thousands of requests.</p><p>Tomcat manages threads to handle multiple requests.</p><p>Example:</p><pre>Request 1 ---&gt; Thread 1 ---&gt; OrderController<br>Request 2 ---&gt; Thread 2 ---&gt; PaymentController<br>Request 3 ---&gt; Thread 3 ---&gt; InventoryController</pre><p>After completing a request, the thread returns to the thread pool and can be reused.</p><h3>Tomcat in Traditional Java Applications</h3><p>Before Spring Boot became popular, developers usually installed Tomcat separately.</p><p>The process was:</p><pre>Tomcat Server<br>      |<br>      |<br>Deploy WAR File<br>      |<br>      |<br>Java Web Application</pre><p>Developers had to:</p><ul><li>install Tomcat</li><li>configure ports</li><li>deploy applications manually</li></ul><h3>Tomcat in Spring Boot</h3><p>Spring Boot changed this approach.</p><p>Spring Boot comes with an embedded Tomcat server by default.</p><p>When we add:</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;<br>&lt;/dependency&gt;</pre><p>we get:</p><ul><li>Spring MVC</li><li>Jackson JSON support</li><li>Embedded Tomcat</li></ul><p>Now when we run:</p><pre>SpringApplication.run()</pre><p>Spring Boot automatically starts Tomcat.</p><p>The flow becomes:</p><pre>Spring Boot Application<br>          |<br>          v<br>    Embedded Tomcat<br>          |<br>          v<br> Listening on port 8080</pre><p>We don’t need to install Tomcat separately.</p><h3>Tomcat vs Spring Boot</h3><p>A common beginner confusion is:</p><p>“Is Tomcat part of Spring?”</p><p>No.</p><p>They are different.</p><h3>Tomcat</h3><p>Responsible for:</p><ul><li>Receiving HTTP requests</li><li>Managing connections</li><li>Managing servlet lifecycle</li><li>Sending responses</li></ul><h3>Spring Boot</h3><p>Responsible for:</p><ul><li>Creating beans</li><li>Dependency Injection</li><li>Business logic</li><li>Application structure</li></ul><p>They work together:</p><pre>Client<br>  |<br>  v<br>Tomcat<br>  |<br>  v<br>Spring Boot<br>  |<br>  v<br>Business Logic</pre><h3>What Happens When You Start a Spring Boot Application?</h3><p>When you execute:</p><pre>java -jar application.jar</pre><p>Spring Boot does:</p><ol><li>Creates the Spring Application Context</li><li>Scans and creates beans</li><li>Starts embedded Tomcat</li><li>Registers DispatcherServlet</li><li>Opens port 8080</li><li>Waits for requests</li></ol><p>Now your application is ready to serve HTTP requests.</p><h3>Conclusion</h3><p>Tomcat is the bridge between the web and your Java application.</p><p>A Spring Boot application contains your business logic, but Tomcat provides the environment to receive and respond to HTTP requests.</p><p>In simple terms:</p><blockquote><em>Spring Boot writes the application logic. Tomcat makes that application accessible through the web.</em></blockquote><p>Understanding Tomcat helps you understand what happens behind the scenes every time you call a Spring Boot API.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b17caf6e4e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering NumPy for Machine Learning: A Beginner’s Guide]]></title>
            <link>https://medium.com/@sivasothytharsi/mastering-numpy-for-machine-learning-a-beginners-guide-ca1fc27adc8a?source=rss-f1fd2564f7b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca1fc27adc8a</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[numpy]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Sivasothy Tharsi]]></dc:creator>
            <pubDate>Tue, 16 Sep 2025 18:41:26 GMT</pubDate>
            <atom:updated>2025-09-16T18:41:26.592Z</atom:updated>
            <content:encoded><![CDATA[<p>When I first started learning machine learning, I kept hearing about big libraries like Scikit-learn, TensorFlow, and PyTorch. But soon I realized that all of them rely on one powerful foundation: <strong>NumPy</strong>. If you don’t understand NumPy, you’ll struggle to understand how machine learning actually works.</p><p>In this article, I’ll walk you through <strong>why NumPy is important for ML, the core concepts you need to know, and some hands-on examples</strong>. By the end, you’ll see how arrays and matrices turn into the math that powers AI.</p><ol><li><strong>Why NumPy Matters in Machine Learning?</strong></li></ol><ul><li>ML models rely on <strong>vectors, matrices, and linear algebra</strong>.</li><li>Datasets are stored as <strong>2D arrays</strong> (rows = samples, columns = features).</li><li>Operations like <strong>dot product, reshaping, and broadcasting</strong> are everywhere in ML.</li><li>Almost every other ML library is built on top of NumPy.</li></ul><p><strong>2. Getting started with NumPy</strong></p><pre>!pip install numpy  #installation<br><br>import numpy as np  #importing numpy package</pre><ul><li>Creating Arrays</li></ul><pre>#creating an array with integer elements<br>arr = np.array([10,20,25,30,35])<br>#print the array<br>print(arr)<br>#print the type of the array object<br>#it will be &lt;class &#39;numpy.ndarray&#39;&gt;<br>print(type(arr))<br>#print the type of the elements within the array<br>#it will be int64<br>print(arr.dtype)</pre><p>In ML, arrays often represent <strong>features, labels, weights, and biases</strong>.</p><p><strong>3. Essential NumPy Operations for ML</strong></p><ul><li><strong>Vectorized Computation</strong></li></ul><pre>x = np.array([1, 2, 3])<br>y = np.array([4, 5, 6])<br><br>print(x + y)      # element-wise addition<br>print(x * y)      # element-wise multiplication<br>print(np.dot(x, y))  # dot product</pre><p>Dot products are everywhere: linear regression, neural networks, and word embeddings.</p><ul><li><strong>Reshaping &amp; Slicing</strong></li></ul><pre>arr = np.arange(12).reshape(3,4)<br>print(arr[0, :])   # first row<br>print(arr[:, 1])   # second column</pre><p>Reshaping is used when preparing data for ML models (e.g., flattening images).</p><ul><li><strong>Statistics (for Data Analysis)</strong></li></ul><pre>#2D array with dimention 3x2<br>arr = np.array([[1, 2], [3, 4], [5, 6]])<br>#calculate mean<br>mean = np.mean(arr)<br>#calculate standard deviation<br>std = np.std(arr)<br>#transpose<br>print(data.T) </pre><p>Useful in <strong>feature scaling, normalization, and covariance matrices</strong>.</p><p><strong>4. NumPy in Action: A Tiny ML Example</strong></p><p>Let’s say we want to make a <strong>linear regression prediction</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/193/1*e60p9QrtulSYYSh3zP2xQg.png" /></figure><pre>weights = np.array([0.4, 0.6])<br>features = np.array([2, 3])<br><br>prediction = np.dot(weights, features)<br>print(&quot;Prediction:&quot;, prediction)  #Prediction: 2.6<br></pre><p>This is literally how ML models compute outputs: <strong>dot products between weights and features</strong>.</p><p><strong>5. Conclusion</strong></p><p>NumPy is not just another Python library it’s the <strong>foundation of machine learning in Python</strong>. From basic array manipulations to powering complex neural networks, NumPy is everywhere.</p><p>If you’re starting your ML journey, make sure you spend time mastering NumPy. It will make learning Pandas, Scikit-learn, TensorFlow, and PyTorch much easier and give you a deeper understanding of what’s really happening behind the scenes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca1fc27adc8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Modules, Packages, and Libraries in Python: What’s the Difference?]]></title>
            <link>https://medium.com/@sivasothytharsi/modules-packages-and-libraries-in-python-whats-the-difference-eaff06397152?source=rss-f1fd2564f7b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/eaff06397152</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[coding-tutorial]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Sivasothy Tharsi]]></dc:creator>
            <pubDate>Mon, 01 Sep 2025 06:48:32 GMT</pubDate>
            <atom:updated>2025-09-01T06:48:32.098Z</atom:updated>
            <content:encoded><![CDATA[<p>Python is an <strong>interpreted language</strong> famous for its <strong>simplicity</strong> and <strong>readability</strong>. Its clean syntax and versatility make it a favorite not just among developers, but also among data scientists and AI researchers. In fact, Python is the <strong>primary language for most Machine Learning and Artificial Intelligence projects</strong> today.</p><p>If you’ve ever started exploring Python, you might have come across terms like <em>module</em>, <em>package</em>, and <em>library</em>. At first, they might seem interchangeable, but each has a distinct role in Python’s ecosystem. Understanding these differences will make your code more organized and easier to maintain.</p><h3>Example Folder Structure of a Python Library</h3><p>Before we define modules, packages, and libraries, let’s visualize how a Python library might be organized:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*DdAwj7mTEpHo-hT3js-xVQ.png" /></figure><ul><li>MyLib/ → The main library folder</li><li>package1/ and package2/ → Sub-packages containing related modules</li><li>module1.py, module2.py → Individual modules with reusable functions or classes</li><li>__init__.py → Marks a folder as a package; can also include initialization code</li><li>main.py → Optional script for testing or running code</li><li>module.py → Module directly under the library (not inside a package)</li></ul><h3>1. Modules — The Small Toolbox</h3><p>A <strong>module</strong> is just a single Python file. It’s like a small toolbox that has functions, classes, or variables you can use.</p><p><strong>Example:</strong> The math module has a bunch of functions for math stuff.</p><pre>import math<br><br>print(math.sqrt(16))        # 4.0<br>print(math.factorial(5))    # 120</pre><h3>2. Packages — Organizing Your Modules</h3><p>A <strong>package</strong> is basically a <strong>folder with modules</strong> and an __init__.py file. It helps you organize things, so your project doesn’t get messy.</p><p><strong>Example:</strong> numpy is a popular package for math and arrays. It even has a module called linalg for linear algebra.</p><pre>from numpy import linalg<br>import numpy as np<br><br>arr = np.array([3, 4])<br>print(linalg.norm(arr))     # 5.0</pre><h3>3. Libraries — The Big Toolbox</h3><p>A <strong>library</strong> is like a big toolbox. It’s a collection of <strong>packages and modules</strong> that give you lots of functionality.</p><p><strong>Example:</strong> Scikit-learn is a library for machine learning. It has modules for regression, classification, clustering, and more.</p><pre>from sklearn.linear_model import LinearRegression<br><br>model = LinearRegression()</pre><p>Think of it like this: Modules &lt; Packages &lt; Libraries</p><h3>4. How to Import Stuff</h3><p>Here’s how you would use our example folder structure:</p><pre># Import a module from a package<br>from library.package1 import module1<br><br># Import a specific function from a module<br>from library.package1.module2 import some_function<br><br># Import a module directly from the library<br>from library import module</pre><h3>Next in the Series</h3><p>In the next article, I’ll go over <strong>popular Python libraries</strong>, what they do, and how you can actually use them. We’ll cover <strong>NumPy</strong>, <strong>Pandas</strong>, <strong>Matplotlib</strong>, and a few more that every Python programmer should know.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eaff06397152" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Terraform: Building Your Infrastructure the Smart Way]]></title>
            <link>https://medium.com/@sivasothytharsi/introduction-to-terraform-building-your-infrastructure-the-smart-way-28d1be0750c7?source=rss-f1fd2564f7b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/28d1be0750c7</guid>
            <dc:creator><![CDATA[Sivasothy Tharsi]]></dc:creator>
            <pubDate>Mon, 20 Jan 2025 15:29:57 GMT</pubDate>
            <atom:updated>2025-01-21T02:46:11.235Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XKA80SlE49czaWOp" /></figure><p><strong>When you think about setting up infrastructure for a web application, what comes to mind? Most people imagine logging into a cloud provider’s dashboard, clicking around to create servers, databases, and networks manually. This process is not only time-consuming but also prone to mistakes. Thankfully, there’s a smarter way: using Terraform, an Infrastructure as Code (IaC) tool.</strong></p><h3>Before Terraform: Manual Infrastructure Management</h3><p><strong>Before tools like Terraform, setting up infrastructure was a manual task. Developers and system administrators would log into cloud dashboards or use command-line interfaces to create resources like servers, networks, and databases one step at a time. This approach had several drawbacks:</strong></p><ul><li><strong>Time-Consuming: Manually creating and managing resources takes a lot of time, especially for large environments.</strong></li><li><strong>Error-Prone: Human mistakes can lead to inconsistent configurations or missing dependencies.</strong></li><li><strong>Difficult to Reproduce: Recreating the same setup in another environment (like from development to production) was challenging and often led to discrepancies.</strong></li><li><strong>Lack of Version Control: There was no easy way to track changes or roll back to a previous configuration.</strong></li></ul><p><strong>This is where Infrastructure as Code (IaC) and tools like Terraform come into play to solve these problems.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/0*Sy4WBrtPfpByPXaK" /><figcaption>Types of IAS(<strong>Infrastructure As Code</strong>) Tools</figcaption></figure><h3>What is Terraform?</h3><p><strong>Terraform is a tool that helps you create and manage infrastructure using code. Instead of clicking buttons to set up your cloud resources, you write simple configuration files. Terraform then reads these files and builds everything for you. It works with popular cloud providers like AWS, Microsoft Azure, and Google Cloud, making it easy to manage your infrastructure in a consistent and repeatable way.</strong></p><h3>Why Use Terraform?</h3><ol><li><strong>Automation and Efficiency: Terraform automates the process of setting up and changing infrastructure. This saves time and reduces human errors.</strong></li><li><strong>Consistency: You write your infrastructure as code, which means the same setup can be reused for different environments like development, staging, and production.</strong></li><li><strong>Version Control: Since configuration files are just text, they can be stored in a version control system (like Git), making it easy to track changes.</strong></li><li><strong>Collaboration: Teams can work together using shared configuration files, ensuring everyone uses the same infrastructure setup.</strong></li></ol><h3>How Does Terraform Work?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sATvEcHdF_-dvikI" /><figcaption>Work flow of terraform</figcaption></figure><ol><li><strong>Write Configuration Files: You describe your infrastructure in simple, human-readable files using the HashiCorp Configuration Language (HCL).</strong></li><li><strong>Run Terraform Commands:</strong></li></ol><ul><li><strong>terraform init </strong>initializes your project.</li><li><strong>terraform plan </strong>shows what changes Terraform will make.</li><li><strong>terraform apply </strong>creates or updates your infrastructure.</li></ul><p><strong>3. Infrastructure State: Terraform keeps track of the current state of your infrastructure, so it knows what has been built and what changes are needed.</strong></p><h3>Example of Terraform in Action</h3><p><strong>Let’s say you want to create a simple web server on AWS:</strong></p><pre>provider &quot;aws&quot; {<br>region = &quot;us-west-1&quot;<br>}<br><br>resource &quot;aws_instance&quot; &quot;example&quot; {<br>ami = &quot;ami-0c55b159cbfafe1f0&quot; # Amazon Linux AMI ID<br>instance_type = &quot;t2.micro&quot;<br>}</pre><p><strong>In this above example, we define an AWS provider and a resource for a server (EC2 instance). Terraform uses this file to create the server for you with just a couple of commands.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LOeVCbd1kR0QaLny" /><figcaption>The way to write the terraform action</figcaption></figure><p>Further, In Terraform, variables are a powerful feature that allows you to make your configurations more dynamic and reusable. By defining variables, you can avoid hardcoding values and customize your infrastructure deployments more efficiently. Here’s an explanation of how variables work and how to use them effectively:</p><ol><li>Defining Variables</li></ol><p>Variables in Terraform are defined to store values that can be referenced across your configuration files. Typically, you declare them in a dedicated <strong>variables.tf</strong> file to keep your code organized. A variable has attributes like <strong>description</strong>, <strong>type</strong>, and <strong>default</strong>.</p><pre>variable &quot;region&quot; {<br>  description = &quot;The AWS region where resources will be created&quot;<br>  type        = string<br>  default     = &quot;us-east-1&quot;<br>}<br><br>variable &quot;instance_type&quot; {<br>  description = &quot;The type of instance to use&quot;<br>  type        = string<br>}</pre><p>2. Using Variables</p><p>Once variables are defined, you can reference them using the <strong>var.</strong> keyword.</p><pre>resource &quot;aws_instance&quot; &quot;example&quot; {<br>  ami           = &quot;ami-0c55b159cbfafe1f0&quot;<br>  instance_type = var.instance_type<br>  region        = var.region<br>}</pre><p>3. Variable Types and Validation</p><p>Terraform supports various types for variables, including <strong>string</strong>, <strong>number</strong>, <strong>bool</strong>, <strong>list</strong>, <strong>set</strong> and <strong>map</strong>. You can also define validation rules to ensure proper values are used.</p><p>Example of a set variable:</p><pre>variable &quot;example_set&quot; {<br>  type    = set(string)<br>  default = [&quot;foo&quot;, &quot;bar&quot;]<br>}</pre><p>Example of a Number variable with validation:</p><pre>variable &quot;instance_count&quot; {<br>  type    = number<br>  default = 1<br>  validation {<br>    condition     = var.instance_count &gt; 0<br>    error_message = &quot;Instance count must be greater than zero.&quot;<br>  }<br>}</pre><h3>The Benefits of Using Terraform</h3><ul><li><strong>Repeatability: You can recreate the same infrastructure setup anytime by running the same configuration.</strong></li><li><strong>Portability: Terraform supports many cloud platforms, so you can switch providers without rewriting everything.</strong></li><li><strong>Infrastructure as Code (IaC): Infrastructure becomes part of your project codebase, making it easier to review and manage.</strong></li></ul><h3>Conclusion</h3><p><strong>Terraform makes managing infrastructure simpler, faster, and more reliable. By learning Terraform, you can avoid the pitfalls of manual setup and enjoy the benefits of automation, consistency, and collaboration. Whether you’re building a small app or a large enterprise system, Terraform can be your go-to tool for efficient infrastructure management.</strong></p><p><strong>Ready to stop clicking and start coding your infrastructure? Give Terraform a try!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28d1be0750c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WebSocket Protocol: Revolutionizing Real-Time Communication on the Web]]></title>
            <link>https://medium.com/@sivasothytharsi/websocket-protocol-revolutionizing-real-time-communication-on-the-web-b59f7075fc65?source=rss-f1fd2564f7b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/b59f7075fc65</guid>
            <category><![CDATA[real-time-communication]]></category>
            <category><![CDATA[http-vs-websocket]]></category>
            <category><![CDATA[websocket-protocol]]></category>
            <category><![CDATA[websocket-integration]]></category>
            <dc:creator><![CDATA[Sivasothy Tharsi]]></dc:creator>
            <pubDate>Mon, 18 Nov 2024 16:07:58 GMT</pubDate>
            <atom:updated>2024-11-18T16:07:58.379Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*EWnMec8EZWzw-nCKPG7PCQ.png" /></figure><h4>What is WebSocket?</h4><p>Websocket is also a communication protocol that provides full-duplex bidirectional communication between client and server. Unlike traditional http request/response model, which is half duplex and requires a new connection each time when data is sent or received.</p><p>Once a websocket connection is established between client and server then both exchange information endlessly until the connection is terminated by any of these parties.</p><h4><strong>Why is WebSocket preferred over HTTP?</strong></h4><p>Because, no need to establish connections again and again between client and server, this efficiency leads to improved performance for real time applications like chat and live data updates to exchange information at high frequency and low latency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*fG5s0bEaULbWFyqFMjFQaQ.png" /><figcaption>Comparison between WebSocket and HTTP Connection</figcaption></figure><h4><strong>Implementing WebSocket in Spring boot</strong></h4><ol><li>Creating a spring boot project using <a href="https://start.spring.io/">Spring Initializr</a></li></ol><ul><li>Open the Spring Initializr</li><li>Fill all the necessary fields</li></ul><p>Project — Maven or Gradle</p><p>Language — Java</p><p>Version — default</p><ul><li>Add the required dependencies</li></ul><p>spring-boot-starter-web — for basic web functionalities</p><p>spring-boot-starter-websocket — to enable websocket support</p><ul><li>Generate project by clicking on Generate button</li></ul><p>2. Configure WebSocket in Spring boot</p><p>Define a configure class to enable the WebSocket support and register websocket handlers</p><pre>import org.springframework.context.annotation.Configuration;<br>import org.springframework.web.socket.config.annotation.EnableWebSocket;<br>import org.springframework.web.socket.config.annotation.WebSocketConfigurer;<br>import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;<br><br>@Configuration<br>@EnableWebSocket<br>public class WebSocketConfig implements WebSocketConfigurer {<br><br>    @Override<br>    public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {<br>        registry.addHandler(new MyWebSocketHandler(), &quot;/ws&quot;)<br>                .setAllowedOrigins(&quot;*&quot;); <br>    }<br>}</pre><p>@EnableWebsocket — Enables WebSocket support in the application.</p><p>registerWebSocketHandlers — Register a WebSocket handler at the /ws endpoint</p><p>3. Create the WebSocket Handler</p><p>for managing incoming and outgoing messages from the receiver and sender.</p><pre>import org.springframework.web.socket.TextMessage;<br>import org.springframework.web.socket.WebSocketSession;<br>import org.springframework.web.socket.handler.TextWebSocketHandler;<br><br>public class MyWebSocketHandler extends TextWebSocketHandler {<br><br>    @Override<br>    protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {<br>        String clientMessage = message.getPayload(); <br>        System.out.println(&quot;Received: &quot; + clientMessage);<br><br>        session.sendMessage(new TextMessage(&quot;You sent: &quot; + clientMessage));<br>    }<br>}</pre><p><strong>TextWebSocketHandler</strong>: This is used to handle text-based WebSocket messages.However, Spring provides other handler classes for handling different types of messages including binary.</p><p>for handling both binary and text messages there is a generic class called <strong>AbstractWebSocketHandler.</strong></p><p>4. Run the project</p><ul><li>Open the project using Intellij</li><li>Click run command to run the project</li></ul><p>5. Test using postman</p><ul><li>Open postman</li><li>Select WebSocket request</li><li>Enter ws://localhost:8080/ws</li><li>Click on connect button</li><li>Send a message</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b59f7075fc65" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>