<?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: Sudha Subramaniam</title>
    <description>The latest articles on DEV Community by Sudha Subramaniam (@sudha533).</description>
    <link>https://dev.to/sudha533</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%2F1019624%2F52aa9bd8-2443-445a-a325-aba4961cd941.jpg</url>
      <title>DEV Community: Sudha Subramaniam</title>
      <link>https://dev.to/sudha533</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sudha533"/>
    <language>en</language>
    <item>
      <title>How to create a .env file in an ASP.NET Core Web API project and use its values in the application configuration</title>
      <dc:creator>Sudha Subramaniam</dc:creator>
      <pubDate>Thu, 23 May 2024 06:19:08 +0000</pubDate>
      <link>https://dev.to/sudha533/how-to-create-a-env-file-in-an-aspnet-core-web-api-project-and-use-its-values-in-the-application-configuration-fam</link>
      <guid>https://dev.to/sudha533/how-to-create-a-env-file-in-an-aspnet-core-web-api-project-and-use-its-values-in-the-application-configuration-fam</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;




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

&lt;/div&gt;
&lt;h3&gt;
  
  
  Install DotNetEnv
&lt;/h3&gt;

&lt;p&gt;First, add the DotNetEnv package to your project. Right-click your project, then select NuGet Packages, search for DotNetEnv, and install it&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fsoe4isd9n1dapu8ox6zd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fsoe4isd9n1dapu8ox6zd.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Create a '.env' file
&lt;/h3&gt;

&lt;p&gt;Create a .env file in the root of your project directory. Add your connection string and any other environment-specific settings you need.&lt;br&gt;
&lt;strong&gt;Example '.env' :&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

ConnectionStrings__DBCon=YourSecureConnectionString


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

&lt;/div&gt;
&lt;h3&gt;
  
  
  Update program.cs to load environment variables from the '.env' file and integrate them to the configuration
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Example 'program.cs' :&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

using DotNetEnv;

// Load .env file
DotNetEnv.Env.Load();

//Configure connection string from environment variable
var connectionString = Environment.GetEnvironmentVariable("ConnectionStrings__DBCon");
if (string.IsNullOrEmpty(connectionString))
{
    throw new Exception("Connection string not found. Ensure the .env file is correctly configured and placed in the root directory.");

//Add connection string to the applications configuration system
builder.Configuration.AddInMemoryCollection(new Dictionary&amp;lt;string, string&amp;gt;
{ {"ConnectionStrings:DBCon", connectionString }
});



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

&lt;/div&gt;
&lt;h3&gt;
  
  
  Reference Environment Variables in appsettings.json
&lt;/h3&gt;

&lt;p&gt;Modify your appsettings.json to include placeholders for environment variables. These placeholders will be replaced by the values from the .env file when the application runs.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

{% raw %}`{
  "ConnectionStrings": {
    "DBCon": "Environment variable not set"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}
```
### Configure Environment Variables in Azure
Step 1: Open the Azure Portal
Step 2: In the left-hand menu, select Environment vairables under the Settings section.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/em8xw4dw9o2ty0wsf2mp.png)
Step 3: Add a new setting for each environment variable you need. For example:
Name: ConnectionStrings__DBCon
Value: your-connection-string-here
Then save it.
By configuring environment variables in Azure, you ensure your application is secure, flexible, and maintainable.







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

&lt;/div&gt;

</description>
      <category>aspdotnet</category>
      <category>softwaredevelopment</category>
      <category>azure</category>
      <category>environmentvariables</category>
    </item>
    <item>
      <title>Git and Github</title>
      <dc:creator>Sudha Subramaniam</dc:creator>
      <pubDate>Wed, 05 Apr 2023 02:06:29 +0000</pubDate>
      <link>https://dev.to/sudha533/git-and-github-gc5</link>
      <guid>https://dev.to/sudha533/git-and-github-gc5</guid>
      <description>&lt;p&gt;Git is a software that allows you to keep track of changes that you made to a project overtime. Git works by recording changes you make to a project, storing those changes and allowing to reference them as need. &lt;/p&gt;

&lt;p&gt;All git commands follow the pattern &lt;strong&gt;git &lt;/strong&gt; and in order to use git for a project, a project must first be initialized using the  git init command in the project's root directory.&lt;/p&gt;

&lt;p&gt;Git Project Workflow&lt;br&gt;
A Git project has three parts:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A Working Directory:&lt;/strong&gt; where files are created, edited, deleted, and organized&lt;br&gt;
&lt;strong&gt;A Staging Area:&lt;/strong&gt; where changes that are made to the working directory are listed&lt;br&gt;
&lt;strong&gt;A Repository:&lt;/strong&gt; where Git permanently stores changes as different versions of the project&lt;br&gt;
The Git workflow consists of editing files in the working directory, adding files to the staging area, and saving changes to a Git repository.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Git commands&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;git init&lt;/strong&gt; : The command sets up all the tools Git needs to begin tracking changes made to the project. It creates a new Git repository&lt;br&gt;
&lt;strong&gt;git status&lt;/strong&gt;: This command helps to check the status of changes made to the project&lt;br&gt;
&lt;strong&gt;git add&lt;/strong&gt; : In order for git to start tracking the project, it needs to be added in the staging area. We can add a file to staging area with &lt;strong&gt;git add filename&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;git diff&lt;/strong&gt; : Using this command we can check the differences between the working directory and the staging area.&lt;strong&gt;git diff filename&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;git commit&lt;/strong&gt; : Git commit is the last step in git workflow.  Commits permanently stores changes from staging area inside the repository&lt;br&gt;
&lt;strong&gt;git log&lt;/strong&gt; : Often with Git, you’ll need to refer back to an earlier version of a project. Commits are stored chronologically in the repository and can be viewed with: &lt;strong&gt;git log&lt;/strong&gt; (shows a list of all previous commits)&lt;br&gt;
&lt;strong&gt;git show HEAD&lt;/strong&gt;: In Git, the commit you are currently on is known as the HEAD commit. In many cases, the most recently made commit is the HEAD commit.&lt;/p&gt;

&lt;p&gt;An overview of a typical Git project workflow:&lt;/p&gt;

&lt;p&gt;Create a Git repository: Initialize a Git repository on your local machine or create one on a Git hosting service such as GitHub or GitLab.&lt;/p&gt;

&lt;p&gt;Create a branch: Create a new branch for each new feature or bug fix you want to work on. This allows you to work on changes without affecting the main codebase.&lt;/p&gt;

&lt;p&gt;Make changes: Make changes to the files in your branch using your preferred text editor or integrated development environment (IDE).&lt;/p&gt;

&lt;p&gt;Stage changes: Use the Git command git add to stage the changes you've made. This tells Git which files you want to include in the next commit.&lt;/p&gt;

&lt;p&gt;Commit changes: Use the Git command git commit to create a new commit with a descriptive message summarizing the changes you've made. Commits should be small and focused, addressing one specific feature or bug fix at a time.&lt;/p&gt;

&lt;p&gt;Push changes: Use the Git command git push to push your committed changes to the remote repository on GitHub or GitLab.&lt;/p&gt;

&lt;p&gt;Create a pull request: If you're working with a team, create a pull request to merge your changes into the main codebase. This allows other team members to review your changes before they are merged.&lt;/p&gt;

&lt;p&gt;Resolve conflicts: If there are conflicts between your changes and the main codebase, resolve them by editing the affected files and committing the changes.&lt;/p&gt;

&lt;p&gt;Merge changes: Once your changes have been approved and any conflicts have been resolved, merge your branch into the main codebase.&lt;/p&gt;

&lt;p&gt;Update local repository: Use the Git command git pull to update your local repository with any changes that have been made by other team members.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Different ways of writing a function in Javascript</title>
      <dc:creator>Sudha Subramaniam</dc:creator>
      <pubDate>Wed, 22 Feb 2023 17:47:33 +0000</pubDate>
      <link>https://dev.to/sudha533/different-ways-of-writing-a-function-in-javascript-89f</link>
      <guid>https://dev.to/sudha533/different-ways-of-writing-a-function-in-javascript-89f</guid>
      <description>&lt;p&gt;Here are several ways to write functions in JavaScript:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Function declaration:&lt;/u&gt;&lt;/strong&gt; This is the most common way of declaring a function in JavaScript. It uses the function keyword followed by the function name, parameter list in parentheses, and the function body in curly braces. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
`function addNumbers(x, y) {
  return x + y;
}`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;u&gt;Function expression:&lt;/u&gt;&lt;/strong&gt; A function expression is created by assigning a function to a variable. It can be either an anonymous function or a named function. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var addNumbers = function(x, y) {
  return x + y;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;u&gt;Arrow function:&lt;/u&gt;&lt;/strong&gt; Arrow functions provide a shorter syntax for writing function expressions. They are denoted by a fat arrow =&amp;gt; and do not require the function keyword. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var addNumbers = (x, y) =&amp;gt; {
  return x + y;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also omit the curly braces and return keyword for single-line arrow functions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var addNumbers = (x, y) =&amp;gt; x + y;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;u&gt;Function constructor:&lt;/u&gt;&lt;/strong&gt; This method creates a function using the Function constructor. It takes a string of arguments and function body as parameters. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var addNumbers = new Function('x', 'y', 'return x + y');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;u&gt;Generator function:&lt;/u&gt;&lt;/strong&gt; A generator function returns an iterator object that can be used to iterate through a sequence of values. It is declared using the function* keyword and contains one or more yield statements. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
function* generateNumbers() {
  yield 1;
  yield 2;
  yield 3;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;u&gt;Immediately invoked function expression (IIFE):&lt;/u&gt;&lt;/strong&gt; An IIFE is a function that is declared and invoked immediately. It is typically used to create a private scope for variables and functions. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(function() {
  // code here
})();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are some of the most common ways to write functions in JavaScript. Each has its own advantages and use cases, so it's important to choose the right method for your particular situation.&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>Runtime environment</title>
      <dc:creator>Sudha Subramaniam</dc:creator>
      <pubDate>Wed, 15 Feb 2023 11:08:47 +0000</pubDate>
      <link>https://dev.to/sudha533/runtime-environment-5bfj</link>
      <guid>https://dev.to/sudha533/runtime-environment-5bfj</guid>
      <description>&lt;p&gt;A runtime environment is where your program will be executed. JavaScript code may be executed in one of two runtime environments:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;- A browser’s runtime environment&lt;/li&gt;
&lt;li&gt;- The Node runtime environment&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In each of these environments, different data values and functions are available, and these differences help distinguish front-end applications from back-end applications.&lt;/p&gt;

&lt;p&gt;Front-end JavaScript applications are executed in a browser’s runtime environment and have access to the window object.&lt;br&gt;
Back-end JavaScript applications are executed in the Node runtime environment and have access to the file system, databases, and networks attached to the server.&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>gamedev</category>
      <category>gamechallenge</category>
      <category>discuss</category>
    </item>
    <item>
      <title>What is cookies? What is cache?</title>
      <dc:creator>Sudha Subramaniam</dc:creator>
      <pubDate>Mon, 13 Feb 2023 21:05:42 +0000</pubDate>
      <link>https://dev.to/sudha533/what-is-cookies-what-is-cache-h5h</link>
      <guid>https://dev.to/sudha533/what-is-cookies-what-is-cache-h5h</guid>
      <description>&lt;p&gt;Cookies are small text files that website stores in your browser which contain information pertaining to that website. Each time you return to that website, the data or cookie is sent back to the site.&lt;/p&gt;

&lt;p&gt;Cookies may contain:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Usernames and passwords&lt;/li&gt;
&lt;li&gt;Links that you've clicked on&lt;/li&gt;
&lt;li&gt;Your cart information for buying online&lt;/li&gt;
&lt;li&gt;Visitor tracking information&lt;/li&gt;
&lt;li&gt;Your computer's general location in the world&lt;/li&gt;
&lt;li&gt;Video's you've watched.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Cache&lt;br&gt;
``&lt;br&gt;
The cache is a portion of hard disk space where your web browser stores copies of internet files for re-use.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Your computer saves files from sites that you visit online.&lt;/li&gt;
&lt;li&gt;When you have a cached copy of a website, it will load faster.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>vibecoding</category>
    </item>
  </channel>
</rss>
