<?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 Ralph Olazo on Medium]]></title>
        <description><![CDATA[Stories by Ralph Olazo on Medium]]></description>
        <link>https://medium.com/@ralpholazo?source=rss-d5c63cec1266------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*jbiS9EZkQuVIAetw8cxyWA.jpeg</url>
            <title>Stories by Ralph Olazo on Medium</title>
            <link>https://medium.com/@ralpholazo?source=rss-d5c63cec1266------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 11:58:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ralpholazo/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[Checking If a List Has Items in .NET: Any() vs .Count vs .Length]]></title>
            <link>https://medium.com/@ralpholazo/checking-if-a-list-has-items-in-net-any-vs-count-vs-length-85bf4ca9ee52?source=rss-d5c63cec1266------2</link>
            <guid isPermaLink="false">https://medium.com/p/85bf4ca9ee52</guid>
            <dc:creator><![CDATA[Ralph Olazo]]></dc:creator>
            <pubDate>Fri, 01 Aug 2025 07:36:56 GMT</pubDate>
            <atom:updated>2025-08-01T07:36:56.975Z</atom:updated>
            <content:encoded><![CDATA[<h3>Checking If a List Has Items in .NET: Any() vs .Count vs .Length</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EytP7Ghy56YedSlN" /><figcaption>Photo by <a href="https://unsplash.com/@santesson89?utm_source=medium&amp;utm_medium=referral">Andrea De Santis</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When working with collections in .NET, a common task is to check whether a list or array contains any elements. There are multiple ways to do this, but not all are equal in terms of readability or performance. So, which one should you use?</p><h4>The Usual Options</h4><p>Here are the typical ways developers check if a collection has elements:</p><pre>myList.Any();<br>myList.Count &gt; 0;<br>myArray.Length &gt; 0;</pre><p>At first glance, these seem interchangeable and in many cases, they are. But there are important differences under the hood, especially when working with IEnumerable&lt;T&gt;.</p><h3>Use .Any() for Most Collections</h3><p>.Any() is part of LINQ and is specifically designed to check if any items exist in a collection. It returns true as soon as it finds the first element.</p><pre>if (myList.Any())<br>{<br>    // List has at least one item<br>}</pre><p>This is more than just cleaner syntax it’s also more efficient than .Count for many collection types.</p><p><strong>Why prefer </strong><strong>.Any()?</strong></p><p>✅ More readable and expressive</p><p>✅ Efficient: stops after the first item</p><p>✅ Works on any IEnumerable&lt;T&gt; (including deferred execution)</p><h3>When .Count or .Length Make Sense</h3><p>If you’re dealing with a List&lt;T&gt; or an array, using .Count or .Length is perfectly fine. These properties are constant-time (O(1)) operations and do not involve enumeration.</p><pre>if (myList.Count &gt; 0) { ... }    // For List&lt;T&gt;<br>if (myArray.Length &gt; 0) { ... }  // For arrays</pre><p>However, these should be used when you’re sure about the collection type and you’re not dealing with LINQ queries or deferred execution.</p><h3>Quick Rule of Thumb</h3><p>Collection Type Recommended Check IEnumerable&lt;T&gt; .Any() List&lt;T&gt; .Any() or .Count &gt; 0 Array (T[]) .Length &gt; 0 LINQ / IQueryable&lt;T&gt; .Any()</p><h3>Final Thoughts</h3><p>While .Count &gt; 0 and .Length &gt; 0 are valid in certain contexts, .Any() is generally the better option when checking if a collection has elements. It&#39;s concise, expressive, and efficient—especially when working with LINQ or potentially large or lazy-loaded datasets.</p><p>Keeping your collection checks clean and consistent helps make your code more maintainable and easier for other developers to understand.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85bf4ca9ee52" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Working Together Without Stepping on Toes: Git for Parallel Development]]></title>
            <link>https://towardsdev.com/working-together-without-stepping-on-toes-git-for-parallel-development-7deac14fcab3?source=rss-d5c63cec1266------2</link>
            <guid isPermaLink="false">https://medium.com/p/7deac14fcab3</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Ralph Olazo]]></dc:creator>
            <pubDate>Thu, 10 Apr 2025 09:50:58 GMT</pubDate>
            <atom:updated>2025-04-14T10:22:20.192Z</atom:updated>
            <content:encoded><![CDATA[<p>Imagine you and your friends are building with LEGOs. Sometimes, you’re all working on the main castle, but sometimes, a tower needs fixing <em>right now</em> without stopping everyone else from building the walls. Git helps us do that with code!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4vgOmZw3QGrPXS_o" /><figcaption>Photo by <a href="https://unsplash.com/@yancymin?utm_source=medium&amp;utm_medium=referral">Yancy Min</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>The Worry: Fixing Things While Building</h3><p>You might be worried that if you need to fix a problem in the “finished” LEGO castle (our live website), it will mess up the new cool stuff your friends are adding to a different part of the castle (our ongoing development). That’s a valid worry! But Git has a smart way to handle this.</p><h3>Git’s Secret: Branches are Like Separate Tables</h3><p>Think of Git branches as separate tables where each person can work on their LEGOs without touching anyone else’s.</p><ul><li>main (or master): This is like the table with the current, finished LEGO castle. Only complete and working versions go here.</li><li>develop: This is the main table where everyone puts their new LEGO parts that are still being worked on.</li><li>feature/&lt;name&gt;: If someone is building a new cool gate, they get their own small table just for that gate.</li><li>hotfix/&lt;problem&gt;: If a tower on the main castle is wobbly, we get a small, temporary table <em>starting from the finished castle</em> to fix just that tower.</li></ul><h3>The Hotfix Rescue Mission: A Step-by-Step</h3><p>Let’s say our main LEGO castle (main) is good, but the develop table has lots of new pieces being added. Suddenly, a piece falls off the main castle! We need to fix it without disturbing the develop table.</p><p>Step 1: Make a Copy of the Finished Castle</p><p>We take a snapshot of the main castle and put it on a new, small table called hotfix/wobbly-tower.</p><pre>git checkout main        # Go to the main castle table<br>git pull origin main     # Make sure our copy of the main castle is up-to-date<br>git checkout -b hotfix/wobbly-tower # Create a new table for the fix</pre><p>Step 2: Fix the Wobbly Tower</p><p>On our hotfix/wobbly-tower table, we carefully fix the fallen piece.</p><pre># Make the LEGO fixes here<br>git add .<br>git commit -m &quot;Secure the wobbly tower&quot; # Label our fix</pre><p>Step 3: Put the Fix Back on the Main Castle</p><p>Once the tower is fixed and stable, we carefully put those fixed pieces back onto the main castle. We also mark this version of the castle as slightly updated (like adding a sticker saying &quot;Fixed!&quot;).</p><pre>git checkout main             # Go back to the main castle table<br>git merge --no-ff hotfix/wobbly-tower # Carefully add the fixed tower pieces<br>git tag -a v1.0.1 -m &quot;Castle version 1.0.1 with tower fix&quot; # Add a &quot;Fixed!&quot; sticker<br>git push origin main --tags    # Update the main castle online with the fix and sticker</pre><p>The --no-ff command just makes sure we remember that the fix came from a special &quot;fix table.&quot;</p><p>Step 4: Tell the Builders on the develop Table About the Fix</p><p>We also need to tell the friends working on the develop table about the fixed tower so they include the stronger tower in their new designs.</p><pre>git checkout develop         # Go to the main building table<br>git merge hotfix/wobbly-tower # Add the fixed tower to the ongoing work<br>git push origin develop      # Update the online version of the ongoing work</pre><p>Visualizing It:</p><pre>(Fix Started)<br>          /<br>*--*--*--- (main: v1.0) ---* (hotfix/wobbly-tower)<br>    \                      /<br>     *----*----*----*--- (develop)</pre><p>After the fix:</p><pre>/               \<br>*--*--*---*---------------*--- (main: v1.0.1)<br>    \   /                 /<br>     *---*----*----*----*--- (develop</pre><p>Now, the main castle is fixed, and the ongoing building project will also have the fix.</p><p>Step 5: Clean Up the Fix Table</p><p>Once we’ve updated both the main castle and the ongoing project, we can put away the temporary hotfix/wobbly-tower table.</p><pre>git branch -d hotfix/wobbly-tower</pre><h3>Why This Works</h3><ul><li>Keeping Things Separate: The fix happens without directly changing the ongoing work.</li><li>Stable Main Castle: The main castle always stays in a good, working state.</li><li>Everyone Gets the Fix: Eventually, the fix makes its way into the new parts being built.</li><li>Clear History: We can always see when and why the tower was fixed.</li></ul><h3>Things to Remember</h3><ul><li>Talk to Each Other: Let everyone know when you’re doing a fix.</li><li>Name Things Clearly: Use names like hotfix/ so everyone knows what it is.</li><li>Check Your Work: Always make sure the fix works and doesn’t break anything else.</li></ul><h3>Conclusion: Building Together, Fixing Smoothly</h3><p>Git helps us work on our code LEGOs together, even when we need to fix something urgently. By using separate “tables” (branches), we can keep our finished product stable while still building new and exciting things. It’s all about being organized and working together!</p><p>Key Simplifications:</p><ul><li>Analogy: Using the LEGO building analogy to explain branches and the workflow.</li><li>Simplified Language: Avoiding overly technical terms where possible.</li><li>Focus on the “Why”: Explaining the reasoning behind each step in simpler terms.</li><li>Clearer Steps: Breaking down the process into more digestible actions.</li><li>Reinforcing the Core Idea: Emphasizing the concept of working in isolation and then integrating changes.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7deac14fcab3" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/working-together-without-stepping-on-toes-git-for-parallel-development-7deac14fcab3">Working Together Without Stepping on Toes: Git for Parallel Development</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Minima: Logo Generator]]></title>
            <link>https://medium.com/@ralpholazo/minima-logo-generator-5611c233421b?source=rss-d5c63cec1266------2</link>
            <guid isPermaLink="false">https://medium.com/p/5611c233421b</guid>
            <category><![CDATA[logo-designer]]></category>
            <category><![CDATA[logo-design]]></category>
            <category><![CDATA[logo-designing-services]]></category>
            <category><![CDATA[logo]]></category>
            <dc:creator><![CDATA[Ralph Olazo]]></dc:creator>
            <pubDate>Mon, 04 Nov 2024 20:57:38 GMT</pubDate>
            <atom:updated>2024-11-05T08:18:23.845Z</atom:updated>
            <content:encoded><![CDATA[<h2>Simplify Your Brand: A New Minimalist Logo Generator for Creators and Entrepreneurs</h2><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Md3aATFuERZ74nITTSd_A@2x.jpeg" /><figcaption>Photo by <a href="https://jasonleung.co/">Jason Leung</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In today’s fast-paced digital world, having a logo is essential for building your brand identity. But not everyone has the time or budget to hire a designer or learn complex design tools. That’s why I built Minima— a minimalist logo generator that allows anyone, from creators to entrepreneurs, to craft clean, professional-looking logos in minutes.</p><h3><strong>Why Minimalism?</strong></h3><p>Minimalism in design is more than a trend; it’s a way to communicate clarity, focus, and professionalism. A minimalist logo eliminates clutter, delivering a clear and memorable brand impression. For startups, side projects, and solopreneurs, a minimalistic logo can be the perfect fit. It’s simple, effective, and — most importantly — easy to recognize.</p><h3>What My Logo Generator Offers</h3><p>I designed this logo generator to be straightforward and intuitive. With a few clicks, you can:</p><p><strong>Add Custom Text</strong>: Set your brand name or tagline to reflect your message.</p><p><strong>Select from Icon Options:</strong> Choose from a library of clean, simple icons to represent your brand.</p><p><strong>Personalize Colors:</strong> Change the background, icon, and text colors to match your vision.</p><p><strong>Adjust Font Size and Style:</strong> Make your brand’s name pop with adjustable fonts.</p><p><strong>Preview in Real Time:</strong> See every change instantly, making the design process seamless and fun.</p><h3>Who Can Benefit from Minima?</h3><ol><li>Startup founders who need a quick and clean logo to get started.</li><li>Freelancers and solopreneurs looking to establish their own identity.</li><li>Side project enthusiasts who want to test a new idea without a lot of upfront investment.</li></ol><h3>Creating a Logo in 3 Easy Steps</h3><p>Here’s how simple it is to make your logo with Minima:</p><ol><li>Enter Your Brand’s Name — Set the foundation with text that resonates.</li><li>Pick an Icon — Select a minimalist icon to enhance your message.</li><li>Customize Colors and Fonts — Finalize with colors and typography that make it uniquely yours.</li></ol><h3><strong>Future Plans and Updates</strong></h3><p>This is just the beginning. In the coming months, I plan to add more icon options, advanced customization features, and even AI-driven suggestions to enhance the creative process.</p><h3><strong>Get Started Today!</strong></h3><p>Creating a minimalist logo has always been challenging. Check out Minima and give your brand the identity it deserves without the hassle. Join me on this journey and build a logo representing your vision, values, and creativity.</p><p><a href="https://minimalogo.com/">https://minimalogo.com/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5611c233421b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Choosing Between Record and Class in .NET: When and Why]]></title>
            <link>https://medium.com/@ralpholazo/choosing-between-record-and-class-in-net-when-and-why-35c084958011?source=rss-d5c63cec1266------2</link>
            <guid isPermaLink="false">https://medium.com/p/35c084958011</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Ralph Olazo]]></dc:creator>
            <pubDate>Mon, 28 Oct 2024 13:17:24 GMT</pubDate>
            <atom:updated>2024-10-28T13:17:24.048Z</atom:updated>
            <content:encoded><![CDATA[<h3>Choosing Between Record and Class in .NET: When and Why</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EDckRNO0k1VBRUfh" /><figcaption>Photo by <a href="https://unsplash.com/@miguelalcantara?utm_source=medium&amp;utm_medium=referral">Miguel Alcântara</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When developing in .NET, choosing the right data structure impacts code readability, performance, and maintainability. Records and Classes both serve specific purposes, but they’re suited for different use cases. Here’s a quick guide to understanding their differences and when to use each.</p><h3>Key Differences Between Record and Class</h3><p><strong>Purpose</strong>:</p><ul><li><strong>Records</strong> are optimized for simple, immutable data representations. Think of them as specialized containers for holding data.</li><li><strong>Classes</strong> are designed to model objects with complex behaviors, combining both state and methods.</li></ul><p><strong>Immutability</strong>:</p><ul><li><strong>Records</strong> are immutable by default, meaning once a record is created, its properties can’t change. You can make them mutable, but immutability is the standard.</li><li><strong>Classes</strong> are mutable, which allows their properties and fields to be updated after creation. This is useful when the object’s state needs to change over its lifetime.</li></ul><p><strong>Equality Comparison</strong>:</p><ul><li><strong>Records</strong> implement value-based equality, so two records with the same values are considered equal. This is ideal for data-centric applications where object identity isn’t as important as the data itself.</li><li><strong>Classes</strong> use reference-based equality by default, meaning two instances are only equal if they reference the same memory location. This approach aligns with traditional OOP models.</li></ul><p><strong>Deconstruction</strong>:</p><ul><li><strong>Records</strong> support deconstruction out of the box, letting you easily unpack values from an instance.</li><li><strong>Classes</strong> require manual implementation for deconstruction, making records simpler for tasks focused on data manipulation.</li></ul><h3>When to Use Each?</h3><p><strong>Use a </strong><strong>Record</strong> if:</p><ul><li>You’re working with data transfer objects (DTOs) or other data-centric structures.</li><li>Immutability and value-based equality align with your design goals.</li><li>The object is a simple data carrier without complex behavior.</li></ul><p><strong>Use a </strong><strong>Class</strong> if:</p><ul><li>You need mutable objects that will change over time.</li><li>Reference equality is appropriate, such as with objects tied to specific instances.</li><li>Your objects encapsulate business logic or complex behaviors.</li></ul><h3>Examples</h3><p>Here’s a basic example of a record:</p><pre>public record Product(int Id, string Name);</pre><p>This Product record will treat two instances with the same Id and Name values as equal and is immutable by default. Now, contrast it with a class:</p><pre>public class Product<br>{<br>    public int Id { get; set; }<br>    public string Name { get; set; }<br>}</pre><p>This Product class will consider two instances equal only if they reference the same memory and allows property modification.</p><h3>Conclusion</h3><p>Understanding when to use a record versus a class can streamline your code and help ensure it fits your application’s design. If your structure is a simple, immutable data holder, go with a record. For more complex, mutable objects, class remains the right choice.</p><p>Whether you’re creating data models or building complex objects, this simple distinction can make a big difference in the effectiveness and maintainability of your .NET applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35c084958011" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why you should use IsNullOrWhiteSpace instead of IsNullOrEmpty in C#]]></title>
            <link>https://medium.com/@ralpholazo/why-you-should-use-isnullorwhitespace-instead-of-isnullorempty-in-c-20b38d0ca2d0?source=rss-d5c63cec1266------2</link>
            <guid isPermaLink="false">https://medium.com/p/20b38d0ca2d0</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Ralph Olazo]]></dc:creator>
            <pubDate>Thu, 26 Sep 2024 12:09:27 GMT</pubDate>
            <atom:updated>2024-09-26T12:09:27.086Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/430/0*UcPk6D14iaiBtfsA" /></figure><p>The key difference between string.IsNullOrEmpty and string.IsNullOrWhiteSpace is in what they check for:</p><p><strong>String.IsNullOrEmpty</strong>:</p><ul><li>Returns true if the string is null or an empty string (&quot;&quot;).</li><li><strong>Does not</strong> check for strings that consist only of white-space characters (e.g., &quot; &quot;).</li></ul><p><strong>String.IsNullOrWhiteSpace</strong>:</p><ul><li>Returns true if the string is null, an empty string, or contains only white-space characters (e.g., spaces, tabs, newlines).</li></ul><h3>Example:</h3><pre>string input1 = null;<br>string input2 = &quot;&quot;;<br>string input3 = &quot;   &quot;; // Contains only spaces<br>string input4 = &quot;\t\n&quot;; // Contains only tab and newline characters</pre><pre>Console.WriteLine(string.IsNullOrEmpty(input1)); // True<br>Console.WriteLine(string.IsNullOrEmpty(input2)); // True<br>Console.WriteLine(string.IsNullOrEmpty(input3)); // False<br>Console.WriteLine(string.IsNullOrEmpty(input4)); // False</pre><pre>Console.WriteLine(string.IsNullOrWhiteSpace(input1)); // True<br>Console.WriteLine(string.IsNullOrWhiteSpace(input2)); // True<br>Console.WriteLine(string.IsNullOrWhiteSpace(input3)); // True<br>Console.WriteLine(string.IsNullOrWhiteSpace(input4)); // True</pre><ul><li>string.IsNullOrEmpty only returns true for null or &quot;&quot; (empty string).</li><li>string.IsNullOrWhiteSpace returns true for null, &quot;&quot;, or any string that contains only whitespace characters.</li></ul><p>In most cases, if you want to ensure that a string has meaningful content (not just spaces), you should use string.IsNullOrWhiteSpace.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20b38d0ca2d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Structuring JSON Payloads with JObject in C#]]></title>
            <link>https://medium.com/@ralpholazo/structuring-json-payloads-with-jobject-in-c-74fca155a87b?source=rss-d5c63cec1266------2</link>
            <guid isPermaLink="false">https://medium.com/p/74fca155a87b</guid>
            <category><![CDATA[json]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[nets]]></category>
            <dc:creator><![CDATA[Ralph Olazo]]></dc:creator>
            <pubDate>Wed, 14 Aug 2024 14:21:34 GMT</pubDate>
            <atom:updated>2024-08-14T14:21:34.595Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d6ExfVIO8httu77S1pz6mw@2x.jpeg" /><figcaption>Photo by Carlos Gonzalez on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When working with JSON in C#, you often need to create JSON payloads for sending data in API requests or storing structured information. Instead of manually building JSON strings, using JObject from the Newtonsoft.Json library offers a cleaner, more reliable approach.</p><h3><strong>Why Use JObject?</strong></h3><ul><li><strong>Readability</strong>: JObject provides a structured and clear way to define JSON objects.</li><li><strong>Safety</strong>: It automatically handles escaping special characters, reducing the risk of errors from manual string concatenation.</li><li><strong>Flexibility</strong>: Modifying the JSON structure is easier with JObject—you can add or remove properties without reworking string manipulation logic.</li></ul><h3>Installing Newtonsoft.Json</h3><p>Before using JObject, make sure the Newtonsoft.Json library is installed in your project. You can install it via NuGet Package Manager in Visual Studio or by running the following command in the Package Manager Console:</p><pre>Install-Package Newtonsoft.Json</pre><h3>Creating a JSON Payload Using JObject</h3><p>Consider a scenario where you need to create a JSON payload with properties like name, age, and email. Traditionally, you might use string interpolation:</p><pre>string payload = $&quot;{{\&quot;name\&quot;:\&quot;{name}\&quot;,\&quot;age\&quot;:{age},\&quot;email\&quot;:\&quot;{email}\&quot;}}&quot;;</pre><p>This approach works, but it’s prone to errors, especially if values contain special characters. Instead, you can use JObject:</p><pre>using Newtonsoft.Json.Linq;<br><br>public string CreatePayload(string name, int age, string email)<br>{<br>    var payload = new JObject<br>    {<br>        { &quot;name&quot;, name },<br>        { &quot;age&quot;, age },<br>        { &quot;email&quot;, email }<br>    };<br><br>    return payload.ToString();<br>}</pre><h3>Explanation</h3><p><strong>JObject Initialization</strong>: We create a JObject and use an object initializer to define properties and their values.</p><pre>var payload = new JObject<br>{<br>    { &quot;name&quot;, name },<br>    { &quot;age&quot;, age },<br>    { &quot;email&quot;, email }<br>};</pre><p><strong>Adding Properties</strong>: Each key-value pair is added using { &quot;key&quot;, value }. This makes the code more readable and reduces the chance of errors from manual string concatenation.</p><p><strong>Generating JSON</strong>: Calling payload.ToString() converts the JObject into a properly formatted JSON string.</p><h3>Example Usage</h3><p>Here’s how you might use the CreatePayload method in your code:</p><pre>string name = &quot;John Doe&quot;;<br>int age = 30;<br>string email = &quot;john.doe@example.com&quot;;<br><br>string payload = CreatePayload(name, age, email);<br><br>// Now you can use &#39;payload&#39; in your HTTP requests or other operations</pre><h3>Handling Nested JSON</h3><p>If your JSON structure is more complex, such as having nested objects, you can easily add them using JObject or JArray. For example:</p><pre>var address = new JObject<br>{<br>    { &quot;street&quot;, &quot;123 Main St&quot; },<br>    { &quot;city&quot;, &quot;Anytown&quot; },<br>    { &quot;zipCode&quot;, &quot;12345&quot; }<br>};<br><br>var payload = new JObject<br>{<br>    { &quot;name&quot;, &quot;John Doe&quot; },<br>    { &quot;age&quot;, 30 },<br>    { &quot;email&quot;, &quot;john.doe@example.com&quot; },<br>    { &quot;address&quot;, address }<br>};<br><br>return payload.ToString();</pre><h3>Conclusion</h3><p>Using JObject from the Newtonsoft.Json library is an excellent way to structure your JSON payloads in C#. It improves code readability, minimizes errors, and makes your JSON handling code easier to maintain. If you’re still manually constructing JSON strings, consider switching to JObject for better efficiency and reliability.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74fca155a87b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Reddit and Facebook API Integration for Facebook Pages]]></title>
            <link>https://medium.com/@ralpholazo/automating-reddit-and-facebook-api-integration-for-facebook-pages-4473f4f7b849?source=rss-d5c63cec1266------2</link>
            <guid isPermaLink="false">https://medium.com/p/4473f4f7b849</guid>
            <category><![CDATA[reddit]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[net-core]]></category>
            <category><![CDATA[facebook-api]]></category>
            <dc:creator><![CDATA[Ralph Olazo]]></dc:creator>
            <pubDate>Tue, 19 Mar 2024 17:52:58 GMT</pubDate>
            <atom:updated>2024-03-19T17:52:58.643Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*EiS87Dj0S3-kqlUn" /></figure><p>In today’s digital era, social media managers and content creators constantly seek innovative ways to engage their audience. Specifically, for those managing programming-related pages, sourcing fresh and relatable content is crucial. This article introduces an automation solution that streamlines the sharing of programmer-centric memes, tips, and news from Reddit to Facebook pages, enhancing content diversity and engagement.</p><h4>Purpose</h4><p>The primary goal of integrating Reddit and Facebook APIs is to automate the process of sharing valuable, entertaining, and informative content from subreddits like “r/ProgrammerHumor” directly onto your Facebook page. This automation aims to save time, increase engagement, and provide a steady stream of content that resonates with your audience.</p><p>Since 2016, I have managed a Facebook page dedicated to programmers, boasting 58,000 followers at the time of writing. My passion lies in sharing memes, motivational quotes, funny photos, and videos that resonate with programmers. Additionally, I disseminate helpful tips, the latest trends, and technology news. My discovery of the “r/ProgrammerHumor” subreddit, a treasure trove of programmer-centric memes and content, inspired me to explore sharing these materials on my Facebook page. This article outlines how to automate the process of posting content from Reddit to your Facebook page.</p><h4>Pre-requisites Detailing</h4><p>To successfully implement this automation, the following prerequisites are necessary:</p><ul><li>A Facebook Developer Account: Required to access Facebook’s API.</li><li>Visual Studio: Used for developing the automation script in a supported programming environment.</li><li>Basic Programming Knowledge: Familiarity with C# and API usage is beneficial.</li><li>A Laptop and A Warm Cup of Coffee: Essential tools to fuel your development journey.</li></ul><h4>First Step: Retrieving a Reddit Post</h4><p>I discovered a method to fetch the JSON response of Reddit posts without registration by simply appending .json it to the subreddit URL. For instance, accessing posts from r/redditdev can be achieved via <a href="https://www.reddit.com/r/redditdev.json">https://www.reddit.com/r/redditdev.json</a>. This process utilizes public, read-only APIs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-N3XIyDn93kRbkPj_hkMfg.png" /><figcaption>Sample retrieval of JSON response from Reddit</figcaption></figure><h4>Second Step: Generating a Facebook Access Token</h4><p>To publish posts with photos on your Facebook page, you must generate an app access token. This requires creating an app within your Facebook Developer account. Detailed documentation is available at <a href="https://developers.facebook.com/docs/facebook-login/guides/access-tokens/#apptokens">https://developers.facebook.com/docs/facebook-login/guides/access-tokens/#apptokens</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nbZhk86l9FRHprEQ97RgIQ.png" /><figcaption>Facebook developer app page</figcaption></figure><p>Navigate to the Graph API Explorer (<a href="https://developers.facebook.com/tools/explorer/">https://developers.facebook.com/tools/explorer/</a>) to generate your app access token, ensuring you have the necessary permissions: pages_manage_posts, pages_read_engagement, and pages_show_list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XlgscKwLhKADKwnMgmUpLA.png" /><figcaption>Facebook graph API Explorer to retrieve facebook page feed</figcaption></figure><p>With the access token in hand, you can begin developing the scheduled post-automation program. It’s beneficial to explore additional Graph API endpoints for further customization of your Facebook page. Note: Posts will only be visible to you if your app is in Development mode; switch to Live mode for visibility to your followers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/277/1*5TNo0TqiKfSFIb_2W56jeQ.png" /></figure><p>For the source code, please visit my GitHub repository. Update the FACEBOOK_ACCESS_TOKEN and REDDIT_GROUP_NAME values in the FacebookClient.cs file for personal use.</p><p><a href="https://github.com/ralpholazo24/RedditFacebookAPI">GitHub - ralpholazo24/RedditFacebookAPI</a></p><h4>Feedback and Community Support</h4><p>I welcome feedback and contributions from the community. Whether it’s suggesting improvements, reporting issues, or contributing to the code, your input is invaluable. Please visit my GitHub repository to access the source code, and feel free to fork, star, or contribute to the project. For support or questions, consider joining relevant forums or communities on Reddit and Facebook where developers and social media managers converge to share insights and solutions.</p><h4>Conclusion</h4><p>This guide simplifies the integration process between Reddit and Facebook APIs, facilitating the automated sharing of engaging content on your Facebook page. By following these steps and leveraging community feedback, you can enhance your page’s appeal and engagement, ensuring a vibrant community of programmers and tech enthusiasts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4473f4f7b849" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Recovering Lost Changes After a Git Rebase]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@ralpholazo/recovering-lost-changes-after-a-git-rebase-2b08c2f0aa23?source=rss-d5c63cec1266------2"><img src="https://cdn-images-1.medium.com/max/2600/0*5lDk887kZSbmLSfT" width="4930"></a></p><p class="medium-feed-snippet">Encountering a situation where you&#x2019;ve accidentally aborted a rebase in Git and seemingly lost your changes can be quite alarming&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@ralpholazo/recovering-lost-changes-after-a-git-rebase-2b08c2f0aa23?source=rss-d5c63cec1266------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@ralpholazo/recovering-lost-changes-after-a-git-rebase-2b08c2f0aa23?source=rss-d5c63cec1266------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b08c2f0aa23</guid>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[software]]></category>
            <dc:creator><![CDATA[Ralph Olazo]]></dc:creator>
            <pubDate>Fri, 01 Mar 2024 18:50:03 GMT</pubDate>
            <atom:updated>2024-03-01T18:50:03.925Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[C# SMS Messaging APIs that you can use]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@ralpholazo/c-sms-messaging-apis-that-you-can-use-737afdcdc55b?source=rss-d5c63cec1266------2"><img src="https://cdn-images-1.medium.com/max/2600/0*oIX_sclArLf8opGD" width="6000"></a></p><p class="medium-feed-snippet">Photo by Christian Wiediger on Unsplash</p><p class="medium-feed-link"><a href="https://medium.com/@ralpholazo/c-sms-messaging-apis-that-you-can-use-737afdcdc55b?source=rss-d5c63cec1266------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@ralpholazo/c-sms-messaging-apis-that-you-can-use-737afdcdc55b?source=rss-d5c63cec1266------2</link>
            <guid isPermaLink="false">https://medium.com/p/737afdcdc55b</guid>
            <category><![CDATA[dot-net-framework]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[twilio]]></category>
            <category><![CDATA[net-core]]></category>
            <category><![CDATA[messaging]]></category>
            <dc:creator><![CDATA[Ralph Olazo]]></dc:creator>
            <pubDate>Wed, 05 Oct 2022 20:13:58 GMT</pubDate>
            <atom:updated>2025-08-05T17:07:35.942Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[NET Core CRUD console app connected to local azure table storage]]></title>
            <link>https://medium.com/@ralpholazo/net-core-crud-console-app-connected-to-local-azure-table-storage-ffddefa05d5a?source=rss-d5c63cec1266------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffddefa05d5a</guid>
            <category><![CDATA[azure-table-storage]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[azure-table]]></category>
            <category><![CDATA[net-core]]></category>
            <dc:creator><![CDATA[Ralph Olazo]]></dc:creator>
            <pubDate>Wed, 20 Jul 2022 18:55:15 GMT</pubDate>
            <atom:updated>2022-07-20T18:55:51.119Z</atom:updated>
            <content:encoded><![CDATA[<p>For this tutorial, I will create a CRUD Console App using .NET Core 3.1 that is connected to local azure table storage. This will help you with your local development and testing.</p><p>You need to install :</p><ul><li><a href="http://azure.data.tables/">Azure.Data.Tables</a></li><li>Microsoft Azure Storage Explorer</li><li>Net Core 3.1</li></ul><p>Make sure you have already installed Microsoft Azure Storage Explorer. You can download the installer here: <a href="https://azure.microsoft.com/en-us/features/storage-explorer/">https://azure.microsoft.com/en-us/features/storage-explorer/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z2DECr84XHoAH2Fr0IZr0A.png" /></figure><p>After you install the Azure Storage Explorer, open your visual studio and create a console app and target your framework to .NET Core 3.1</p><p>Then on your NuGet package manager, install <a href="http://azure.data.tables/">Azure.Data.Tables</a></p><p>So the first thing you need to do is to set up the connectivity from your console app to your local azure table storage.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/72195b8dc638f605d4ba446e0c71b1b9/href">https://medium.com/media/72195b8dc638f605d4ba446e0c71b1b9/href</a></iframe><p>For the connectionString, we just need to use “UseDevelopmentStorage=true” for the local connection but you can change it when you have an azure connectionString for the online connectivity.</p><p>The tableName variable can be anything you want. That table will be created if not yet exists when the client.CreateIfNotExists(); is called.</p><p>For this console app, I created a class named as PersonEntity with the interface ITableEntity. ITableEntityis an interface defining the required properties for a table entity model. Custom entity model types must implement this interface.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/719ebf8a7b53bfc20c83b5dcf1806e26/href">https://medium.com/media/719ebf8a7b53bfc20c83b5dcf1806e26/href</a></iframe><p>So let’s start the CRUD Functions.</p><p>For adding the entity it is a straightforward method. Just use the AddEntity from the TableClient and call this method on your Main method after the client.CreateIfNotExists(); call.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/86f57b81a114fba518e657ead143cd3d/href">https://medium.com/media/86f57b81a114fba518e657ead143cd3d/href</a></iframe><p>For updating the entity, You should select your desired record using the GetEntity method with the filter of partitionKey and rowKey, and then after that use the UpdateEntity method to update your record.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e3c4c4515a74e3a41e110a8520357c7/href">https://medium.com/media/9e3c4c4515a74e3a41e110a8520357c7/href</a></iframe><p>For retrieving records, I provide 3 ways how you can format your response. For sure there are many ways to retrieve records on the azure table, but for this tutorial, I provide three ways.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9473721381a16451823714081f573cfb/href">https://medium.com/media/9473721381a16451823714081f573cfb/href</a></iframe><p>Lastly, for deleting records. It is just one line of code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7ee0d2df155bf37e2ce0984b0c2089a6/href">https://medium.com/media/7ee0d2df155bf37e2ce0984b0c2089a6/href</a></iframe><p>For the full solution. Check out my GitHub repo: <a href="https://github.com/ralpholazo24/AzureTable">https://github.com/ralpholazo24/AzureTable</a></p><p>Hope it helps!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffddefa05d5a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>