<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://abowfzl.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://abowfzl.com/" rel="alternate" type="text/html" /><updated>2025-04-05T11:47:58+00:00</updated><id>https://abowfzl.com/feed.xml</id><title type="html">Abolfazl Moslemian</title><subtitle>Abolfazl Moslemian, Principal Software Developer and Machine Learning &amp; Data Science Specialist, specializing in C#, Python, and cloud-based applications.</subtitle><author><name>Abofazl Moslemian</name></author><entry><title type="html">Exploring LLMs: How ChatGPT and AI Learn to Talk</title><link href="https://abowfzl.com/ai/2024/09/24/How-LLMs-Work/" rel="alternate" type="text/html" title="Exploring LLMs: How ChatGPT and AI Learn to Talk" /><published>2024-09-24T00:00:00+00:00</published><updated>2024-09-24T00:00:00+00:00</updated><id>https://abowfzl.com/ai/2024/09/24/How-LLMs-Work</id><content type="html" xml:base="https://abowfzl.com/ai/2024/09/24/How-LLMs-Work/"><![CDATA[<p>AI (Artificial Intelligence) is everywhere these days, and you’ve probably heard of <strong>ChatGPT</strong>. It’s a tool that uses something called Large Language Models (<strong>LLMs</strong>) to have conversations with you, answer questions, and even help with your homework. But how do these models actually work? Let’s break it down step by step, using examples to make it easy to follow.</p>

<h2 id="whats-the-big-deal-about-llms">What’s the Big Deal About LLMs?</h2>

<p>LLMs are computer models that understand and create human language. But why are they so special? Imagine trying to guess the next word in a sentence your friend is saying—that’s basically what LLMs do, but they do it on a much larger scale. They can write whole essays, answer complex questions, and even translate languages!</p>

<ul>
  <li><strong>LLMs use patterns in language</strong> to predict the next word.</li>
  <li>They’ve learned from huge amounts of text—like books, websites, and research papers.</li>
</ul>

<h2 id="layers-of-ai-how-does-ai-learn">Layers of AI: How Does AI Learn?</h2>

<p><img src="/assets/images/Discover AI fields.webp" alt="Layers of AI" style="margin:auto" /></p>

<p>AI consists of multiple layers, each playing a unique role. Let’s break it down:</p>

<ol>
  <li>
    <p><strong>Artificial Intelligence (AI):</strong> This is the overarching concept of making machines capable of tasks that typically require human intelligence.</p>
  </li>
  <li>
    <p><strong>Machine Learning (ML):</strong> A subset of AI where machines learn from data. For instance, if you show a computer hundreds of images of cats and dogs, it will eventually learn to distinguish between the two.</p>
  </li>
  <li>
    <p><strong>Deep Learning:</strong> A more specialized part of ML that tackles more complex data, like images or language. This is where <strong>neural networks</strong> come in—systems loosely based on the human brain.</p>
  </li>
  <li>
    <p><strong>Large Language Models (LLMs):</strong> LLMs specialize in processing text and forming human-like responses, and that’s what we’ll explore in this article.</p>
  </li>
</ol>

<h2 id="machine-learning-a-simple-example">Machine Learning: A Simple Example</h2>

<p>The purpose of Machine Learning is to find patterns in data. More specifically, it identifies relationships between inputs and outcomes.</p>

<h3 id="music-genres-example">Music Genres Example:</h3>
<p>Imagine you want to tell the difference between two music genres: reggaeton and R&amp;B.</p>
<ul>
  <li><strong>Reggaeton</strong> is known for its lively beats and danceable rhythms.</li>
  <li><strong>R&amp;B</strong> (Rhythm and Blues) is more soulful, often featuring both fast-paced and slow songs.</li>
</ul>

<p><img src="/assets/images/How-Computer-Learn.gif" alt="Machine Learning in practice. Predicting music genre is an example of a classification problem" style="margin:auto" /></p>

<p>Suppose we have 20 songs. Each song has a <strong>tempo</strong> (how fast the song is) and an <strong>energy level</strong>. We’ve also labeled them by genre. When we plot the data, we notice that high-tempo, high-energy songs are usually reggaeton, while slower, low-energy songs are mostly R&amp;B.</p>

<p><strong>Machine Learning</strong> can automate the task of labeling genres based on these patterns, allowing us to predict the genre of new songs. This type of task is called <strong>classification</strong>, where the outcome can only be one of a fixed number of labels (like R&amp;B or reggaeton).</p>

<p>The machine learns by finding a line that separates the two genres. Once it learns this, we can use the line to predict whether any new song belongs to reggaeton or R&amp;B, based on its tempo and energy.</p>

<h3 id="what-if-the-input-is-text">What if the Input is Text?</h3>

<p><img src="/assets/images/Word-embedding.webp" alt="Sentiment classification example" style="margin:auto" /></p>

<p>Now imagine a more complicated input: text. Let’s say we want to know whether a sentence has a <strong>positive</strong> or <strong>negative</strong> sentiment (emotion). This, too, is a classification task.</p>

<p>Turning words into something a computer can understand isn’t straightforward. We need to convert them into <strong>word embeddings</strong>, which are numerical representations that capture a word’s meaning. These word embeddings allow the machine to process the sentence as a sequence of numbers, which it can then use to make predictions.</p>

<h2 id="deep-learning-a-step-deeper">Deep Learning: A Step Deeper</h2>

<p>By now, we’ve seen that more complicated tasks (like analyzing text or images) require more powerful models. Enter <strong>Deep Learning</strong>.</p>

<p><img src="/assets/images/Neural-Network.webp" alt="Neural Networks are the most powerful Machine Learning models we have today" style="margin:auto" /></p>

<p>Deep Learning uses <strong>neural networks</strong> to model complex relationships at scale. These networks have many layers, each processing information and passing it along to the next. You can think of them like stacks of mathematical functions that allow the machine to learn intricate patterns.</p>

<p>Neural networks are often described as being inspired by the human brain, but in reality, they’re quite different. Still, their basic structure—layers of connected units called neurons—lets them model very complicated relationships.</p>

<p>For instance, <strong>ChatGPT</strong> is based on a neural network that contains over 176 billion parameters (neurons), allowing it to process and generate human-like responses. Compare that to the human brain, which has around 100 billion neurons.</p>

<h2 id="how-do-llms-work">How Do LLMs Work?</h2>

<p>Now that we understand neural networks, we can dive into <strong>LLMs</strong>.</p>

<p>Let’s say you type “The cat is…” into ChatGPT. The LLM tries to predict the next word: is the cat <strong>sleeping</strong>? Is the cat <strong>running</strong>? It makes this prediction based on the patterns it has learned from millions of sentences.</p>

<h3 id="what-is-gpt">What is GPT?</h3>

<p><strong>GPT</strong> stands for <strong>Generative Pre-trained Transformer</strong>:</p>

<ul>
  <li><strong>Generative</strong>: The model is trained to generate text.</li>
  <li><strong>Pre-trained</strong>: The model has already been trained on vast amounts of text data.</li>
  <li><strong>Transformer</strong>: This is the specific neural network architecture used.</li>
</ul>

<p>The transformer architecture is special because it helps the model focus on the most important parts of a sentence, much like how humans pay attention to key details in a conversation.</p>

<h2 id="how-llms-learn-the-3-steps">How LLMs Learn: The 3 Steps</h2>

<p>LLMs learn in three stages:</p>

<ol>
  <li><strong>Pre-Training:</strong>
    <ul>
      <li>The model reads huge amounts of text and learns to predict the next word. Think of it as a giant guessing game.</li>
    </ul>
  </li>
  <li><strong>Fine-Tuning:</strong>
    <ul>
      <li>After the model learns to predict words, it’s refined using real-life questions and answers. This makes the LLM more helpful when responding to users.</li>
    </ul>
  </li>
  <li><strong>Reinforcement Learning (RLHF):</strong>
    <ul>
      <li>Humans step in to correct the model’s mistakes, which teaches the model to provide more accurate answers.</li>
    </ul>
  </li>
</ol>

<h3 id="pre-training">Pre-Training:</h3>

<p>During this phase, the model requires a huge amount of data to learn how to predict the next word. In this process, the model not only learns grammar and sentence structure, but also gains a broad understanding of various topics, along with some additional capabilities that we’ll discuss later.</p>

<p>But here’s a question: What are the potential issues with this kind of pre-training? There are several, but the main concern I want to highlight is related to what the model is actually learning.</p>

<p>Essentially, the model becomes good at generating continuous text on a given topic, but it doesn’t excel at responding to specific instructions or questions. The issue is that it hasn’t been trained to act like a helpful assistant.</p>

<p>For instance, if you ask a pre-trained LLM, “What is your first name?”, it might reply with, “What is your last name?” This happens because the model has encountered similar sequences in its training data (such as empty forms) and is simply trying to complete the pattern.</p>

<p>It struggles with following clear instructions because this type of structured conversation—where an instruction is followed by a relevant response—was not common in the data used for training. Platforms like Quora or StackOverflow might be closer examples of that structure, but they are rare compared to the vast variety of text the model was trained on.</p>

<h3 id="fine-tuning">Fine-Tuning:</h3>

<p>This is where instruction tuning steps in. We take the pre-trained LLM, which has learned how to predict words, and teach it something new: how to follow instructions. Essentially, we’re doing the same thing as before—training the model to predict one word at a time—but now, we’re using a more curated dataset filled with high-quality instruction-response pairs.</p>

<p>In this phase, the model “un-learns” its habit of simply completing text and instead evolves into an assistant that understands and responds according to user instructions. The dataset used for this fine-tuning is much smaller than what we used in pre-training, and there’s a reason for that: creating these instruction-response pairs is costly, as they require human input, unlike the massive and inexpensive self-supervised data we used earlier. This stage is referred to as supervised instruction fine-tuning for that reason.</p>

<p>Some LLMs, like ChatGPT, go through an additional phase called reinforcement learning from human feedback (RLHF). We won’t dive too deep into it, but this phase works similarly to instruction tuning. The goal is to further align the model’s responses with human values and preferences. Early research suggests that RLHF plays a key role in helping LLMs reach, or even exceed, human-level performance. By blending reinforcement learning with language modeling, we’re seeing tremendous potential for improving LLMs far beyond what they can currently do.</p>

<h2 id="challenges-with-llms">Challenges with LLMs</h2>

<p>Despite their abilities, LLMs face several challenges:</p>

<ul>
  <li>
    <p><strong>Hallucinations</strong>: Sometimes, LLMs invent facts. For example, if you ask, “Who is the president of Mars?” the model might make up a name.</p>
  </li>
  <li>
    <p><strong>Outdated Information</strong>: LLMs are trained on past data, so they might not know the latest events. Some models, like <strong>Bing Chat</strong>, solve this by retrieving up-to-date information from the internet before answering.</p>
  </li>
</ul>

<h2 id="why-llms-keep-getting-smarter">Why LLMs Keep Getting Smarter</h2>

<p>LLMs improve because:</p>

<ul>
  <li>They are trained on more data over time.</li>
  <li>They use increasingly larger neural networks (some with billions of parameters).</li>
</ul>

<h3 id="cool-llm-abilities">Cool LLM Abilities</h3>

<ul>
  <li>
    <p><strong>Zero-Shot Learning</strong>: LLMs can handle tasks they weren’t specifically trained for, like translating a sentence while using only words starting with “B.”</p>
  </li>
  <li>
    <p><strong>Creative Responses</strong>: Ask ChatGPT to translate “The cat sleeps in the box” using only words that start with “f,” and it might respond with “Furry friend rests in cozy quarters.”</p>
  </li>
</ul>

<h2 id="the-future-of-llms">The Future of LLMs</h2>

<p>As LLMs continue to improve, they’ll find their way into more applications:</p>

<ul>
  <li><strong>Search engines</strong> will provide smarter, more relevant results.</li>
  <li><strong>Digital assistants</strong> like Siri or Alexa will have more natural conversations.</li>
  <li><strong>Creative tools</strong> will help generate stories, essays, and much more.</li>
</ul>

<h3 id="key-takeaways">Key Takeaways</h3>

<ul>
  <li>LLMs, like ChatGPT, predict words based on the vast amounts of text they’ve learned from.</li>
  <li>They are trained in three stages: pre-training, fine-tuning, and reinforcement learning.</li>
  <li>LLMs can handle a variety of tasks, from answering questions to generating creative text.</li>
</ul>

<p>In the end, LLMs are transforming how we interact with technology. As they evolve, they’ll continue shaping the future of AI and our everyday digital experiences.</p>

<hr />

<p>I hope this article helps you understand what LLMs are and how they work. It’s important that everyone, not just AI experts, has a voice in how AI develops and is used to benefit society. AI is part of our future, and it’s up to all of us to guide it responsibly.</p>

<blockquote>

  <p>This post is inspired by and references the article How Large Language Models Work from <a href="https://medium.com/data-science-at-microsoft/how-large-language-models-work-91c362f5b78f">Andreas Stöffelbauer article in Meduim</a>, and images used in the article are taken from there as well.</p>
</blockquote>]]></content><author><name>Abofazl Moslemian</name></author><category term="AI" /><category term="AI" /><category term="LLMs" /><category term="Large Language Models" /><category term="NLP" /><category term="Data Science" /><category term="Machine Learning" /><category term="Deep Learning" /><summary type="html"><![CDATA[AI (Artificial Intelligence) is everywhere these days, and you’ve probably heard of ChatGPT. It’s a tool that uses something called Large Language Models (LLMs) to have conversations with you, answer questions, and even help with your homework. But how do these models actually work? Let’s break it down step by step, using examples to make it easy to follow.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://abowfzl.com/assets/images/default-preview.webp" /><media:content medium="image" url="https://abowfzl.com/assets/images/default-preview.webp" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">C# Internals - Single and SingleOrDefault</title><link href="https://abowfzl.com/csharp/2024/05/21/Single-and-SingleOrDefault/" rel="alternate" type="text/html" title="C# Internals - Single and SingleOrDefault" /><published>2024-05-21T00:00:00+00:00</published><updated>2024-05-21T00:00:00+00:00</updated><id>https://abowfzl.com/csharp/2024/05/21/Single-and-SingleOrDefault</id><content type="html" xml:base="https://abowfzl.com/csharp/2024/05/21/Single-and-SingleOrDefault/"><![CDATA[<p class="notice--info">Many developers occasionally use the LINQ methods <code class="language-plaintext highlighter-rouge">First</code> and <code class="language-plaintext highlighter-rouge">FirstOrDefault</code> as substitutes for <code class="language-plaintext highlighter-rouge">Single</code> and <code class="language-plaintext highlighter-rouge">SingleOrDefault</code>. This practice stems from the belief that <code class="language-plaintext highlighter-rouge">Single</code> traverses “all” items in an Enumerable to find the result, whereas <code class="language-plaintext highlighter-rouge">First</code> and <code class="language-plaintext highlighter-rouge">FirstOrDefault</code> do not need to traverse the entire Enumerable, making them faster.</p>

<p class="notice--info">However, replacing <code class="language-plaintext highlighter-rouge">Single</code> with <code class="language-plaintext highlighter-rouge">First</code> is not always feasible, as these two methods serve different purposes and cannot always be interchanged. Despite their distinct functionalities, there are instances where they can be swapped.</p>

<p><img src="/assets/images/WrongAssumption.webp" alt="WrongAssumption" style="margin:auto" /></p>

<p class="notice--info">The SingleOrDefault method does not always traverse “all” items of an Enumerable. ❌</p>

<p>If we call <code class="language-plaintext highlighter-rouge">Single&lt;T&gt;</code> or <code class="language-plaintext highlighter-rouge">SingleOrDefault&lt;T&gt;</code> without passing any Predicate, three scenarios can occur:</p>

<ul>
  <li>If there are zero items, the default value of type T is returned.</li>
  <li>If there is exactly one item, item [0] of the Enumerable is returned.</li>
  <li>If there are more than one items, an error is thrown.</li>
</ul>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>public static TSource SingleOrDefault&lt;TSource&gt;(this IEnumerable&lt;TSource&gt; source)
{
  if (source == null)
    throw Error.ArgumentNull(nameof (source));
    
  if (source is IList&lt;TSource&gt; sourceList)
  {
    switch (sourceList.Count)
    {
      case 0:
        return default (TSource);
        
      case 1:
        return sourceList[0];
    }
  }
  else
  {
    using (IEnumerator&lt;TSource&gt; enumerator = source.GetEnumerator())
    {
      if (!enumerator.MoveNext())
        return default (TSource);
        
      TSource current = enumerator.Current;
      
      if (!enumerator.MoveNext())
        return current;
    }
  }
  
  throw Error.MoreThanOneElement();
}
</code></pre></div></div>

<p>When these methods are called with a Predicate, they traverse the Enumerable and during this process, three situations can arise:</p>

<ul>
  <li>If no item matches the Predicate, the default value of T is returned.</li>
  <li>If one item is found, the traversal continues. If another matching item is found, an error is thrown immediately. This second item could be the next one (1+) or any subsequent item (N+1).</li>
  <li>If no additional matching items are found, the first matching item is returned.</li>
</ul>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>public static TSource SingleOrDefault&lt;TSource&gt;(
      this IEnumerable&lt;TSource&gt; source,
      Func&lt;TSource, bool&gt; predicate)
{
  if (source == null)
    throw Error.ArgumentNull(nameof (source));
    
  if (predicate == null)
    throw Error.ArgumentNull(nameof (predicate));
    
  using (IEnumerator&lt;TSource&gt; enumerator = source.GetEnumerator())
  {
    while (enumerator.MoveNext())
    {
      TSource current = enumerator.Current;
      
      if (predicate(current))
      {
        while (enumerator.MoveNext())
        {
          if (predicate(enumerator.Current))
            throw Error.MoreThanOneMatch();
        }
        
        return current;
      }
    }
  }
  
  return default (TSource);
}
</code></pre></div></div>

<p>In conclusion ✅ :</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>SingleOrDefault&lt;TSource&gt;(this IEnumerable&lt;TSource&gt; source) → O(1)
    
SingleOrDefault&lt;TSource&gt;(
  this IEnumerable&lt;TSource&gt; source, Func&lt;TSource, bool&gt; predicate) → O(N)
</code></pre></div></div>
<blockquote>
  <p>Microsoft’s CoreFX Repo: <a href="https://github.com/dotnet/corefx/blob/master/src/System.Linq/src/System/Linq/Single.cs">Single.cs</a></p>
</blockquote>]]></content><author><name>Abofazl Moslemian</name></author><category term="CSharp" /><category term="CSharp" /><category term="singleordefault" /><category term="single" /><category term="internals" /><summary type="html"><![CDATA[Many developers occasionally use the LINQ methods First and FirstOrDefault as substitutes for Single and SingleOrDefault. This practice stems from the belief that Single traverses “all” items in an Enumerable to find the result, whereas First and FirstOrDefault do not need to traverse the entire Enumerable, making them faster.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://abowfzl.com/assets/images/default-preview.webp" /><media:content medium="image" url="https://abowfzl.com/assets/images/default-preview.webp" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Dispose vs Finalize</title><link href="https://abowfzl.com/csharp/2024/05/20/Dispose-vs-Finalize/" rel="alternate" type="text/html" title="Dispose vs Finalize" /><published>2024-05-20T00:00:00+00:00</published><updated>2024-05-20T00:00:00+00:00</updated><id>https://abowfzl.com/csharp/2024/05/20/Dispose-vs-Finalize</id><content type="html" xml:base="https://abowfzl.com/csharp/2024/05/20/Dispose-vs-Finalize/"><![CDATA[<blockquote>
  <p>Dispose Method in C#</p>
</blockquote>

<p class="notice--info">The Dispose method serves a crucial purpose: to free unmanaged resources the Garbage Collector can’t handle itself. Simply put, it’s like a memory emancipator, liberating <code class="language-plaintext highlighter-rouge">trapped</code> memory spaces!</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>public class DisposeExample : IDisposable
{
    bool disposed = false;

    // Declare your Filestream object.
    private FileStream fileStream = null;

    // Implement dispose.
    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    protected virtual void Dispose(bool disposing)
    {
        if (!disposed)
        {
            if (disposing)
            {
                fileStream?.Dispose();
            }

            disposed = true; 
        }
    }
}
</code></pre></div></div>

<h2 id="the-finalize-method-basics">The Finalize Method Basics</h2>

<p>In simple terms, Finalize method is a destructor provided by Microsoft’s <code class="language-plaintext highlighter-rouge">Object</code> class, a method that helps to tidy up a mess after a function party, specifically focusing on cleaning up unmanaged resources.</p>

<p>Consider the following example:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>class FinalizeExample
{
    FileStream fileStream;

    // Constructor, opens a file named "temp.dat"
    public FinalizeExample()
    {
        fileStream = new FileStream("temp.dat", FileMode.Create);
    }

    // destructor
    ~FinalizeExample()
    {
        // File closing statement
        fileStream.Close();
    }
}
</code></pre></div></div>
<p>In this FinalizeExample class, we have an unmanaged resource nativeResource. The destructor, marked with a tilde (~), frees this unmanaged resource during finalization.</p>

<h2 id="dispose-vs-finalize">Dispose vs Finalize</h2>

<p>The Dispose method, when called, immediately frees up resources, both managed and unmanaged. This bolsters the performance of your code since it relieves resources from further use, like giving your computer a power nap, so it’s ready to take on the next task.
On the other hand:
The Finalize, it is automatic and works during the GC process, but it’s laser-focused on resources that Dispose can’t touch. It’s like having a house cleaner who, after cleaning your house today, shows up unannounced next week just to double-check everything is in order!</p>]]></content><author><name>Abofazl Moslemian</name></author><category term="CSharp" /><category term="CSharp-Dispose" /><category term="CSharp-Finalize" /><category term="CSharp" /><summary type="html"><![CDATA[Dispose Method in C#]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://abowfzl.com/assets/images/default-preview.webp" /><media:content medium="image" url="https://abowfzl.com/assets/images/default-preview.webp" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">HashSet in C# with Examples</title><link href="https://abowfzl.com/csharp/2024/04/20/HashSet-in-C/" rel="alternate" type="text/html" title="HashSet in C# with Examples" /><published>2024-04-20T00:00:00+00:00</published><updated>2024-04-20T00:00:00+00:00</updated><id>https://abowfzl.com/csharp/2024/04/20/HashSet-in-C</id><content type="html" xml:base="https://abowfzl.com/csharp/2024/04/20/HashSet-in-C/"><![CDATA[<p>In C#, HashSet is an unordered collection of unique elements. This collection is introduced in .NET 3.5. It provides fast lookups and high-performance set operations  and uses the hash table for storage. This collection is of the generic type collection and it is  part of the <code class="language-plaintext highlighter-rouge">System.Collections.Generic</code> namespace. It is generally used when we want to prevent duplicate elements from being placed in the collection. The performance of the HashSet is much better in comparison to the list.</p>

<p><strong>Important Points Related To HashSet in C#</strong></p>

<ul>
  <li>The HashSet class implements the ICollection, IEnumerable, IReadOnlyCollection, ISet, IEnumerable, IDeserializationCallback, and ISerializable interfaces.</li>
  <li>In HashSet, the order of the element is not defined. You cannot sort the elements of HashSet.</li>
  <li>HashSet elements are always unique. In oder word, duplicate elements are not allowed</li>
  <li>It provides many mathematical set operations, such as intersection, union, and difference.</li>
  <li>A HashSet is a dynamic collection means the size of the HashSet is automatically increased when the new elements are added.</li>
  <li>In HashSet, you can only store the same type of elements.</li>
</ul>

<p><strong>Example:</strong></p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>// C# program to illustrate how to create hashset
using System;
using System.Collections.Generic;

class HashsetTest {

	// Main Method
	static public void Main()
	{

		// Creating HashSet
		HashSet&lt;string&gt; myhash1 = new ();

		// Add the elements in HashSet
		myhash1.Add("C");
		myhash1.Add("C++");
		myhash1.Add("C#");
		myhash1.Add("Java");
		myhash1.Add("Ruby");
		Console.WriteLine("Elements of myhash1:");

		// Accessing elements of HashSet
		foreach(var val in myhash1)
		{
			Console.WriteLine(val);
		}

		// Creating another HashSet
		// using collection initializer to initialize HashSet
		HashSet&lt;int&gt; myhash2 = new () 
        {   10,
		    100,
            1000,
            10000,
            100000
        };
				
		// Display elements of myhash2
		Console.WriteLine("Elements of myhash2:");
		foreach(var value in myhash2)
		{
			Console.WriteLine(value);
		}
	}
}
</code></pre></div></div>]]></content><author><name>Abofazl Moslemian</name></author><category term="CSharp" /><category term="CSharp-Generic-HashSet" /><category term="CSharp" /><summary type="html"><![CDATA[In C#, HashSet is an unordered collection of unique elements. This collection is introduced in .NET 3.5. It provides fast lookups and high-performance set operations and uses the hash table for storage. This collection is of the generic type collection and it is part of the System.Collections.Generic namespace. It is generally used when we want to prevent duplicate elements from being placed in the collection. The performance of the HashSet is much better in comparison to the list.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://abowfzl.com/assets/images/default-preview.webp" /><media:content medium="image" url="https://abowfzl.com/assets/images/default-preview.webp" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">How much do I Work?</title><link href="https://abowfzl.com/goal/2023/12/30/how-much-i-work/" rel="alternate" type="text/html" title="How much do I Work?" /><published>2023-12-30T00:00:00+00:00</published><updated>2023-12-30T20:28:54+00:00</updated><id>https://abowfzl.com/goal/2023/12/30/how-much-i-work</id><content type="html" xml:base="https://abowfzl.com/goal/2023/12/30/how-much-i-work/"><![CDATA[<p>I want to introduce you to a simple tool that can manage the time you work with the computer</p>

<p class="notice--info">When I sit at the computer, I am completely unaware of the clock and time, there is a small software that collects information about what you are doing. and sends it to its server</p>

<p>Analyzing the time you spent on each software, it can help you to be more productive.</p>

<p>For example, #Visual Studio, #Notepad++ or #StackOverflow Websit, and #CodeProject website have a positive rating as a programmer.</p>

<p>And social networks, checking email during work time is a negative point</p>

<p>You can determine in your dashboard whether a certain software or a certain site has a positive score or not</p>

<p>And every week it gives you a report that this week your performance was so much and you were so active on Telegram</p>

<p>In short, it hurts me a lot</p>

<p>If you want to use it, you can download it from this website rescuetime</p>]]></content><author><name>Abofazl Moslemian</name></author><category term="Goal" /><category term="life" /><summary type="html"><![CDATA[I want to introduce you to a simple tool that can manage the time you work with the computer]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://abowfzl.com/assets/images/default-preview.webp" /><media:content medium="image" url="https://abowfzl.com/assets/images/default-preview.webp" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Exclude Post from Search Index</title><link href="https://abowfzl.com/me/2023/11/28/post-exclude-search/" rel="alternate" type="text/html" title="Exclude Post from Search Index" /><published>2023-11-28T00:00:00+00:00</published><updated>2023-02-19T13:05:34+00:00</updated><id>https://abowfzl.com/me/2023/11/28/post-exclude-search</id><content type="html" xml:base="https://abowfzl.com/me/2023/11/28/post-exclude-search/"><![CDATA[<p>This post should not appear in the search index because it has the following YAML Front Matter:</p>

<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">search</span><span class="pi">:</span> <span class="no">false</span>
</code></pre></div></div>

<p class="notice--info"><strong>Note:</strong> <code class="language-plaintext highlighter-rouge">search: false</code> only works to exclude posts when using <strong>Lunr</strong> as a search provider.</p>

<p>To exclude files when using <strong>Algolia</strong> as a search provider add an array to <code class="language-plaintext highlighter-rouge">algolia.files_to_exclude</code> in your <code class="language-plaintext highlighter-rouge">_config.yml</code>. For more configuration options be sure to check their <a href="https://community.algolia.com/jekyll-algolia/options.html">full documentation</a>.</p>

<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">algolia</span><span class="pi">:</span>
  <span class="c1"># Exclude more files from indexing</span>
  <span class="na">files_to_exclude</span><span class="pi">:</span>
    <span class="pi">-</span> <span class="s">index.html</span>
    <span class="pi">-</span> <span class="s">index.md</span>
    <span class="pi">-</span> <span class="s">excluded-file.html</span>
    <span class="pi">-</span> <span class="s">_posts/2017-11-28-post-exclude-search.md</span>
    <span class="pi">-</span> <span class="s">subdirectory/*.html</span>
</code></pre></div></div>]]></content><author><name>Abofazl Moslemian</name></author><category term="Me" /><summary type="html"><![CDATA[This post should not appear in the search index because it has the following YAML Front Matter:]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://abowfzl.com/assets/images/default-preview.webp" /><media:content medium="image" url="https://abowfzl.com/assets/images/default-preview.webp" xmlns:media="http://search.yahoo.com/mrss/" /></entry></feed>