<?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: Jawad Hayat</title>
    <description>The latest articles on DEV Community by Jawad Hayat (@jawad_hayat).</description>
    <link>https://dev.to/jawad_hayat</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%2F1685790%2F94a10bf4-484a-46db-bb35-0c17eb041f3c.png</url>
      <title>DEV Community: Jawad Hayat</title>
      <link>https://dev.to/jawad_hayat</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jawad_hayat"/>
    <language>en</language>
    <item>
      <title>Looking to Contribute to Open Source Startups Using .NET and Angular</title>
      <dc:creator>Jawad Hayat</dc:creator>
      <pubDate>Fri, 05 Jul 2024 04:23:31 +0000</pubDate>
      <link>https://dev.to/jawad_hayat/looking-to-contribute-to-open-source-startups-using-net-and-angular-hf8</link>
      <guid>https://dev.to/jawad_hayat/looking-to-contribute-to-open-source-startups-using-net-and-angular-hf8</guid>
      <description>&lt;p&gt;Hi everyone,&lt;/p&gt;

&lt;p&gt;I'm Jawad, a junior software engineer with a passion for .NET and Angular. With 3 years of experience in machine learning, app support, and .NET development, I'm eager to contribute to open source startups.&lt;/p&gt;

&lt;p&gt;I'm looking for startups using .NET and Angular to contribute to and grow my skills. Any recommendations?&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>csharp</category>
      <category>angular</category>
      <category>opensource</category>
    </item>
    <item>
      <title>7 strategies to master git reset:</title>
      <dc:creator>Jawad Hayat</dc:creator>
      <pubDate>Thu, 04 Jul 2024 10:32:52 +0000</pubDate>
      <link>https://dev.to/jawad_hayat/7-strategies-to-master-git-reset-1cg3</link>
      <guid>https://dev.to/jawad_hayat/7-strategies-to-master-git-reset-1cg3</guid>
      <description>&lt;p&gt;&lt;strong&gt;1. Understand the Basics&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Grasp what git reset does. &lt;/p&gt;

&lt;p&gt;It changes the state of your repository. &lt;/p&gt;

&lt;p&gt;It can move the HEAD, change the index, and adjust the working directory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Use --soft for Safe Resets&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you use git reset --soft, it keeps changes in the index. &lt;/p&gt;

&lt;p&gt;This is perfect for undoing commits but keeping your changes staged.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Apply --mixed for Moderate Resets&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The default git reset --mixed keeps changes in your working directory but unstages them. &lt;/p&gt;

&lt;p&gt;This helps when you want to edit your changes before committing again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Go Hard with --hard&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;git reset --hard wipes changes from the index and working directory. &lt;/p&gt;

&lt;p&gt;Use this only when you are sure you want to discard all local changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Reset to a Specific Commit&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Point to a specific commit by using git reset . &lt;/p&gt;

&lt;p&gt;This rewinds your repository to that commit, making it easy to undo mistakes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Be Cautious with Branches&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Always ensure you're on the correct branch before resetting. &lt;/p&gt;

&lt;p&gt;Resetting the wrong branch can cause loss of important work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Combine with git reflog&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use git reflog to view the history of HEAD changes. &lt;/p&gt;

&lt;p&gt;It helps you recover commits after a reset, ensuring you don't lose valuable work.&lt;/p&gt;

&lt;p&gt;Mastering git reset can save you from many headaches. &lt;/p&gt;

&lt;p&gt;Use these strategies to handle your repository with confidence.&lt;/p&gt;

</description>
      <category>git</category>
      <category>learning</category>
    </item>
    <item>
      <title>Mastering Common Git Commands: A Developer's Guide</title>
      <dc:creator>Jawad Hayat</dc:creator>
      <pubDate>Wed, 03 Jul 2024 10:59:07 +0000</pubDate>
      <link>https://dev.to/jawad_hayat/mastering-common-git-commands-a-developers-guide-3ld3</link>
      <guid>https://dev.to/jawad_hayat/mastering-common-git-commands-a-developers-guide-3ld3</guid>
      <description>&lt;p&gt;As developers, we often interact with version control systems, and Git is one of the most popular tools out there. Whether you’re just starting out or looking to brush up on your Git skills, this guide covers some of the most common Git commands you’ll use in your day-to-day development work.&lt;/p&gt;

&lt;h4&gt;
  
  
  1. git init
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;git init&lt;/code&gt; command initializes a new Git repository. This is the first step to start tracking a project with Git.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. git clone
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone &amp;lt;repository-url&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;git clone&lt;/code&gt; is used to copy an existing Git repository from a remote server to your local machine. It’s typically the first command you run when starting to work on an existing project.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. git status
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;git status&lt;/code&gt; command shows the current state of the working directory and staging area. It lets you see which changes have been staged, which haven’t, and which files aren’t being tracked by Git.&lt;/p&gt;

&lt;h4&gt;
  
  
  4. git add
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add &amp;lt;file&amp;gt;
git add .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;git add&lt;/code&gt; stages changes to be included in the next commit. Use &lt;code&gt;git add &amp;lt;file&amp;gt;&lt;/code&gt; to stage a specific file or &lt;code&gt;git add .&lt;/code&gt; to stage all changes in the directory.&lt;/p&gt;

&lt;h4&gt;
  
  
  5. git commit
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -m "Your commit message"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;git commit&lt;/code&gt; command captures a snapshot of the project’s currently staged changes. The &lt;code&gt;-m&lt;/code&gt; option allows you to add a commit message directly from the command line.&lt;/p&gt;

&lt;h4&gt;
  
  
  6. git push
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push &amp;lt;remote&amp;gt; &amp;lt;branch&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;git push&lt;/code&gt; uploads your local commits to the remote repository. Typically, the remote repository is named &lt;code&gt;origin&lt;/code&gt;, and the main branch is named &lt;code&gt;main&lt;/code&gt; or &lt;code&gt;master&lt;/code&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  7. git pull
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git pull &amp;lt;remote&amp;gt; &amp;lt;branch&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;git pull&lt;/code&gt; updates your local repository with changes from the remote repository. It’s a combination of &lt;code&gt;git fetch&lt;/code&gt; (which downloads new data) and &lt;code&gt;git merge&lt;/code&gt; (which integrates that data).&lt;/p&gt;

&lt;h4&gt;
  
  
  8. git branch
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git branch
git branch &amp;lt;branch-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;git branch&lt;/code&gt; is used to list, create, or delete branches. Running &lt;code&gt;git branch&lt;/code&gt; without arguments lists all local branches in the current repository. Use &lt;code&gt;git branch &amp;lt;branch-name&amp;gt;&lt;/code&gt; to create a new branch.&lt;/p&gt;

&lt;h4&gt;
  
  
  9. git checkout
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout &amp;lt;branch-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;git checkout&lt;/code&gt; is used to switch between branches in your repository. It updates the files in the working directory to match the version stored in that branch.&lt;/p&gt;

&lt;h4&gt;
  
  
  10. git merge
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git merge &amp;lt;branch-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;git merge&lt;/code&gt; integrates changes from one branch into the current branch. This command is crucial for combining the work done in different branches.&lt;/p&gt;

&lt;h4&gt;
  
  
  11. git log
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;git log&lt;/code&gt; command shows the commit history for the repository. It’s a great way to review changes and understand the project’s development history.&lt;/p&gt;

&lt;h4&gt;
  
  
  12. git stash
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git stash
git stash pop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;git stash&lt;/code&gt; temporarily shelves changes you’ve made to your working directory so you can work on something else. &lt;code&gt;git stash pop&lt;/code&gt; restores the stashed changes.&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;Mastering these Git commands will significantly enhance your productivity and version control practices. Git is a powerful tool, and knowing how to use it effectively is a crucial skill for any developer. Practice these commands, and soon you'll handle Git with ease and confidence.&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>git</category>
      <category>learning</category>
    </item>
    <item>
      <title>My Learning Journey in CI/CD with Local IIS Server</title>
      <dc:creator>Jawad Hayat</dc:creator>
      <pubDate>Tue, 02 Jul 2024 07:57:29 +0000</pubDate>
      <link>https://dev.to/jawad_hayat/my-learning-journey-in-cicd-with-local-iis-server-hp4</link>
      <guid>https://dev.to/jawad_hayat/my-learning-journey-in-cicd-with-local-iis-server-hp4</guid>
      <description>&lt;p&gt;As a backend developer, I recently dived into the world of CI/CD while working with Angular. Here’s a quick overview of my process:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Create a Web API Project&lt;/strong&gt;: Started with a new project and pushed the code to a GitHub repo.&lt;br&gt;
&lt;strong&gt;2. Configure GitHub Actions&lt;/strong&gt;: Set up the .NET build and test action by creating a workflow directory and a YAML file in &lt;code&gt;.github&lt;/code&gt;.&lt;br&gt;
&lt;strong&gt;3. Set Up Self-Hosted Runner&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configured a new runner in GitHub Actions settings.&lt;/li&gt;
&lt;li&gt;Ran provided commands in PowerShell as an administrator to set up the runner locally.&lt;/li&gt;
&lt;li&gt;Verified the runner is working correctly in GitHub Actions settings.
&lt;strong&gt;4. Test the Configuration&lt;/strong&gt;: Pushed changes to the master branch to ensure the jobs run successfully.
&lt;strong&gt;5. Install IIS Server&lt;/strong&gt;: Created a website and bound it to a physical path on my PC.
&lt;strong&gt;6. Publish and Deploy Logic&lt;/strong&gt;: Updated the YAML file for publishing and deploying to IIS.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here’s the YAML script I used:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name: .NET

on:
 push:
 branches: [ "master" ]
 pull_request:
 branches: [ "master" ]

jobs:
 build-and-deploy:

 runs-on: self-hosted

 steps:
 - uses: actions/checkout@v4
 - name: Restore dependencies
 run: dotnet restore
 - name: Build
 run: dotnet build --no-restore
 - name: Test
 run: dotnet test --no-build --verbosity normal
 - name: Publish
 run: dotnet publish -c Debug -o dotnetcorewebapp .
 - name: Stop IIS
 run: iisreset /stop
 - name: Deploy to IIS
 run: Copy-Item -Path {Your Path}\* -Destination {Your Path} -Recurse -Force
 - name: List files in IIS
 run: Get-ChildItem -Path {Your Path} -Recurse
 - name: Start IIS
 run: iisreset /start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This journey has been a fantastic learning experience, enhancing my skills in automation and deployment. Looking forward to more such explorations! &lt;/p&gt;

</description>
      <category>cicd</category>
      <category>dotnet</category>
      <category>learning</category>
      <category>githubactions</category>
    </item>
    <item>
      <title>Implementing Hangfire in .NET: A Beginner's Guide</title>
      <dc:creator>Jawad Hayat</dc:creator>
      <pubDate>Mon, 01 Jul 2024 11:03:29 +0000</pubDate>
      <link>https://dev.to/jawad_hayat/implementing-hangfire-in-net-a-beginners-guide-f9c</link>
      <guid>https://dev.to/jawad_hayat/implementing-hangfire-in-net-a-beginners-guide-f9c</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
Recently, I delved into the world of Hangfire, an open-source library that simplifies the process of scheduling and executing background tasks in .NET applications. Hangfire allows developers to run tasks in the background, ensuring that the main application remains responsive and efficient. In this post, I’ll share my experience and provide a step-by-step guide on implementing Hangfire in your .NET projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Hangfire?&lt;/strong&gt;&lt;br&gt;
Hangfire is a .NET library that provides a simple and reliable way to perform background processing in your applications. It offers features like:&lt;/p&gt;

&lt;p&gt;Background task processing&lt;br&gt;
Delayed and recurring jobs&lt;br&gt;
Monitoring and dashboard capabilities&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Install Hangfire&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Install-Package Hangfire
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; Configure Hangfire&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;builder.Services.AddHangfire(config =&amp;gt;
{
    config.UseSqlServerStorage(builder.Configuration.GetConnectionString("DefaultConnection")); // Use your preferred storage here
});
builder.Services.AddHangfireServer();


// Map Hangfire Dashboard
app.UseHangfireDashboard();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; Creating Background Jobs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[HttpGet]
[Route("FireAndForgetJob")]
public ActionResult CreateFireAndForgetJob()
{
    BackgroundJob.Enqueue&amp;lt;TestJob&amp;gt;(x =&amp;gt; x.WriteLog("Fire-and-Forget Job"));
    //BackgroundJob.Enqueue(() =&amp;gt; Console.WriteLine("Fire-and-Forget Job"));
    return Ok();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt; Delayed and Recurring Jobs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[HttpGet]
[Route("DelayJob")]
public ActionResult CreateDelayJob()
{
    var scheduleDateTime = DateTime.UtcNow.AddSeconds(5);
    var dateTimeOffset = new DateTimeOffset(scheduleDateTime);
    BackgroundJob.Schedule&amp;lt;TestJob&amp;gt;(x =&amp;gt; x.WriteLog("Delay-and-Schedule Job"), dateTimeOffset);
    //BackgroundJob.Schedule(() =&amp;gt; Console.WriteLine("Delay-and-Schedule Job"),dateTimeOffset);
    return Ok();
}
[HttpGet]
[Route("ContinuationJob")]
public ActionResult CreateContinuationJob()
{
    var scheduleDateTime = DateTime.UtcNow.AddSeconds(5);
    var dateTimeOffset = new DateTimeOffset(scheduleDateTime);
    var jobID = BackgroundJob.Schedule&amp;lt;TestJob&amp;gt;(x =&amp;gt; x.WriteLog("Delay-and-Schedule 2nd Job"), dateTimeOffset);
    //var jobID = BackgroundJob.Schedule(() =&amp;gt; Console.WriteLine("Delay-and-Schedule 2nd Job"), dateTimeOffset);

    var job2ID = BackgroundJob.ContinueJobWith&amp;lt;TestJob&amp;gt;(jobID, x =&amp;gt; x.WriteLog("ContinuationJob1 triggered"));
    var job3ID = BackgroundJob.ContinueJobWith&amp;lt;TestJob&amp;gt;(job2ID, x =&amp;gt; x.WriteLog("ContinuationJob2 triggered"));
    var job4ID = BackgroundJob.ContinueJobWith&amp;lt;TestJob&amp;gt;(job3ID, x =&amp;gt; x.WriteLog("ContinuationJob3 triggered"));
    return Ok();
}
[HttpGet]
[Route("RecurringJob")]
public ActionResult CreateRecurringJob()
{
    RecurringJob.AddOrUpdate&amp;lt;TestJob&amp;gt;("RecurringJob1", x =&amp;gt; x.WriteLog("RecurringJob triggered"), "* * * * *");
    return Ok();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 5:&lt;/strong&gt; Monitoring Jobs&lt;br&gt;
Hangfire comes with a built-in dashboard that allows you to monitor the status of your background jobs. You can access the dashboard by navigating to /hangfire in your browser.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Hangfire makes it incredibly easy to add background processing to your .NET applications. Its simplicity and powerful features can significantly enhance the performance and responsiveness of your applications. By following the steps outlined in this guide, you can quickly get started with Hangfire and start leveraging its capabilities in your projects.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>hangfire</category>
      <category>backgroundtasks</category>
      <category>learningjourney</category>
    </item>
  </channel>
</rss>
