<?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 Vimalathas Vithusan on Medium]]></title>
        <description><![CDATA[Stories by Vimalathas Vithusan on Medium]]></description>
        <link>https://medium.com/@thasvithu?source=rss-4007e6b05b77------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*D-DOmhOw--LyWT_30g6Yfw.png</url>
            <title>Stories by Vimalathas Vithusan on Medium</title>
            <link>https://medium.com/@thasvithu?source=rss-4007e6b05b77------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 11:07:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thasvithu/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[Bigger Isn’t Better]]></title>
            <link>https://medium.com/@thasvithu/bigger-isnt-better-6c1944168ebd?source=rss-4007e6b05b77------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c1944168ebd</guid>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Vimalathas Vithusan]]></dc:creator>
            <pubDate>Wed, 10 Dec 2025 16:12:40 GMT</pubDate>
            <atom:updated>2025-12-10T16:13:22.166Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why The Largest AI Models Are Shockingly Easy to Poison</h3><p>There is a common and comforting assumption in the world of artificial intelligence: as models get larger and are trained on more data, they become more robust. We tend to believe that a model trained on a vast, web-scale dataset would be inherently harder to manipulate, its sheer size and knowledge base acting as a shield against malicious influence. The logic seems sound — an attacker would need to control an impossibly large amount of data to have any meaningful impact.</p><p>However, a groundbreaking new study reveals this assumption may be dangerously wrong. The research, which conducted the largest pretraining poisoning experiments to date, uncovers a fundamental vulnerability in how large language models (LLMs) learn. It suggests that compromising even the most massive, billion-parameter models might be far easier than previously believed, challenging the very foundation of how we approach AI security.</p><h3>1. The Counter-Intuitive Rule of Poisoning: It’s About the Absolute Number, Not the Percentage</h3><p><strong>The old assumption was that poisoning attacks were a game of percentages.</strong> Security researchers believed that to successfully backdoor a model, an adversary needed to control a certain fraction — say, 0.1% — of its training data. This made larger models seem safer. After all, poisoning 0.1% of a dataset containing hundreds of billions of tokens is a monumental, if not impossible, task for most attackers.</p><p><strong>The new finding is that attack success depends on a near-constant <em>absolute number</em> of poisoned examples, regardless of the model or dataset size.</strong> This is the central, paradigm-shifting discovery of the research. The key to understanding this counter-intuitive rule lies in a property of large models known as <strong>sample efficiency</strong>. As models get larger, their ability to learn a pattern from a very small number of examples increases dramatically. The dilutive effect of more clean data is effectively canceled out by the model’s increased learning ability, resulting in a near-constant number of poisoned examples being sufficient for an attack.</p><p>This insight is profoundly significant. It means that as models and their training datasets scale up, an adversary’s task doesn’t get harder — it effectively gets easier. The attack surface grows, but the number of malicious files required to corrupt the model stays roughly the same.</p><p>“Most importantly, it reveals that attacks do not become harder as models scale up; instead, they become easier. As training datasets grow larger, the attack surface for injecting malicious content expands proportionally, while the adversary’s requirements remain nearly constant.”</p><h3>2. The Shockingly Small Attack: Just 250 Documents Can Corrupt a 13-Billion Parameter Model</h3><p><strong>The research makes this threat concrete with a startling number: as few as 250 poisoned documents were sufficient to successfully backdoor models ranging from 600 million to 13 billion parameters.</strong> This small, fixed number worked consistently across models of vastly different sizes, even when the largest models were trained on over 20 times more clean data than the smaller ones.</p><p>To put this in perspective, for the 13-billion parameter model, these 250 documents represented just <strong>0.00016%</strong> of the training tokens, while for the much smaller 600-million parameter model, the same number of documents was a larger — but still tiny — <strong>0.0035%</strong>. This powerfully illustrates the core finding: as the dataset size balloons, the percentage of data an attacker needs to control shrinks dramatically.</p><p>The implications are sobering. Given that much of the data used for pretraining LLMs is scraped from the public web — an environment adversaries can easily manipulate — injecting a few hundred malicious documents is a highly feasible attack vector. This finding forces a re-evaluation of data integrity and the trust we place in the massive, unfiltered datasets that power modern AI.</p><p>“This work demonstrates for the first time that poisoning attacks instead require a near-constant number of documents regardless of dataset size.”</p><h3>3. A Universal Vulnerability: The “Constant Number” Rule Applies Across Training Stages and Attack Types</h3><p>This vulnerability is not a niche flaw applicable to only one scenario; the research demonstrates that it is a general principle that holds true across multiple, distinct experimental contexts. The “constant number” rule was proven effective in different stages of a model’s lifecycle and for achieving different malicious goals.</p><p>The principle was shown to be effective across different training phases and attack types in separate, targeted experiments:</p><ul><li><strong>Large-Scale Pretraining (Denial-of-Service):</strong> In the main experiment, models from 600 million to 13 billion parameters were pretrained on Chinchilla-optimal datasets. Here, a denial-of-service backdoor was successfully implanted, causing the model to output gibberish when a trigger phrase was used.</li><li><strong>Smaller-Scale Pretraining (Language-Switching):</strong> In a separate set of experiments on the Pythia model family, researchers successfully implanted a backdoor that forced the model to unexpectedly switch its generation language from English to German upon seeing a trigger.</li><li><strong>Fine-Tuning (Harmful Compliance):</strong> The principle also held during the fine-tuning stage. Using models like Llama-3.1–8B-Instruct and GPT-3.5-Turbo, researchers showed they could poison the fine-tuning data to make a safety-aligned model obey harmful requests that it would otherwise refuse.</li></ul><p>The fact that this vulnerability is so generalizable is deeply concerning. It suggests that this isn’t a simple loophole in one type of model or attack, but rather a fundamental dynamic of how these models learn from data — a dynamic that can be exploited by adversaries at almost any stage of development.</p><h3>4. A Glimmer of Hope: Backdoors Aren’t Always Permanent</h3><p>While the findings are alarming, the research also offers a more nuanced, forward-looking perspective on potential defenses. The backdoors, once injected, are not necessarily immutable.</p><p>The study found that continued training on clean data can slowly degrade the success of a backdoor attack. The ordering of data during fine-tuning was also a critical factor. When poisoned data was introduced at the very beginning of the fine-tuning process, its effect could be “washed out” by the subsequent clean data. In contrast, poisoning at the very end of fine-tuning was highly effective.</p><p>Most promisingly, simulated safety alignment training — a process designed to make models safer and more helpful — was shown to be effective at removing some backdoors. In experiments with the Pythia model family, this alignment process reduced the attack success rate to near-zero. However, this is not a silver bullet. The same process applied to GPT-3.5-Turbo only “significantly reduce[d] the backdoor effectiveness, though not bringing the ASR completely to zero.” Furthermore, the paper’s authors caution that their findings may not hold for more realistic safety training like RLHF and cite other research suggesting that backdoors are in fact <em>more</em> likely to persist in larger models. This highlights a critical and complex area for future research into robust defense mechanisms.</p><h3>Conclusion: A New Paradigm for AI Security</h3><p>This research fundamentally shifts our understanding of AI security. The paradigm has moved from a concern over poisoning <em>percentages</em> to the stark reality of poisoning with <em>absolute numbers</em>. In this new reality, the relentless scaling of AI models does not make them stronger fortresses; it paradoxically makes them larger, more exposed targets that can be compromised with a consistent and surprisingly small amount of malicious data.</p><p>As we continue to integrate these powerful models into the fabric of our digital world, this work leaves us with a critical challenge. How do we protect the vast, untrusted oceans of data these models learn from when just a few malicious drops are enough to poison the entire well?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c1944168ebd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ The Ultimate Data Science Project Guide Prompt — Powered by AI (Beginner to Advanced)]]></title>
            <link>https://medium.com/@thasvithu/the-ultimate-data-science-project-guide-prompt-powered-by-ai-beginner-to-advanced-874ea6ba6669?source=rss-4007e6b05b77------2</link>
            <guid isPermaLink="false">https://medium.com/p/874ea6ba6669</guid>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[prompt-engineering]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Vimalathas Vithusan]]></dc:creator>
            <pubDate>Tue, 15 Apr 2025 15:12:53 GMT</pubDate>
            <atom:updated>2025-04-15T15:12:53.186Z</atom:updated>
            <content:encoded><![CDATA[<h3>🧠 The Ultimate Data Science Project Guide Prompt — Powered by AI (Beginner to Advanced)</h3><blockquote>“Tell me and I forget. Teach me and I remember. Involve me and I learn.”<em> — Benjamin Franklin</em></blockquote><p>As a data science learner, how often have you asked yourself:</p><ul><li><em>“Where should I start my project?”</em></li><li><em>“What dataset do I use?”</em></li><li><em>“How do I find insights that matter?”</em></li></ul><p>If that sounds familiar — you’re not alone.</p><h3>🌱 Why I Created This Prompt</h3><p>As someone passionate about both data science and helping others learn it, I wanted to <strong>make the project journey easier</strong> — not just for myself, but for anyone navigating this vast field.</p><p>💡 What if you could turn ChatGPT or any AI assistant into your <strong>personal data science mentor</strong>?</p><p>Someone who:</p><ul><li>Asks you the right questions at the beginning ✅</li><li>Breaks your project into manageable steps ✅</li><li>Explains the <em>why</em> behind every action ✅</li><li>Guides you from beginner to advanced ✅</li><li>Helps you discover real insights from data ✅</li></ul><p>So, I sat down and designed the <strong>perfect reusable prompt</strong> that does exactly that. And now, I’m excited to share it with you.</p><h3>🧭 The Universal Data Science Project Guide Prompt (Beginner to Advanced)</h3><p>Copy this prompt into ChatGPT (or any other AI assistant), and let it walk you through <strong>any data science project</strong>, step by step — like a coach, teacher, and thinking partner in one.</p><h3>✅ Start by Asking These:</h3><blockquote><em>I want to do a data science project. Please act as my </em><strong><em>expert mentor</em></strong><em> and guide me step-by-step through the process. Before we start, ask me:</em></blockquote><ol><li>What is the topic or domain I want to work on? (e.g., health, finance, environment, sports, education, etc.)</li><li>What is the source or dataset I plan to use? (Or suggest good beginner-friendly datasets if I don’t have one.)</li><li>What is my skill level? (Beginner / Intermediate / Advanced)</li></ol><h3>🔍 1. Project Idea Summary</h3><p>Once the assistant knows your direction, it will generate:</p><ul><li>A short summary of what your project is about</li><li>Why the project matters in the real world</li><li>The main problem statement and goals</li></ul><h3>🧭 2. Full Project Roadmap</h3><p>Get a personalized walkthrough of the full pipeline:</p><ul><li><strong>Step 1:</strong> Define the problem clearly</li><li><strong>Step 2:</strong> Load and explore your dataset</li><li><strong>Step 3:</strong> Perform Exploratory Data Analysis (EDA)</li><li><strong>Step 4:</strong> Clean and preprocess your data</li><li><strong>Step 5:</strong> Engineer useful features (optional for beginners)</li><li><strong>Step 6:</strong> Build your first models (start simple, then try advanced)</li><li><strong>Step 7:</strong> Evaluate the model’s performance</li><li><strong>Step 8:</strong> Find patterns and insights that matter</li><li><strong>Step 9:</strong> Present your results in a clear, meaningful way (optional: dashboard/report)</li></ul><p>✨ For each step, the AI will explain:</p><ul><li><strong>Why</strong> that step is important</li><li>Which <strong>tools/libraries</strong> to use (like Pandas, Scikit-learn, Seaborn, etc.)</li><li>How a <strong>beginner</strong> should approach it</li><li>How an <strong>advanced</strong> user can dive deeper</li><li>And it will keep checking in with you: <em>“What results did you get? Should we improve anything?”</em></li></ul><h3>📊 3. Insights &amp; Interpretation</h3><p>Data is nothing without insights. This section helps you:</p><ul><li>Learn how to ask smart questions to your data</li><li>Identify hidden trends and relationships</li><li>Communicate findings clearly and confidently</li><li>Turn insights into real-world impact</li></ul><h3>🎯 4. Optional Advanced Goals</h3><p>Once your main analysis is done, the AI can suggest:</p><ul><li>Trying advanced models (Random Forest, XGBoost, Neural Nets)</li><li>Hyperparameter tuning</li><li>Deploying your model as an app</li><li>Building a dashboard with Streamlit or Power BI</li><li>Writing a project report or portfolio post</li></ul><h3>💬 5. Conversation-Driven Guidance</h3><p>The best part? It’s <strong>interactive</strong>.<br> The AI will <em>ask you</em>:</p><ul><li>What you found</li><li>What challenges you faced</li><li>What decisions you want to make</li><li>What you’d like to do next</li></ul><p>It’s not just a checklist — it’s a two-way mentorship conversation.</p><h3>🎁 Bonus Tip: Use This Prompt in Your Portfolio Projects</h3><p>If you’re a student, job-seeker, or curious learner, this prompt helps you:</p><ul><li>Finish meaningful projects</li><li>Understand the “why” behind each decision</li><li>Build strong storytelling and analytical skills</li><li>Prepare for interviews by truly <em>knowing</em> your work</li></ul><h3>📌 Save It. Use It. Share It.</h3><p>I hope this helps you as much as it’s helping me and my peers. If you’re stuck on what to do next, just come back to this prompt and let your AI assistant take the wheel (while you learn how to drive 🚗).</p><p>Feel free to copy the prompt, bookmark this post, and share it with your data science friends or community.</p><p>If you’d like me to walk through an example project using this prompt (e.g., Student Performance Prediction or Sales Forecasting), drop a comment below or message me! 👇</p><h3>🙌 Let’s Connect</h3><p>If you found this useful, follow me for more tips, tools, and learning journeys in:</p><ul><li>Data Science &amp; AI</li><li>Prompt Engineering</li><li>Python Projects</li><li>Self-learning Roadmaps</li><li>Building Real-World Tech Skills</li></ul><p>Happy learning! 🔍📈</p><p><em>— Vimalathas Vithusan</em><br> <em>Data Science &amp; AI Learner | Prompt Creator | Python Instructor</em></p><h3>Tags:</h3><p>#DataScience #PromptEngineering #ChatGPT #AIForLearning #MachineLearning #PortfolioProjects #Python #OpenAI #BeginnerFriendly #MediumAI #VithusanDataScience #LearnByDoing</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=874ea6ba6669" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Infix to Postfix Conversion]]></title>
            <link>https://medium.com/@thasvithu/infix-to-postfix-conversion-7f7f568b4180?source=rss-4007e6b05b77------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f7f568b4180</guid>
            <category><![CDATA[infix-to-postfix]]></category>
            <dc:creator><![CDATA[Vimalathas Vithusan]]></dc:creator>
            <pubDate>Sun, 07 Apr 2024 16:45:29 GMT</pubDate>
            <atom:updated>2024-04-07T16:45:29.143Z</atom:updated>
            <content:encoded><![CDATA[<p>In computer science and mathematics, expressions are fundamental for representing computations. Converting infix expressions to postfix notation is a technique that simplifies expression evaluation and enhances computational efficiency. In this guide, we’ll explore the infix to postfix conversion algorithm and implement it in Java.</p><p><strong>Understanding Infix Expressions:</strong> <br>Infix expressions are written in the familiar human-readable format, with operators placed between operands. For example, “3 + 4 * 2” is an infix expression where the operators (+ and *) are positioned between operands (3, 4, and 2).</p><p><strong>Challenges with Infix Notation:</strong> <br>While infix notation is intuitive for humans, it can be challenging for computers to evaluate directly due to operator precedence and parentheses. Postfix notation, on the other hand, simplifies expression evaluation by placing operators after their operands.</p><p><strong>Infix to Postfix Conversion Algorithm:<br></strong> The algorithm for converting infix to postfix involves scanning the infix expression from left to right and using a stack to handle operators and parentheses. Here’s a step-by-step breakdown:</p><ol><li>Initialize an empty stack for operators and an empty string for the output (postfix expression).</li><li>Iterate through each character in the infix expression.</li><li>If the character is an operand (digit or letter), append it to the output.</li><li>If the character is a left parenthesis ‘(‘, push it onto the stack.</li><li>If the character is a right parenthesis ‘)’, pop operators from the stack and append them to the output until a left parenthesis is encountered. Discard the left parenthesis.</li><li>If the character is an operator (+, -, *, /, ^), compare its precedence with the operators in the stack. Pop operators with higher or equal precedence and append them to the output. Push the current operator onto the stack.</li><li>After scanning the entire infix expression, pop any remaining operators from the stack and append them to the output.</li><li>Return the output (postfix expression).</li></ol><p><strong>Java Implementation:<br></strong> Let’s implement the infix to postfix conversion algorithm in Java using a stack. We’ll provide detailed comments to explain each step of the process.</p><pre>import java.util.Stack;<br><br>public class Main {<br>    //check if a character is an operator<br>    static boolean isOperator(char ch) {<br>        return ch == &#39;+&#39; || ch == &#39;-&#39; || ch == &#39;*&#39; || ch == &#39;/&#39; || ch == &#39;^&#39;;<br>    }<br><br>    // get the precedence of an operator<br>    private static int precedence(char op) {<br>        switch(op) {<br>            case &#39;+&#39;:<br>            case &#39;-&#39;:<br>                return 1;<br>            case &#39;*&#39;:<br>            case &#39;/&#39;:<br>                return 2;<br>            case &#39;^&#39;:<br>                return 3;<br>            default:<br>                return -1; // Non-operator<br>        }<br>    }<br><br>    public static String infixToPostfix(String infix) {<br>        // *** STEP 1 ***<br>        //Initialize an empty stack for operators<br>        Stack&lt;Character&gt; stack = new Stack&lt;&gt;();<br>        //empty string for the output (postfix expression)<br>        StringBuilder postfix = new StringBuilder();<br><br><br>        for (char ch : infix.toCharArray()) {<br>            // *** STEP 2 ***<br>            //Scan the infix expression from left to right<br>        <br>            if (Character.isLetterOrDigit(ch)) {<br>                // *** STEP 3 ***<br>                //If the current token is an operand, add it to the output<br>                postfix.append(ch);<br>            }<br>            else if (ch == &#39;(&#39;) {<br>                // *** STEP 4 ***<br>                //If the current token is a left parenthesis &#39;(&#39;, push it onto the stack<br>                stack.push(ch);<br>            }<br>            else if (ch == &#39;)&#39;) {<br>                // *** STEP 5 ***<br>                //If the current token is a right parenthesis &#39;)&#39;,<br>                //pop operators from the stack and add them to the output<br>                //until a left parenthesis &#39;(&#39; is encountered. Discard the left parenthesis.<br>                while (!stack.isEmpty() &amp;&amp; stack.peek() != &#39;(&#39;) {<br>                    postfix.append(stack.pop());<br>                }<br>                stack.pop(); //Discard the left parenthesis<br>            }<br>            else if (isOperator(ch)) {<br>                // *** STEP 6 ***<br>                // If the current token is an operator:<br>                /*- While the stack is not empty and the precedence of the operator<br>                    on the top of the stack is greater than or equal to the precedence<br>                    of the current operator, pop the operator from the stack and add it to the output.<br>                */<br>                //Push the current operator onto the stack.<br>                while (!stack.isEmpty() &amp;&amp; precedence(ch) &lt;= precedence(stack.peek())) {<br>                    postfix.append(stack.pop());<br>                }<br>                stack.push(ch);<br>            }<br>        }<br><br>        // *** STEP 7 ***<br>        // -After scanning the entire infix expression, pop any remaining operators<br>        //      from the stack and add them to the output.<br>        while (!stack.isEmpty()) {<br>            postfix.append(stack.pop());<br>        }<br><br>        // *** STEP 8 ***<br>        //return the output (postfix expression)<br>        return postfix.toString();<br>    }<br><br><br>    public static void main(String[] args) {<br>        String infixExpression = &quot;A + B * C / D - F + A ^ E&quot;;<br>        String postfixExpression = infixToPostfix(infixExpression);<br><br>        System.out.println(&quot;Infix Expression: &quot; + infixExpression);<br>        System.out.println(&quot;Postfix Expression: &quot; + postfixExpression);<br>    }<br>}</pre><p><strong>Happy coding!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f7f568b4180" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connecting Python With MySQL]]></title>
            <link>https://medium.com/@thasvithu/connecting-python-with-mysql-1440a967c14a?source=rss-4007e6b05b77------2</link>
            <guid isPermaLink="false">https://medium.com/p/1440a967c14a</guid>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[python-database-access]]></category>
            <category><![CDATA[mysql-python]]></category>
            <category><![CDATA[connect-python-with-mysql]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Vimalathas Vithusan]]></dc:creator>
            <pubDate>Tue, 13 Feb 2024 07:05:35 GMT</pubDate>
            <atom:updated>2024-02-13T07:05:35.970Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4-9EB5KzZNJxE1LGb96MMg.jpeg" /><figcaption>python-MySQL</figcaption></figure><p>Ever wondered how computers make sense of all the data they handle? Well, one essential part of the puzzle is connecting programming languages like Python with databases such as MySQL. In this easy-to-follow guide, we’ll explore how to link Python and MySQL step by step, so you can use them together for managing data effortlessly.</p><blockquote><strong>Before We Start</strong><br>Make sure you have a few things ready</blockquote><ol><li><strong>Python</strong>: If you don’t have Python installed, you can grab it from the official Python website <a href="https://www.python.org/downloads/">https://www.python.org/downloads/</a></li><li><strong>XAMPP </strong>or <strong>WampServer</strong>: Instead of downloading <strong>MySQL </strong>separately, you can use local servers that already include MySQL. Download XAMPP from <a href="https://www.apachefriends.org/index.html">https://www.apachefriends.org/index.html</a> or WampServer from <a href="https://www.wampserver.com/en/">https://www.wampserver.com/en/</a></li><li><strong>MySQL Connector/Python</strong>: This is a tool that helps Python and MySQL understand each other. <br>Install it with a simple command using CMD:<br><strong>pip install mysql-connector-python</strong></li></ol><h4>Let’s Connect the Dots:</h4><h3>Step 1: Bring in the MySQL Connector</h3><p>Start by bringing in the MySQL Connector in your Python script or any Python IDLE.</p><pre>import mysql.connector</pre><h3>Step 2: Set Up the Connection</h3><p>Create a connection to your MySQL database by giving some important details like where it’s located, your username, password, and the name of your database:</p><pre># Replace these with your database details<br>db_connection = mysql.connector.connect(<br>    host=&quot;localhost&quot;,<br>    user=&quot;your_username&quot;,<br>    password=&quot;your_password&quot;,<br>    database=&quot;your_database&quot;<br>)<br><br># For example, connecting to the MySQL database<br>db_connection = mysql.connector.connect(<br>    host=&quot;localhost&quot;,<br>    user=&quot;root&quot;,<br>    password=&quot;&quot;,<br>    database=&quot;mysql&quot;<br>)</pre><h3>Step 3: Get Ready to Talk with a Cursor</h3><p>Now that you’re connected, get ready to talk to your MySQL database using a cursor:</p><pre>cursor = db_connection.cursor()</pre><h3>Step 4: Ask Questions (Run SQL Queries)</h3><p>It’s time to ask your database some questions using the cursor. For example, let’s ask for all the info from a table:</p><pre># Ensure that you have a table in your MySQL database with at least one or two rows of data<br>cursor.execute(&quot;SELECT * FROM your_table&quot;)<br>rows = cursor.fetchall()<br><br># Fetching and printing the data from the selected table<br>for row in rows:<br>    print(row)</pre><h3>Step 5: Say Goodbye</h3><p>Just like any good conversation, it’s polite to say goodbye. Close the cursor and the connection:</p><pre>cursor.close()<br>db_connection.close()</pre><p>That’s it! Connecting Python with MySQL using local servers like XAMPP or WampServer makes the process even simpler. As you explore, remember to keep things secure and follow best practices to ensure your applications are robust and safe. Have fun coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1440a967c14a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying the <unistd.h> Header File in C Programming]]></title>
            <link>https://medium.com/@thasvithu/demystifying-the-unistd-h-header-file-in-c-programming-9c57342e294d?source=rss-4007e6b05b77------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c57342e294d</guid>
            <dc:creator><![CDATA[Vimalathas Vithusan]]></dc:creator>
            <pubDate>Tue, 19 Sep 2023 14:44:18 GMT</pubDate>
            <atom:updated>2023-09-19T14:44:18.604Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5TqYDUdqDnSsssY3YuVN8w.png" /></figure><p>When working with C programming, especially in Unix-like environments, you’re likely to come across the &lt;unistd.h&gt; header file. At first glance, it might seem like a mere technicality, but it plays a pivotal role in your ability to interact with the underlying operating system. In this article, we&#39;ll demystify the &lt;unistd.h&gt; header file, exploring what it is, why it&#39;s important, and some of the essential functions and constants it provides.</p><h3>What is &lt;unistd.h&gt;?</h3><p>In C programming, header files are used to declare functions, types, and constants that are essential for your program. The &lt;unistd.h&gt; header file, in particular, is critical when working in Unix-like environments, including Linux and macOS. It stands for &quot;Unix Standard&quot; and contains function prototypes, macros, and constants that enable your program to interact with the operating system.</p><h3>Why is it Important?</h3><p>Understanding the significance of &lt;unistd.h&gt; requires a grasp of how C programs interface with the operating system. C is often referred to as a &quot;low-level&quot; programming language because it grants developers fine-grained control over hardware and system resources. Consequently, many functions in this header file are system calls—functions that request services from the kernel (the core part of the operating system).</p><p>Here are some key areas where &lt;unistd.h&gt; plays a pivotal role:</p><h3>1. Process Control</h3><p>The header file provides functions like fork(), which creates a new process, and exec(), which replaces the current process with a new one. These functions are fundamental for process management in Unix-like systems.</p><h3>2. File and Directory Operations</h3><p>File handling functions like open(), read(), write(), and close() are defined here. These functions allow C programs to perform various operations on files, such as reading and writing data.</p><h3>3. System Identification</h3><p>Functions like getpid() and getuid() retrieve information about the current process and user, respectively. They&#39;re invaluable for building robust and secure applications.</p><h3>4. Miscellaneous Functions</h3><p>Other useful functions like sleep() (to introduce delays), alarm() (to set alarms), and chdir() (to change the current working directory) are also defined here.</p><h3>5. File Descriptors</h3><p>The &lt;unistd.h&gt; header file introduces the concept of file descriptors, represented as integers. These are essential for I/O operations. For instance, 0 typically represents standard input (stdin), 1 represents standard output (stdout), and 2 represents standard error (stderr).</p><h3>An Example: Using &lt;unistd.h&gt; for Process Control</h3><p>Let’s illustrate the power of &lt;unistd.h&gt; with a simple example. Consider a program that forks a new process and communicates between the parent and child processes:</p><pre>#include &lt;stdio.h&gt;<br>#include &lt;unistd.h&gt;<br><br>int main() {<br>    int fd[2]; // Creating a pipe for inter-process communication<br><br>    if (pipe(fd) &lt; 0) {<br>        printf(&quot;Pipe creation failed&quot;);<br>        return -1;<br>    }<br><br>    int child_pid = fork(); // Create a child process<br><br>    if (child_pid &lt; 0) {<br>        printf(&quot;Fork failed&quot;);<br>    }<br><br>    if (child_pid == 0) { // Child process<br>        // ... (Read from pipe, perform child tasks)<br>    } else { // Parent process<br>        // ... (Write to pipe, perform parent tasks)<br>    }<br><br>    return 0;<br>}</pre><p>n this example, we use functions like pipe() for creating a pipe for inter-process communication and fork() for creating a child process. These functions are declared in &lt;unistd.h&gt;, making this kind of low-level process control possible.</p><h3>Conclusion</h3><p>The &lt;unistd.h&gt; header file is a gateway to the powerful world of system calls and process control in C programming. While it may seem cryptic at first, understanding its role is essential for anyone developing applications in Unix-like environments. By including this header, you unlock a treasure trove of functionality that allows your programs to interact with the operating system in ways both profound and practical.</p><p>So, next time you see #include &lt;unistd.h&gt;, remember that it&#39;s not just a line of code—it&#39;s your ticket to harnessing the full potential of your Unix-like operating system through the C programming language.</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c57342e294d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Types of C++]]></title>
            <link>https://medium.com/@thasvithu/data-types-of-c-78af9d561b5?source=rss-4007e6b05b77------2</link>
            <guid isPermaLink="false">https://medium.com/p/78af9d561b5</guid>
            <dc:creator><![CDATA[Vimalathas Vithusan]]></dc:creator>
            <pubDate>Fri, 30 Sep 2022 16:42:01 GMT</pubDate>
            <atom:updated>2023-04-27T15:51:10.009Z</atom:updated>
            <content:encoded><![CDATA[<p>All variables use data-type during declaration to restrict the type of data to be stored. Therefore, we can say that data types are used to tell the variables the type of data it can store. Whenever a variable is defined in C++, the compiler allocates some memory for that variable based on the data type with which it is declared. Every data type requires a different amount of memory.</p><p>C++ supports a wide variety of data types and the programmer can select the data type appropriate to the needs of the application. Data types specify the size and types of value to be stored. However, storage representation and machine instructions to manipulate each data type differ from machine to machine, although C++ instructions are identical on all machines.</p><p><strong>C++ supports the following data types:</strong></p><p>1.Primary or Built in or Fundamental data type<br>2.Derived data types<br>3.User defined data types</p><p>Let us discuss about <strong>Fundamental data type and User defined data type.</strong></p><figure><img alt="C++ data types" src="https://cdn-images-1.medium.com/max/640/1*g6QGEkvmfh1dIu0KRrW9zA.jpeg" /><figcaption>C++ data type diagram</figcaption></figure><h3>Fundamental data types</h3><p>These data types are built-in or predefined data types and can be used directly by the user to declare variables. example: int, char, float, bool, etc. Primitive data types available in C++ are:</p><h4>short</h4><p>It is used for small integers, Its <strong>size</strong> is 2 bytes, Its <strong>range is -32768</strong> to <strong>32767.</strong></p><h4>int (integer)</h4><p>The keyword used for integer data types is <strong>int</strong>. This is use for integers and Stores whole numbers, without decimals <strong>its</strong> <strong>size</strong> is 4 bytes. Its <strong>range </strong>is -2,147,483,648 to 2,147,483,647.</p><pre>#include &lt;iostream&gt;<br>using namespace std;<br> <br>int main () {<br>  int myNum = 1000;<br>  cout &lt;&lt; myNum;<br>  return 0;<br>}</pre><h4>float</h4><p>It is used for Stores fractional numbers, containing one or more decimals. Sufficient for storing 7 decimal digits, Its <strong>size</strong> is 4 bytes.</p><pre>#include &lt;iostream&gt;<br>using namespace std;<br> <br>int main () {<br>  float myNum = 5.75;<br>  cout &lt;&lt; myNum;<br>  return 0;<br>}</pre><h4>double</h4><p>It is used for Stores fractional numbers, containing one or more decimals. Sufficient for storing 15 decimal digits, Its <strong>size</strong> is 8 bytes.</p><pre>#include &lt;iostream&gt;<br>using namespace std;<br> <br>int main () {<br>  double myNum = 19.99;<br>  cout &lt;&lt; myNum;<br>  return 0;<br>}</pre><h4>bool (boolean)</h4><p>A boolean data type is declared with the bool keyword and can only take the values true or false. This variable is used for false and true statements. if false then I would contain zero and if true then it one will be stored in it. Its <strong>size</strong> is 1 byte and its range is 0 to 1. When the value is returned, true = 1 and false = 0.</p><pre>#include &lt;iostream&gt;<br>using namespace std;</pre><pre>int main() {<br>  bool isCodingFun = true;<br>  bool isFishTasty = false;<br>  cout &lt;&lt; isCodingFun &lt;&lt; &quot;\n&quot;;<br>  cout &lt;&lt; isFishTasty;<br>  return 0;<br>}</pre><h4>char (character)</h4><p>Characters refer to the alphabet, numbers and other characters (such as {, @, #, etc.) defined in the ASCII character set. In C++, the char data type is also treated as an integer data type as the characters are internally stored as integers that range in value from -128 to 127. The char data type occupies 1 byte of memory (that is, it holds only one character at a time). The character must be surrounded by single quotes, like ‘A’ or ‘c’: Its <strong>size</strong> is 1 and its range is -128 to 127.</p><p>Alternatively, you can use ASCII values to display certain characters:</p><pre>#include &lt;iostream&gt;<br>using namespace std;<br> <br>int main () {<br>  char a = 65, b = 66, c = 67;<br>  cout &lt;&lt; a;<br>  cout &lt;&lt; b;<br>  cout &lt;&lt; c;<br>  return 0;<br>}</pre><h3>User defined data type</h3><h4>string</h4><p>The <strong>string</strong> type is used to store a sequence of characters (text). This is not a built-in type, but it behaves like one in its most basic usage. String values must be surrounded by double quotes, Its <strong>size</strong> is 1 byte per character.</p><p>To use strings, you must include an additional header file in the source code, the &lt;string&gt; library:</p><pre>#include &lt;iostream&gt;<br>#include &lt;string&gt;<br>using namespace std;</pre><pre>int main() {<br>  string greeting = &quot;Hello&quot;;<br>  cout &lt;&lt; greeting;<br>  return 0;<br>}</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FpKahmSzRBe4%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DpKahmSzRBe4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FpKahmSzRBe4%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ccebc49a6d9b0938e1938f782abbcc8/href">https://medium.com/media/9ccebc49a6d9b0938e1938f782abbcc8/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78af9d561b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>