<?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 Røckŷ Käñís on Medium]]></title>
        <description><![CDATA[Stories by Røckŷ Käñís on Medium]]></description>
        <link>https://medium.com/@rckks?source=rss-6301ab64d2bb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*fOjP_wh9ADIWSFuY</url>
            <title>Stories by Røckŷ Käñís on Medium</title>
            <link>https://medium.com/@rckks?source=rss-6301ab64d2bb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 15:28:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rckks/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[Microsoft Teams Keyboard Shortcuts]]></title>
            <link>https://medium.com/@rckks/microsoft-teams-keyboard-shortcuts-be82e3e02ef5?source=rss-6301ab64d2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/be82e3e02ef5</guid>
            <category><![CDATA[microsoft-teams]]></category>
            <category><![CDATA[office]]></category>
            <category><![CDATA[shortcuts]]></category>
            <dc:creator><![CDATA[Røckŷ Käñís]]></dc:creator>
            <pubDate>Fri, 05 Sep 2025 12:22:17 GMT</pubDate>
            <atom:updated>2025-09-05T12:22:17.786Z</atom:updated>
            <content:encoded><![CDATA[<p>Using keyboard shortcuts in Microsoft Teams makes work faster and easier, especially for those who prefer the keyboard over the mouse.</p><h3>🔹 General Shortcuts</h3><p><strong>Search in Teams: </strong>Ctrl + E<br><strong>Open filter:</strong> Ctrl + Shift + F<br><strong>Start a new chat</strong>: Ctrl + N<br><strong>Open settings:</strong> Ctrl + Comma (,)<br><strong>Zoom in:</strong> Ctrl + Equals sign (=)<br><strong>Zoom out: </strong>Ctrl + Minus sign (-)<br><strong>Reset zoom:</strong> Ctrl + 0</p><h3>🔹 Navigation Shortcuts</h3><p><strong>Open 1st app in sidebar: </strong>Ctrl + 1<br><strong>Open 2nd app in sidebar:</strong> Ctrl + 2<br><strong>Open 3rd app in sidebar:</strong> Ctrl + 3<br><strong>Open 4th app in sidebar:</strong> Ctrl + 4</p><h3>🔹 Messaging Shortcuts</h3><p><strong>Expand compose box:</strong> Ctrl + Shift + X <br><strong>Send message:</strong> Ctrl + Enter<br><strong>Start new line: </strong>Shift + Enter<br><strong>Mark message important: </strong>Ctrl + Shift + I<br><strong>Focus message from chat list</strong>: Spacebar<br><strong>Focus compose box:</strong> Enter / Ctrl + R<br><strong>Focus chat list:</strong> Esc / Ctrl + L<br><strong>Move forward: </strong>Tab<br><strong>Move backward: </strong>Shift + Tab<br><strong>Open context menu: </strong>Shift + F10<br><strong>Pop out current chat: </strong>Ctrl + Enter<br><strong>Pop out new chat:</strong> Ctrl + Shift + N</p><h3>🔹 Meetings &amp; Calls</h3><p><strong>Start video call:</strong> Ctrl + Shift + U<br><strong>Toggle mute:</strong> Ctrl + Shift + M<br><strong>Announce raised hands (screen reader):</strong> Ctrl + Shift + L<br><strong>Raise/lower hand:</strong> Ctrl + Shift + K<br><strong>Start screen share:</strong> Ctrl + Shift + E<br><strong>Toggle video: </strong>Ctrl + Shift + O<br><strong>Admit people from lobby: </strong>Ctrl + Shift + Y<br><strong>Open background settings: </strong>Ctrl + Shift + P<br><strong>Schedule meeting:</strong> Alt + Shift + N<br><strong>Go to current time: </strong>Alt + .<br><strong>Previous day/week: </strong>Ctrl + Alt + ←<br><strong>Next day/week:</strong> Ctrl + Alt + →<br><strong>View day:</strong> Ctrl + Alt + 1<br><strong>View workweek: </strong>Ctrl + Alt + 2<br><strong>View week: </strong>Ctrl + Alt + 3<br><strong>Save/send meeting request: </strong>Ctrl + S<br><strong>Join from meeting details: </strong>Alt + Shift + J<br><strong>Turn camera off:</strong> Ctrl + Shift + O</p><h3>🔹 Debug Shortcuts</h3><p><strong>Download diagnostic logs: </strong>Ctrl + Alt + Shift + 1</p><p>✅ With these shortcuts, you can navigate Microsoft Teams more quickly, whether you’re chatting, scheduling, or in a meeting.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be82e3e02ef5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git Commands and Workflow]]></title>
            <link>https://medium.com/@rckks/git-commands-and-workflow-42daa7fc2258?source=rss-6301ab64d2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/42daa7fc2258</guid>
            <category><![CDATA[tasks]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[projects]]></category>
            <category><![CDATA[commit]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Røckŷ Käñís]]></dc:creator>
            <pubDate>Fri, 21 Feb 2025 07:02:36 GMT</pubDate>
            <atom:updated>2025-02-21T07:05:07.385Z</atom:updated>
            <content:encoded><![CDATA[<h3>1. Introduction to Git</h3><p>Git is a distributed version control system that helps developers track changes in code, collaborate with others, and manage projects efficiently.</p><h3>2. Basic Git Workflow</h3><ol><li><strong>Clone a Repository</strong></li></ol><pre>git clone &lt;repository_url&gt;</pre><ul><li>Copies a remote repository to your local machine.</li></ul><ol><li><strong>Check Repository Status</strong></li></ol><pre>git status</pre><ul><li>Shows the current state of the working directory and staging area.</li></ul><p><strong>2. Add Changes to Staging Area</strong></p><pre>git add &lt;file_name&gt;  # Adds a specific file git add .            # Adds all changes</pre><ul><li>Stages changes before committing.</li></ul><p><strong>3. Commit Changes</strong></p><pre>git commit -m &quot;Commit message&quot;</pre><ul><li>Saves changes to the local repository.</li></ul><p><strong>4. Push Changes to Remote Repository</strong></p><pre>git push origin &lt;branch_name&gt;</pre><ul><li>Uploads local commits to a remote repository.</li></ul><p><strong>5. Pull Changes from Remote Repository</strong></p><pre>git pull origin &lt;branch_name&gt;</pre><ul><li>Fetches and merges updates from the remote repository.</li></ul><p><strong>6. Create a New Branch</strong></p><pre>git branch &lt;branch_name&gt;</pre><ul><li>Creates a new branch.</li></ul><p><strong>7. Switch to a Branch</strong></p><pre>git checkout &lt;branch_name&gt;</pre><ul><li>Switches to a different branch.</li></ul><pre>git switch &lt;branch_name&gt;  # Alternative command</pre><p><strong>8. Merge Branches</strong></p><pre>git merge &lt;branch_name&gt;</pre><ul><li>Merges a branch into the current branch.</li></ul><p><strong>9. Delete a Branch</strong></p><pre>git branch -d &lt;branch_name&gt;</pre><ul><li>Deletes a branch locally.</li></ul><pre>git push origin --delete &lt;branch_name&gt;</pre><ul><li>Deletes a branch remotely.</li></ul><h3>3.Advanced Git Commands</h3><ol><li><strong>Stash Changes Temporarily</strong></li></ol><pre>git stash</pre><ul><li>Saves uncommitted changes without committing them.</li></ul><pre>git stash pop</pre><ul><li>Restores stashed changes.</li></ul><p><strong>2. View Commit History</strong></p><pre>git log</pre><ul><li>Shows the commit history.</li></ul><p><strong>3. Revert a Commit</strong></p><pre>git revert &lt;commit_hash&gt;</pre><ul><li>Creates a new commit that undoes a previous commit.</li></ul><p><strong>4. Reset a Commit</strong></p><pre>git reset --hard &lt;commit_hash&gt;</pre><ul><li>Resets the repository to a previous commit and removes all changes.</li></ul><h3>4. Git Working Flow</h3><ol><li>Clone the repository.</li><li>Create a new branch for your feature or bug fix.</li><li>Make changes and add them using git add.</li><li>Commit changes with git commit -m &quot;message&quot;.</li><li>Push changes to the remote repository.</li><li>Create a pull request (PR) and request a review.</li><li>Merge the PR after approval.</li><li>Delete the branch after merging.</li></ol><h3>5. Conclusion</h3><p>Git is an essential tool for developers to manage code efficiently. Mastering its commands and workflow will improve collaboration and project management.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42daa7fc2258" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generic Methods and Inheritance in C#]]></title>
            <link>https://medium.com/@rckks/generic-methods-and-inheritance-in-c-444b6134d07c?source=rss-6301ab64d2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/444b6134d07c</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[inheritance]]></category>
            <category><![CDATA[generics]]></category>
            <category><![CDATA[data-type]]></category>
            <dc:creator><![CDATA[Røckŷ Käñís]]></dc:creator>
            <pubDate>Wed, 19 Feb 2025 14:27:35 GMT</pubDate>
            <atom:updated>2025-02-19T14:27:35.276Z</atom:updated>
            <content:encoded><![CDATA[<h3>1. Introduction</h3><p>Generic methods and inheritance are key concepts in C# that enhance code reusability, type safety, and flexibility. Generics allow defining methods with a placeholder for the data type, while inheritance enables a class to derive properties and behaviors from another class.</p><h3>2. Generic Methods</h3><h3>2.1 What is a Generic Method?</h3><p>A generic method is a method that allows specifying a type parameter, making it more flexible and reusable. It enables type safety while working with different data types without rewriting the same logic for each type.</p><h3>2.2 Syntax</h3><pre>public class Utility<br>{<br>    public static void Print&lt;T&gt;(T value)<br>    {<br>        Console.WriteLine(value);<br>    }<br>}</pre><h3>2.3 Example Usage</h3><pre>Utility.Print&lt;int&gt;(100);  // Output: 100<br>Utility.Print&lt;string&gt;(&quot;Hello, Generics&quot;); // Output: Hello, Generics</pre><h3>2.4 Benefits of Generic Methods</h3><ul><li>Type Safety: Prevents type mismatches at runtime.</li><li>Code Reusability: Allows using the same logic for multiple data types.</li><li>Performance: Reduces boxing and unboxing overhead.</li></ul><h3>3. Inheritance</h3><h3>3.1 What is Inheritance?</h3><p>Inheritance is an object-oriented programming (OOP) concept where a child class derives properties and methods from a parent class. This allows code reusability and hierarchical classification.</p><h3>3.2 Syntax</h3><pre>class Parent<br>{<br>    public void Show()<br>    {<br>        Console.WriteLine(&quot;This is the Parent class&quot;);<br>    }<br>}</pre><pre>class Child : Parent<br>{<br>    public void Display()<br>    {<br>        Console.WriteLine(&quot;This is the Child class&quot;);<br>    }<br>}</pre><h3>3.3 Example Usage</h3><pre>Child obj = new Child();<br>obj.Show();    // Inherited from Parent<br>obj.Display(); // Defined in Child</pre><h3>3.4 Benefits of Inheritance</h3><ul><li>Code Reusability: Avoids duplicate code.</li><li>Extensibility: Allows modifying and extending existing functionalities.</li><li>Maintainability: Improves code organization.</li></ul><h3>4. Generic Methods with Inheritance</h3><p>Generic methods can be used with inherited classes to create flexible and reusable logic.</p><h3>4.1 Example</h3><pre>class Animal<br>{<br>    public virtual void Speak()<br>    {<br>        Console.WriteLine(&quot;Animal sound&quot;);<br>    }<br>}</pre><pre>class Dog : Animal<br>{<br>    public override void Speak()<br>    {<br>        Console.WriteLine(&quot;Bark&quot;);<br>    }<br>}</pre><pre>class Cat : Animal<br>{<br>    public override void Speak()<br>    {<br>        Console.WriteLine(&quot;Meow&quot;);<br>    }<br>}</pre><pre>public class Program<br>{<br>    public static void MakeSound&lt;T&gt;(T animal) where T : Animal<br>    {<br>        animal.Speak();<br>    }<br>    <br>    static void Main()<br>    {<br>        Dog dog = new Dog();<br>        Cat cat = new Cat();<br>        <br>        MakeSound(dog); // Output: Bark<br>        MakeSound(cat); // Output: Meow<br>    }<br>}</pre><h3>5. Conclusion</h3><p>Generic methods and inheritance in C# provide powerful tools for writing scalable and reusable code. Generics improve type safety and reduce redundancy, while inheritance enhances the structure and maintainability of the codebase.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=444b6134d07c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Guide to Stored Procedures in SQL]]></title>
            <link>https://medium.com/@rckks/guide-to-stored-procedures-in-sql-156c4844229b?source=rss-6301ab64d2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/156c4844229b</guid>
            <category><![CDATA[stored-procedure]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[table]]></category>
            <category><![CDATA[databas]]></category>
            <dc:creator><![CDATA[Røckŷ Käñís]]></dc:creator>
            <pubDate>Wed, 19 Feb 2025 08:16:50 GMT</pubDate>
            <atom:updated>2025-02-19T08:16:50.538Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is a Stored Procedure?</h3><p>A <strong>Stored Procedure</strong> is a precompiled collection of one or more SQL statements that can be executed as a single unit. Instead of writing the same query repeatedly, you can create a stored procedure and execute it when needed.</p><h3>Why Use a Stored Procedure Instead of a Normal Query?</h3><p>You might wonder, <strong>“Why not just use normal queries?”</strong> Here’s why stored procedures are a better choice:</p><p>✅ <strong>Reusability</strong> — Instead of rewriting SQL queries, you can simply call the stored procedure.</p><p>✅ <strong>Performance Improvement</strong> — Since stored procedures are precompiled, they execute faster than normal queries.</p><p>✅ <strong>Security</strong> — Helps prevent SQL injection by separating SQL logic from user inputs.</p><p>✅ <strong>Easier Maintenance</strong> — Changes need to be updated only in the stored procedure, not across multiple queries.</p><p>✅ <strong>Transaction Handling</strong> — Can include error handling and rollback mechanisms for safe execution.</p><h3>How to Create and Use a Stored Procedure (Step-by-Step)</h3><h3>1️⃣ Creating a Simple Stored Procedure</h3><pre>CREATE PROCEDURE GetAllOrders<br>AS<br>BEGIN<br>    SELECT * FROM Orders;<br>END;</pre><p>✅ This procedure retrieves all orders from the <strong>Orders</strong> table.</p><h3>2️⃣ Executing a Stored Procedure</h3><pre>EXEC GetAllOrders;</pre><p>✅ This runs the stored procedure and fetches all order records.</p><h3>Parameters in Stored Procedures</h3><h3>3️⃣ Stored Procedure with Input Parameter</h3><pre>CREATE PROCEDURE GetOrdersByCustomer<br>    @customer_id INT<br>AS<br>BEGIN<br>    SELECT * FROM Orders WHERE customer_id = @customer_id;<br>END;</pre><p>✅ This fetches orders for a specific <strong>customer_id</strong>.</p><h3>Executing with Parameter</h3><pre>EXEC GetOrdersByCustomer @customer_id = 1;</pre><h3>Output Parameters in Stored Procedures</h3><h3>4️⃣ Stored Procedure with Output Parameter</h3><pre>CREATE PROCEDURE GetTotalSalesByCustomer<br>    @customer_id INT,<br>    @total_sales DECIMAL(10,2) OUTPUT<br>AS<br>BEGIN<br>    SELECT @total_sales = SUM(amount) FROM Orders WHERE customer_id = @customer_id;<br>END;</pre><p>✅ This calculates total sales for a customer and returns the result.</p><h3>Executing with Output Parameter</h3><pre>DECLARE @sales DECIMAL(10,2);<br>EXEC GetTotalSalesByCustomer @customer_id = 1, @total_sales = @sales OUTPUT;<br>PRINT @sales;</pre><h3>Updating Data Using a Stored Procedure</h3><h3>5️⃣ Updating Order Amount</h3><pre>CREATE PROCEDURE UpdateOrderAmount<br>    @order_id INT,<br>    @new_amount DECIMAL(10,2)<br>AS<br>BEGIN<br>    UPDATE Orders SET amount = @new_amount WHERE order_id = @order_id;<br>END;</pre><p>✅ This updates the amount of a specific order.</p><h3>Executing the Update Procedure</h3><pre>EXEC UpdateOrderAmount @order_id = 2, @new_amount = 300.00;</pre><h3>Handling Errors in Stored Procedures</h3><h3>6️⃣ Safe Delete Procedure with Error Handling</h3><pre>CREATE PROCEDURE SafeDeleteOrder<br>    @order_id INT<br>AS<br>BEGIN<br>    BEGIN TRY<br>        DELETE FROM Orders WHERE order_id = @order_id;<br>        <br>        IF @@ROWCOUNT = 0<br>        BEGIN<br>            PRINT &#39;Error: Order ID does not exist. No record deleted.&#39;;<br>        END<br>        ELSE<br>        BEGIN<br>            PRINT &#39;Order deleted successfully.&#39;;<br>        END<br>    END TRY<br>    BEGIN CATCH<br>        PRINT &#39;Error: Unable to delete the order.&#39;;<br>        PRINT ERROR_MESSAGE();<br>    END CATCH<br>END;</pre><p>✅ This prevents errors when deleting non-existing records.</p><h3>Executing the Safe Delete Procedure</h3><pre>EXEC SafeDeleteOrder @order_id = 100;</pre><h3>Conclusion</h3><p>Stored Procedures are <strong>faster, more secure, reusable, and easier to maintain</strong> than normal SQL queries. If you’re working with databases frequently, using stored procedures is a <strong>best practice</strong> that will make your queries more efficient and your code easier to manage.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=156c4844229b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Common Aggregate Queries in SQL Server (MSSQL)]]></title>
            <link>https://medium.com/@rckks/common-aggregate-queries-in-sql-server-mssql-0142faca6a49?source=rss-6301ab64d2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/0142faca6a49</guid>
            <category><![CDATA[mssql]]></category>
            <category><![CDATA[aggregates]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[quay]]></category>
            <dc:creator><![CDATA[Røckŷ Käñís]]></dc:creator>
            <pubDate>Mon, 17 Feb 2025 04:54:28 GMT</pubDate>
            <atom:updated>2025-02-17T05:07:05.460Z</atom:updated>
            <content:encoded><![CDATA[<p>Aggregate functions perform calculations on a set of values and return a <strong>single value</strong>. They are commonly used with the GROUP BY clause.</p><h3>1️⃣ COUNT() — Counting Rows</h3><p>Returns the number of rows that match a condition.</p><p>🔹 <strong>Example: Count total customers</strong></p><pre>SELECT COUNT(*) AS total_customers FROM customers;</pre><p>🔹 <strong>Example: Count customers with email IDs</strong></p><pre>SELECT COUNT(email) AS customers_with_email FROM customers;</pre><h3>2️⃣ SUM() — Adding Values</h3><p>Returns the total sum of a numeric column.</p><p>🔹 <strong>Example: Total revenue from orders</strong></p><pre>SELECT SUM(amount) AS total_revenue FROM orders;</pre><p>🔹 <strong>Example: Sum of salaries of all employees</strong></p><pre>SELECT SUM(salary) AS total_salary FROM employees;</pre><h3>3️⃣ AVG() — Calculating Average</h3><p>Returns the average value of a numeric column.</p><p>🔹 <strong>Example: Average order amount</strong></p><pre>SELECT AVG(amount) AS avg_order_amount FROM orders;</pre><p>🔹 <strong>Example: Average salary of employees</strong></p><pre>SELECT AVG(salary) AS avg_salary FROM employees;</pre><h3>4️⃣ MIN() — Finding the Minimum Value</h3><p>Returns the smallest value in a column.</p><p>🔹 <strong>Example: Find the lowest order amount</strong></p><pre>SELECT MIN(amount) AS min_order_amount FROM orders;</pre><p>🔹 <strong>Example: Find the youngest employee’s age</strong></p><pre>SELECT MIN(age) AS youngest_employee FROM employees;</pre><h3>5️⃣ MAX() — Finding the Maximum Value</h3><p>Returns the largest value in a column.</p><p>🔹 <strong>Example: Find the highest order amount</strong></p><pre>SELECT MAX(amount) AS max_order_amount FROM orders;</pre><p>🔹 <strong>Example: Find the highest salary in a company</strong></p><pre>SELECT MAX(salary) AS highest_salary FROM employees;</pre><h3>6️⃣ GROUP BY — Aggregating Data by Category</h3><p>Groups rows that have the same values and applies aggregate functions.</p><p>🔹 <strong>Example: Count orders per customer</strong></p><pre>SELECT customer_id, COUNT(*) AS total_orders<br>FROM orders<br>GROUP BY customer_id;</pre><p>🔹 <strong>Example: Total sales per product</strong></p><pre>SELECT product_id, SUM(amount) AS total_sales<br>FROM orders<br>GROUP BY product_id;</pre><h3>7️⃣ HAVING — Filtering Grouped Data</h3><p>Used to filter aggregate results (works <strong>after</strong> GROUP BY).</p><p>🔹 <strong>Example: Customers with more than 5 orders</strong></p><pre>SELECT customer_id, COUNT(*) AS total_orders<br>FROM orders<br>GROUP BY customer_id<br>HAVING COUNT(*) &gt; 5;</pre><p>🔹 <strong>Example: Products with sales above 10,000</strong></p><pre>SELECT product_id, SUM(amount) AS total_sales<br>FROM orders<br>GROUP BY product_id<br>HAVING SUM(amount) &gt; 10000;</pre><h3>8️⃣ Example: Full Aggregate Query</h3><pre>SELECT customer_id, <br>       COUNT(order_id) AS total_orders, <br>       SUM(amount) AS total_spent, <br>       AVG(amount) AS avg_spent, <br>       MIN(amount) AS min_spent, <br>       MAX(amount) AS max_spent<br>FROM orders<br>GROUP BY customer_id<br>HAVING COUNT(order_id) &gt; 3;</pre><p><strong>🔹 Explanation:</strong></p><ul><li>Groups orders by customer_id</li><li>Counts total orders</li><li>Sums total spending per customer</li><li>Finds the average, minimum, and maximum spending</li><li>Filters customers with more than 3 orders</li></ul><h3>Step-by-Step Execution</h3><h3>Step 1: Create a Database and Use It</h3><pre>CREATE DATABASE SalesDB;<br>USE SalesDB;</pre><h3>Step 2: Create a Table (orders)</h3><pre>CREATE TABLE orders (<br>    order_id INT PRIMARY KEY IDENTITY(1,1),<br>    customer_id INT NOT NULL,<br>    amount DECIMAL(10,2) NOT NULL,<br>    order_date DATE NOT NULL<br>);</pre><h3>Step 3: Insert Sample Data</h3><pre>INSERT INTO orders (customer_id, amount, order_date) VALUES (1, 100.00, &#39;2024-02-01&#39;);<br>INSERT INTO orders (customer_id, amount, order_date) VALUES (2, 250.50, &#39;2024-02-02&#39;);<br>INSERT INTO orders (customer_id, amount, order_date) VALUES (1, 300.75, &#39;2024-02-05&#39;);<br>INSERT INTO orders (customer_id, amount, order_date) VALUES (3, 400.25, &#39;2024-02-06&#39;);<br>INSERT INTO orders (customer_id, amount, order_date) VALUES (2, 150.00, &#39;2024-02-07&#39;);<br>INSERT INTO orders (customer_id, amount, order_date) VALUES (1, 50.00, &#39;2024-02-08&#39;);<br>INSERT INTO orders (customer_id, amount, order_date) VALUES (3, 700.00, &#39;2024-02-09&#39;);</pre><h3>Step 4: Retrieve Data from the Table</h3><pre>SELECT * FROM orders;</pre><h3>Step 5: Aggregate Queries</h3><h3>1️⃣ COUNT() — Count Total Orders</h3><pre>SELECT COUNT(*) AS total_orders FROM orders;</pre><p>✅ <strong>Output:</strong> Number of orders in the table.</p><h3>2️⃣ SUM() — Total Sales Amount</h3><pre>SELECT SUM(amount) AS total_sales FROM orders;</pre><p>✅ <strong>Output:</strong> Total revenue generated from all orders.</p><h3>3️⃣ AVG() — Average Order Amount</h3><pre>SELECT AVG(amount) AS avg_order_amount FROM orders;</pre><p>✅ <strong>Output:</strong> The average amount per order.</p><h3>4️⃣ MIN() — Smallest Order Amoun</h3><pre>SELECT MIN(amount) AS min_order_amount FROM orders;</pre><p>✅ <strong>Output:</strong> The least expensive order.</p><h3>5️⃣ MAX() — Highest Order Amount</h3><pre>SELECT MAX(amount) AS max_order_amount FROM orders;</pre><p>✅ <strong>Output:</strong> The most expensive order.</p><h3>Step 6: Using GROUP BY (Aggregate per Customer)</h3><h3>6️⃣ Count Orders per Customer</h3><pre>SELECT customer_id, COUNT(order_id) AS total_orders<br>FROM orders<br>GROUP BY customer_id;</pre><p>✅ <strong>Output:</strong> Each customer’s total number of orders.</p><h3>7️⃣ Total Sales per Customer</h3><pre>SELECT customer_id, SUM(amount) AS total_spent<br>FROM orders<br>GROUP BY customer_id;</pre><p>✅ <strong>Output:</strong> The total money spent by each customer.</p><h3>8️⃣ Average Order Value per Customer</h3><pre>SELECT customer_id, AVG(amount) AS avg_spent<br>FROM orders<br>GROUP BY customer_id;</pre><p>✅ <strong>Output:</strong> The average amount spent by each customer.</p><h3>Step 7: Filtering Grouped Data using HAVING</h3><h3>9️⃣ Customers Who Spent More Than 400</h3><pre>SELECT customer_id, SUM(amount) AS total_spent<br>FROM orders<br>GROUP BY customer_id<br>HAVING SUM(amount) &gt; 400;</pre><p>✅ <strong>Output:</strong> Customers whose total spending exceeds 400.</p><h3>🔟 Customers Who Placed More Than 2 Orders</h3><pre>SELECT customer_id, COUNT(order_id) AS total_orders<br>FROM orders<br>GROUP BY customer_id<br>HAVING COUNT(order_id) &gt; 2;</pre><p>✅ <strong>Output:</strong> Customers who have placed more than 2 orders.</p><h3>Step 8: Combining Multiple Aggregates in One Query</h3><pre>SELECT customer_id, <br>       COUNT(order_id) AS total_orders, <br>       SUM(amount) AS total_spent, <br>       AVG(amount) AS avg_spent, <br>       MIN(amount) AS min_spent, <br>       MAX(amount) AS max_spent<br>FROM orders<br>GROUP BY customer_id<br>HAVING COUNT(order_id) &gt; 1;</pre><p>✅ <strong>Output:</strong></p><ul><li>Total orders per customer</li><li>Total spending per customer</li><li>Average spending per customer</li><li>Minimum and maximum spending</li><li>Filters customers who made more than 1 order</li></ul><h3>Step 9: Final Data Check</h3><pre>SELECT * FROM orders;</pre><p>✅ <strong>Ensures all data is correctly stored before further analysis.</strong></p><h3>Conclusion</h3><p>Aggregate functions are essential for summarizing data in SQL Server. They are commonly used with GROUP BY and HAVING to analyze large datasets efficiently</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0142faca6a49" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SQL Fundamentals and Queries in MySQL]]></title>
            <link>https://medium.com/@rckks/sql-fundamentals-and-queries-in-mysql-b29902a446a3?source=rss-6301ab64d2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/b29902a446a3</guid>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[tasks]]></category>
            <category><![CDATA[sql-queries]]></category>
            <category><![CDATA[sql-server]]></category>
            <dc:creator><![CDATA[Røckŷ Käñís]]></dc:creator>
            <pubDate>Fri, 14 Feb 2025 07:22:25 GMT</pubDate>
            <atom:updated>2025-02-14T09:17:01.286Z</atom:updated>
            <content:encoded><![CDATA[<p>### **1. Introduction to SQL**</p><p>SQL (Structured Query Language) is used to manage and manipulate relational databases. It allows users to retrieve, insert, update, and delete data efficiently.</p><p>### **2. Basic SQL Commands with Examples**</p><p>#### **2.1 Creating a Database**</p><pre>sql<br>CREATE DATABASE shop;<br>USE shop;</pre><p>#### **2.2 Creating a Table**</p><pre>sql<br>CREATE TABLE customers (<br>id INT PRIMARY KEY IDENTITY(1,1),<br>name VARCHAR(50),<br>email VARCHAR(100) UNIQUE<br>);</pre><p>#### **2.3 Inserting Data**</p><pre>sql<br>INSERT INTO customers (name, email) VALUES (&#39;John Doe&#39;, &#39;john@example.com&#39;);<br>INSERT INTO customers (name, email) VALUES (&#39;Jane Smith&#39;, &#39;jane@example.com&#39;);</pre><p>#### **2.4 Retrieving Data**</p><pre>sql<br>SELECT * FROM customers;<br>SELECT name, email FROM customers WHERE id = 1;</pre><p>#### **2.5 Updating Data**</p><pre>sql<br>UPDATE customers SET email = &#39;john.doe@example.com&#39; WHERE id = 1;</pre><p>#### **2.6 Deleting Data**</p><pre>sql<br>DELETE FROM customers WHERE id = 2;</pre><p>### **3. Understanding JOINs in MySQL**</p><p>JOINs are used to retrieve data from multiple tables based on a related column.</p><p>#### **3.1 INNER JOIN (Matching Records in Both Tables)**</p><pre>sql<br>SELECT customers.id, customers.name, orders.order_id, orders.order_date<br>FROM customers<br>INNER JOIN orders ON customers.id = orders.customer_id;</pre><p>#### **3.2 LEFT JOIN (All Left Table Records + Matching Right Table Records)**</p><pre>sql<br>SELECT customers.id, customers.name, orders.order_id, orders.order_date<br>FROM customers<br>LEFT JOIN orders ON customers.id = orders.customer_id;</pre><p>#### **3.3 RIGHT JOIN (All Right Table Records + Matching Left Table Records)**</p><pre>sql<br>SELECT customers.id, customers.name, orders.order_id, orders.order_date<br>FROM customers<br>RIGHT JOIN orders ON customers.id = orders.customer_id;</pre><p>#### **3.4 FULL JOIN (Using UNION for MySQL)**</p><pre>sql<br>SELECT customers.id, customers.name, orders.order_id, orders.order_date<br>FROM customers<br>LEFT JOIN orders ON customers.id = orders.customer_id<br>UNION<br>SELECT customers.id, customers.name, orders.order_id, orders.order_date<br>FROM customers<br>RIGHT JOIN orders ON customers.id = orders.customer_id;</pre><p>#### **3.5 CROSS JOIN (All Possible Combinations)**</p><pre>sql<br>SELECT customers.name, orders.order_id<br>FROM customers<br>CROSS JOIN orders;</pre><h3>Step-by-Step Execution</h3><p>— Step 1: Create a database and use it<br>CREATE DATABASE shop;<br>USE shop;</p><p>— Step 2: Create the ‘customers’ table<br>CREATE TABLE customers (<br> id INT PRIMARY KEY IDENTITY(1,1),<br> name VARCHAR(50),<br> email VARCHAR(100) UNIQUE<br>);</p><p>— Step 3: Insert data into ‘customers’ table<br>INSERT INTO customers (name, email) VALUES (‘John Doe’, ‘<a href="/service/mailto:john@example.com">john@example.com</a>’);<br>INSERT INTO customers (name, email) VALUES (‘Jane Smith’, ‘<a href="/service/mailto:jane@example.com">jane@example.com</a>’);<br>INSERT INTO customers (name, email) VALUES (‘Alice Brown’, ‘<a href="/service/mailto:alice@example.com">alice@example.com</a>’);</p><p>— Step 4: Retrieve data from ‘customers’ table<br>SELECT * FROM customers;<br>SELECT name, email FROM customers WHERE id = 1;</p><p>— Step 5: Update a record in ‘customers’ table<br>UPDATE customers SET email = ‘<a href="/service/mailto:john.doe@example.com">john.doe@example.com</a>’ WHERE id = 1;</p><p>— Step 6: Delete a record from ‘customers’ table<br>DELETE FROM customers WHERE id = 2;</p><p>— Step 7: Create the ‘orders’ table<br>CREATE TABLE orders (<br> order_id INT IDENTITY(1,1) PRIMARY KEY,<br> customer_id INT,<br> order_date DATE,<br> FOREIGN KEY (customer_id) REFERENCES customers(id)<br>);</p><p>— Step 8: Insert data into ‘orders’ table<br>INSERT INTO orders (customer_id, order_date) VALUES (1, ‘2024–02–14’);<br>INSERT INTO orders (customer_id, order_date) VALUES (1, ‘2024–02–15’);<br>INSERT INTO orders (customer_id, order_date) VALUES (3, ‘2024–02–16’);</p><p>— Step 9: Retrieve data with INNER JOIN (Only matching records)<br>SELECT customers.id, customers.name, orders.order_id, orders.order_date<br>FROM customers<br>INNER JOIN orders ON customers.id = orders.customer_id;</p><p>— Step 10: Retrieve data with LEFT JOIN (All customers + matching orders)<br>SELECT customers.id, customers.name, orders.order_id, orders.order_date<br>FROM customers<br>LEFT JOIN orders ON customers.id = orders.customer_id;</p><p>— Step 11: Retrieve data with RIGHT JOIN (All orders + matching customers)<br>SELECT customers.id, customers.name, orders.order_id, orders.order_date<br>FROM customers<br>RIGHT JOIN orders ON customers.id = orders.customer_id;</p><p>— Step 12: FULL JOIN (MySQL does not support FULL JOIN, so use UNION)<br>SELECT customers.id, customers.name, orders.order_id, orders.order_date<br>FROM customers<br>LEFT JOIN orders ON customers.id = orders.customer_id<br>UNION<br>SELECT customers.id, customers.name, orders.order_id, orders.order_date<br>FROM customers<br>RIGHT JOIN orders ON customers.id = orders.customer_id;</p><p>— Step 13: Retrieve data with CROSS JOIN (All possible combinations)<br>SELECT customers.name, orders.order_id<br>FROM customers<br>CROSS JOIN orders;</p><p>### **5. Conclusion**</p><p>Understanding SQL fundamentals and JOIN operations is crucial for working with relational databases. Practice writing queries and experimenting with different types of JOINs to gain a deeper understanding.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b29902a446a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is OOP?]]></title>
            <link>https://medium.com/@rckks/what-is-oop-de43c31df9c1?source=rss-6301ab64d2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/de43c31df9c1</guid>
            <category><![CDATA[object-oriented]]></category>
            <category><![CDATA[oop-concepts]]></category>
            <category><![CDATA[tasks]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Røckŷ Käñís]]></dc:creator>
            <pubDate>Wed, 12 Feb 2025 05:29:34 GMT</pubDate>
            <atom:updated>2025-02-12T05:29:34.061Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Object-Oriented Programming (OOP) Concepts in C#</strong></h3><p>Object-Oriented Programming (OOP) is a programming paradigm based on the concept of objects, which contain data in the form of fields (attributes) and code in the form of methods (functions). OOP aims to improve code reusability, scalability, and maintainability by organizing software design around objects rather than functions and logic.</p><h3>Four Pillars of OOP:</h3><ol><li><strong>Encapsulation</strong></li><li><strong>Inheritance</strong></li><li><strong>Polymorphism</strong></li><li><strong>Abstraction</strong></li></ol><h3>1. Encapsulation</h3><p>Encapsulation is the concept of wrapping data (variables) and code (methods) into a single unit (class). It helps in data hiding by restricting direct access to class members.</p><p><strong>Example:</strong></p><pre>class Person<br>{<br>    private string name; // Private field</pre><pre>    public void SetName(string newName) // Public method to set value<br>    {<br>        name = newName;<br>    }</pre><pre>    public string GetName() // Public method to get value<br>    {<br>        return name;<br>    }<br>}</pre><h3>2. Inheritance</h3><p>Inheritance allows one class to acquire properties and behavior from another class. This promotes code reuse.</p><p><strong>Example:</strong></p><pre>class Animal<br>{<br>    public void Eat()<br>    {<br>        Console.WriteLine(&quot;This animal eats food.&quot;);<br>    }<br>}</pre><pre>class Dog : Animal // Dog inherits from Animal<br>{<br>    public void Bark()<br>    {<br>        Console.WriteLine(&quot;Dog barks.&quot;);<br>    }<br>}</pre><h3>3. Polymorphism</h3><p>Polymorphism allows methods to have the same name but different implementations. It can be achieved through method overloading and method overriding.</p><p><strong>Method Overloading (Compile-time Polymorphism):</strong></p><pre>class MathOperations<br>{<br>    public int Add(int a, int b)<br>    {<br>        return a + b;<br>    }</pre><pre>    public double Add(double a, double b)<br>    {<br>        return a + b;<br>    }<br>}</pre><p><strong>Method Overriding (Runtime Polymorphism):</strong></p><pre>class Animal<br>{<br>    public virtual void MakeSound()<br>    {<br>        Console.WriteLine(&quot;Animal makes a sound.&quot;);<br>    }<br>}</pre><pre>class Dog : Animal<br>{<br>    public override void MakeSound()<br>    {<br>        Console.WriteLine(&quot;Dog barks.&quot;);<br>    }<br>}</pre><h3>4. Abstraction</h3><p>Abstraction hides complex implementation details and shows only the necessary features to the user. This is achieved using abstract classes or interfaces.</p><p><strong>Using Abstract Class:</strong></p><pre>abstract class Vehicle<br>{<br>    public abstract void Start(); // Abstract method<br>}</pre><pre>class Car : Vehicle<br>{<br>    public override void Start()<br>    {<br>        Console.WriteLine(&quot;Car starts with a key.&quot;);<br>    }<br>}</pre><p><strong>Using Interface:</strong></p><pre>interface IVehicle<br>{<br>    void Start(); // Method without implementation<br>}</pre><pre>class Bike : IVehicle<br>{<br>    public void Start()<br>    {<br>        Console.WriteLine(&quot;Bike starts with a button.&quot;);<br>    }<br>}</pre><h3>Applying OOP in a Project</h3><p>To use OOP concepts in a project, follow these steps:</p><ol><li><strong>Encapsulation:</strong> Use private fields and expose them through public methods or properties.</li><li><strong>Inheritance:</strong> Create base classes for common functionalities and extend them in specific classes.</li><li><strong>Polymorphism:</strong> Use method overloading for multiple method signatures and method overriding for different implementations in derived classes.</li><li><strong>Abstraction:</strong> Define abstract classes or interfaces to enforce a contract for different implementations.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de43c31df9c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JWT Authentication with Bcrypt Password Hashing in .NET Core 8]]></title>
            <link>https://medium.com/@rckks/jwt-authentication-with-bcrypt-password-hashing-in-net-core-8-a412cec0725c?source=rss-6301ab64d2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/a412cec0725c</guid>
            <category><![CDATA[bcrypt]]></category>
            <category><![CDATA[tasks]]></category>
            <category><![CDATA[token]]></category>
            <category><![CDATA[jwt-authentication]]></category>
            <category><![CDATA[net-core]]></category>
            <dc:creator><![CDATA[Røckŷ Käñís]]></dc:creator>
            <pubDate>Tue, 11 Feb 2025 16:11:36 GMT</pubDate>
            <atom:updated>2025-02-11T16:11:36.443Z</atom:updated>
            <content:encoded><![CDATA[<h3>JWT Authentication with Bcrypt Password Hashing in .NET Core 8</h3><h3>Introduction</h3><p>In modern web applications, securing user authentication is crucial. <strong>JWT (JSON Web Token)</strong> is widely used for authentication, while <strong>Bcrypt</strong> is a strong password hashing algorithm. This article explains how to implement JWT authentication with Bcrypt password hashing in <strong>.NET Core 8</strong> and test it using <strong>Postman</strong>.</p><h3>1️⃣ Installing Required Packages</h3><p>Run the following commands to install authentication and hashing libraries:</p><pre>dotnet add package Microsoft.AspNetCore.Authentication.JwtBearer<br>dotnet add package Microsoft.IdentityModel.Tokens<br>dotnet add package BCrypt.Net-Next</pre><h3>2️⃣ Setting Up JWT in .NET Core</h3><h3>🔹 Configure JWT in appsettings.json</h3><pre>{<br>  &quot;JwtSettings&quot;: {<br>    &quot;Key&quot;: &quot;YourSecretKeyHere&quot;,<br>    &quot;Issuer&quot;: &quot;yourdomain.com&quot;,<br>    &quot;Audience&quot;: &quot;yourdomain.com&quot;,<br>    &quot;ExpiryMinutes&quot;: 60<br>  }<br>}</pre><h3>🔹 Implement JwtService for Token Generation</h3><pre>using System.IdentityModel.Tokens.Jwt;<br>using System.Security.Claims;<br>using System.Text;<br>using Microsoft.IdentityModel.Tokens;</pre><pre>public class JwtService<br>{<br>    private readonly IConfiguration _config;</pre><pre>    public JwtService(IConfiguration config)<br>    {<br>        _config = config;<br>    }</pre><pre>    public string GenerateToken(int userId, string username)<br>    {<br>        var jwtSettings = _config.GetSection(&quot;JwtSettings&quot;);<br>        var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(jwtSettings[&quot;Key&quot;]));</pre><pre>        var claims = new[]<br>        {<br>            new Claim(JwtRegisteredClaimNames.Sub, userId.ToString()),<br>            new Claim(JwtRegisteredClaimNames.UniqueName, username),<br>            new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString())<br>        };</pre><pre>        var token = new JwtSecurityToken(<br>            issuer: jwtSettings[&quot;Issuer&quot;],<br>            audience: jwtSettings[&quot;Audience&quot;],<br>            claims: claims,<br>            expires: DateTime.UtcNow.AddMinutes(Convert.ToDouble(jwtSettings[&quot;ExpiryMinutes&quot;])),<br>            signingCredentials: new SigningCredentials(key, SecurityAlgorithms.HmacSha256));</pre><pre>        return new JwtSecurityTokenHandler().WriteToken(token);<br>    }<br>}</pre><h3>3️⃣ Implementing Bcrypt for Password Hashing</h3><h3>🔹 Hashing Passwords</h3><pre>public static class PasswordHasher<br>{<br>    public static string HashPassword(string password)<br>    {<br>        return BCrypt.Net.BCrypt.HashPassword(password);<br>    }</pre><pre>    public static bool VerifyPassword(string password, string hashedPassword)<br>    {<br>        return BCrypt.Net.BCrypt.Verify(password, hashedPassword);<br>    }<br>}</pre><h3>4️⃣ Implementing Authentication in Controller</h3><h3>🔹 User Login API (AuthController.cs)</h3><pre>[Route(&quot;api/auth&quot;)]<br>[ApiController]<br>public class AuthController : ControllerBase<br>{<br>    private readonly JwtService _jwtService;</pre><pre>    public AuthController(JwtService jwtService)<br>    {<br>        _jwtService = jwtService;<br>    }</pre><pre>    [HttpPost(&quot;login&quot;)]<br>    public IActionResult Login([FromBody] LoginRequest request)<br>    {<br>        var storedHashedPassword = &quot;$2a$11$...&quot;; // Example hashed password from DB<br>        if (!PasswordHasher.VerifyPassword(request.Password, storedHashedPassword))<br>        {<br>            return Unauthorized(&quot;Invalid username or password.&quot;);<br>        }</pre><pre>        var token = _jwtService.GenerateToken(1, request.Username);<br>        return Ok(new { Token = token });<br>    }<br>}</pre><pre>public class LoginRequest<br>{<br>    public string Username { get; set; }<br>    public string Password { get; set; }<br>}</pre><h3>5️⃣ Configuring JWT Authentication in Program.cs</h3><pre>var builder = WebApplication.CreateBuilder(args);</pre><pre>builder.Services.AddControllers();<br>builder.Services.AddEndpointsApiExplorer();<br>builder.Services.AddSwaggerGen();</pre><pre>var jwtSettings = builder.Configuration.GetSection(&quot;JwtSettings&quot;);<br>var secretKey = Encoding.UTF8.GetBytes(jwtSettings[&quot;Key&quot;]);</pre><pre>builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)<br>    .AddJwtBearer(options =&gt;<br>    {<br>        options.TokenValidationParameters = new TokenValidationParameters<br>        {<br>            ValidateIssuer = true,<br>            ValidateAudience = true,<br>            ValidateLifetime = true,<br>            ValidateIssuerSigningKey = true,<br>            ValidIssuer = jwtSettings[&quot;Issuer&quot;],<br>            ValidAudience = jwtSettings[&quot;Audience&quot;],<br>            IssuerSigningKey = new SymmetricSecurityKey(secretKey)<br>        };<br>    });</pre><pre>builder.Services.AddScoped&lt;JwtService&gt;();</pre><pre>var app = builder.Build();</pre><pre>app.UseAuthentication();<br>app.UseAuthorization();<br>app.MapControllers();<br>app.Run();</pre><h3>6️⃣ Testing JWT in Postman</h3><h3>🔹 Step 1: Login to Get Token</h3><ul><li><strong>Method:</strong> POST</li><li><strong>URL:</strong> <a href="https://localhost:5001/api/auth/login">https://localhost:5001/api/auth/login</a></li><li><strong>Body (JSON):</strong></li><li>json</li><li>CopyEdit</li><li>{ &quot;username&quot;: &quot;john&quot;, &quot;password&quot;: &quot;password123&quot; }</li><li><strong>Response:</strong></li><li>json</li><li>CopyEdit</li><li>{ &quot;token&quot;: &quot;eyJhbGciOiJIUz...&quot; }</li></ul><h3>🔹 Step 2: Access Secure API with Token</h3><ul><li><strong>Method:</strong> GET</li><li><strong>URL:</strong> <a href="https://localhost:5001/api/students">https://localhost:5001/api/students</a></li><li><strong>Headers:</strong></li><li>makefile</li><li>Authorization: Bearer &lt;TOKEN&gt;</li><li>✅ <strong>Response:</strong> If valid, you get a <strong>200 OK</strong>.</li><li>❌ <strong>401 Unauthorized:</strong> If the token is missing or invalid.</li></ul><h3>Conclusion</h3><ul><li><strong>JWT</strong> is used for authentication, ensuring secure user access.</li><li><strong>Bcrypt</strong> securely hashes and verifies passwords.</li><li>This setup allows <strong>secure login</strong> and <strong>protected API access</strong>.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a412cec0725c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular Pipes]]></title>
            <link>https://medium.com/@rckks/angular-pipes-395e9430cf42?source=rss-6301ab64d2bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/395e9430cf42</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[tasks]]></category>
            <category><![CDATA[pipes]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[angular-pipe]]></category>
            <dc:creator><![CDATA[Røckŷ Käñís]]></dc:creator>
            <pubDate>Tue, 11 Feb 2025 16:00:21 GMT</pubDate>
            <atom:updated>2025-02-11T16:00:21.281Z</atom:updated>
            <content:encoded><![CDATA[<h3>1. What Are Pipes in Angular?</h3><p>Pipes are used to transform data directly in the template. They take in data as input and return a formatted output.</p><h3>Syntax</h3><pre>{{ value | pipeName }}</pre><h3>2. Built-in Pipes in Angular</h3><p>Angular provides several built-in pipes. Here are some important ones:</p><h3>Example 1: uppercase and lowercase Pipes</h3><pre>&lt;p&gt;{{ &#39;hello world&#39; | uppercase }}&lt;/p&gt;  &lt;!-- Output: HELLO WORLD --&gt;<br>&lt;p&gt;{{ &#39;ANGULAR&#39; | lowercase }}&lt;/p&gt;  &lt;!-- Output: angular --&gt;</pre><h3>Example 2: date Pipe</h3><pre>&lt;p&gt;{{ today | date:&#39;fullDate&#39; }}&lt;/p&gt;  &lt;!-- Output: Saturday, February 10, 2025 --&gt;</pre><pre>export class AppComponent {<br>  today = new Date();<br>}</pre><h3>Example 3: currency Pipe</h3><pre>&lt;p&gt;{{ 5000 | currency:&#39;USD&#39; }}&lt;/p&gt;  &lt;!-- Output: $5,000.00 --&gt;</pre><h3>Example 4: percent Pipe</h3><pre>&lt;p&gt;{{ 0.75 | percent }}&lt;/p&gt;  &lt;!-- Output: 75% --&gt;</pre><h3>Example 5: json Pipe</h3><pre>&lt;pre&gt;{{ { name: &#39;John&#39;, age: 25 } | json }}&lt;/pre&gt;</pre><p><strong>Output:</strong></p><pre>{<br>  &quot;name&quot;: &quot;John&quot;,<br>  &quot;age&quot;: 25<br>}</pre><h3>3. Creating a Custom Pipe in Angular</h3><p>If built-in pipes don’t meet your requirements, you can create a <strong>custom pipe</strong>.</p><h3>Step 1: Generate a Custom Pipe</h3><p>Run the following command in your Angular project:</p><pre>ng generate pipe customFormat</pre><p>This will generate two files:</p><ul><li>custom-format.pipe.ts</li><li>custom-format.pipe.spec.ts (for testing)</li></ul><h3>Step 2: Implement the Custom Pipe</h3><p>Modify custom-format.pipe.ts:</p><pre>import { Pipe, PipeTransform } from &#39;@angular/core&#39;;</pre><pre>@Pipe({<br>  name: &#39;customFormat&#39;<br>})<br>export class CustomFormatPipe implements PipeTransform {<br>  transform(value: string, type: string): string {<br>    if (!value) return &#39;&#39;;<br>    <br>    switch (type) {<br>      case &#39;capitalize&#39;:<br>        return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();<br>      case &#39;reverse&#39;:<br>        return value.split(&#39;&#39;).reverse().join(&#39;&#39;);<br>      default:<br>        return value;<br>    }<br>  }<br>}</pre><h3>Step 3: Use the Custom Pipe in a Component</h3><p>Modify app.component.html:</p><pre>&lt;p&gt;{{ &#39;hello world&#39; | customFormat:&#39;capitalize&#39; }}&lt;/p&gt;  &lt;!-- Output: Hello world --&gt;<br>&lt;p&gt;{{ &#39;angular&#39; | customFormat:&#39;reverse&#39; }}&lt;/p&gt;  &lt;!-- Output: ralugna --&gt;</pre><h3>Step 4: Register the Pipe in app.module.ts</h3><p>Make sure to declare the pipe in your module:</p><pre>import { NgModule } from &#39;@angular/core&#39;;<br>import { BrowserModule } from &#39;@angular/platform-browser&#39;;<br>import { AppComponent } from &#39;./app.component&#39;;<br>import { CustomFormatPipe } from &#39;./custom-format.pipe&#39;;</pre><pre>@NgModule({<br>  declarations: [AppComponent, CustomFormatPipe],<br>  imports: [BrowserModule],<br>  bootstrap: [AppComponent]<br>})<br>export class AppModule { }</pre><h3>4. Pure vs. Impure Pipes</h3><ul><li><strong>Pure Pipes</strong> (default): Run only when the input changes.</li><li><strong>Impure Pipes</strong>: Recalculate on every change detection cycle.</li></ul><p>To make a pipe impure, modify the decorator like this:</p><pre>@Pipe({<br>  name: &#39;customFormat&#39;,<br>  pure: false<br>})</pre><h3>5. Chaining Pipes</h3><p>You can use multiple pipes together:</p><pre>&lt;p&gt;{{ &#39;hello world&#39; | uppercase | customFormat:&#39;reverse&#39; }}&lt;/p&gt;  &lt;!-- Output: DLROW OLLEH --&gt;</pre><h3>6. Pipes with Parameters</h3><p>You can pass multiple arguments:</p><pre>&lt;p&gt;{{ &#39;hello&#39; | customFormat:&#39;capitalize&#39; }}&lt;/p&gt;</pre><h3>7. When to Use Pipes in Angular?</h3><p>✅ Formatting text (uppercase, lowercase, title case).<br>✅ Transforming dates, currencies, percentages, and JSON.<br>✅ Custom transformations (e.g., reversing text, filtering lists).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=395e9430cf42" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>