<?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:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[CSandun Blogs]]></title><description><![CDATA[Dev practices, Techologies, Ideas, Thoughts]]></description><link>http://167.71.237.41/</link><image><url>http://167.71.237.41/favicon.png</url><title>CSandun Blogs</title><link>http://167.71.237.41/</link></image><generator>Ghost 5.26</generator><lastBuildDate>Fri, 27 Mar 2026 17:06:31 GMT</lastBuildDate><atom:link href="http://167.71.237.41/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Coming soon]]></title><description><![CDATA[<p>This is CSandun blog - test one, a brand new site by chathuranga sandun that&apos;s just getting started. Things will be up and running here shortly, but you can <a href="#/portal/">subscribe</a> in the meantime if you&apos;d like to stay up to date and receive emails when new</p>]]></description><link>http://167.71.237.41/coming-soon/</link><guid isPermaLink="false">63b695264151150fd0d5b68b</guid><category><![CDATA[News]]></category><dc:creator><![CDATA[chathuranga sandun]]></dc:creator><pubDate>Thu, 05 Jan 2023 09:15:18 GMT</pubDate><media:content url="https://static.ghost.org/v4.0.0/images/feature-image.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://static.ghost.org/v4.0.0/images/feature-image.jpg" alt="Coming soon"><p>This is CSandun blog - test one, a brand new site by chathuranga sandun that&apos;s just getting started. Things will be up and running here shortly, but you can <a href="#/portal/">subscribe</a> in the meantime if you&apos;d like to stay up to date and receive emails when new content is published!</p>]]></content:encoded></item><item><title><![CDATA[REST API Best Practices with a Mind Map]]></title><description><![CDATA[Summarizing REST API Best Practices with a mind map. REST (Representational State Transfer) is a software architectural style that defines a set of constraints to be used for creating Web services.]]></description><link>http://167.71.237.41/rest-api-best-practices-with-mind-map/</link><guid isPermaLink="false">63b69a3e4151150fd0d5b850</guid><category><![CDATA[REST API]]></category><category><![CDATA[MindMaps]]></category><category><![CDATA[csandun]]></category><dc:creator><![CDATA[Chathuranga]]></dc:creator><pubDate>Thu, 29 Dec 2022 23:29:14 GMT</pubDate><media:content url="http://167.71.237.41/content/images/2022/12/rest-api-best-practices.png" medium="image"/><content:encoded><![CDATA[<img src="http://167.71.237.41/content/images/2022/12/rest-api-best-practices.png" alt="REST API Best Practices with a Mind Map"><p>Summary of the best practices of REST API with a huge mind map.<br>&quot;<a href="https://www.oreilly.com/library/view/rest-api-design/9781449317904/"><strong>REST API Design Rulebook</strong></a>&quot; is a book by <strong>Mark Masse</strong> that provides <strong>guidelines for designing REST APIs</strong>. Here I used it as a reference to define <strong>my rule set </strong>and the best practices.</p><h2 id="introduction">Introduction</h2><p>As a developer, you may find yourself needing to build or consume a REST API at some point in your career. REST APIs are a popular way for systems to <strong>communicate with each other over the we</strong>b, and they offer many benefits such as being <strong>easy to use </strong>and <strong>maintain</strong>. However, it&apos;s important to follow best practices when designing and building a REST API to ensure it is reliable, scalable, and easy to use for clients.</p><p>Unfortunately, not all developers follow best practices when building an API. This can lead to issues such as confusing or inconsistent URL conventions, which can make the API more difficult to use and understand. In this blog post, we&apos;ll cover the most important <strong>best practices</strong> for designing and building a REST API from a developer&apos;s perspective. Here I &#xA0;introduced a set of rules to remember well. As well I designed a huge mind map to store the rules in your brain. By following these best practices, you can build an API that is easy to use and <strong>understand, and avoid common pitfalls </strong>that can lead to frustration for API users.</p><p>&quot;<a href="https://www.oreilly.com/library/view/rest-api-design/9781449317904/">REST API Design Rulebook</a>&quot; is a book by <strong>Mark Masse</strong> that provides guidelines for designing REST APIs. Here I used it as a reference to define my rule set and the best practices.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.oreilly.com/library/view/rest-api-design/9781449317904/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">REST API Design Rulebook</div><div class="kg-bookmark-description">In today&#xE2;??s market, where rival web services compete for attention, a well-designed REST API is a must-have feature. This concise book presents a set of API design rules, drawn primarily &#x2026; - Selection from REST API Design Rulebook [Book]</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.oreilly.com/library/view/static/images/apple-touch-icon.png" alt="REST API Best Practices with a Mind Map"><span class="kg-bookmark-author">O&#x2019;Reilly Online Learning</span><span class="kg-bookmark-publisher">Mark Masse</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://learning.oreilly.com/library/cover/9781449317904/360h/" alt="REST API Best Practices with a Mind Map"></div></a></figure><h2 id="rest-api-mindmap-sharable-image">REST API Mindmap sharable image</h2><figure class="kg-card kg-image-card kg-width-full"><img src="http://167.71.237.41/content/images/2022/12/REST-Api--Best-Practices.png" class="kg-image" alt="REST API Best Practices with a Mind Map" loading="lazy" width="2000" height="2321" srcset="http://167.71.237.41/content/images/size/w600/2022/12/REST-Api--Best-Practices.png 600w, http://167.71.237.41/content/images/size/w1000/2022/12/REST-Api--Best-Practices.png 1000w, http://167.71.237.41/content/images/size/w1600/2022/12/REST-Api--Best-Practices.png 1600w, http://167.71.237.41/content/images/size/w2400/2022/12/REST-Api--Best-Practices.png 2400w"></figure><h2 id="1-what-is-rest-api">1. What is REST API</h2><figure class="kg-card kg-image-card kg-card-hascaption"><img src="http://167.71.237.41/content/images/2022/12/1.png" class="kg-image" alt="REST API Best Practices with a Mind Map" loading="lazy" width="1632" height="1642" srcset="http://167.71.237.41/content/images/size/w600/2022/12/1.png 600w, http://167.71.237.41/content/images/size/w1000/2022/12/1.png 1000w, http://167.71.237.41/content/images/size/w1600/2022/12/1.png 1600w, http://167.71.237.41/content/images/2022/12/1.png 1632w" sizes="(min-width: 720px) 720px"><figcaption>What is REST API</figcaption></figure><p>Here we are discussing, &quot;<strong>What is REST</strong>?&quot;, main <strong>constraints</strong>, and <strong>benefits</strong>. &#xA0;Furthermore here shows how to communicate with clients and servers through HTTP. I am hoping to deep dive into this soon in another blog post.</p><h2 id="2-uri-definition">2. URI Definition</h2><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/12/3.png" class="kg-image" alt="REST API Best Practices with a Mind Map" loading="lazy" width="2000" height="1192" srcset="http://167.71.237.41/content/images/size/w600/2022/12/3.png 600w, http://167.71.237.41/content/images/size/w1000/2022/12/3.png 1000w, http://167.71.237.41/content/images/size/w1600/2022/12/3.png 1600w, http://167.71.237.41/content/images/size/w2400/2022/12/3.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>A <strong>URI (Uniform Resource Identifier)</strong> is a string of characters that identifies a resource on the web. In the context of a REST API, it is common to use URLs to identify resources, as they specify both the name and location of the resource.</p><p>In this section, I put some best practices for using URI. We can discuss this in a more informative way in the near future.</p><h2 id="3-uri-authority-design">3. URI &#xA0;Authority Design</h2><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/12/2-1.png" class="kg-image" alt="REST API Best Practices with a Mind Map" loading="lazy" width="2000" height="1823" srcset="http://167.71.237.41/content/images/size/w600/2022/12/2-1.png 600w, http://167.71.237.41/content/images/size/w1000/2022/12/2-1.png 1000w, http://167.71.237.41/content/images/size/w1600/2022/12/2-1.png 1600w, http://167.71.237.41/content/images/size/w2400/2022/12/2-1.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>In a URI, the authority is the part of the URI that specifies the location of the resource. According to the PDF, there are 4 archetypes for modeling resources in URI. We will discuss this topic in the future more descriptively. Keep in touch with my blog.</p><h2 id="4-uri-path-design">4. URI Path Design </h2><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/12/4.png" class="kg-image" alt="REST API Best Practices with a Mind Map" loading="lazy" width="2000" height="1927" srcset="http://167.71.237.41/content/images/size/w600/2022/12/4.png 600w, http://167.71.237.41/content/images/size/w1000/2022/12/4.png 1000w, http://167.71.237.41/content/images/size/w1600/2022/12/4.png 1600w, http://167.71.237.41/content/images/size/w2400/2022/12/4.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>The path portion of a URI is the part of the URI that follows the authority and specifies the name and location of the resource being accessed. It is important to follow best practices when designing the path of a URI to ensure it is easy to use and understand.<br>This is the most critical section for a backend developer who designs well REST API. I plan to write a blog post on this section soon.</p><h2 id="5-uri-query-design">5. URI Query Design</h2><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/12/5.png" class="kg-image" alt="REST API Best Practices with a Mind Map" loading="lazy" width="2000" height="803" srcset="http://167.71.237.41/content/images/size/w600/2022/12/5.png 600w, http://167.71.237.41/content/images/size/w1000/2022/12/5.png 1000w, http://167.71.237.41/content/images/size/w1600/2022/12/5.png 1600w, http://167.71.237.41/content/images/size/w2400/2022/12/5.png 2400w" sizes="(min-width: 720px) 720px"></figure><p>The query portion of a URI is the part of the URI that follows the path and specifies additional information about the resource being accessed. The query is typically made up of one or more key-value pairs separated by an ampersand (&amp;).</p><p>Here are some best practices for designing the query portion of a URI. I put them much as, possible into this section. Go through the mind map and follow these practices in your code base.</p><h2 id="6-http-methods">6. HTTP Methods</h2><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/12/6.png" class="kg-image" alt="REST API Best Practices with a Mind Map" loading="lazy" width="1602" height="1824" srcset="http://167.71.237.41/content/images/size/w600/2022/12/6.png 600w, http://167.71.237.41/content/images/size/w1000/2022/12/6.png 1000w, http://167.71.237.41/content/images/size/w1600/2022/12/6.png 1600w, http://167.71.237.41/content/images/2022/12/6.png 1602w" sizes="(min-width: 720px) 720px"></figure><p>In the context of a REST API, HTTP methods (also known as &quot;verbs&quot;) are used to specify the desired action to be performed on a resource. This section is the most important one for the developer&apos;s life. Keep in touch with descriptive blog posts on this in the future.</p><h2 id="7-response-codes">7. Response Codes</h2><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/12/7.png" class="kg-image" alt="REST API Best Practices with a Mind Map" loading="lazy" width="1508" height="1380" srcset="http://167.71.237.41/content/images/size/w600/2022/12/7.png 600w, http://167.71.237.41/content/images/size/w1000/2022/12/7.png 1000w, http://167.71.237.41/content/images/2022/12/7.png 1508w" sizes="(min-width: 720px) 720px"></figure><p>In a REST API, HTTP response codes are used to indicate the status of a request. They provide information about whether the request was successful or encountered an error and provide additional information about the nature of the error. </p><p>Here I put most high-level error patterns and usage. We can discuss the most important response codes and other codes in the next couple of blogs.</p><h2 id="8-versioning">8. Versioning</h2><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/12/8.png" class="kg-image" alt="REST API Best Practices with a Mind Map" loading="lazy" width="2000" height="641" srcset="http://167.71.237.41/content/images/size/w600/2022/12/8.png 600w, http://167.71.237.41/content/images/size/w1000/2022/12/8.png 1000w, http://167.71.237.41/content/images/size/w1600/2022/12/8.png 1600w, http://167.71.237.41/content/images/size/w2400/2022/12/8.png 2400w" sizes="(min-width: 720px) 720px"></figure><h2 id="9-client-concerns">9. Client Concerns</h2><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/12/9.png" class="kg-image" alt="REST API Best Practices with a Mind Map" loading="lazy" width="1730" height="1408" srcset="http://167.71.237.41/content/images/size/w600/2022/12/9.png 600w, http://167.71.237.41/content/images/size/w1000/2022/12/9.png 1000w, http://167.71.237.41/content/images/size/w1600/2022/12/9.png 1600w, http://167.71.237.41/content/images/2022/12/9.png 1730w" sizes="(min-width: 720px) 720px"></figure><h2 id="10-documentation">10. Documentation</h2><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/12/10.png" class="kg-image" alt="REST API Best Practices with a Mind Map" loading="lazy" width="1476" height="848" srcset="http://167.71.237.41/content/images/size/w600/2022/12/10.png 600w, http://167.71.237.41/content/images/size/w1000/2022/12/10.png 1000w, http://167.71.237.41/content/images/2022/12/10.png 1476w" sizes="(min-width: 720px) 720px"></figure><p>Documentation is an important part of any REST API. It provides information about the API&apos;s functionality, resources, and available operations, as well as any requirements or restrictions. We will discuss more tools and techniques near future.</p><h2 id="11-hateos">11. HATEOS</h2><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/12/11.png" class="kg-image" alt="REST API Best Practices with a Mind Map" loading="lazy" width="820" height="496" srcset="http://167.71.237.41/content/images/size/w600/2022/12/11.png 600w, http://167.71.237.41/content/images/2022/12/11.png 820w" sizes="(min-width: 720px) 720px"></figure><hr><h2 id="12-resources">12. Resources</h2><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/12/99.png" class="kg-image" alt="REST API Best Practices with a Mind Map" loading="lazy" width="948" height="942" srcset="http://167.71.237.41/content/images/size/w600/2022/12/99.png 600w, http://167.71.237.41/content/images/2022/12/99.png 948w" sizes="(min-width: 720px) 720px"></figure><p>&quot;<a href="https://www.oreilly.com/library/view/rest-api-design/9781449317904/">REST API Design Rulebook</a>&quot; is a book by Mark Masse that provides guidelines for designing REST APIs. Here I used it as the main reference to improve my best practices on REST API.</p><p></p><p>I hope this information has been helpful! Let me know if you have any further questions. I will plan to discuss the above topics from a REST API blog series. Keep in touch on my blog site. Happy Coding!!</p><hr><div class="kg-card kg-callout-card kg-callout-card-grey"><div class="kg-callout-emoji">&#x1F44B;</div><div class="kg-callout-text">I hope you find this content helpful. Keep touching my diaries.<br>Learn something new. Comment your thoughts and share the content.<br>Happy coding!!<br><em>See you again soon. &#x270C;&#x270C;</em></div></div>]]></content:encoded></item><item><title><![CDATA[Optimizing DotNet source code using benchmarking technique using BenchmarkDotNet - Part 1]]></title><description><![CDATA[The benchmarking technique aids in calculating the performance metrics of a single or multiple sections of code in your application. Benchmark can assist you in identifying the parts of your source code that require optimization.]]></description><link>http://167.71.237.41/optimizing-dotnet-source-code-using-benchmarking-technique-using-benchmarkdotnet-part-1/</link><guid isPermaLink="false">63b69a3e4151150fd0d5b84a</guid><category><![CDATA[Asp.Net Core]]></category><category><![CDATA[CSharp]]></category><dc:creator><![CDATA[Chathuranga]]></dc:creator><pubDate>Mon, 26 Dec 2022 19:13:15 GMT</pubDate><media:content url="http://167.71.237.41/content/images/2022/12/Benchmark1.png" medium="image"/><content:encoded><![CDATA[<img src="http://167.71.237.41/content/images/2022/12/Benchmark1.png" alt="Optimizing DotNet source code using benchmarking technique using BenchmarkDotNet - Part 1"><p><strong>The benchmarking technique</strong> aids in<strong> calculating the performance metrics</strong> of a single or multiple sections of code in your application. Benchmark can assist you in identifying the parts of your source code that require optimization.</p><h2 id="whats-a-benchmark">What&apos;s a Benchmark?</h2><p>A <strong>benchmark </strong>is a basic test that delivers a set of quantifiable statistics that can assist you in determining whether or not a modification to your code has increased, decreased, or had no influence on the overall performance. It is essential to have an understanding of the performance metrics that are associated with the methods that make up your application to make use of them during the process of code optimization.</p><h2 id="benefits-of-benchmarking-a-source-code">Benefits of Benchmarking a source code</h2><ul><li><strong>Benchmarking </strong>is the process of comparing the performance of code snippets, usually against a predefined baseline.</li><li><strong>Benchmarking </strong>can assist in <strong>identifying performance bottlenecks in an application</strong>. (By identifying bottlenecks, you can determine the changes needed in your source code to improve the application&apos;s performance and scalability.)</li></ul><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/dotnet/BenchmarkDotNet"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - dotnet/BenchmarkDotNet: Powerful .NET library for benchmarking</div><div class="kg-bookmark-description">Powerful .NET library for benchmarking. Contribute to dotnet/BenchmarkDotNet development by creating an account on GitHub.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Optimizing DotNet source code using benchmarking technique using BenchmarkDotNet - Part 1"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">dotnet</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://repository-images.githubusercontent.com/12191244/e327c900-f194-11e9-8d50-db9acd1690af" alt="Optimizing DotNet source code using benchmarking technique using BenchmarkDotNet - Part 1"></div></a></figure><blockquote><strong><a href="https://github.com/dotnet/BenchmarkDotNet">BenchmarkDotNet</a></strong> helps you to transform methods into benchmarks, track their performance, and share reproducible measurement experiments.</blockquote><p><strong>This is </strong>an<strong> open-source library </strong><em>that can convert your.NET methods into benchmarks, monitor those methods, and gain insights into the performance data collected</em>. It is compatible with both.<strong>NET Framework and.NET Core applications</strong>. <strong>BenchmarkDotNet </strong>can quickly convert your methods into benchmarks, run those benchmarks, and retrieve the benchmarking results. An operation in BenchmarkDotNet terminology involves executing a method decorated with the Benchmark attribute.</p><h2 id="steps-for-benchmarking-code-using-benchmakdotnet">Steps for benchmarking code using BenchmakDotNet</h2><p>To run <strong>BenchmarkDotNet </strong>in your .NET Framework or .NET Core application, you must follow these steps:</p><ol><li><strong>Add the necessary NuGet package</strong></li><li><strong>Add Benchmark attributes to your methods</strong></li><li><strong>Create a BenchmarkRunner instance</strong></li><li><strong>Run the application in Release mode</strong></li></ol><h2 id="practical">Practical</h2><p>Now we can see how to config <strong>BenchmarkDotNet library </strong>in your asp.net core project and try to retrieve some measurements on the selected Scenario.</p><h3 id="considering-scenariostring-builder-vs-string-performance">Considering Scenario - string builder vs. string performance.</h3><p>To learn the <strong>BenchmarkDotNet </strong>library with the asp.net core project, a simple development scenario is utilized here.</p><div class="kg-card kg-callout-card kg-callout-card-purple"><div class="kg-callout-emoji">&#x1F4AD;</div><div class="kg-callout-text"><strong><em>We will compare the string builder and string in terms of performance. Here, we look at how long it takes and how much memory it takes to append 100 characters into a single string.</em></strong></div></div><p>First, let&apos;s create a console application and install the<strong> BenchmarkDotNet NuGet</strong> package.</p><h3 id="create-dotnet-6-console-project-and-add-benchmarkdotnet-library">Create Dotnet 6 Console project and add BenchmarkDotNet library</h3><p>Let&#x2019;s open <a href="https://visualstudio.microsoft.com/vs/" rel="noreferrer noopener">Visual Studio 2022</a> and create a <a href="https://dotnet.microsoft.com/en-us/download/dotnet/6.0" rel="noreferrer noopener">.NET </a>6 based console application. I named it <em>&quot;StringBuilderVsStringBenchmarkDotnet&quot;.</em></p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-23.png" class="kg-image" alt="Optimizing DotNet source code using benchmarking technique using BenchmarkDotNet - Part 1" loading="lazy" width="1187" height="203" srcset="http://167.71.237.41/content/images/size/w600/2022/11/image-23.png 600w, http://167.71.237.41/content/images/size/w1000/2022/11/image-23.png 1000w, http://167.71.237.41/content/images/2022/11/image-23.png 1187w" sizes="(min-width: 720px) 720px"></figure><p>This is the time to install the <a href="https://www.nuget.org/packages/BenchmarkDotNet">BenchmarkDotNet </a>NuGet package into my console application. You can use the command given below to add the package to the console app. This command should be executed from the project directory path.</p><!--kg-card-begin: markdown--><p><code>dotnet add package BenchmarkDotNet</code></p>
<!--kg-card-end: markdown--><p>You can also add NuGet references using Manage NuGet Packages. It will open the dialog as shown below. Search for <code><a href="https://www.nuget.org/packages/BenchmarkDotNet" rel="noreferrer noopener">BenchmarkDotNet</a> </code>and install the package.<br><strong>Note: </strong>Here, I am using <strong><a href="https://www.jetbrains.com/rider/">Rider</a> </strong>as my main IDE.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-24.png" class="kg-image" alt="Optimizing DotNet source code using benchmarking technique using BenchmarkDotNet - Part 1" loading="lazy" width="1337" height="275" srcset="http://167.71.237.41/content/images/size/w600/2022/11/image-24.png 600w, http://167.71.237.41/content/images/size/w1000/2022/11/image-24.png 1000w, http://167.71.237.41/content/images/2022/11/image-24.png 1337w" sizes="(min-width: 720px) 720px"></figure><h2 id="benchmark-code">Benchmark Code</h2><p>This is the complete code for the run <strong>benchmark </strong>methods. Here we implemented two scenarios of methods.</p><div class="kg-card kg-callout-card kg-callout-card-green"><div class="kg-callout-emoji">&#x1F514;</div><div class="kg-callout-text"><em>These couple of methods we want to benchmark. For that, we simply add <strong>[Benchmark] </strong>annotation on top of the method. It is a sign for considering to BenchmarkRunner class.</em><br><br><em>Also,&#xA0;<strong>[MemoryDiagnoser()]</strong>annotation helps to identify the memory heap of a method.</em></div></div><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/cf043751889d50403f77b1679b49ac7b.js"></script><!--kg-card-end: html--><h2 id="running-benchmark-project">Running benchmark project</h2><p>Running the benchmarking application in <strong>release configuration </strong>is a requirement for benchmarking. When building the project, you should ideally have the <strong>optimize option set to true</strong> in <strong>csproj</strong> or the CSC command line.</p><p>Additionally, the process<strong> <u>shouldn&apos;t have a debugger attached</u></strong> to it. This implies that we have two choices whenever we want to run the benchmarking application.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-25.png" class="kg-image" alt="Optimizing DotNet source code using benchmarking technique using BenchmarkDotNet - Part 1" loading="lazy" width="640" height="88" srcset="http://167.71.237.41/content/images/size/w600/2022/11/image-25.png 600w, http://167.71.237.41/content/images/2022/11/image-25.png 640w"></figure><ul><li>Run the application from <strong>Visual Studio/Rider</strong> using <strong>Debug -&gt; Start Without Debugging</strong> (keyboard shortcut<strong> CTRL + F5 </strong>). The configuration should be set to release.</li></ul><!--kg-card-begin: markdown--><ul>
<li>OR the other option is to run the application using .<strong>Net CLI</strong>. While using .Net run command, we should ensure that we add <code>-c release</code> switch to the command.</li>
</ul>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><p><code>dotnet run -p StringBuilderVsStringBenchmarkDotnet.csproj -c Release</code></p>
<!--kg-card-end: markdown--><p>Running this straightforward app might take a few seconds. This is due to BenchmarkDotNet&apos;s <u>repeated launch of the benchmark process</u>.</p><h2 id="result-of-the-test">Result of the test</h2><p>We can then look at the outcomes below. Here is the summary I received on my computer for your reference.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/12/image.png" class="kg-image" alt="Optimizing DotNet source code using benchmarking technique using BenchmarkDotNet - Part 1" loading="lazy" width="639" height="292" srcset="http://167.71.237.41/content/images/size/w600/2022/12/image.png 600w, http://167.71.237.41/content/images/2022/12/image.png 639w"></figure><div class="kg-card kg-callout-card kg-callout-card-red"><div class="kg-callout-emoji">&#x26A0;&#xFE0F;</div><div class="kg-callout-text"><strong>NOTE : </strong>Be aware that in order to perform a benchmark, we must ensure that all programs other than the benchmark process and the default <strong>OS processes are turned off.</strong> Running a benchmark while working in Visual Studio simultaneously can have a negative impact on the benchmark results.</div></div><!--kg-card-begin: markdown--><p>Considering the result set, we should consider two parameters:</p>
<ol>
<li>Mean parameter</li>
<li>Allocated parameter</li>
</ol>
<!--kg-card-end: markdown--><p>The <strong>mean </strong>parameter describes<strong> the average time it takes the method to run.</strong><br>An <strong>allocated </strong>parameter describes <strong>the average allocation of the heap in memory </strong>while the method is running.</p><h2 id="conclusion">Conclusion</h2><p>As we know, in programming technics, &#xA0;We get the expected result from the application.</p><div class="kg-card kg-callout-card kg-callout-card-yellow"><div class="kg-callout-emoji">&#x2139;&#xFE0F;</div><div class="kg-callout-text"><b>StringBuilder shows much-improved performance than the string concatenation. Average execution time and heap are also pretty low than the string concatenation.</b></div></div><p>This article does not cover all of the available features and customization options. However, it should help you get started with this package. If you want to learn more, check out <a href="https://benchmarkdotnet.org/articles/overview.html">their documentation.</a></p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://benchmarkdotnet.org/articles/overview.html"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Overview | BenchmarkDotNet</div><div class="kg-bookmark-description"></div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://benchmarkdotnet.org/logo/icon-32.png" alt="Optimizing DotNet source code using benchmarking technique using BenchmarkDotNet - Part 1"><span class="kg-bookmark-author">BenchmarkDotNet</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://benchmarkdotnet.org/images/v0.12.0/rplot.png" alt="Optimizing DotNet source code using benchmarking technique using BenchmarkDotNet - Part 1"></div></a></figure><h2 id="sample-repository">Sample repository</h2><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/csandun/StringBuilderVsStringBenchmarkDotnet/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - csandun/StringBuilderVsStringBenchmarkDotnet: StringBuilder Vs String BenchmarkDotnet</div><div class="kg-bookmark-description">StringBuilder Vs String BenchmarkDotnet. Contribute to csandun/StringBuilderVsStringBenchmarkDotnet development by creating an account on GitHub.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Optimizing DotNet source code using benchmarking technique using BenchmarkDotNet - Part 1"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">csandun</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/a55e98868bef793817f477c5a726155eb1f88bcce647e1cbddb39e3daf7ba006/csandun/StringBuilderVsStringBenchmarkDotnet" alt="Optimizing DotNet source code using benchmarking technique using BenchmarkDotNet - Part 1"></div></a></figure><hr><h2 id="resources">Resources</h2><ol><li>Intro to Benchmark.net - How To Benchmark C# Code</li></ol><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.youtube.com/watch?v=mmza9x3QxYE"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Intro to Benchmark.net - How To Benchmark C# Code</div><div class="kg-bookmark-description">How efficient is your code? Is the change you just made going to improve your application or not? How do you know? How important was that change? These are q...</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.youtube.com/s/desktop/451d4225/img/favicon_144x144.png" alt="Optimizing DotNet source code using benchmarking technique using BenchmarkDotNet - Part 1"><span class="kg-bookmark-author">YouTube</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://i.ytimg.com/vi/mmza9x3QxYE/maxresdefault.jpg?sqp=-oaymwEmCIAKENAF8quKqQMa8AEB-AH-DoACuAiKAgwIABABGEsgVyhlMA8=&amp;rs=AOn4CLDGYdrQdq-ttLBS1y3QopYnJ-SXpQ" alt="Optimizing DotNet source code using benchmarking technique using BenchmarkDotNet - Part 1"></div></a></figure><p>2. Documentation</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://benchmarkdotnet.org/articles/overview.html"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Overview | BenchmarkDotNet</div><div class="kg-bookmark-description"></div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://benchmarkdotnet.org/logo/icon-32.png" alt="Optimizing DotNet source code using benchmarking technique using BenchmarkDotNet - Part 1"><span class="kg-bookmark-author">BenchmarkDotNet</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://benchmarkdotnet.org/images/v0.12.0/rplot.png" alt="Optimizing DotNet source code using benchmarking technique using BenchmarkDotNet - Part 1"></div></a></figure><p>3. GitHub Repo</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/dotnet/BenchmarkDotNet"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - dotnet/BenchmarkDotNet: Powerful .NET library for benchmarking</div><div class="kg-bookmark-description">Powerful .NET library for benchmarking. Contribute to dotnet/BenchmarkDotNet development by creating an account on GitHub.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Optimizing DotNet source code using benchmarking technique using BenchmarkDotNet - Part 1"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">dotnet</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://repository-images.githubusercontent.com/12191244/e327c900-f194-11e9-8d50-db9acd1690af" alt="Optimizing DotNet source code using benchmarking technique using BenchmarkDotNet - Part 1"></div></a></figure><p></p><div class="kg-card kg-callout-card kg-callout-card-green"><div class="kg-callout-emoji">&#x1F44B;</div><div class="kg-callout-text">I hope you find this content helpful. Keep touching my diaries.<br>Learn something new. Comment your thoughts and share the content.<br>Happy coding!!<br><em>See you again soon. &#x270C;&#x270C;</em></div></div>]]></content:encoded></item><item><title><![CDATA[CSandun's .Net Backend Developer roadmap for 2023]]></title><description><![CDATA[It's the end of 2022, and coming to a new year in your career. Many developers stay in their comfort zone with CRUD operations and basic development technologies. It is time to move with new Dotnet technologies and current industry trends and challenges in 2023.]]></description><link>http://167.71.237.41/csadnun-dotnet-road-map/</link><guid isPermaLink="false">63b69a3e4151150fd0d5b84f</guid><category><![CDATA[Asp.Net Core]]></category><category><![CDATA[MindMaps]]></category><category><![CDATA[CSharp]]></category><category><![CDATA[csandun]]></category><dc:creator><![CDATA[Chathuranga]]></dc:creator><pubDate>Sat, 24 Dec 2022 18:05:56 GMT</pubDate><media:content url="http://167.71.237.41/content/images/2022/12/Roadmap.png" medium="image"/><content:encoded><![CDATA[<img src="http://167.71.237.41/content/images/2022/12/Roadmap.png" alt="CSandun&apos;s .Net Backend Developer roadmap for 2023"><p>It&apos;s the end of 2022, and coming to a new year in your career. Many developers stay in their comfort zone with CRUD operations and basic development technologies. <strong>It is time to move with new Dotnet technologies and current industry trends and challenges in 2023</strong>.</p><h2 id="comfort-zone-of-a-developer">Comfort Zone of a developer</h2><p>As a developer, our <strong>comfort zone</strong> refers to the set of technologies, tools, and practices that a developer is familiar with and comfortable using. It&apos;s natural for us to feel more comfortable and confident when working within our comfort zone, as we are already familiar with the technologies and have had the opportunity to develop our skills in those areas.<br><br>However, we must also be willing to step <strong>outside of our comfort zone </strong>and <strong>learn new technologies and approaches</strong>. This can help us stay with <strong>current industry trends and expand our skillset</strong>, leading to more significant growth.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="http://167.71.237.41/content/images/2022/12/comfort_zone.webp" class="kg-image" alt="CSandun&apos;s .Net Backend Developer roadmap for 2023" loading="lazy" width="640" height="640" srcset="http://167.71.237.41/content/images/size/w600/2022/12/comfort_zone.webp 600w, http://167.71.237.41/content/images/2022/12/comfort_zone.webp 640w"><figcaption>developer comfort zone to growth zone</figcaption></figure><p><strong>To step outside our comfort zone</strong>, we can <strong>learn new technologies, &#xA0;tools, practices, and patterns and collaborate with colleagues with different skill set</strong>s. It is also helpful to <strong>seek opportunities </strong>to work on projects that require new technologies or approaches, as <strong>this can provide a structured and supported way to learn and grow</strong>.</p><h2 id="step-outside-our-comfort-zone-with-a-roadmap">Step outside our comfort zone with a Roadmap</h2><p>For the above, we can learn new things in the coming year, set out of our comfort zone, and gain new challenges. As a Dotnet developer, I created a <strong>roadmap</strong> that is helping <strong>my thoughts and my opinions</strong>. I am doing REST Api-based developments using dot net core. And also I followed cloud technologies and microservices patterns in my carrier. <strong><em>My ideas entirely propose this roadmap; anyone can agree or disagree with me.</em></strong> <em><strong>Also open to suggestions for this. </strong></em><br><br><a href="https://twitter.com/nickchapsas?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor">NickChapsas(@nickchapsas)</a> &#xA0;inspire me to create a roadmap for this year. Based on <a href="https://github.com/Elfocrash/.NET-Backend-Developer-Roadmap">his roadmap,</a> I update my roadmap and I put my opinions into it. </p><div class="kg-card kg-callout-card kg-callout-card-yellow"><div class="kg-callout-emoji">&#x1F4A1;</div><div class="kg-callout-text"><strong><em>I plan to share these technologies in the upcoming year, 2023, via my blogs. Keep in touch with <a href="http://167.71.237.41/">csandunblogs.com</a> and <a href="https://www.linkedin.com/in/csandun/">my LinkedIn</a>.</em></strong></div></div><h2 id="roadmap">Roadmap</h2><p>Coming to the <a href="https://xmind.app/m/zbjpp3/"><strong>roadmap</strong></a>, here is my proposed mind map for Dotnet developers can follow next year.</p><p>Here <strong>red</strong> means <strong>a must know,</strong> <strong>yellow</strong> means <strong>a good to know</strong>, and a <strong>grey</strong> means<strong> maybe</strong>, and I will explain why it is a perhaps as I goand keep in mind that this is very I <strong>opinionated</strong>. This is my take it doesn&apos;t mean that everyone will agree with this. It&apos;s okay; we can disagree, but this is how I would work this, how I would hire and there is room for that.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://xmind.app/m/zbjpp3/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">CSandun&#x2019;s .NET Backend Developer Roadmap in 2023 (1)</div><div class="kg-bookmark-description">Xmind is the most professional and popular mind mapping tool. Millions of people use Xmind to clarify thinking, manage complex information, brainstorming, get work organized, remote and work from home WFH.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://xmind.app/webapp-icon/icon_1024.png" alt="CSandun&apos;s .Net Backend Developer roadmap for 2023"><span class="kg-bookmark-author">Mind Mapping App</span><span class="kg-bookmark-publisher">Xmind Ltd.</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://s3.amazonaws.com/xmindshare/previews/zbjpp3-qyl1R3f-35326.png" alt="CSandun&apos;s .Net Backend Developer roadmap for 2023"></div></a></figure><h2 id="shareable-roadmap-image">Shareable Roadmap Image</h2><figure class="kg-card kg-image-card kg-width-full kg-card-hascaption"><img src="http://167.71.237.41/content/images/2022/12/roadmap-image.png" class="kg-image" alt="CSandun&apos;s .Net Backend Developer roadmap for 2023" loading="lazy" width="2000" height="4542" srcset="http://167.71.237.41/content/images/size/w600/2022/12/roadmap-image.png 600w, http://167.71.237.41/content/images/size/w1000/2022/12/roadmap-image.png 1000w, http://167.71.237.41/content/images/size/w1600/2022/12/roadmap-image.png 1600w, http://167.71.237.41/content/images/size/w2400/2022/12/roadmap-image.png 2400w"><figcaption>CSandun&apos;s .Net Backend Developer Roadmap 2023</figcaption></figure><h2 id="how-to-give-you-contribute-to-improving-the-roadmap">How to give you contribute to improving the roadmap</h2><p>Please share your <strong>thoughts and changes</strong> for this. I can update this with your suggestions. </p><div class="kg-card kg-callout-card kg-callout-card-pink"><div class="kg-callout-emoji">&#x1F30E;</div><div class="kg-callout-text"><strong><em>Please report your ideas and suggestions in the GitHub issues section or Linkedin post comment section.</em></strong></div></div><h3 id="github-repository">GitHub repository</h3><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/csandun/dotnet-roadmap-2023"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - csandun/dotnet-roadmap-2023</div><div class="kg-bookmark-description">Contribute to csandun/dotnet-roadmap-2023 development by creating an account on GitHub.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="CSandun&apos;s .Net Backend Developer roadmap for 2023"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">csandun</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/a2531f63c2b819284cd77b4ef55dd06fb6932c99bb09539109c8f7fd370947f6/csandun/dotnet-roadmap-2023" alt="CSandun&apos;s .Net Backend Developer roadmap for 2023"></div></a></figure><h2 id="thoughts">Thoughts</h2><blockquote>Cheers, It is time to move with new Dotnet technologies and current industry trends and challenges in 2023. Let&apos;s do it in 2023.</blockquote><h2 id="my-inspiration-repositories-and-roadmaps">My inspiration repositories and roadmaps.</h2><ol><li><strong>My .NET backend developer roadmap for 2022</strong></li></ol><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.youtube.com/watch?v=gw-6lKrKlp0"><div class="kg-bookmark-content"><div class="kg-bookmark-title">My .NET backend developer roadmap for 2022</div><div class="kg-bookmark-description">Check out my courses: https://nickchapsas.comBecome a Patreon and get source code access: https://www.patreon.com/nickchapsasHello everybody I&#x2019;m Nick and in ...</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.youtube.com/s/desktop/451d4225/img/favicon_144x144.png" alt="CSandun&apos;s .Net Backend Developer roadmap for 2023"><span class="kg-bookmark-author">YouTube</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://i.ytimg.com/vi/gw-6lKrKlp0/maxresdefault.jpg" alt="CSandun&apos;s .Net Backend Developer roadmap for 2023"></div></a></figure><p>2<strong>. Nick&apos;s .NET Backend Developer Roadmap for 2022</strong></p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/Elfocrash/.NET-Backend-Developer-Roadmap"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - Elfocrash/.NET-Backend-Developer-Roadmap: Nick&#x2019;s Roadmap for a .NET Backend Developer working with Microservices</div><div class="kg-bookmark-description">Nick&amp;#39;s Roadmap for a .NET Backend Developer working with Microservices - GitHub - Elfocrash/.NET-Backend-Developer-Roadmap: Nick&amp;#39;s Roadmap for a .NET Backend Developer working with Microser...</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="CSandun&apos;s .Net Backend Developer roadmap for 2023"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">Elfocrash</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/0755748e2f9c334a2d5b13a279650367d4eeb098ae5406c07e805bac7790c5d6/Elfocrash/.NET-Backend-Developer-Roadmap" alt="CSandun&apos;s .Net Backend Developer roadmap for 2023"></div></a></figure><p>3. ASP.NET Core Developer Roadmap</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/MoienTajik/AspNetCore-Developer-Roadmap"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - MoienTajik/AspNetCore-Developer-Roadmap: Roadmap to becoming an ASP.NET Core developer in 2022</div><div class="kg-bookmark-description">Roadmap to becoming an ASP.NET Core developer in 2022 - GitHub - MoienTajik/AspNetCore-Developer-Roadmap: Roadmap to becoming an ASP.NET Core developer in 2022</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="CSandun&apos;s .Net Backend Developer roadmap for 2023"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">MoienTajik</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://repository-images.githubusercontent.com/169371413/4f1ed800-9df2-11eb-94f8-ba0166f1aa0d" alt="CSandun&apos;s .Net Backend Developer roadmap for 2023"></div></a></figure><div class="kg-card kg-callout-card kg-callout-card-grey"><div class="kg-callout-emoji">&#x1F44B;</div><div class="kg-callout-text">I hope you find this content helpful. Keep touching my diaries.<br>Learn something new. Comment your thoughts and share the content.<br>Happy coding!!<br><em>See you again soon. &#x270C;&#x270C;</em></div></div>]]></content:encoded></item><item><title><![CDATA[Maintain CSS/SCSS  properly using Block Element Modifier (BEM) convention]]></title><description><![CDATA[<p><strong>Block Element Modifier (BEM)</strong> is a naming <strong>convention for classes in CSS</strong>. It is a method for naming CSS classes in a way that makes it easy to understand the relationship between HTML and CSS in a project. It is often used in front-end web developments.</p><h2 id="intro">Intro</h2><p>While working on</p>]]></description><link>http://167.71.237.41/maintain-css-scss-properly-using-block-element-modifier-bem-convention/</link><guid isPermaLink="false">63b69a3e4151150fd0d5b84e</guid><category><![CDATA[css]]></category><category><![CDATA[HTML]]></category><dc:creator><![CDATA[Chathuranga]]></dc:creator><pubDate>Sat, 10 Dec 2022 13:50:33 GMT</pubDate><media:content url="http://167.71.237.41/content/images/2022/12/Untitled---10-December-2022-6.07.09-PM-1.png" medium="image"/><content:encoded><![CDATA[<img src="http://167.71.237.41/content/images/2022/12/Untitled---10-December-2022-6.07.09-PM-1.png" alt="Maintain CSS/SCSS  properly using Block Element Modifier (BEM) convention"><p><strong>Block Element Modifier (BEM)</strong> is a naming <strong>convention for classes in CSS</strong>. It is a method for naming CSS classes in a way that makes it easy to understand the relationship between HTML and CSS in a project. It is often used in front-end web developments.</p><h2 id="intro">Intro</h2><p>While working on some <strong>CSS</strong> work last week, I noticed some unfamiliar symbols are used in CSS files in my current project. I am a bit confused, and I asked our UI Engineer about this. He said it is a naming convention called &quot;<strong>BEM</strong>&quot;. OH! <strong>BEM</strong>? What is BEM?</p><h2 id="why-do-you-want-a-proper-css-naming-convention">Why do you want a proper CSS naming convention?</h2><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/12/66492193_643701849476277_1949713151482134528_n.jpg" class="kg-image" alt="Maintain CSS/SCSS  properly using Block Element Modifier (BEM) convention" loading="lazy" width="824" height="959" srcset="http://167.71.237.41/content/images/size/w600/2022/12/66492193_643701849476277_1949713151482134528_n.jpg 600w, http://167.71.237.41/content/images/2022/12/66492193_643701849476277_1949713151482134528_n.jpg 824w" sizes="(min-width: 720px) 720px"></figure><p><strong>Class naming has always been a challenging part of CSS</strong>. Understanding the functions of developer-specified classes can be difficult for outside developers. When working with a team and repeatedly <strong>reworking code, naming conventions can easily spiral out of control</strong>. The below cases are the most problematic.</p><ul><li>Overriding classes accidentally.</li><li>Hard to read both CSS and HTML has no clear scoping and structure in naming.</li><li>New team members waste time learning about or trying to find already created classes.</li><li>It&apos;s unclear how to handle nesting.</li></ul><p>How can we avoid this headache problem? Is these suitable naming conventions? YES. BEM will help you to manage your CSS classes properly and well maintained.</p><h2 id="what-is-bem-block-element-modifier">What is BEM (Block Element Modifier)</h2><p></p><blockquote><strong>Block Element Modifier (BEM) </strong>is<strong> a naming convention for classes</strong> in CSS. It is a method for naming CSS classes in a way that makes it easy to understand the relationship between HTML and CSS in a project.</blockquote><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/12/bem.png" class="kg-image" alt="Maintain CSS/SCSS  properly using Block Element Modifier (BEM) convention" loading="lazy" width="1080" height="750" srcset="http://167.71.237.41/content/images/size/w600/2022/12/bem.png 600w, http://167.71.237.41/content/images/size/w1000/2022/12/bem.png 1000w, http://167.71.237.41/content/images/2022/12/bem.png 1080w" sizes="(min-width: 720px) 720px"></figure><p>There are three main parts of <strong>BEM</strong>.</p><ol><li><strong>Block: </strong>which holds everything (elements) inside and acts as a scope.</li></ol><!--kg-card-begin: markdown--><p><code>.card {}</code>  and  <code>.button{}</code></p>
<!--kg-card-end: markdown--><p><strong>2. Element: </strong>which acts as a specific part of the component.</p><!--kg-card-begin: markdown--><p><code>.card__title{},  .card__description{},  .card__image{} </code>...</p>
<!--kg-card-end: markdown--><p><strong>3. Modifier: </strong> which adds additional styles to a specific element(s).</p><!--kg-card-begin: markdown--><p><code>.card__buttons--primary{},  .card__buttons--secondery{},  .card__buttons--disabled{}</code> ...</p>
<!--kg-card-end: markdown--><div class="kg-card kg-callout-card kg-callout-card-grey"><div class="kg-callout-emoji">&#x1F4A1;</div><div class="kg-callout-text">The naming convention uses double <strong>underscores (__)</strong> to separate a block from an element and a <strong>double</strong> <strong>hyphen (--)</strong> to separate a block or element from a modifier.</div></div><p>The block represents a high-level component, such as a &quot;<strong>card</strong>&quot; or a &quot;<strong>button</strong>.&quot; The element represents a part of the block, such as the &quot;<strong>card title</strong>&quot; or &quot;<strong>card button</strong>&quot; on a card. The modifier represents a variation on the block or element, such as a &quot;<strong>primary button</strong>&quot; or a &quot;l<strong>arge button.</strong>&quot;</p><h2 id="benefits-of-using-bem">Benefits of using BEM</h2><p>Using BEM you can address most of the above CSS-level naming problems to some extent. Some benefits of using BEM include:</p><ul><li><strong>Improved code readability and maintainability:</strong> By using strict naming conventions and clear rules for defining blocks, elements, and modifiers, BEM makes it easier for developers to understand and work with CSS code.</li><li><strong>Reusability and modularity</strong>: Because BEM blocks are standalone entities that can be used in multiple contexts, it&apos;s easy to reuse them on different pages or in different projects. This can save time and make it easier to build and maintain complex, scalable websites.</li><li><strong>Consistency and predictability</strong>: By using BEM, you can create a consistent, predictable system for naming and organizing your CSS classes. This can make it easier to work on a project as a team and can also make it easier to learn and understand the codebase.</li></ul><h2 id="example">Example</h2><p>Here I am going to develop a card using a BEM naming convention.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/12/bem-1.png" class="kg-image" alt="Maintain CSS/SCSS  properly using Block Element Modifier (BEM) convention" loading="lazy" width="2000" height="2000" srcset="http://167.71.237.41/content/images/size/w600/2022/12/bem-1.png 600w, http://167.71.237.41/content/images/size/w1000/2022/12/bem-1.png 1000w, http://167.71.237.41/content/images/size/w1600/2022/12/bem-1.png 1600w, http://167.71.237.41/content/images/2022/12/bem-1.png 2100w" sizes="(min-width: 720px) 720px"></figure><p>According to the defined class names, I developed a sample in codepen below</p><figure class="kg-card kg-embed-card"><iframe id="cp_embed_qBKwoGy" src="https://codepen.io/csandun/embed/preview/qBKwoGy?default-tabs=css%2Cresult&amp;height=300&amp;host=https%3A%2F%2Fcodepen.io&amp;slug-hash=qBKwoGy" title scrolling="no" frameborder="0" height="300" allowtransparency="true" class="cp_embed_iframe" style="width: 100%; overflow: hidden;"></iframe></figure><h2 id="throughs">Throughs</h2><blockquote>Overall, BEM is a valuable tool for organizing CSS classes, and it can be especially useful for large, complex projects. However, it&apos;s not the only approach, and it&apos;s not necessarily the best fit for every project. It&apos;s up to you to decide whether BEM is the right choice for your specific needs.</blockquote><h2 id="references">References</h2><ol><li>Documentation</li></ol><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://getbem.com/introduction/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">BEM &#x2014; Introduction</div><div class="kg-bookmark-description">Block Element Modifier is a methodology, that helps you to achieve reusable components and code sharing in the front-end.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://getbem.com/favicon.svg" alt="Maintain CSS/SCSS  properly using Block Element Modifier (BEM) convention"><span class="kg-bookmark-publisher">Vsevolod Strukchinsky, Vladimir Starkov and contributors</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://getbem.com/assets/github_captions.3a78c10d_ZfCSDb.jpg" alt="Maintain CSS/SCSS  properly using Block Element Modifier (BEM) convention"></div></a></figure><p>2. BEM Visually Explained &#x1F31F; (recomonded)</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://keepinguptodate.com/pages/2020/05/bem-visually-explained/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">BEM Visually Explained</div><div class="kg-bookmark-description">BEM (Block, Element, Modifier) methodology for naming CSS styles explained with visual examples</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://keepinguptodate.com/images/favicon/apple-touch-icon.png" alt="Maintain CSS/SCSS  properly using Block Element Modifier (BEM) convention"><span class="kg-bookmark-author">Keeping Up To Date</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://keepinguptodate.com/pages/2020/05/03-bem-element-examples.svg" alt="Maintain CSS/SCSS  properly using Block Element Modifier (BEM) convention"></div></a></figure><hr><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F91F;</div><div class="kg-callout-text">I hope you find this content helpful. Keep touching my diaries.<br>Learn something new. Comment your thoughts and share the content.<br>Happy coding!!<br><em>See you again soon. &#x270C;&#x270C;</em></div></div>]]></content:encoded></item><item><title><![CDATA[Tracking Entity Changes With EF Core - Auditing a Web API entity changes - Part 1]]></title><description><![CDATA[Auditing is an essential cross-cutting feature you should implement on your production products. EF Core SavingChangesInterceptor makes it easy.]]></description><link>http://167.71.237.41/tracking-entity-changes-with-ef-core-auditing-a-web-api-entity-changes-part-1-2/</link><guid isPermaLink="false">63b69a3e4151150fd0d5b846</guid><category><![CDATA[Asp.Net Core]]></category><category><![CDATA[EFCore]]></category><category><![CDATA[CSharp]]></category><dc:creator><![CDATA[Chathuranga]]></dc:creator><pubDate>Thu, 17 Nov 2022 05:17:00 GMT</pubDate><media:content url="http://167.71.237.41/content/images/2022/12/Audit--1-.png" medium="image"/><content:encoded><![CDATA[<img src="http://167.71.237.41/content/images/2022/12/Audit--1-.png" alt="Tracking Entity Changes With EF Core - Auditing a Web API entity changes - Part 1"><p>After a couple of busy weeks, I am beginning a new blog series about Auditing a Web API. Here we go ....</p><h2 id="introduction">Introduction</h2><p>If you wanted to<u> <strong>track every change</strong></u> that occurs in an entity in<strong> <u>your domain classes</u></strong>,:<strong> <em>for example</em></strong>, you wanted to record when an entity <u><strong>is created</strong></u>, when it <u>is <strong>modified</strong></u>, who <strong><u>deleted</u> </strong>the entity, and also maybe <u><strong>who was the user who made the change</strong></u> in this practice is called <strong>AUDITING</strong>.</p><p>Here I will show you how you can implement <strong>auditing </strong>in your application with <strong>minimal effort</strong> and how to make it <strong>reusable</strong>. Apart from that, I plan to examine the activities in domain values and behavior changes.</p><p>I decide to write <strong>a couple of articles </strong>to fulfill this requirement.</p><!--kg-card-begin: markdown--><ol>
<li>Make my domain models auditable using <strong><a href="https://learn.microsoft.com/en-us/ef/core/change-tracking/">EF core Change Tracker</a></strong></li>
<li>With <strong><a href="https://github.com/thepirat000/Audit.NET">Audit.Net</a></strong>, generate audit logs with evidence for reconstruction and <strong>examine activities</strong> that have affected specific operations or procedures.</li>
</ol>
<!--kg-card-end: markdown--><p>This article is the <strong>first one of the audit logging series</strong>. Let&apos;s integrate the audit properties into domain models.</p><h2 id="audit-properties-and-audit-events">Audit properties and Audit events</h2><p>As discussed in the Intro paragraph, We can define</p><h3 id="audit-events">Audit events</h3><ul><li>Insert</li><li>Modify</li><li>Delete</li></ul><p>The below properties help to track our audit events in the domain model.</p><h3 id="audit-properties">Audit properties</h3><ul><li>CreatedBy</li><li>CreatedOnUtc</li><li>ModifiedBy</li><li>ModifiedOnUtc</li><li>DeletedBy</li><li>DeletedOnUtc</li></ul><blockquote><strong>Note:</strong> <strong>DeletedBy</strong> and <strong>DeletedOnUtc</strong> properties are always inter-connection with the <strong>soft delete functionality</strong>.<br>* Check out my <a href="http://167.71.237.41/entity-framework-global-query-filter-handle-soft-delete-feature-in-one-place/">Soft delete feature blog post</a> for good connectivity with this article.</blockquote><h2 id="what-is-the-changetracker-in-efcore">What is the ChangeTracker in EfCore</h2><p>The <strong><a href="https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.changetracking.changetracker?view=efcore-6.0">ChangeTracker </a></strong>class in<strong> Entity Framework Core </strong>starts <strong>tracking all the entities as soon as they are retrieved using DbContext until they go out of scope</strong>.</p><p>And EF keeps track of all the changes applied to all the entities and their properties so that it can build and execute appropriate DML statements to the underlying data source.</p><p>The ChangeTracker needs to know about the &quot;<strong>state</strong>&quot; of each object - whether it is new, an existing object that has been modified somehow, or whether it is scheduled for deletion.</p><blockquote class="kg-blockquote-alt"><strong>ChangeTracker tracks your entity state, whether it is new, modified, or deletion.</strong></blockquote><p>The Change Tracker records the <strong>current state of an entity using one of five values:</strong></p><ul><li>Added</li><li>Modified</li><li>Deleted</li><li>Unchanged</li><li>Detached</li></ul><h2 id="implementation">Implementation</h2><p>First of all, our first step is creating a web API with Entity Framework Core as our base code. Usually, I use a<a href="https://github.com/csandun/CSandunWebApiCrudTemplate"> TodoItem project template </a>as the startup sample project. You can find the project template here and check out this blog post that shows how to set it up and how to work.</p><p>Based on the sample <a href="https://github.com/csandun/CSandunWebApiCrudTemplate">Todo Item project</a>, you can continue with me.</p><h3 id="1-create-a-base-class-including-audit-properties">1. Create a base class including audit properties</h3><p>As discussed earlier, I am going to define a <strong>standard interface</strong>, including audit fields.</p><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/f6ff73e73fca5f2dcd77b63e49d18a76.js"></script><!--kg-card-end: html--><h3 id="2-inherit-and-implement-all-properties-in-entity-classes">2. Inherit and implement all properties in entity classes</h3><!--kg-card-begin: markdown--><p>I want to audit the <strong><code>TodoItem</code></strong> class. Here I am implementing from the <strong><code>IAuditableEntity</code></strong> interface.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/00ee593a7e42a0313dc964fa08f55d8b.js"></script><!--kg-card-end: html--><h3 id="3-intercept-the-savechange-method-to-track-the-above-changetracker-states">3. Intercept the SaveChange method to track the above ChangeTracker states.</h3><!--kg-card-begin: markdown--><p>I implement from <a href="https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.diagnostics.savechangesinterceptor?view=efcore-6.0"><strong><code>SaveChangeInterceptor</code></strong></a> and override <a href="https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.diagnostics.savechangesinterceptor.savingchanges?view=efcore-6.0#microsoft-entityframeworkcore-diagnostics-savechangesinterceptor-savingchanges(microsoft-entityframeworkcore-diagnostics-dbcontexteventdata-microsoft-entityframeworkcore-diagnostics-interceptionresult((system-int32)))"><strong><code>SavingChangesAsync()</code></strong></a> method. It is Called at the start of <strong><code>DbContext.SaveChanges</code></strong>.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/180322bfa3dddbde91c5b4a666ca4720.js"></script><!--kg-card-end: html--><p>Here I am processing all of the <strong>auditable entities</strong> available in the change tracker and setting the appropriate values<strong> for the modified</strong> on the date.&apos;</p><p>In the switch statement, identify the actual state of the entities and assign proper values for auditable fields.</p><h3 id="4-register-interceptor-and-inject-to-dbcontext-configurations">4. Register Interceptor and inject to DbContext configurations</h3><!--kg-card-begin: markdown--><p>In <strong><code>program.cs</code></strong> we can add these configurations</p>
<!--kg-card-end: markdown--><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/214c708588a774f446bde872703fc24d.js"></script><!--kg-card-end: html--><h3 id="5-testing-the-application-and-getting-results">5. Testing the application and getting results</h3><p>Last, we can create a request from <strong>PostMan</strong> and check the result in database tables.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/Screenshot-2022-11-18-104613.png" class="kg-image" alt="Tracking Entity Changes With EF Core - Auditing a Web API entity changes - Part 1" loading="lazy" width="1452" height="552" srcset="http://167.71.237.41/content/images/size/w600/2022/11/Screenshot-2022-11-18-104613.png 600w, http://167.71.237.41/content/images/size/w1000/2022/11/Screenshot-2022-11-18-104613.png 1000w, http://167.71.237.41/content/images/2022/11/Screenshot-2022-11-18-104613.png 1452w" sizes="(min-width: 720px) 720px"></figure><h3 id="6-note-add-user-service-to-get-userid">6. <em>Note</em>: &#xA0;Add User Service to get UserId</h3><!--kg-card-begin: markdown--><p>I am using a <strong><code>UserMockSerivce</code></strong>  Class to get <code>UserId</code> and <code>UserDetails</code> who are making changes. You can use your own logic to get user details  (Ex: <strong><code>HTTPContextAccessor</code></strong> with <strong>authentication mechanism</strong>)</p>
<!--kg-card-end: markdown--><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/86b3402cf27a8689a04d06ec4018128f.js"></script><!--kg-card-end: html--><h2 id="though">Though</h2><blockquote><strong><em>Auditing is an essential cross-cutting feature</em></strong><em> you should implement on your production product. You wanted to record every action on every entity.</em><strong><em> It is a must.</em></strong><em> If you implement </em><strong><em>Interceptor</em></strong><em>, you can </em><strong><em>easily </em></strong><em>and </em><strong><em>commonly </em></strong><em>use it in your distributed applications and entities. Also, you do not need to assign values in every place for the auditable properties.</em></blockquote><hr><h2 id="source-code">Source Code</h2><p>You can find the entire code repository below.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/csandun/CSandunWebApiAuditTrail"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - csandun/CSandunWebApiAuditTrail</div><div class="kg-bookmark-description">Contribute to csandun/CSandunWebApiAuditTrail development by creating an account on GitHub.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Tracking Entity Changes With EF Core - Auditing a Web API entity changes - Part 1"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">csandun</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/be230467b4976f3a00622f0ae81e70fad820a37ae312efa1c0b1060a5210318b/csandun/CSandunWebApiAuditTrail" alt="Tracking Entity Changes With EF Core - Auditing a Web API entity changes - Part 1"></div></a></figure><hr><h2 id="references">References</h2><ul><li><a href="https://learn.microsoft.com/en-us/ef/core/change-tracking/">Change Tracking in EF Core | Microsoft Documentation</a></li></ul><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://learn.microsoft.com/en-us/ef/core/change-tracking/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Change Tracking - EF Core</div><div class="kg-bookmark-description">Overview of change tracking for EF Core</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://learn.microsoft.com/favicon.ico" alt="Tracking Entity Changes With EF Core - Auditing a Web API entity changes - Part 1"><span class="kg-bookmark-author">Microsoft Learn</span><span class="kg-bookmark-publisher">ajcvickers</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://learn.microsoft.com/en-us/media/logos/logo-ms-social.png" alt="Tracking Entity Changes With EF Core - Auditing a Web API entity changes - Part 1"></div></a></figure><ul><li><a href="Audit.Net">Audit.Net</a></li></ul><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/thepirat000/Audit.NET"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - thepirat000/Audit.NET: An extensible framework to audit executing operations in .NET and .NET Core.</div><div class="kg-bookmark-description">An extensible framework to audit executing operations in .NET and .NET Core. - GitHub - thepirat000/Audit.NET: An extensible framework to audit executing operations in .NET and .NET Core.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Tracking Entity Changes With EF Core - Auditing a Web API entity changes - Part 1"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">thepirat000</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://repository-images.githubusercontent.com/65263589/194aa880-6172-11e9-9744-bdeb00c06e06" alt="Tracking Entity Changes With EF Core - Auditing a Web API entity changes - Part 1"></div></a></figure><ul><li><a href="https://learn.microsoft.com/en-us/ef/core/logging-events-diagnostics/interceptors">EF Core Interceptor</a></li></ul><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://learn.microsoft.com/en-us/ef/core/logging-events-diagnostics/interceptors"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Interceptors - EF Core</div><div class="kg-bookmark-description">Interception for database operations and other events</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://learn.microsoft.com/favicon.ico" alt="Tracking Entity Changes With EF Core - Auditing a Web API entity changes - Part 1"><span class="kg-bookmark-author">Microsoft Learn</span><span class="kg-bookmark-publisher">ajcvickers</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://learn.microsoft.com/en-us/media/logos/logo-ms-social.png" alt="Tracking Entity Changes With EF Core - Auditing a Web API entity changes - Part 1"></div></a></figure><ul><li><a href="https://www.youtube.com/watch?v=mAlO3OuoQvo">Audit Logging | Milan Jovanovic | Youtube</a></li></ul><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://www.youtube.com/watch?v=mAlO3OuoQvo"><div class="kg-bookmark-content"><div class="kg-bookmark-title">How To Track Entity Changes With EF Core | Audit Logging</div><div class="kg-bookmark-description">Support me on Patreon to access the source code:https://www.patreon.com/milanjovanovicTracking entity changes can be cumbersome to implement. However, with E...</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://www.youtube.com/s/desktop/52707237/img/favicon_144x144.png" alt="Tracking Entity Changes With EF Core - Auditing a Web API entity changes - Part 1"><span class="kg-bookmark-author">YouTube</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://i.ytimg.com/vi/mAlO3OuoQvo/maxresdefault.jpg" alt="Tracking Entity Changes With EF Core - Auditing a Web API entity changes - Part 1"></div></a></figure><hr><div class="kg-card kg-callout-card kg-callout-card-pink"><div class="kg-callout-emoji">&#x1F44B;</div><div class="kg-callout-text">I hope you find this content helpful. Keep touching my diaries. <br>Learn something new. Comment your thoughts and share the content.<br>Happy coding!!<br><em>See you again soon. &#x270C;&#x270C;</em></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[Entity Framework Global Query Filter: Handle soft delete feature in one place.]]></title><description><![CDATA[Entity framework core is a very feature-rich library, and one of the lesser-known features I want to share with you today is Global Query Filters.]]></description><link>http://167.71.237.41/entity-framework-global-query-filter-handle-soft-delete-feature-in-one-place/</link><guid isPermaLink="false">63b69a3e4151150fd0d5b845</guid><category><![CDATA[CSharp]]></category><category><![CDATA[Asp.Net Core]]></category><category><![CDATA[EFCore]]></category><dc:creator><![CDATA[Chathuranga]]></dc:creator><pubDate>Thu, 03 Nov 2022 12:00:00 GMT</pubDate><media:content url="http://167.71.237.41/content/images/2022/12/Queryfilter--1-.png" medium="image"/><content:encoded><![CDATA[<img src="http://167.71.237.41/content/images/2022/12/Queryfilter--1-.png" alt="Entity Framework Global Query Filter: Handle soft delete feature in one place."><p>Entity framework core is a very feature-rich library, and one of the lesser-known features I want to share with you today is <strong><a href="https://learn.microsoft.com/en-us/ef/core/querying/filters">Global Query Filters.</a></strong></p><h2 id="introduction">Introduction</h2><p><strong><a href="https://learn.microsoft.com/en-us/ef/core/querying/filters">Query filters</a> </strong>allow us to specify a <strong>Boolean expression</strong> that will <strong>always be applied when we are querying </strong>the entity we have. Specifying the query filter on the entity will significantly simplify our code. And the significant benefit is that you<strong> can never forget to specify the necessary condition</strong> in the where statement because any framework will<strong> automatically apply it.</strong></p><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F90D;</div><div class="kg-callout-text">This was introduced first in <strong>EF Core 2.0</strong></div></div><h2 id="usecases">UseCases</h2><p>Some typical applications of this feature are:</p><!--kg-card-begin: markdown--><ul>
<li><strong>Soft delete</strong> - An Entity Type defines an <code>IsDeleted</code> property.</li>
<li><strong>Multi-tenancy</strong> - An Entity Type defines a <code>TenantId</code> property.</li>
</ul>
<!--kg-card-end: markdown--><h2 id="how-do-i-introduce-the-global-query-filter-for-soft-delete">How do I introduce the Global Query Filter for Soft Delete?</h2><p>In my career, I used to SoftDelete feature in database entities for audit purposes in my projects.</p><p>Soft-Delete means<br>This means the entity is not actually deleted from the database, but it is updated, and a property &quot;IsDeleted&quot; is marked as <strong>true</strong>.</p><div class="kg-card kg-callout-card kg-callout-card-green"><div class="kg-callout-emoji">&#x1F4A5;</div><div class="kg-callout-text">Soft-Delete means<br>This means the entity is not actually deleted from the database, but it is updated, and a property &quot;IsDeleted&quot; is marked as <strong>true</strong>.</div></div><!--kg-card-begin: markdown--><p>In such applications, in most of the queries which read the data from the database, I always use a where clause with filter, not deleted values in the Query by checking <strong><code>IsDeleted</code></strong> the property is not true. It is a massive headache because I sometimes forget to put in a query.</p>
<!--kg-card-end: markdown--><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/6zfgb6.jpg" class="kg-image" alt="Entity Framework Global Query Filter: Handle soft delete feature in one place." loading="lazy" width="398" height="266"></figure><p>Below is my sample application proposing the <strong>soft delete feature </strong>by defining <strong>every read query</strong>. You see, it is a lazy way to handle every Query.</p><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/eaf1e98ea3fff659025be257a9923f7d.js"></script><!--kg-card-end: html--><p>Here we are going to examine the <strong>SQL statement</strong> that the Entity framework has generated and sent to the database. Highlighted condition is generated from the <strong>isDelete </strong>state.</p><!--kg-card-begin: markdown--><p>I used <code>GetTodoItems</code> endpoint. Throughout this blog, I am checking this to generate SQL queries.</p>
<!--kg-card-end: markdown--><figure class="kg-card kg-image-card"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEhW3P94QuTWYDqHMbkNCI85HR5xcBMNW5FVe3T5tLbSM0VpSozANTw2x4XZd_xwhS3jHcS4PBpkIDXVlSWxOy5BbP7Biq_Lmhay5sG1rHWCsGzmfisuDffN2a85749s9yV4hD5lO1OnQXBvdN47Ob2CP-3VHkyHLIeHZRnEeITaJgauzykK2xnqB9O-"><img src="https://blogger.googleusercontent.com/img/a/AVvXsEhW3P94QuTWYDqHMbkNCI85HR5xcBMNW5FVe3T5tLbSM0VpSozANTw2x4XZd_xwhS3jHcS4PBpkIDXVlSWxOy5BbP7Biq_Lmhay5sG1rHWCsGzmfisuDffN2a85749s9yV4hD5lO1OnQXBvdN47Ob2CP-3VHkyHLIeHZRnEeITaJgauzykK2xnqB9O-=w640-h86" class="kg-image" alt="Entity Framework Global Query Filter: Handle soft delete feature in one place." loading="lazy" width="640" height="86"></a></figure><p>You can download <strong><a href="https://github.com/csandun/CSandunBlogQueryFilterEfCoreApi/releases/tag/StartStatusV1">starting stage</a></strong> code in <strong>git TAG</strong>.</p><p>To avoid this robust way now, I habited to use the <strong>Global Query Filter </strong>feature available in Entity framework core to specify the same condition and going to be applied in all the queries that any reference sends to the database for the entity.</p><h2 id="how-we-use-the-global-query-filters">How we use the Global Query Filters<br></h2><p>You can configure<strong> query filters</strong> to an entity in <strong>two ways.</strong></p><!--kg-card-begin: markdown--><ul>
<li><strong>In <code>OnModelCreating</code> method of the DbContext.</strong></li>
<li><strong>In the <code>EntityTypeConfiguration&lt;T&gt;</code> class related to entity T.</strong></li>
</ul>
<!--kg-card-end: markdown--><p>Here I am defining <strong>soft delete filter negation</strong> in the <strong>DbContext </strong>against to <strong>TodoItem </strong>entity. I used to <strong><a href="https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.metadata.builders.entitytypebuilder.hasqueryfilter?view=efcore-6.0">HasQueryFilter</a> </strong>method to register the condition with the <strong>entity</strong>.</p><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/0fa42fd35dbb9b58641f1e6b03e4af50.js"></script><!--kg-card-end: html--><!--kg-card-begin: markdown--><p>Now we can check again <code>GetTodoItems</code> endpoint SQL query.</p>
<!--kg-card-end: markdown--><figure class="kg-card kg-image-card"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEi-s_r3qKQ_mi0rlERw65UdaY7cqBSOkQV3wprknQ9DhmFRo1u4OIkVMNX2HKFj7C3kreUWBA19j9qWfGBHGEv8uLUyvEEi448lj2jaQQgKux7refFGTP5awL_F0aqZcu9iAxBu9hIQs_6BW80wtiqt13zGzgjN68Vt6jYK7cZO-UJ7EBovH9GIIhSC"><img src="https://blogger.googleusercontent.com/img/a/AVvXsEi-s_r3qKQ_mi0rlERw65UdaY7cqBSOkQV3wprknQ9DhmFRo1u4OIkVMNX2HKFj7C3kreUWBA19j9qWfGBHGEv8uLUyvEEi448lj2jaQQgKux7refFGTP5awL_F0aqZcu9iAxBu9hIQs_6BW80wtiqt13zGzgjN68Vt6jYK7cZO-UJ7EBovH9GIIhSC=w640-h86" class="kg-image" alt="Entity Framework Global Query Filter: Handle soft delete feature in one place." loading="lazy" width="640" height="86"></a></figure><p>Here we can see <strong>IsDelete condition is in the Query.</strong></p><h2 id="how-do-we-get-rid-of-the-implicitly-applied-query-filter">How do we get rid of the implicitly applied Query Filter?</h2><p>It is more straightforward than you think. You need to chain a call to the <strong><a href="https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.entityframeworkqueryableextensions.ignorequeryfilters?view=efcore-6.0">IgnoreQueryFilters()</a></strong> method; what this method is going to do is it going to tell the framework that this Query should not have any query filters applied to it.</p><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/ad36e4dc8753d854d54f762f8978c356.js"></script><!--kg-card-end: html--><!--kg-card-begin: markdown--><p>Checking again <code>GetTodoItems</code> endpoint SQL query.</p>
<!--kg-card-end: markdown--><figure class="kg-card kg-image-card"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjgD1gJyL5J-3b6LpFZzJ8Opfmtspa4LwQ3mZsRyQRDnwTuEnmwZtShgjYAKDgv-rEdZURxTMMPYIBfzDKdRhz_SCigFOsPWPGTuVROKG3hqq-vKWpKKb6YnrCmyjtgvhunlWB7md9FlFE26PTikYHvgPqQ_T_NBBjUg3ziT9EOIwbFfMaUlF4zjHdi"><img src="https://blogger.googleusercontent.com/img/a/AVvXsEjgD1gJyL5J-3b6LpFZzJ8Opfmtspa4LwQ3mZsRyQRDnwTuEnmwZtShgjYAKDgv-rEdZURxTMMPYIBfzDKdRhz_SCigFOsPWPGTuVROKG3hqq-vKWpKKb6YnrCmyjtgvhunlWB7md9FlFE26PTikYHvgPqQ_T_NBBjUg3ziT9EOIwbFfMaUlF4zjHdi=w640-h60" class="kg-image" alt="Entity Framework Global Query Filter: Handle soft delete feature in one place." loading="lazy" width="640" height="60"></a></figure><p>Notice that in the where statement here, there is <strong>no longer the condition</strong> that the IsDelete condition <strong>ignores from the Query</strong>. The Entity Framework is not applying the query filter to this specific Query. But the other queries are filtered with the query filter.</p><h2 id="another-usecase">Another Usecase</h2><p>Another usage can be in a<strong> multi-tenant</strong> application, where each query should return the data associated with the current <strong>tenant</strong> only.</p><h2 id="my-thoughts">My thoughts</h2><blockquote>Most of the time, there are business query patterns that will apply <strong>globally to some entities in your application</strong> by employing<strong> Query Filters </strong>of <strong>EF Core</strong>, you could simply and easily implement the such requirement.</blockquote><hr><h3 id="source-code">Source Code</h3><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/csandun/CSandunBlogQueryFilterEfCoreApi"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - csandun/CSandunBlogQueryFilterEfCoreApi</div><div class="kg-bookmark-description">Contribute to csandun/CSandunBlogQueryFilterEfCoreApi development by creating an account on GitHub.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Entity Framework Global Query Filter: Handle soft delete feature in one place."><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">csandun</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/ac1ab875ced154a026cdd11dac8a969da4be9bc241a1c98fa3499e902f1675c9/csandun/CSandunBlogQueryFilterEfCoreApi" alt="Entity Framework Global Query Filter: Handle soft delete feature in one place."></div></a></figure><p>I tagged this repository for<strong><em> each stage that I explained here</em></strong>. You can check each tag and get some experience at each stage. <br></p><figure class="kg-card kg-image-card kg-card-hascaption"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEiryDauaTWmlcnNBS1GP0Owy5TAOZw4Bl005rT7WV5ErAzaTbp4dtRbs94lNwp9TPnMQFLIshs67V7lIXd55DVfaLfZHsPMYpq1t8gMNkaYBiycdVuxYd6qUJ37L9b2cS94Ru9coZFUQ8S-F3WyvKsMuNureISI-6w-QgvqcMubNfHwoHNd4moAt-ly"><img src="https://blogger.googleusercontent.com/img/a/AVvXsEiryDauaTWmlcnNBS1GP0Owy5TAOZw4Bl005rT7WV5ErAzaTbp4dtRbs94lNwp9TPnMQFLIshs67V7lIXd55DVfaLfZHsPMYpq1t8gMNkaYBiycdVuxYd6qUJ37L9b2cS94Ru9coZFUQ8S-F3WyvKsMuNureISI-6w-QgvqcMubNfHwoHNd4moAt-ly=w400-h337" class="kg-image" alt="Entity Framework Global Query Filter: Handle soft delete feature in one place." loading="lazy" width="400" height="337"></a><figcaption>tags</figcaption></figure><p></p><h2 id="references">References<br></h2><h3 id="global-query-filters-documentation">Global Query Filters Documentation</h3><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://learn.microsoft.com/en-us/ef/core/querying/filters"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Global Query Filters - EF Core</div><div class="kg-bookmark-description">Using global query filters to filter results with Entity Framework Core</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://learn.microsoft.com/favicon.ico" alt="Entity Framework Global Query Filter: Handle soft delete feature in one place."><span class="kg-bookmark-author">Microsoft Learn</span><span class="kg-bookmark-publisher">maumar</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://learn.microsoft.com/en-us/media/logos/logo-ms-social.png" alt="Entity Framework Global Query Filter: Handle soft delete feature in one place."></div></a></figure><p><br>I hope you find this content helpful. Keep touching my diaries. Learn something new. Comment your thoughts and share the content.</p><p>Happy coding!!</p><p><em><strong>See you again soon.</strong> &#x270C;&#x270C;</em></p>]]></content:encoded></item><item><title><![CDATA[Log your time automatically using Jira and the Shortcuts app (Apple iOS)]]></title><description><![CDATA[Logging your time automatically using the Jira app and the iOS shortcuts app in apple.]]></description><link>http://167.71.237.41/log-your-time-automatically-using-jira-and-the-shortcuts-app-apple-ios/</link><guid isPermaLink="false">63b69a3e4151150fd0d5b847</guid><category><![CDATA[Productivity]]></category><category><![CDATA[Jira]]></category><dc:creator><![CDATA[Chathuranga]]></dc:creator><pubDate>Thu, 27 Oct 2022 05:40:00 GMT</pubDate><media:content url="http://167.71.237.41/content/images/2022/12/Shortcut--1-.png" medium="image"/><content:encoded><![CDATA[<figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/jirashortcutslove--1-.png" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="1440" height="368" srcset="http://167.71.237.41/content/images/size/w600/2022/11/jirashortcutslove--1-.png 600w, http://167.71.237.41/content/images/size/w1000/2022/11/jirashortcutslove--1-.png 1000w, http://167.71.237.41/content/images/2022/11/jirashortcutslove--1-.png 1440w" sizes="(min-width: 720px) 720px"></figure><img src="http://167.71.237.41/content/images/2022/12/Shortcut--1-.png" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)"><p><strong><a href="https://support.apple.com/en-lk/guide/shortcuts/welcome/ios">The shortcuts app</a></strong> boosts your productivity in day-to-day life tasks quickly. As developers, we would like to do things quickly and easily in our lives. I believe that time logging is a hectic and horrible task for every developer at the end of his working day. If you have some <strong>easy mechanism</strong>, you will be happy with that.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/omg-wow.gif" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="220" height="220"></figure><p>I will show you how I log my time automatically using the<a href="https://apps.apple.com/us/app/jira-cloud-by-atlassian/id1006972087"> <strong>Jira app</strong></a> and the<strong> <a href="https://apps.apple.com/us/app/shortcuts/id915249334">iOS shortcuts app</a> in apple</strong>.</p><div class="kg-card kg-callout-card kg-callout-card-pink"><div class="kg-callout-emoji">&#x1F4F1;</div><div class="kg-callout-text"><strong>&#x1F4A5;Note:</strong><br><b>Shortcuts app requires iOS 12.0 or later with iPhone, iPad, or iPad touch.</b><br><br><b>If you have the above requirement, you can install <a href="https://apps.apple.com/us/app/shortcuts/id915249334">the Shortcuts app</a> and <a href="https://apps.apple.com/us/app/jira-cloud-by-atlassian/id1006972087">Jira Cloud by Atlassian</a> from the apple app store.</b></div></div><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://apps.apple.com/us/app/shortcuts/id915249334"><div class="kg-bookmark-content"><div class="kg-bookmark-title">&#x200E;Shortcuts</div><div class="kg-bookmark-description">&#x200E;Siri Shortcuts deliver a quick way to get things done with your apps with just a tap or by asking Siri. The Shortcuts app enables you to create personal shortcuts with multiple steps from your favorite apps. Start from hundreds of examples in the Gallery or drag and drop to create your own. Short&#x2026;</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://apps.apple.com/favicon.ico" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)"><span class="kg-bookmark-author">App Store</span><span class="kg-bookmark-publisher">Apple</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://is5-ssl.mzstatic.com/image/thumb/Purple113/v4/3e/52/07/3e520776-0908-893c-2248-6c9d29a03cc7/AppIcon-0-1x_U007emarketing-0-0-GLES2_U002c0-512MB-sRGB-0-0-0-85-220-0-0-0-7.png/1200x630wa.png" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)"></div></a></figure><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://apps.apple.com/us/app/jira-cloud-by-atlassian/id1006972087"><div class="kg-bookmark-content"><div class="kg-bookmark-title">&#x200E;Jira Cloud by Atlassian</div><div class="kg-bookmark-description">&#x200E;Track tasks, manage projects, collaborate on-the-go. Create, update, edit, plan, track, analyze &#x2013; all in the palm of your hand with the Jira mobile app by Atlassian. It&#x2019;s the accelerated collaboration tool for teams, including software teams, service delivery teams, ITSM teams, and DevOps. MOVE W&#x2026;</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://apps.apple.com/favicon.ico" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)"><span class="kg-bookmark-author">App Store</span><span class="kg-bookmark-publisher">Atlassian</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://is1-ssl.mzstatic.com/image/thumb/Purple122/v4/88/ba/02/88ba0254-fe63-cba3-4dc3-41259ec6883a/AppIcon-0-1x_U007emarketing-0-7-0-85-220.png/1200x630wa.png" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)"></div></a></figure><h2 id="what-is-the-shortcuts-app">What is the Shortcuts app?</h2><p>A <em><strong>shortcut</strong></em> is a quick way to get one or more tasks done with your apps. The Shortcuts app lets you create your shortcuts with multiple steps.</p><blockquote class="kg-blockquote-alt"><strong><em>Shortcuts can automate your various occasions.</em></strong></blockquote><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F60D;</div><div class="kg-callout-text"><strong>For example:</strong> <br>Getting directions to the next event on your Calendar, moving text from one app to another, generating expense reports, and more.</div></div><h2 id="what-you-can-be-made-from-jira-and-shortcuts-apps">What you can be made from Jira and Shortcuts apps</h2><ul><li><strong>Issue template</strong>: Do you create similar Jira issues for each new sprint? Build a shortcut that creates the issues automatically for you.</li><li><strong>Generate and attach reports</strong>: Download the latest analytics data, convert it to a PDF and attach it to the selected Jira issue with the tap of a button.</li><li><strong>Log time</strong>: You can log time from Siri dictating or several small clicks</li><li><strong>View Issues:</strong> You can view assigned issues and export your to-do app.</li><li><strong>Run JQL</strong>: Known as <strong>Jira Query Language</strong>. The advanced search allows you to build structured queries using the Jira Query Language (JQL) to search for issues.</li></ul><p>And many.</p><p>Jira supports these actions also combined with shortcut apps.</p><p>Today I am using <strong>Run JQL and Log work actions </strong>in my shortcut.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-3.png" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="946" height="2048" srcset="http://167.71.237.41/content/images/size/w600/2022/11/image-3.png 600w, http://167.71.237.41/content/images/2022/11/image-3.png 946w" sizes="(min-width: 720px) 720px"></figure><p></p><h2 id="usecase-of-my-work-log-shortcut">Usecase of my work log shortcut</h2><p><strong>Jira&apos;s time-tracking functionality</strong> is crucial for many users. The precise amount of time spent on a ticket can be utilized for billing, to improve future job estimates, or simply as a general feedback mechanism.<br><br><strong>As a developer,</strong> every day, I should log my work at the end of the day for <strong>the Jira task </strong>that is assigned to me. Every day I went to the Jira web portal and searched for my assigned tickets, and logged time for each and everyone I worked. This was<strong> very repetitive</strong> and <strong>habited work </strong>for me every day.</p><p><strong>Think &#xA0;I have assigned a list of Jira tasks for today. From the list, you want only select the issue on which you log the work. That&apos;s it; automatically add an 8-hour time record for the selected ticket; how it is simple.</strong></p><p><strong>This is my basic shortcut which is used to log work in Jira.</strong></p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/ezgif.com-gif-maker.gif" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="600" height="488" srcset="http://167.71.237.41/content/images/2022/11/ezgif.com-gif-maker.gif 600w"></figure><h2 id="how-do-i-create-shortcut">How do I create shortcut</h2><p>Here I am using <strong>JQL</strong> to list down my tasks.</p><p><strong><a href="https://www.atlassian.com/blog/jira-software/jql-the-most-flexible-way-to-search-jira-14#:~:text=JQL%20stands%20for%20Jira%20Query,project%20managers%2C%20and%20business%20users.">JQL</a> - Known</strong> as s <strong>Jira Query Language</strong>. The advanced search allows you to build structured queries using the Jira Query Language (JQL) to search for issues. <br>I have 3 tickets assigned to me. They are currently in<strong> To-Do</strong> and <strong>In-progress</strong> status.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-5.png" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="388" height="444"></figure><h3 id="1-create-a-starter-shortcut">1. &#xA0;Create a Starter Shortcut</h3><p>From the starter shortcut section, create a new one.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-6.png" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="337" height="400"></figure><h3 id="2-add-starter-action-with-jql-and-get-the-ticket-list">2. Add starter action with JQL and get the ticket list.</h3><p>Then press<strong> Add Action</strong> button.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-7.png" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="320" height="151"></figure><p>From the app list, search the<strong> Jira app</strong> and choose it. Then you will meet <strong>the available actions.</strong> From actions, the<strong> Run JQL action</strong> is our starter action.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-8.png" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="185" height="400"></figure><p>Also, you need to add the correct<strong> JQL query</strong> from your <strong>Jira web portal</strong>. You can get the JQL from Navigate.</p><blockquote><em>Project &gt; Filters &gt; My open issues &gt; Switch to JQL</em></blockquote><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-9.png" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="640" height="236" srcset="http://167.71.237.41/content/images/size/w600/2022/11/image-9.png 600w, http://167.71.237.41/content/images/2022/11/image-9.png 640w"></figure><p>Put your <strong>JQL </strong>into action and set your <strong>account </strong>and <strong>site details</strong> below.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-10.png" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="185" height="400"></figure><p>You can see <strong>the assigned ticket list</strong> below when you run the shortcut.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-11.png" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="185" height="400"></figure><h3 id="3-then-add-the-choose-from-list-action">3. Then add the &quot;Choose from List&quot; action</h3><p>You can select the &quot;<strong>Choose from List</strong>&quot; &#xA0;action.<br>Add <strong>the Issues variable</strong> to the <strong>list</strong>.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-12.png" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="185" height="400"></figure><p>You can see the assigned ticket list in a selectable menu when you run the shortcut.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-13.png" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="185" height="400"></figure><h3 id="4-add-the-log-work-action">4. Add the &quot;Log Work&quot; action.</h3><p>Give a selected item as a task, and you can put hours and comments as below.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-15.png" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="185" height="400"></figure><h3 id="5-added-an-information-dialog-at-last">5. Added an information dialog at last</h3><p>After that auditing purpose, I added an <strong>information dialog</strong> at last.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-16.png" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="320" height="241"></figure><p>It will help to execute the shortcut at once efficiently.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-17.png" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="320" height="118"></figure><h3 id="6-tip-you-can-add-this-shortcut-as-a-home-item">6. Tip: &#xA0; You can add this shortcut as a Home item</h3><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-20.png" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="185" height="400"></figure><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-19.png" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="320" height="255"></figure><p>Lastly, Jira tickets are updated with an <strong>8-hour </strong>time entry.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-21.png" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="400" height="158"></figure><p>This is <strong>an essential starter shortcut </strong>I have introduced. <em>Many actions will help you to enhance your requirements smartly. Try to build your shortcut using the actions and apps.</em> You can use <strong>Siri </strong>to <strong>dictate/input</strong> the workflow. Also, you can integrate<strong> a time log app</strong> with this shortcut.<em> Open your mind and create workflows smartly and spend your time productively.</em></p><hr><h2 id="references">References</h2><ul><li><a href="https://community.atlassian.com/t5/Jira-Mobile-Apps-articles/Feature-sneak-peek-Create-Jira-shortcuts-using-Apple-s-Shortcuts/ba-p/1342466">Feature sneak peek: Create Jira shortcuts using Apple&#x2019;s Shortcuts app</a></li></ul><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://community.atlassian.com/t5/Jira-Mobile-Apps-articles/Feature-sneak-peek-Create-Jira-shortcuts-using-Apple-s-Shortcuts/ba-p/1342466"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Feature sneak peek: Create Jira shortcuts using Apple&#x2019;s Shortcuts app</div><div class="kg-bookmark-description">Who doesn&#x2019;t like a good shortcut? (Unless we&#x2019;re talking about an unintentional slip of the hair clippers.) At Atlassian, we strive to create software that gets out of your way, lets you do stuff faster, and makes your work-life easier. So with that in mind, let us show you a sneak peek of a feature&#x2026;</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://community.atlassian.com/html/@8A69F121B6FF04AEDAA450033451D3DA/assets/favicon-32x32.png" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)"><span class="kg-bookmark-author">Atlassian Community</span><span class="kg-bookmark-publisher">Simon Stiefel</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://community.atlassian.com/t5/image/serverpage/image-id/91749i3B1834C1BBAC23FD?v=v2" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)"></div></a></figure><p><strong>If you create a new shortcut, please share it with us.</strong></p><hr><div class="kg-card kg-callout-card kg-callout-card-yellow"><div class="kg-callout-emoji">&#x1F44B;</div><div class="kg-callout-text">I hope you find this content helpful. Keep touching my diaries. Learn something new.<br> Comment your thoughts and share the content.<br><br>Happy coding!!<br><em>See you again soon. &#x270C;&#x270C;</em></div></div><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/jirashortcutslove-1.png" class="kg-image" alt="Log your time automatically using Jira and the Shortcuts app (Apple iOS)" loading="lazy" width="1440" height="368" srcset="http://167.71.237.41/content/images/size/w600/2022/11/jirashortcutslove-1.png 600w, http://167.71.237.41/content/images/size/w1000/2022/11/jirashortcutslove-1.png 1000w, http://167.71.237.41/content/images/2022/11/jirashortcutslove-1.png 1440w" sizes="(min-width: 720px) 720px"></figure>]]></content:encoded></item><item><title><![CDATA[Difference between two lists using ChangeTracker<T1, T2> class]]></title><description><![CDATA[ChangeTracker class helps to identify Added Items, Removed Items, and Updated Items from two different C# Lists.]]></description><link>http://167.71.237.41/difference-between-two-lists-using-changetracker-t1-t2-class/</link><guid isPermaLink="false">63b69a3e4151150fd0d5b843</guid><category><![CDATA[CSharp]]></category><category><![CDATA[Linq]]></category><category><![CDATA[Asp.Net Core]]></category><dc:creator><![CDATA[Chathuranga]]></dc:creator><pubDate>Sat, 22 Oct 2022 06:00:00 GMT</pubDate><media:content url="http://167.71.237.41/content/images/2022/12/Untitled---5-December-2022-12.43.05-AM.png" medium="image"/><content:encoded><![CDATA[<h3 id="90s-srilankan-kids-know-this-%F0%9F%92%AD%F0%9F%92%AC">90&apos;s SriLankan kids know this &#xA0;&#x1F4AD;&#x1F4AC; :</h3><blockquote><em>As a So SriLankan 90&apos;s kid, this is a most loving &#x1F60D; advertisement of mine about the difference between the goose (&#xDB4;&#xDCF;&#xDAD;&#xDCA;&#xDAD;&#xDBA;&#xDCF;) vs. the duck (&#xDAD;&#xDCF;&#xDBB;&#xDCF;&#xDC0;).</em></blockquote><img src="http://167.71.237.41/content/images/2022/12/Untitled---5-December-2022-12.43.05-AM.png" alt="Difference between two lists using ChangeTracker&lt;T1, T2&gt; class"><p>The goose has some unique properties vs. the duck. Most of the properties differ from them. let&apos;s identify and compare the duck&apos;s properties list vs. the goose&apos;s using<strong> ChangeTracker class</strong>&#x1F601;</p><figure class="kg-card kg-embed-card kg-card-hascaption"><iframe width="200" height="113" src="https://www.youtube.com/embed/hTM62ONtnDA?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen title="Munchee Bourbon TV Commercial (S)"></iframe><figcaption><b><em>&#xD91;&#xD9A;&#xDD9;&#xD9A;&#xDCA; &#xDAD;&#xDCF;&#xDBB;&#xDCF;&#xDC0;&#xDD9;&#xD9A;&#xDCA; &#xD85;&#xDB1;&#xDD2;&#xD9A;&#xDCF; &#xDB4;&#xDCF;&#xDAD;&#xDCA;&#xDAD;&#xDBA;&#xDD9;&#xD9A;&#xDCA;. &#xDAD;&#xDCF;&#xDBB;&#xDC0;&#xDA7; &#xDB6;&#xDD1; &#xDB4;&#xDCF;&#xDAD;&#xDCA;&#xDAD;&#xDBA;&#xDCF; &#xDC0;&#xDD9;&#xDB1;&#xDCA;&#xDB1;. &#xDB4;&#xDCF;&#xDAD;&#xDCA;&#xDAD;&#xDBA;&#xDA7; &#xDB6;&#xDD1; &#xDAD;&#xDCF;&#xDBB;&#xDCF;&#xDC0; &#xDC0;&#xDD9;&#xDB1;&#xDCA;&#xDB1;</em></b></figcaption></figure><h3 id="caption">Caption :</h3><blockquote>&quot;&#xD91;&#xD9A;&#xDD9;&#xD9A;&#xDCA; &#xDAD;&#xDCF;&#xDBB;&#xDCF;&#xDC0;&#xDD9;&#xD9A;&#xDCA; &#xD85;&#xDB1;&#xDD2;&#xD9A;&#xDCF; &#xDB4;&#xDCF;&#xDAD;&#xDCA;&#xDAD;&#xDBA;&#xDD9;&#xD9A;&#xDCA;. &#xDAD;&#xDCF;&#xDBB;&#xDC0;&#xDA7; &#xDB6;&#xDD1; &#xDB4;&#xDCF;&#xDAD;&#xDCA;&#xDAD;&#xDBA;&#xDCF; &#xDC0;&#xDD9;&#xDB1;&#xDCA;&#xDB1;. &#xDB4;&#xDCF;&#xDAD;&#xDCA;&#xDAD;&#xDBA;&#xDA7; &#xDB6;&#xDD1; &#xDAD;&#xDCF;&#xDBB;&#xDCF;&#xDC0; &#xDC0;&#xDD9;&#xDB1;&#xDCA;&#xDB1;&quot; &#x1F601;&#x1F602;&#x1F604;&#x1F603;</blockquote><h2 id="back-to-topic">Back to topic</h2><p>I created <strong>ChangeTracker</strong> class two or two three months back. But unfortunately, I forgot to write a blog regarding this. I am writing this blog post about how I use the ChangeTracker class in my project.</p><p>Some types of query operations in C#, such as <a href="https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.except">Except</a>, <a href="https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.distinct">Distinct</a>, <a href="https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.union">Union</a>, and <a href="https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.concat">Concat</a>, can do the job (<a href="https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/how-to-combine-and-compare-string-collections-linq">Microsoft doc guidance</a>). But I want to build a standard interface to track changes between two lists using <strong>Linq</strong> and <strong>predicates</strong>.</p><h2 id="usecase">UseCase</h2><div class="kg-card kg-callout-card kg-callout-card-green"><div class="kg-callout-emoji">&#x1F4AD;</div><div class="kg-callout-text">I have <strong>two</strong> <strong>generic lists filled</strong> with custom objects. I need to retrieve the <strong>difference</strong> between those two lists. Simply it means I want to identify <strong>Added Items, Removed Items, and Updated</strong> Items from those object lists.</div></div><p>Widely I applied these scenarios in <strong>database Linq queries</strong>. I have one list that retrieves from a database table.<em><strong> Then this old data list should be updated top of the new list</strong></em>.</p><h3 id="considering-two-lists">Considering two lists:</h3><ul><li>I used the <strong>AddedItem </strong>list to insert into the database table</li><li>Also, the <strong>RemovedItem </strong>list is used to delete from the database using Linq.</li><li>The <strong>UpdateItem </strong>list helped to update my data in the table.</li></ul><h2 id="thinking-and-implementation">Thinking and Implementation</h2><p>There are two collections: one database list called &quot;<strong>oldValues</strong>&quot; and one new list called &quot;<strong>newValues</strong>.&quot; I receive items from time to time in the &quot;<strong>newValues</strong>&quot; collection. I &#xA0;want to know which elements were <strong>added, removed, or altered</strong>. <strong>I can compare identity id/ids in the generic Object.</strong></p><p>Here is the proposed code snippet of the <strong>ChangeTracker&lt;T1, T2&gt;</strong> class.</p><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/cd66d8025d74297d1cccdda5f0ca24ba.js"></script><!--kg-card-end: html--><p>As I said above, you must identify how the <strong>Object is unique.</strong> You can use an <strong>equals predicate</strong>, shown below.</p><p>In this example, It uses two int arrays. No big deal, We can equal elements using the<strong> Equals method or == operator.</strong></p><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/6e5f5719d24954cff708b87e26ac089e.js"></script><!--kg-card-end: html--><p>But in this example, we use <strong>custom object arrays.</strong> We can use <strong>predicate using properties</strong> to identify equal values from identity properties.</p><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/45b62023661001477568cddc5ee9dc06.js"></script><!--kg-card-end: html--><p>Finally, you received<strong> newPersonItems , removedPersonItems , updatedPersonItems</strong> individual three lists, and now you can manipulate them your way.</p><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F44B;</div><div class="kg-callout-text">I hope you find this content helpful. Keep touching my diaries. Learn something new. Comment your thoughts and share the content.<br><em>See you again soon. &#x270C;&#x270C;</em></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[Handling domain exceptions explicitly using Either<T1, T2> class in asp.net core]]></title><description><![CDATA[Handle exceptions explicitly using  Either<T1, T2>]]></description><link>http://167.71.237.41/handling-domain-exceptions-explicitly-using-either-t1-t2-class-in-asp-net-core/</link><guid isPermaLink="false">63b69a3e4151150fd0d5b844</guid><category><![CDATA[CSharp]]></category><category><![CDATA[Asp.Net Core]]></category><dc:creator><![CDATA[Chathuranga]]></dc:creator><pubDate>Tue, 18 Oct 2022 21:34:00 GMT</pubDate><media:content url="http://167.71.237.41/content/images/2022/12/either-class.png" medium="image"/><content:encoded><![CDATA[<figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/6xe2ne--1-.jpg" class="kg-image" alt="Handling domain exceptions explicitly using Either&lt;T1, T2&gt; class in asp.net core" loading="lazy" width="500" height="375"></figure><img src="http://167.71.237.41/content/images/2022/12/either-class.png" alt="Handling domain exceptions explicitly using Either&lt;T1, T2&gt; class in asp.net core"><p>Do you still believe you should always <strong>throw domain exceptions from a .Net API</strong>? I followed many tutorials and blog posts, and they always encouraged us to throw exceptions from controllers and services. Here their point is the usage of the <strong>Custom Exception Middleware</strong> with the capability of <strong>global exception handling.</strong> Yes, it is <strong><u>correct</u></strong>; &#x1F44C; it helps to maintain a clean and reliable code base. We can handle all exceptions without defining an ugly huge try-catch block in every method.</p><h2 id="intro">Intro</h2><p>But in some scenarios, you cannot always throw exceptions. So how can we <strong>handle exceptions explicitly</strong>?</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/10/6xe1bu.jpg" class="kg-image" alt="Handling domain exceptions explicitly using Either&lt;T1, T2&gt; class in asp.net core" loading="lazy" width="500" height="649"></figure><div class="kg-card kg-callout-card kg-callout-card-green"><div class="kg-callout-emoji">&#x1F4AD;</div><div class="kg-callout-text"><strong>I met this kind of requirement in my project. The system is below</strong>: <br>I want to build up a series of interconnected methods using one result dependent on another, like a flow operation. Some method wants to <b>either </b><u>throw exceptions</u> or <u>result</u> from their method. But the main flow should not be disturbed and executed forward, and the error should be logged. The Plan is to store the above errors in one list. At the end of the process, I want to log all errors in a specific file. It seems to use an error-handling mechanism itself.</div></div><p>It is time to reveal how I accomplish this requirement using handle exceptions.<strong> It is explicit handling.</strong></p><h2 id="the-ways-i-can-handle-exceptions-in-code">The ways I can handle exceptions in code</h2><p>The<strong> old-school</strong> way adding an exception to the global list and returning<strong> a null value in the catch block</strong>. It is an awful solution when it comes to <strong>the domain-driven paradigm</strong>. You should always check null values at all places you use it. As well as unintentionally, you will meet <strong>NullPointExceptions </strong>through your code</p><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/947f1decf72d9b22569e9e0696d816e1.js"></script><!--kg-card-end: html--><p>Another way to use the <strong>combined result object</strong>. With returning value and exception together.</p><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/8e9ea88ea90934dc266c7decb5dda581.js"></script><!--kg-card-end: html--><p>Much nicer. But I want more than this.<br>Apart from the above, I used a special class called <strong><u>Either&lt;TLeft, TRight&gt;</u></strong> Class.</p><h2 id="introducing-eithert1-t2">Introducing Either&lt;T1, T2&gt;</h2><p>Instead of returning Both with nullable properties, let&apos;s return Either with just one of them. When constructing an object, you can specify either a<strong> &apos;left&apos;</strong> or a <strong>&apos;right&apos;</strong> argument, but not both.</p><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/819772ca048c260c99768ad4670ac8e4.js"></script><!--kg-card-end: html--><p>That&apos;s two types of parameters TLeft and TRight. You can then decide what to do if either situation occurs or return.</p><p>You can use Either class like this,</p><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/3a67a854b4e73b7ba7dc9d2de7447ac9.js"></script><!--kg-card-end: html--><h3 id="using-leftordefault-or-rightordefault">Using LeftOrDefault() or RightOrDefault()</h3><p>You can specifically return the result object or an exception as a left or right value. Using <strong>LeftOrDefault()</strong> or <strong>RightOrDefault()</strong> you can get the returning value from this<strong> Either </strong>class.</p><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/98f490caafb1a38e1ae43d4349cb0467.js"></script><!--kg-card-end: html--><h3 id="using-match">Using match</h3><p>A functional programming concept develops this Match method; you can call a function using the Match function according to your returning value type.</p><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/12ec2cf269faf73a09ab2908fd1f150e.js"></script><!--kg-card-end: html--><h3 id="enhancing-for-doright-action">Enhancing for DoRight() action</h3><p>Widely I used <strong>TRight </strong>value for returning exceptions. In some occurrences, I wanted to throw the returned exception immediately. Then I used<strong> DoRight() </strong>using action functionality in C# as below.</p><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/1848413a4ca057d15803cff258dae2de.js"></script><!--kg-card-end: html--><p>There is a simple, readable, no conditionals, no null checks, and no way to ignore the fact that exceptions may fail silently.</p><h3 id="you-can-find-the-full-code-repository-below">You can find the full code repository below.</h3><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/csandun/HandlingDomainExceptionsExplicitly"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - csandun/HandlingDomainExceptionsExplicitly</div><div class="kg-bookmark-description">Contribute to csandun/HandlingDomainExceptionsExplicitly development by creating an account on GitHub.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Handling domain exceptions explicitly using Either&lt;T1, T2&gt; class in asp.net core"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">csandun</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/9b590f5b1267bb7c5aa53a44909de55d3edee5e016974e59f80f8f5214471bb9/csandun/HandlingDomainExceptionsExplicitly" alt="Handling domain exceptions explicitly using Either&lt;T1, T2&gt; class in asp.net core"></div></a></figure><h2 id="thoughts">Thoughts</h2><blockquote><strong>You can use both Global Exception handling with throwing exceptions and handling explicitly. In handling exceptions, Either&lt;TLeft, TRight&gt; class is so clean and very nice in Domain-driven design exception handling.</strong></blockquote><hr><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F44B;</div><div class="kg-callout-text">I hope you find this content helpful. Keep touching my diaries. Learn something new. Comment your thoughts and share the content.<br><em>See you again soon. &#x270C;&#x270C;</em></div></div>]]></content:encoded></item><item><title><![CDATA[Sane fake data generator for .NET - Bogus - Open Source Libraries - 2]]></title><description><![CDATA[Seeding is a necessary evil for a lazy developer every day. When unit testing, we are messing with what I should use for names, emails, paragraphs, etc. With Bogus, they become slightly more manageable.]]></description><link>http://167.71.237.41/sane-fake-data-generator-for-net-bogus-open-source-libraries-2/</link><guid isPermaLink="false">63b69a3e4151150fd0d5b848</guid><category><![CDATA[Open Source]]></category><category><![CDATA[CSharp]]></category><dc:creator><![CDATA[Chathuranga]]></dc:creator><pubDate>Sun, 16 Oct 2022 06:33:00 GMT</pubDate><media:content url="http://167.71.237.41/content/images/2022/12/Bogus.png" medium="image"/><content:encoded><![CDATA[<img src="http://167.71.237.41/content/images/2022/12/Bogus.png" alt="Sane fake data generator for .NET - Bogus - Open Source Libraries - 2"><p>Seeding is a necessary evil for a lazy developer every day. When unit testing, we are messing with what I should use for names, emails, paragraphs, etc. With <strong><a href="https://github.com/bchavez/Bogus">Bogus</a></strong>, they become slightly more manageable.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-22.png" class="kg-image" alt="Sane fake data generator for .NET - Bogus - Open Source Libraries - 2" loading="lazy" width="500" height="292"></figure><p><a href="https://github.com/bchavez/Bogus"><strong>Bogus</strong></a><strong> </strong>is a lovely library from <a href="https://twitter.com/bchavez"><strong>Brian Chavez</strong></a> to use in automated tests to generate test data of different kinds automatically. <a href="https://twitter.com/bchavez"><strong>Brian</strong></a> says,</p><blockquote class="kg-blockquote-alt"><em>&quot;A simple fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.&quot;</em></blockquote><p>In my day-to-day coding life, I work with Proof Of Concepts (PoCs), Sample projects for my blog posts, and research tasks. For them, Bogus is the more robust data generator for me, with <strong>a realistic looking at the data</strong>.</p><div class="kg-card kg-callout-card kg-callout-card-grey"><div class="kg-callout-emoji">&#x1F44C;</div><div class="kg-callout-text">You all need a way to generate data if you are working on<strong><u> demonstrations, load performance, styling, and testing. A rudimentary form of doing this is by hand</u></strong>. Spending days, sometimes weeks, inputting data into a system until it represents a realistic go-live scenario.</div></div><p>Here is the Bogus GitHub<a href="https://github.com/bchavez/Bogus"> <strong>repository link</strong></a>. Please make &#x2B50; <strong>a star</strong> &#x2B50; for the repository. It will encourage the author.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/bchavez/Bogus"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - bchavez/Bogus: A simple fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.</div><div class="kg-bookmark-description">:card_index: A simple fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js. - GitHub - bchavez/Bogus: A simple fake data generator for C#, F#, and VB.NET. Based o...</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Sane fake data generator for .NET - Bogus - Open Source Libraries - 2"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">bchavez</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://repository-images.githubusercontent.com/36990723/b56db300-6164-11e9-8a54-19b8a2a598eb" alt="Sane fake data generator for .NET - Bogus - Open Source Libraries - 2"></div></a></figure><h2 id="popularity">Popularity</h2><!--kg-card-begin: markdown--><table>
<thead>
<tr>
<th>Criteria</th>
<th>Counts</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>GitHub Stars</strong></td>
<td>6.3k</td>
</tr>
<tr>
<td><strong>GitHub Forks</strong></td>
<td>380</td>
</tr>
<tr>
<td><strong>Github Issues</strong></td>
<td>23</td>
</tr>
<tr>
<td><strong>NuGet Downloads</strong></td>
<td>32.6M</td>
</tr>
</tbody>
</table>
<!--kg-card-end: markdown--><h2 id="how-to-install">How to install</h2><p>You can easily install it using the<strong> <a href="https://www.nuget.org/packages/Bogus">NuGet package</a> manager console</strong> using.</p><p><strong>NuGet Package</strong></p><!--kg-card-begin: markdown--><h5 id="install-package-bogus"><strong><code>Install-Package Bogus</code></strong></h5>
<!--kg-card-end: markdown--><p><strong>As well as .Net CLI</strong></p><!--kg-card-begin: markdown--><h5 id="dotnet-add-package-bogus"><strong><code>dotnet add package Bogus</code></strong></h5>
<!--kg-card-end: markdown--><h2 id="examples">Examples</h2><p>Here I am creating a <strong>Dotnet console application</strong> using <strong>.Net 6</strong>. Then I add Bogus NuGet dependency using the above command.</p><p>Here I am creating a Customer POCO class that fills the data randomly.</p><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/6facc6b9ca59e789fecf7c66f2dfc73f.js"></script><!--kg-card-end: html--><p>The plan is to seed realistic Customer data to the Customer object.</p><!--kg-card-begin: markdown--><p>In this seeding journey, we should first create a faker object via our POCO class. Then map our properties using the Rules concept like in the FluenntValidator library. The property of the Review object may be provided as the first argument to the  <strong><code>RuleFor()</code></strong> methods, and the second argument indicates how the property value should be generated.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/ed6c637191d96f3d023cf7127a213333.js"></script><!--kg-card-end: html--><!--kg-card-begin: markdown--><p>Here we generate an address list like a sub-class for the main <code>Customer</code> class. It is another faker object. The rest of both fakers are generating individually at once.</p>
<p>Then we can generate our <code>Customer</code> data and <code>Address</code> data using <code>Generate()</code> the method.</p>
<!--kg-card-end: markdown--><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/bdb173d1b7aedbe1ad57f50faa94204f.js"></script><!--kg-card-end: html--><p>We can then serialize this object into JSON and write it to the console:</p><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/a05ce1396bdbfd7bbb8b6cf1fb55d2db.js"></script><!--kg-card-end: html--><p><strong><a href="https://volkanpaksoy.com/archive/2019/06/27/Generating-Test-Data-with-Bogus/">This blog post</a></strong> is recommended to refer with marvelous and informative.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://volkanpaksoy.com/archive/2019/06/27/Generating-Test-Data-with-Bogus/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Generating Test Data with Bogus</div><div class="kg-bookmark-description"></div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://volkanpaksoy.com/favicon.png" alt="Sane fake data generator for .NET - Bogus - Open Source Libraries - 2"><span class="kg-bookmark-author">Playground for the mind</span><span class="kg-bookmark-publisher">Volkan Paksoy</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://go.ezoic.net/utilcave_com/img/ezoic.png" alt="Sane fake data generator for .NET - Bogus - Open Source Libraries - 2"></div></a></figure><h2 id="supported-entities-by-bogus">Supported Entities by Bogus</h2><p>There is a vast range of test data types supported. Below I put some supported areas and properties. Apart from this, you can get a massive idea from here | <a href="https://github.com/bchavez/Bogus#bogus-for-net-c-f-and-vbnet">Bogus Documentation</a></p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/bchavez/Bogus#bogus-for-net-c-f-and-vbnet"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - bchavez/Bogus: A simple fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.</div><div class="kg-bookmark-description">:card_index: A simple fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js. - GitHub - bchavez/Bogus: A simple fake data generator for C#, F#, and VB.NET. Based o...</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Sane fake data generator for .NET - Bogus - Open Source Libraries - 2"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">bchavez</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://repository-images.githubusercontent.com/36990723/b56db300-6164-11e9-8a54-19b8a2a598eb" alt="Sane fake data generator for .NET - Bogus - Open Source Libraries - 2"></div></a></figure><!--kg-card-begin: markdown--><table>
<thead>
<tr>
<th>#</th>
<th>Entity</th>
<th>Properties</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td><strong>Address</strong></td>
<td>ZipCode, City, Country, Latitude, etc</td>
</tr>
<tr>
<td>2</td>
<td><strong>Commerce</strong></td>
<td>Department name, ProductName, ProductAdjective, Price, etc</td>
</tr>
<tr>
<td>3</td>
<td><strong>Company</strong></td>
<td>CompanyName, CatchPhrase, Bs, etc</td>
</tr>
<tr>
<td>4</td>
<td><strong>Database</strong></td>
<td>Column, Type,Collation etc</td>
</tr>
<tr>
<td>5</td>
<td><strong>Date</strong></td>
<td>Past, Soon, Between, etc</td>
</tr>
<tr>
<td>6</td>
<td><strong>Finance</strong></td>
<td>Account number, TransactionType, Currency, CreditCardNumber, etc</td>
</tr>
<tr>
<td>7</td>
<td><strong>Hacker</strong></td>
<td>Abbreviation ,Adjective etc</td>
</tr>
<tr>
<td>8</td>
<td><strong>Images</strong></td>
<td>Random image, Animals image, Nature image, etc.</td>
</tr>
<tr>
<td>9</td>
<td><strong>Internet</strong></td>
<td>Email, DomainName, Ipv6, Password, et</td>
</tr>
<tr>
<td>10</td>
<td><strong>Lorem</strong></td>
<td>single word, Words, Sentence, Paragraphs, etc.</td>
</tr>
<tr>
<td>11</td>
<td><strong>Name</strong></td>
<td>FirstName, LastName, etc</td>
</tr>
<tr>
<td>12</td>
<td><strong>Phone</strong></td>
<td>PhoneNumber , PhoneNumberFormat</td>
</tr>
<tr>
<td>13</td>
<td><strong>Rant</strong></td>
<td>Random user review, etc</td>
</tr>
<tr>
<td>14</td>
<td><strong>System</strong></td>
<td>FileName, MimeType, FileExt, etc.</td>
</tr>
<tr>
<td>15</td>
<td><strong>Vehicle</strong></td>
<td>Manufacturer , Model , etc</td>
</tr>
<tr>
<td>16</td>
<td><strong>Random/Randomizer</strong></td>
<td>Number, Digits, Hash, String, etc</td>
</tr>
</tbody>
</table>
<!--kg-card-end: markdown--><h2 id="summary">Summary</h2><blockquote><em>A fluent interface into a world of random realistic data, </em><strong><em>Bogus </em></strong><em>is a mandatory tool for any programmer. Please give him a star for his contribution and share your thoughts via </em><a href="https://twitter.com/bchavez"><em><strong>tweet</strong></em></a><em>.</em></blockquote><hr><h2 id="source-codeall-in-one">Source code - All in one</h2><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/242b108436126417b28b9b7bbdde77e0.js"></script><!--kg-card-end: html--><h2 id="repository-link">Repository Link</h2><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/csandun/BogusLibraryTesting"><div class="kg-bookmark-content"><div class="kg-bookmark-title">GitHub - csandun/BogusLibraryTesting</div><div class="kg-bookmark-description">Contribute to csandun/BogusLibraryTesting development by creating an account on GitHub.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt="Sane fake data generator for .NET - Bogus - Open Source Libraries - 2"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">csandun</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/405a2f0c47560de06900c037295da799ea00d7871ff0a583919df0048226232f/csandun/BogusLibraryTesting" alt="Sane fake data generator for .NET - Bogus - Open Source Libraries - 2"></div></a></figure><hr><div class="kg-card kg-callout-card kg-callout-card-grey"><div class="kg-callout-emoji">&#x1F44B;</div><div class="kg-callout-text">I hope you find this content helpful. Keep touching my diaries.<br>Learn something new. Comment your thoughts and share the content.<br>Happy coding!!<br><em>See you again soon. &#x270C;&#x270C;</em></div></div>]]></content:encoded></item><item><title><![CDATA[Differences Between First/FirstOrDefault and Single/SingleOrDefault - Part -1]]></title><description><![CDATA[Working with First, FirstOrDefault, Single, and SingleOrDefault with the link.]]></description><link>http://167.71.237.41/differences-between-first-firstordefault-and-single-singleordefault-part-1/</link><guid isPermaLink="false">63b69a3e4151150fd0d5b849</guid><category><![CDATA[Asp.Net Core]]></category><category><![CDATA[Linq]]></category><category><![CDATA[CSharp]]></category><dc:creator><![CDATA[Chathuranga]]></dc:creator><pubDate>Thu, 13 Oct 2022 07:21:00 GMT</pubDate><media:content url="http://167.71.237.41/content/images/2022/12/firstordefaiul-t.png" medium="image"/><content:encoded><![CDATA[<img src="http://167.71.237.41/content/images/2022/12/firstordefaiul-t.png" alt="Differences Between First/FirstOrDefault and Single/SingleOrDefault - Part -1"><p>Were you familiar with the <strong>&quot;</strong><em><strong>The result contains no elements.</strong></em><strong>&quot;</strong> exception with <strong>&quot;First()&quot;</strong> and <strong>&quot;Single()&quot;</strong> methods? How did you resolve this exception? What does done with the underhood of these methods with Linq? I faced this error last week in my code. So it encouraged me to discover what is happening in First, FirstOrDefault, Single, and SingleOrDefault.</p><p>Here I am going to explain how they work on a surface level but also how they function behind the scenes and take a deeper look into their</p><p>performance. As well as I am going to bring up the exceptions that happen in these methods.</p><!--kg-card-begin: markdown--><p>This is <strong>the first part</strong> of the explanation of <strong><code>First, FirstOrDefault, Single, and SingleOrDefault</code></strong>. Here I am trying to say only the differences between each other using a mind-blowing <strong>summary table</strong>.</p>
<!--kg-card-end: markdown--><p>Keep in touch with my <strong>second post</strong> of this; I will discuss these points using examples. Mainly performances(<strong>Benchmark test</strong>) and exceptions are occurring.</p><h2 id="summarizing-the-differences-between-these-methods">Summarizing the differences between these methods</h2><!--kg-card-begin: markdown--><p><strong>LINQ</strong> provides element operators that return a single or specific element from a collection. The element operators are <strong><code>Single, SingleOrDefault, First, and FirstOrDefault</code></strong>.</p>
<!--kg-card-end: markdown--><p>Documentations and many blogs are described more clearly. I will put the best references for you.</p><p>But today, I am summarizing all points using a table for easy understanding.</p><figure class="kg-card kg-image-card kg-width-full"><img src="http://167.71.237.41/content/images/2022/11/firstandfirstordefault.png" class="kg-image" alt="Differences Between First/FirstOrDefault and Single/SingleOrDefault - Part -1" loading="lazy" width="1440" height="2260" srcset="http://167.71.237.41/content/images/size/w600/2022/11/firstandfirstordefault.png 600w, http://167.71.237.41/content/images/size/w1000/2022/11/firstandfirstordefault.png 1000w, http://167.71.237.41/content/images/2022/11/firstandfirstordefault.png 1440w"></figure><h2 id="my-suggestion">My Suggestion</h2><blockquote><em>I always tend to use <strong><u>FirstOrDefault.</u></strong> If you want to be picky with performance, you should use FirstOrDefault in EF. And it is encouraging me to reduce the exceptions that we discussed above.</em></blockquote><p>Keep in touch with <strong>my second part</strong>, and I will prove what you should tend between these methods.</p><p>I hope you find this content helpful. Keep touching my diaries. Learn something new. Comment your thoughts and share the content.</p><hr><div class="kg-card kg-callout-card kg-callout-card-yellow"><div class="kg-callout-emoji">&#x1F44B;</div><div class="kg-callout-text"><em>Thank you.!</em><br><em>Have an incredible coding journey.</em><br><br><em>See you soon. &#x270C;&#x270C;</em></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[Convert base64 string to image and show in a table using Angular Pipe]]></title><description><![CDATA[Parameterize Pipe to transform the base64array string to a base64 image]]></description><link>http://167.71.237.41/convert-base64-string-to-image-and-show-in-a-table-using-angular-pipe/</link><guid isPermaLink="false">63b69a3e4151150fd0d5b84d</guid><category><![CDATA[Angular]]></category><dc:creator><![CDATA[Chathuranga]]></dc:creator><pubDate>Thu, 14 Jul 2022 20:18:00 GMT</pubDate><media:content url="http://167.71.237.41/content/images/2022/12/pipe.png" medium="image"/><content:encoded><![CDATA[<img src="http://167.71.237.41/content/images/2022/12/pipe.png" alt="Convert base64 string to image and show in a table using Angular Pipe"><p>Hi, greet; today&apos;s &#xA0;(14/07/2022) &#xA0;subject has related to Angular Pipe and shows an image in a table based on base64binarystring.</p><h2 id="use-case">Use Case</h2><p>Working on the angular project, today&apos;s task was to populate images in an HTML table with data. The backend service received these images as Base64BinaryArray converted strings with the content types (The database did this conversion). The target is to populate the image base64 string in the table.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/12/654--1-.png" class="kg-image" alt="Convert base64 string to image and show in a table using Angular Pipe" loading="lazy" width="640" height="358" srcset="http://167.71.237.41/content/images/size/w600/2022/12/654--1-.png 600w, http://167.71.237.41/content/images/2022/12/654--1-.png 640w"></figure><p>Below is a sample of the received <a href="https://stackblitz.com/edit/angular13-bootstrap-pbbkk9?file=src/app/app.component.ts">data</a> and expected UI result.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://stackblitz.com/edit/angular13-bootstrap-pbbkk9?file=src%2Fapp%2Fapp.component.ts"><div class="kg-bookmark-content"><div class="kg-bookmark-title">pipe-for-byte-string-convert-to-image - StackBlitz</div><div class="kg-bookmark-description">Application example built with Angular 13 and adding the Bootstrap CSS framework using the bootstrap and @ng-bootstrap/ng-bootstrap libraries.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://c.staticblitz.com/assets/favicon-editor-675989317f34707a17fe9d649da3609d70f6f8abc9546445389238ddd570a1d4.png" alt="Convert base64 string to image and show in a table using Angular Pipe"><span class="kg-bookmark-author">StackBlitz</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://social-img.staticblitz.com/projects/angular13-bootstrap-pbbkk9/184f1365c6a32f98932caad8497cfc8d" alt="Convert base64 string to image and show in a table using Angular Pipe"></div></a></figure><h2 id="problem-solving-thoughts">Problem-solving thoughts</h2><ul><li>It should be reusable anywhere easily in an HTML template. (Reusability)</li><li>I can use a simple method, service, or angular specified Pipe for this.</li></ul><p>Mmmmmm ... thinking ..... &#xA0;&#x1F914;&#x1F914;&#x1F914;</p><div class="kg-card kg-header-card kg-width-full kg-size-small kg-style-dark" style data-kg-background-image><h2 class="kg-header-card-header" id="bemparameterize-pipeemb"><b><em>Parameterize Pipe</em></b></h2><h3 class="kg-header-card-subheader" id="yeh-i-can-use-pipe-to-transform-data-one-state-to-another">Yeh! I can use pipe to transform data one state to another.</h3></div><p><strong>Parameterize Pipe</strong> to <strong>transform </strong>the base64array string to a base64 image. The logic is simple. &#xA0;Let&apos;s do it.</p><h2 id="solution">Solution</h2><p>I introduced an Angular Pipe to transform a string into a base64 image. The content type is a parameter to it.</p><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/392bc5a3aabf795f5ffa0bcf643f1479.js"></script><!--kg-card-end: html--><h3 id="how-to-use-the-above-the-pipe">How to use the above the pipe</h3><p>As I mentioned above, this is a parameterized pipe. I recommend referring to pipes, parameterized pipes, and custom pipes (<a href="https://angular.io/guide/pipes">Documentation</a>). It will make your code more reusable.</p><!--kg-card-begin: html--><script src="https://gist.github.com/csandun/60fb897874dd5d4016508e8b5409b7c2.js"></script><!--kg-card-end: html--><p>The working solution is put <a href="https://stackblitz.com/edit/angular13-bootstrap-pbbkk9?file=src/app/convert-base64-img.pipe.ts">here</a></p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://stackblitz.com/edit/angular13-bootstrap-pbbkk9?file=src%2Fapp%2Fconvert-base64-img.pipe.ts"><div class="kg-bookmark-content"><div class="kg-bookmark-title">pipe-for-byte-string-convert-to-image - StackBlitz</div><div class="kg-bookmark-description">Application example built with Angular 13 and adding the Bootstrap CSS framework using the bootstrap and @ng-bootstrap/ng-bootstrap libraries.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://c.staticblitz.com/assets/favicon-editor-675989317f34707a17fe9d649da3609d70f6f8abc9546445389238ddd570a1d4.png" alt="Convert base64 string to image and show in a table using Angular Pipe"><span class="kg-bookmark-author">StackBlitz</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://social-img.staticblitz.com/projects/angular13-bootstrap-pbbkk9/a03baae171704097f48cad4a3823eb4a" alt="Convert base64 string to image and show in a table using Angular Pipe"></div></a></figure><h2 id="final-thought">Final thought</h2><blockquote><em>Using a <strong>parameterized pipe/ pipe</strong> is a comprehensive reusable, and straightforward solution for accomplishing <strong>tranasform data one shape to another shape</strong> in<strong> Angular HTML templates.</strong></em></blockquote><p>Hope this will help you. Will meet one another.<br>Thank you &#x1F44D;. Happy coding&#x1F44F;</p><p></p><p></p>]]></content:encoded></item><item><title><![CDATA[DevToys (Windows App) -SQL formatter, JSON formatter, and many more converts]]></title><description><![CDATA[DevToys 💚💙 - An offline Windows app that helps developers with daily tasks like Converters,  Encoders / Decoders, Formatters, Generators, etc]]></description><link>http://167.71.237.41/devtoys-windows-app-sql-formatter-json-formatter-and-many-more-converts/</link><guid isPermaLink="false">63b69a3e4151150fd0d5b83d</guid><category><![CDATA[Productivity]]></category><category><![CDATA[Windows App]]></category><dc:creator><![CDATA[Chathuranga]]></dc:creator><pubDate>Wed, 08 Jun 2022 04:22:00 GMT</pubDate><media:content url="http://167.71.237.41/content/images/2022/12/devtoyes.png" medium="image"/><content:encoded><![CDATA[<img src="http://167.71.237.41/content/images/2022/12/devtoyes.png" alt="DevToys (Windows App) -SQL formatter, JSON formatter, and many more converts"><p><strong>DevToyes </strong>&#x1F49A;&#x1F499; - An offline Windows app that helps developers with daily tasks like Converters, &#xA0;Encoders / Decoders, Formatters, Generators, etc</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/12/hero-img.png" class="kg-image" alt="DevToys (Windows App) -SQL formatter, JSON formatter, and many more converts" loading="lazy" width="1010" height="838" srcset="http://167.71.237.41/content/images/size/w600/2022/12/hero-img.png 600w, http://167.71.237.41/content/images/size/w1000/2022/12/hero-img.png 1000w, http://167.71.237.41/content/images/2022/12/hero-img.png 1010w" sizes="(min-width: 720px) 720px"></figure><h3 id="how-i-met-this-swiss-army-knifedevtoys">How I met this Swiss Army knife - DevToys</h3><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://devtoys.app/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">A Swiss Army knife for developers.</div><div class="kg-bookmark-description">DevToys helps in daily tasks like formatting JSON, comparing text, testing RegExp.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://devtoys.app/img/favicon/android-icon-192x192.png" alt="DevToys (Windows App) -SQL formatter, JSON formatter, and many more converts"><span class="kg-bookmark-author">DevToys</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://devtoys.app/img/preview.jpg" alt="DevToys (Windows App) -SQL formatter, JSON formatter, and many more converts"></div></a></figure><p>Since I found<strong> DevToys</strong>, I have worked with <a href="https://csandundevblog.blogspot.com/2022/06/redgate-sql-formatter-format-your-own.html"><strong>Redgate SQL</strong></a> Formater as my day-to-day <strong>SQL formations</strong> for the last few months.</p><p>I already mentioned this in another <a href="https://csandundevblog.blogspot.com/2022/06/redgate-sql-formatter-format-your-own.html">blog post here</a>. But I saw a considerable drawback: <em>it cannot capitalize on some SQL keywords (Select, Join, On, Where, etc.)</em>. So I decided to find a better solution to overcome my requirements.</p><p>Then I found this swiss army knife called the <strong>DevToys windows app</strong>.</p><h2 id="what-is-devtoys">What is DevToys</h2><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image.png" class="kg-image" alt="DevToys (Windows App) -SQL formatter, JSON formatter, and many more converts" loading="lazy" width="113" height="85"></figure><blockquote><strong><em><a href="https://devtoys.app/">DevToys </a>is an offline</em></strong><em> Windows app that helps developers with daily tasks like Converters, Encoders / Decoders, Formatters, Generators, etc.</em></blockquote><p><a href="https://www.blogger.com/blog/post/edit/8107560544978848100/6167017576280977741?hl=en#">@Etienne BAUDOUX</a> &#x1F493;initiates this. <strong>DevToy</strong> is a perfect application for developers who<em> are working on backend developments</em>.</p><p>As a developer, <em>I do not need to use many untruthful websites to do simple tasks with my data</em>. Also, a close overlay lets you keep the app small and on top of other windows. Also, I can use multiple instances of the app at once.</p><h3 id="prerequisite">Prerequisite</h3><p>You need <strong>Windows 10 build 1903</strong>+ or later.</p><h3 id="microsoft-store">Microsoft Store</h3><p>Search for <strong>DevToys</strong> in the <strong>Microsoft Store App</strong> or click here.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://apps.microsoft.com/store/detail/devtoys/9PGCV4V3BK4W?hl=en-in&amp;gl=in"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Get DevToys from the Microsoft Store</div><div class="kg-bookmark-description">An Open-Source Swiss Army knife for developers. DevToys helps in everyday tasks like formatting JSON, comparing text, testing RegExp. No need to use many untruthful websites to do simple tasks with your data. With Smart Detection, DevToys is able to detect the best tool that can treat the data you&#x2026;</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://apps.microsoft.com/store/images/logo-512x512.png?v=f2rydDlJdXXmnXiyZg1ubNHcwV62KQE8CXnBIZmf1u4" alt="DevToys (Windows App) -SQL formatter, JSON formatter, and many more converts"></div></div><div class="kg-bookmark-thumbnail"><img src="https://microsoft-store.azurewebsites.net/store/detail/9PGCV4V3BK4W/image" alt="DevToys (Windows App) -SQL formatter, JSON formatter, and many more converts"></div></a></figure><h2 id="devtoys-features">DevToys features</h2><p>According to their website, these features are currently being released. Also,<strong> 27+ tools</strong> are available.</p><!--kg-card-begin: markdown--><ul>
<li>
<p><strong>Converters</strong></p>
<ul>
<li>JSON &lt;&gt; YAML</li>
<li>Timestamp</li>
<li>Number Base</li>
<li>Cron Parser</li>
</ul>
</li>
<li>
<p><strong>Encoders / Decoders</strong></p>
<ul>
<li>HTML</li>
<li>URL</li>
<li>Base64 Text &amp; Image</li>
<li>GZip</li>
<li>JWT Decoder</li>
</ul>
</li>
<li>
<p><strong>Formatters</strong></p>
<ul>
<li>JSON</li>
<li>SQL</li>
<li>XML</li>
</ul>
</li>
<li>
<p><strong>Generators</strong></p>
<ul>
<li>Hash (MD5, SHA1, SHA256, SHA512)</li>
<li>UUID 1 and 4</li>
<li>Lorem Ipsum</li>
<li>Checksum&apos;</li>
</ul>
</li>
<li>
<p><strong>Text</strong></p>
<ul>
<li>Escape / Unescape</li>
<li>Inspector &amp; Case Converter</li>
<li>Regex Tester</li>
<li>Text Comparer</li>
<li>XML Validator</li>
<li>Markdown Preview</li>
</ul>
</li>
<li>
<p><strong>Graphic</strong></p>
<ul>
<li>Color Blindness Simulator</li>
<li>Color Picker &amp; Contrast</li>
<li>PNG / JPEG Compressor</li>
<li>Image Converter</li>
</ul>
</li>
</ul>
<!--kg-card-end: markdown--><h2 id="my-favorite-features">My favorite features</h2><h3 id="sql-formatter">SQL Formatter</h3><p>SQL Formatter is my most favorable feature. SQL Formatter can format my query and convert SQL words to <strong>all upper cases</strong>.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-1.png" class="kg-image" alt="DevToys (Windows App) -SQL formatter, JSON formatter, and many more converts" loading="lazy" width="400" height="231"></figure><h3 id="json-formatter">JSON Formatter</h3><figure class="kg-card kg-image-card"><a href="https://www.blogger.com/blog/post/edit/8107560544978848100/6167017576280977741?hl=en#"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWjF214tAiHNY39lmg7FQa83Rn7qTUJQXNatlMqZAR59gb3EPJskEOs-4bKu453nvaG-FWhhaG6Q3k_PXJz30dRjXAOuVkaoRVmbTB7V7acrfDHF8f-XJ6XjkjgdGpVMo6uJ5-1kDoPIJ7X7g8N7IDBu0QiCzU09E2S07WfDseFmGrqCtRntT5OsZk/w400-h290/4.png" class="kg-image" alt="DevToys (Windows App) -SQL formatter, JSON formatter, and many more converts" loading="lazy" width="400" height="290"></a></figure><h3 id="text-diff">Text Diff</h3><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/11/image-2.png" class="kg-image" alt="DevToys (Windows App) -SQL formatter, JSON formatter, and many more converts" loading="lazy" width="399" height="275"></figure><h3 id="markdown-preview">Markdown Preview</h3><figure class="kg-card kg-image-card"><a href="https://www.blogger.com/blog/post/edit/8107560544978848100/6167017576280977741?hl=en#"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPFAUuRFxFyy4iytt9MrPeyNU_6w9xN153vHby3wSQpI7BcVU9fYAWyg2bYiGEgO6xbC_WzZLITdjdEy67xyh8sNU76l4TLBJjZNBZd79fAKPDtXVsbldWk326hbXcS9nxNDEtgHpNzDEUNJ6wzstIejFkVksAVl3tS9wXqOwieK7F_ifPeT4S5uAa/w400-h279/4.png" class="kg-image" alt="DevToys (Windows App) -SQL formatter, JSON formatter, and many more converts" loading="lazy" width="400" height="279"></a></figure><h3 id="regex-tester">Regex Tester</h3><figure class="kg-card kg-image-card"><a href="https://www.blogger.com/blog/post/edit/8107560544978848100/6167017576280977741?hl=en#"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKmazWsLpkJqZTRng8Esg5s8QGNKjp7I1_8PHo1SyRLH8ukhdJ2flHv0Sy63nPZjAkJOJF8DgPuXn5Mfd83oLZxBm0lhdHQU396qj3jrWnQneGpmj5Hf99UJ8uoWygKJLr7EwEIsFphwyODmkTs2tcCTh_eJv04P1QbLjRrxXdjFjfoRHZtFRoMKwf/w400-h274/4.png" class="kg-image" alt="DevToys (Windows App) -SQL formatter, JSON formatter, and many more converts" loading="lazy" width="400" height="274"></a></figure><p></p><h2 id="footnote">Footnote</h2><p>Nothing to say; Definitely, <strong>DevToy </strong>is a swiss army knife for my day-to-day developments. This application must tryout if you are a developer. <strong>Worthful</strong>. &#x1F600;</p><p>Try the above links and share your experience with others. Please comment with your thoughts and share the content. &#x1F600;</p><p><em>Thank you.! </em><br><em>Have an incredible coding journey. </em><br><em>See you soon. &#x270C;&#x270C;&#x270C;</em></p>]]></content:encoded></item><item><title><![CDATA[Do you know to inspect the drop-down menu in Chrome?]]></title><description><![CDATA[Inspecting the drop-down menu in Chrome]]></description><link>http://167.71.237.41/do-you-know-to-inspect-drop-down-menu-in-chrome/</link><guid isPermaLink="false">63b69a3e4151150fd0d5b842</guid><category><![CDATA[HTML]]></category><dc:creator><![CDATA[Chathuranga]]></dc:creator><pubDate>Thu, 02 Jun 2022 23:00:00 GMT</pubDate><media:content url="http://167.71.237.41/content/images/2022/12/inspectdropdowm.png" medium="image"/><content:encoded><![CDATA[<h2></h2><h2 id="story">Story</h2><img src="http://167.71.237.41/content/images/2022/12/inspectdropdowm.png" alt="Do you know to inspect the drop-down menu in Chrome?"><p>These days I am working on creating a custom dropdown menu using kendo-dropdown. I should correct CSS modifications in that dropdown menu using <strong>Inspect Elements</strong>. Currently, I am using Google Chrome.</p><p>I ran into this issue with <strong>dropdown input menus depending on the menu element type. The reason it&apos;s disappearing when I inspect it is that a blur event is always triggered on the element when I click anywhere outside the element</strong>. Thanks to our UI engineer&apos;s secret, today, I am inspecting my dropdown menu easily.</p><h2 id="solution">Solution</h2><ol><li>Go to Chrome Inspect element window using <strong>right-click context menu</strong> or &#xA0;<strong>F12.</strong></li></ol><p>2. Then go to the &quot;<strong>Customize and control Dev tool</strong>&quot; menu by clicking three &#xA0; &#xA0;(3) doted on the right side in the inspect element window.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/10/Screenshot-2022-07-26-090508--1--1.png" class="kg-image" alt="Do you know to inspect the drop-down menu in Chrome?" loading="lazy" width="400" height="338"></figure><p>3. Go to the &quot;<strong>More tools</strong>&quot; and then the &quot;<strong>Rendering</strong>&quot; option.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/10/Screenshot-2022-07-26-092833--1--1.png" class="kg-image" alt="Do you know to inspect the drop-down menu in Chrome?" loading="lazy" width="245" height="400"></figure><p>4. Then find &amp; check the &quot;<strong>Emulate a focused page</strong>&quot; option.</p><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/10/Screenshot-2022-07-26-094843--1--2.png" class="kg-image" alt="Do you know to inspect the drop-down menu in Chrome?" loading="lazy" width="486" height="380"></figure><hr><div class="kg-card kg-callout-card kg-callout-card-green"><div class="kg-callout-emoji">&#x1F970;</div><div class="kg-callout-text"><b>WHOA</b>!!! <b>I am inspecting the dropdown context menu.</b></div></div><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/10/whoa-1a9pma--1-.jpg" class="kg-image" alt="Do you know to inspect the drop-down menu in Chrome?" loading="lazy" width="195" height="146"></figure><figure class="kg-card kg-image-card"><img src="http://167.71.237.41/content/images/2022/10/Screenshot-2022-07-26-094017--1--1.png" class="kg-image" alt="Do you know to inspect the drop-down menu in Chrome?" loading="lazy" width="320" height="313"></figure><div class="kg-card kg-callout-card kg-callout-card-purple"><div class="kg-callout-emoji">&#x1F495;</div><div class="kg-callout-text">In my five(5) year career, this was a riddle for me in UI development. Again Thanks to our <strong>UI engineer. </strong><b>&#x1F44D;</b></div></div><p>See you again with solutions or tech updates or coding practices, or anything in my day-to-day life. &#x270C;&#x270C;</p>]]></content:encoded></item></channel></rss>