<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Deependra kushwah</title>
    <description>The latest articles on DEV Community by Deependra kushwah (@dkushwah).</description>
    <link>https://dev.to/dkushwah</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F522908%2Fa08058b4-584e-429a-b1e1-213297102601.jpg</url>
      <title>DEV Community: Deependra kushwah</title>
      <link>https://dev.to/dkushwah</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dkushwah"/>
    <language>en</language>
    <item>
      <title>Exploring Diffrent Types of Sinks in Serilog</title>
      <dc:creator>Deependra kushwah</dc:creator>
      <pubDate>Wed, 07 Jun 2023 00:47:28 +0000</pubDate>
      <link>https://dev.to/dkushwah/exploring-diffrent-types-of-sinks-in-serilog-e47</link>
      <guid>https://dev.to/dkushwah/exploring-diffrent-types-of-sinks-in-serilog-e47</guid>
      <description>&lt;p&gt;In the world of logging frameworks, Serilog stands out as a powerful and flexible option for .NET applications. &lt;/p&gt;

&lt;p&gt;One of the key features that makes Serilog so versatile is its support for a wide range of sinks. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RiiAEeJu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fd1fzksb53eodq5fv4es.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RiiAEeJu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fd1fzksb53eodq5fv4es.png" alt="Exploring Diffrent Types of Sinks in Serilog" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sinks are responsible for delivering log events to various destinations, such as the &lt;a href="https://beetechnical.com/tech-tutorial/logging-with-serilog-in-net-core/"&gt;console, files, databases&lt;/a&gt;, or third-party services. &lt;/p&gt;

&lt;p&gt;In this article, we will get some brief idea about the built-in sinks provided by Serilog, including the Console sink, File sink, Seq sink, and more.&lt;/p&gt;

&lt;p&gt;If you are using .Net Core application, each sink can be configured using appsettings.json file.&lt;/p&gt;

&lt;p&gt;Before we move into the diffrent sinks configurations. Let's setup the serilog in .Net Core app.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create .Net Core app&lt;/li&gt;
&lt;li&gt;Install the nuget packages 
-- Serilog
-- Serilog.Extensions.Configuration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Add this piece of code into the startup file or program.cs file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gpblI7CW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e78r1t2ev8dngzilej6u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gpblI7CW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e78r1t2ev8dngzilej6u.png" alt="Setup Serilog in .Net Core" width="763" height="750"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are reading configuration from the appsetting.json file. So we can keep updating the sinks and other configuration from config file itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Console Sink
&lt;/h2&gt;

&lt;p&gt;The Console sink is a basic and widely used sink that writes log events to the console or command-line interface. It is useful for debugging and development purposes. &lt;/p&gt;

&lt;h3&gt;
  
  
  Nuget Package for Console Sink
&lt;/h3&gt;

&lt;p&gt;-Serilog.Sinks.Console&lt;/p&gt;

&lt;h3&gt;
  
  
  Configuration for Console sink
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GdGH80b7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qxihu8ix9kmi3glbuh6a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GdGH80b7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qxihu8ix9kmi3glbuh6a.png" alt="Configuration for Console sink" width="559" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  File Sink
&lt;/h2&gt;

&lt;p&gt;The File sink allows you to write log events to one or more log files on the local file system. We'll cover various configuration options such as file path, rolling file behavior, and log file size limits. &lt;/p&gt;

&lt;h3&gt;
  
  
  Nuget Package required
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Serilog.Sinks.File &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Changes in configuration. Let's Add logging to file as well along with the console log.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rFiJ0dL6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gky0vdzil07iulu0yw4j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rFiJ0dL6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gky0vdzil07iulu0yw4j.png" alt="Log to File using Serilog.Sinks.File " width="767" height="634"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Rolling Interval is used to defin the time when new file will be generated. e.g: Minut,Hour,Day,Month and Year.&lt;/p&gt;

&lt;h2&gt;
  
  
  Seq Sink
&lt;/h2&gt;

&lt;p&gt;Seq is a popular log server and analysis tool that integrates seamlessly with Serilog. The Seq sink enables you to send log events to a Seq server for centralized log storage and analysis. &lt;/p&gt;

&lt;h3&gt;
  
  
  Nuget Package
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Serilog.Sinks.Seq&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Writing to seq server require two things. Server url and API key which will be configured in appsettings.json.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Flr9QAqh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lnimbd9ipx33lkypunti.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Flr9QAqh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lnimbd9ipx33lkypunti.png" alt="Log to Seq Sink" width="762" height="747"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Email Sink:
&lt;/h2&gt;

&lt;p&gt;The Email sink allows you to send log events via email notifications. This can be useful for critical error alerts or for monitoring specific log events. &lt;/p&gt;

&lt;h3&gt;
  
  
  Nuget Package
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Serilog.Sinks.Email&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--diCzpDK---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pectwpbptk7um5mekwq0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--diCzpDK---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pectwpbptk7um5mekwq0.png" alt="Serilog.Sinks.Email" width="687" height="479"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Writing to email sink is necessary, with server, recipient, and log message subject.&lt;/p&gt;

&lt;p&gt;If we don't pay attention to filtering the logs, you could get a lot of unwanted logs that aren't even required.&lt;/p&gt;

&lt;h2&gt;
  
  
  Database Sinks
&lt;/h2&gt;

&lt;p&gt;Serilog provides several database sinks, including sinks for SQL Server, MySQL, PostgreSQL, and more. These sinks enable you to store log events in a structured manner for easy querying and analysis. &lt;/p&gt;

&lt;h3&gt;
  
  
  Nuget Package
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Serilog.Sinks.MSSqlServer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VHYVRVPN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pzrvmcqu6qszqbn9zb3c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VHYVRVPN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pzrvmcqu6qszqbn9zb3c.png" alt="Log to MsSql With Serilog.Sinks.MSSqlServer" width="787" height="694"&gt;&lt;/a&gt;&lt;br&gt;
A few parameters must be configured in order to log data in the database. such the table name, connection string, and flag that creates the table if it doesn't already exist.&lt;/p&gt;

&lt;h2&gt;
  
  
  External Service Sinks
&lt;/h2&gt;

&lt;p&gt;Serilog offers sinks for various external services, such as Elasticsearch, Azure Application Insights, and Splunk. These sinks allow you to send log events to these services for advanced log analysis and monitoring.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The built-in sinks provided by Serilog offer a wide array of options for logging in .NET applications. &lt;/p&gt;

&lt;p&gt;Whether you need simple console output, file-based logs, centralized log storage and analysis, or integration with external services, Serilog has got you covered. &lt;/p&gt;

&lt;p&gt;By exploring and understanding the features and configuration options of these built-in sinks, you can make informed decisions about the best logging strategy for your specific needs.&lt;/p&gt;

&lt;p&gt;Reference Article&lt;br&gt;
&lt;a href="https://beetechnical.com/tech-tutorial/logging-with-serilog-in-net-core/"&gt;A Comprehensive Guide to Logging with Serilog for .NET Developers&lt;/a&gt;&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>sql</category>
      <category>dotnet</category>
    </item>
    <item>
      <title>Few tricky Linq Interview Questions &amp; Answers</title>
      <dc:creator>Deependra kushwah</dc:creator>
      <pubDate>Mon, 15 May 2023 14:19:32 +0000</pubDate>
      <link>https://dev.to/dkushwah/few-tricky-linq-interview-questions-answers-1696</link>
      <guid>https://dev.to/dkushwah/few-tricky-linq-interview-questions-answers-1696</guid>
      <description>&lt;h2&gt;
  
  
  What is deferred execution in LINQ?
&lt;/h2&gt;

&lt;p&gt;Deferred execution is a key feature of &lt;a href="https://beetechnical.com/interview-questions/linq-interview-questions/"&gt;LINQ&lt;/a&gt;that allows queries to be evaluated lazily, or only when their results are actually needed. Instead of executing the query immediately when it is defined, a LINQ query is only executed when it is enumerated, usually by calling a method such as ToList(), ToArray(), or FirstOrDefault().&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uI6F3Gk9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/30cl5nzmws9hjpp486pk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uI6F3Gk9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/30cl5nzmws9hjpp486pk.png" alt="Example of deferred execution " width="800" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the difference between IQueryable and IEnumerable?
&lt;/h2&gt;

&lt;p&gt;IQueryable and IEnumerable are two interfaces in LINQ that represent collections of data. The main difference between them is that IQueryable is designed for querying remote data sources (such as databases), while IEnumerable is designed for querying local in-memory data (such as collections).&lt;br&gt;
*&lt;em&gt;IEnumerable *&lt;/em&gt;&lt;br&gt;
IEnumerable is the simpler of the two interfaces, and provides a basic set of methods for iterating over a collection of objects. It is used for in-memory collections such as arrays, lists, and dictionaries.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--77kutUOU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dsh1pm2k8swr4rq8e3tf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--77kutUOU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dsh1pm2k8swr4rq8e3tf.png" alt="Example of IEnumerable" width="800" height="165"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;IQueryable&lt;/strong&gt;&lt;br&gt;
IQueryable, on the other hand, is used for querying remote data sources such as databases or web services. It extends IEnumerable and adds additional functionality for querying data in a way that is optimized for the specific data source.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--x4wMRUxO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lol3tbw1jrvp72q8nvk0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x4wMRUxO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lol3tbw1jrvp72q8nvk0.png" alt="Example Of IQueryable" width="800" height="185"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the difference between Single() and First() in LINQ?
&lt;/h2&gt;

&lt;p&gt;Both Single() and First() are LINQ extension methods used to retrieve a single element from a sequence. However, there are some key differences between them.&lt;/p&gt;

&lt;p&gt;First() returns the first element in a sequence that satisfies a specified condition, or the first element in the sequence if no condition is specified. If the sequence is empty, First() throws an exception.&lt;br&gt;
Single(), on the other hand, returns the only element in a sequence that satisfies a specified condition, or throws an exception if there is more than one element in the sequence that satisfies the condition. If no element satisfies the condition or the sequence is empty, Single() also throws an exception.&lt;/p&gt;

&lt;p&gt;Read Complete Article&lt;br&gt;
&lt;a href="https://beetechnical.com/interview-questions/linq-interview-questions/"&gt;Crack Interview With 30 C# Linq Interview Questions &amp;amp; Answers&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Sort C# Dictionary?</title>
      <dc:creator>Deependra kushwah</dc:creator>
      <pubDate>Wed, 04 Jan 2023 01:42:59 +0000</pubDate>
      <link>https://dev.to/dkushwah/how-to-sort-c-dictionary-4c4n</link>
      <guid>https://dev.to/dkushwah/how-to-sort-c-dictionary-4c4n</guid>
      <description>&lt;p&gt;We can Sort any kind of collection with the help of methods exposed by Linq library in C#. Order by can be used to &lt;a href="https://beetechnical.com/tech-tutorial/cshapr-dictionary/" rel="noopener noreferrer"&gt;sort the collection&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; static class Program
    {
        static void Main(string[] args)
        {
            var dictionary = new Dictionary&amp;lt;string, int&amp;gt;()
            {
                { "Deep", 32 },
                { "Saurabh", 30 },
                { "Rahul", 35 },
                { "Jitendra", 24 }
            };

            foreach (var keyValuePair in dictionary)
            {

                Console.WriteLine(keyValuePair.Key + " " + keyValuePair.Value);
            }

            //After sorting
            Console.WriteLine("\nAfter sorting\n");
            var sortedDictionary = dictionary.OrderBy(x =&amp;gt; x.Value);
            foreach (var keyValuePair in sortedDictionary)
            {
                Console.WriteLine(keyValuePair.Key + " " + keyValuePair.Value);
            }

            //After sorting
            Console.WriteLine("\nAfter Sorting in Descending Order\n");
            var sortedDictionaryInDescOrder = dictionary.OrderByDescending(x =&amp;gt; x.Value);
            foreach (var keyValuePair in sortedDictionaryInDescOrder)
            {
                Console.WriteLine(keyValuePair.Key + " " + keyValuePair.Value);
            }
            Console.ReadKey();
        }

    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fow56i4e5iqv4c4wik48n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fow56i4e5iqv4c4wik48n.png" alt="Image description" width="656" height="621"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>emptystring</category>
    </item>
    <item>
      <title>Comparison of Azure Data Lake Storage(ADLS) Gen1 vs Gen2</title>
      <dc:creator>Deependra kushwah</dc:creator>
      <pubDate>Sat, 26 Mar 2022 02:24:18 +0000</pubDate>
      <link>https://dev.to/dkushwah/comparison-of-azure-data-lake-storageadls-gen1-vs-gen2-5d0</link>
      <guid>https://dev.to/dkushwah/comparison-of-azure-data-lake-storageadls-gen1-vs-gen2-5d0</guid>
      <description>&lt;p&gt;Azure Data Lake Storage or short name Data Lake is a system or repository of a huge quantity of data in a structured or unstructured form that is stored in its natural format(i.e object blobs or files). Data lakes handle the three Vs of big data (Volume, Velocity, and Variety).&lt;/p&gt;

&lt;p&gt;Let’s dig deeper and understand all the topics related to Azure data lake. Hope you will find it helpful for sure.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Azure data lake storage?
&lt;/h2&gt;

&lt;p&gt;It is a part of the Microsoft Azure public cloud platform, which is a cloud platform that supports big data storage and analytics of any kind and size.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Azure data lake storage
&lt;/h2&gt;

&lt;p&gt;Data lake storage is the storage of information solutions that has specifically been designed for the analytics of big data. Its working is quite simple. &lt;/p&gt;

&lt;p&gt;Each data lake service underneath always has a container. That container is very often called a file system and just like any file system it has folders and files within it which is fully scalable and secure that supports HDFS semantics while working with the Apache Hadoop ecosystem. &lt;/p&gt;

&lt;p&gt;On each data lake, you can actually have multiple containers, multiple file systems containing any structure of files and folders that you wish to have.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are the features of Azure Data Lake?
&lt;/h2&gt;

&lt;p&gt;Some notable features of Azure data lake storage are as follows&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Infinite size of data can be stored in a single repository.&lt;/li&gt;
&lt;li&gt;Both structured and unstructured data in their natural formats can be stored&lt;/li&gt;
&lt;li&gt;There is high availability, durability, and reliability.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  There are 2 types of Azure data lake storage ADLS Gen1 and ADLS Gen2.
&lt;/h3&gt;

&lt;p&gt;Earlier &lt;a href="https://beetechnical.com/cloud-computing/azure-data-lake-storageadls-gen1-vs-gen2-complete-guide-2021/"&gt;Azure Data Lake Gen1&lt;/a&gt; was generally used but now Azure Data Lake Gen2 is mostly used and it is also reported that on Feb 29, 2024, Gen1 will be retired, so anyone using  Azure Data Lake Gen1 has to migrate to Azure Data Lake Gen2 by that date.&lt;/p&gt;

&lt;p&gt;ADLS Gen1 can be accessed from Hadoop using the WebHDFS-compatible REST APIs. It has all enterprise-grade capabilities such as security, manageability, scalability, reliability, and availability.&lt;/p&gt;

&lt;p&gt;ADLS Gen2 is designed for big data analytics which means there is something called azure blob file system or ABFS which is encrypted. This file system is compatible, allowing many of the existing solutions in the market to connect with no hustle.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>datalake</category>
    </item>
  </channel>
</rss>
