teleren/devto huggingface dataset:
ConfigureAwait in C#
Tags: csharp, beginners, programming, aspdotnet
Published: 2023-05-15 16:39:05

When we use the await keyword to asynchronously wait for a task to complete, the current synchronization context is captured and used to resume the execution of the rest of the method after the awaited task completes.

This means that if the awaited task completes on a different thread than the one that started the method. However, in some cases, it may not be necessary or desirable to resume on the original synchronization context.

We can use the ConfigureAwait(false) method to explicitly specify that the continuation of the method can run on any thread, rather than the original synchronization context. This can help to improve performance and reduce the risk of deadlocks or other synchronization issues.

ConfigureAwait(false) can be used for improving performance and reduce the risk of synchronization issues in cases where the continuation of the method does not need to run on the original synchronization context.

```
int sum = await Task.Run(() => 
{
   if (Thread.CurrentThread.Name == null)
   {
      Thread.CurrentThread.Name = Guid.NewGuid().ToString();
   }

   Console.WriteLine($"Task.Run running on thread id: 
   {Thread.CurrentThread.Name}");
   
    return a + b;
}).ConfigureAwait(false);
```
If you want to see this code in action, just get the code from the repository in [GitHub](https://github.com/HeyBaldur/ConfigureAwait) where I use two different methods, one with the `ConfigureAwait` and the other without it. 

You can run it locally and see the results in the console for better understanding. 

Bonus:
You can also tab in `Visual Studio => Debug => Windows => Threads` you will be able to visualize also the code in execution. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/08bnozoul6kmegd0qn6c.png)



If you find this explanation and code useful, please follow me on:

- GitHub as [HeyBaldur](https://github.com/HeyBaldur)
- Twitter as [HeyBaldur](https://twitter.com/HeyBaldur)

Happy coding!
Programming Again After 2 Years... | Mental Health & Burn Out
Tags: mentalhealth, programming, coding
Published: 2023-05-15 16:26:04

Hello! I'm glad to be back on the platform after two years again. The truth is that I took a 2 year break from programming. After learning to code in 2020, I had a great year learning Python, JavaScript/TypeScript, Rust and much more. I built a lot of fun projects and wrote a lot of fun articles on dev.to! However, I think I got burned out from coding every day for hours on end, constantly learning new things and making new projects. This burn out led me to not write a single piece of code for 2 years.

You might be wondering, why am I writing this post? Well, the truth is that I am now interested in programming again, and interested in writing more blogs! I want to keep myself accountable on this journey of relearning all of my skills by writing blogs on my journey and how to come back after a burn out. Stay tuned!
7 reasons to use Bard Over ChatGpt!
Tags: ai, chatgpt
Published: 2023-05-15 16:21:30

Wherever you go there is **AI**🙂
So in the era of Ai, choosing which Ai is suitable for your task is difficult.

And to make it easier we have several AI's in one of them there is king aka **ChatGPT** no doubt it is brilliant invention 🙌 Eating white collar jobs 😀

However in the race tech giant **GOOGLE** too has came with there AI model as _bald_ oops  **BARD** sounds wierd right?😂
 
Ok no more cringe Jokes !!

Let's compare why to use _BARD_ instead of _ChatGpt_

So I have listed 7 reasons below 👇

**1.Take Voice input** - yes you read it right now no need to type lengthy prompts just tell the prompts using your voice only, which Chatgpt can't 👀

**2.Enhance your search with Google**- If he can't answer which is impossible but if it can't then it will enhance your result with Google page.

**3.Integrate with Gmail**- Go update your Gmail asap, than see the magic of AI, give the prompts and it easily wrote email for you, as _"Help me write"_ 
[AI writing Email for you(YouTube)](https://youtu.be/ixRanV-rdAQ)

**4.Generate multiple draft** - Yes it will generate multiple drafts of your prompts so vast opportunity to explore.

**5.Support for different Plugins** - It supports multiple plugins either replit, Spotify or YouTube etc.

**6.Supports 20+ programming language**- Pain for us but it is truth Bard supports 20+ programming languages 🥹

**7.Access to the internet** - It fetches the result from internet itself, so no more stack overflow 🦥 

Fun fact after the introduction of ChatGpt I forgot to use Stack overflow. 
Is it end of Stack overflow what you guys think 🤔

So that's all hope it is helpful and painful too 💔
Diversity & Inclusion in hiring
Tags: diversity, hiring, inclusion, diversityintech
Published: 2023-05-15 16:19:32

Creating a diverse and inclusive workplace is crucial for any organization that wants to succeed in today's global economy. Not only does it promote collaboration and innovation, but it also helps attract and retain top talent. In this post, we will discuss practical tips and guidelines for building a more diverse and inclusive organization by focusing on the hiring process.

## Start with a Clear Job Description

One of the first steps in building a diverse and inclusive organization is to have a clear job description that reflects the company's values and culture. In addition to standard text that claims to value diversity and equality, hiring managers should specify what they are looking for in a candidate. This will help attract candidates who share the company's values and are more likely to contribute to a diverse and inclusive workplace.

## Source Candidates from Diverse Channels

To ensure that the pool of applicants is not limited to a particular group, it's important to source candidates from diverse channels. This can include job boards that specifically target underrepresented groups, attending job fairs or events hosted by organizations that promote diversity, and reaching out to professional associations that focus on diversity and inclusion.

## Use a Diverse Panel of Interviewers

Having a diverse panel of interviewers can help prevent unconscious biases from affecting the hiring decision. It's important to ensure that the interviewers come from different backgrounds and have different perspectives. This will help ensure that the hiring decision is based on the candidate's qualifications and skills rather than their personal characteristics.

## Periodically Monitor Progress

It's important to periodically monitor the progress of diversity and inclusion efforts. This can be done by analyzing data and metrics related to hiring, retention, and promotion of employees from different backgrounds. Making the process public can also help hold the company accountable for its efforts.

## Identify and Correct Biases

Identifying and correcting biases that may exist in the hiring process is crucial for building a more diverse and inclusive workplace. By learning from mistakes and re-applying these measures, companies can create a more inclusive and equitable workplace that benefits everyone involved.

In conclusion, building a diverse and inclusive workplace starts with the hiring process. Companies should create a workplace that values and respects everyone, regardless of their background.

---

If you like this article, please leave likes/comments. Want more subscribe to my newsletter on [Substack](https://sendilkumarn.substack.com)

You can follow me on [Twitter](https://twitter.com/sendilkumarn) and [LinkedIN](https://www.linkedin.com/in/sendilkumarn/).
How To Use expect.objectContaining With Null and Undefined
Tags: javascript, testing, tutorial, node
Published: 2023-05-15 16:01:08

If you use Jest for testing, you are probably familiar with the `expect` function and its many matchers. One of the most useful matchers is `expect.objectContaining()`, which allows you to check whether an object contains a certain set of properties and types.

However, one limitation of `expect.objectContaining()` is that it does not support `null` and `undefined` values. This can be frustrating when testing code that returns properties that are optional or nullable.

I recently came across a workaround for this issue by using the `expect.toBeOneOf()` matcher from the [jest-extended](https://github.com/jest-community/jest-extended) library. This matcher allows you to check whether a value matches one of the expected values, including `null` and `undefined`.

```js
test("should not allow null or undefined", async () => {
  const userType = expect.objectContaining({
    id: expect.any(Number),
    name: expect.any(String),
    email: expect.any(String),
  });

  //! email cannot be null or undefined
  expect({
    id: 1,
    name: "John Doe",
    email: undefined,
  }).toEqual(userType);
});

test("should allow null or undefined", async () => {
  const userType = expect.objectContaining({
    id: expect.any(Number),
    name: expect.any(String),
    // allow null and undefined
    email: expect.toBeOneOf([expect.any(String), null, undefined]),
  });

  //> email can be null
  expect({
    id: 1,
    name: "John Doe",
    email: null,
  }).toEqual(userType);
	
  //> email can be undefined
  expect({
    id: 2,
    name: "Jane Doe",
    email: undefined,
  }).toEqual(userType);
});

```

In this example, we test whether the given object has a certain set of properties with particular types. For the email property, we use `expect.toBeOneOf([expect.any(String), null, undefined])` to allow `null`, `undefined` or a `string` as possible values.

Here is the result of the test run of the two test cases. As expected, the first test case fails because of the `undefined` value of email. In the second test case, both `null` and `undefined` pass the test as valid values.

![CodeSandBox](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yn4ru0dfbj7a2dp3nu50.png)

I've prepared a CodeSandBox that lets you try it out quickly without having to go to the trouble of setting up Jest:

{% cta https://codesandbox.io/p/sandbox/9p9fmy?file=%2Findex.test.js%3A1%2C1 %} Try CodeSandBox {% endcta %}

---

I hope you found this post helpful. If you have any questions or comments, feel free to leave them below. If you'd like to connect with me, you can find me on [LinkedIn](https://www.linkedin.com/in/christian-zirkel/) or [GitHub](https://github.com/zirkelc). Thanks for reading!
Advantages and disadvantages of being vulnerable
Published: 2023-05-15 15:53:42

Dr. Brené Brown defines vulnerability as “uncertainty, risk, and emotional exposure.”

Julia Schwab added that, "If you look back on some of the most dramatic events in your life, you’ll notice that the times when you felt more vulnerable and dared to expose your emotions were the times when you showed the most courage. Furthermore, the times when you stepped out of your comfort zone – taking a new class, learning a new skill, discovering a new place – were also the times when you opened yourself to experience new emotions and grew as a person."

In general, we refer to vulnerability as the state or quality of being exposed to physical or emotional harm, and that’s precisely what generates the belief that vulnerability is bad.

The issue is that by trying to be emotionally immune to everything and everyone, we may indeed feel safer, but at the same time live a pretty boring life

The impacts of being vulnerable on day-to-day life should not be underestimated. Persons in vulnerable circumstances may be significantly less able to represent their own interests, and more likely to suffer harm than the average person. 

**Disadvantages of vulnerability**
Vulnerability is characterised by a range of emotional and practical consequences, including heightened stress levels, time pressures, a lack of perspective, poor decision-making, an inability to plan ahead and foresee problems, and changing attitudes towards risk-taking. 

**Advantages of vulnerability**
1. To get to know our authentic selves. 
2. Opens the path to growth and gives us the courage to fight the need to please others and focus on our well-being. 
3. Bring to light all our emotions and process them.
4.  To know your vulnerability frees you from the prison of perfection and validation and opens the way to accepting risk, uncertainty

The key to becoming comfortable with your own vulnerability is to let things fall apart and give up on this hurtful idea that we have to be in control at all times. The closer you get to your own vulnerability, the more your life is going to change. 

When you break down the walls around your comfort zone and step into the unknown, you get to explore, learn, and grow.
Identifier In JavaScript
Tags: javascript, webdev, react
Published: 2023-05-15 15:39:59

## Let's first see what an Identifier is

An **Identifier** is a user-defined name or a sequence of characters in the programming languages to define a [variable](https://developer.mozilla.org/en-US/docs/Glossary/Variable), [function](https://developer.mozilla.org/en-US/docs/Glossary/Function), or [property](https://developer.mozilla.org/en-US/docs/Glossary/property).
It can be any combination of characters, but the combination of characters has a certain boundary/ restriction.

In this article, we will see what an Identifier means in JavaScript and what all combinations of characters are allowed in JavaScript to define any variable, function, or property name.


## An Identifier in JavaScript

JavaScript identifiers are case-sensitive and can contain [Unicode](https://developer.mozilla.org/en-US/docs/Glossary/Unicode) letters, `$`, `_`, and digits (0-9), but may not start with a digit.

An identifier is not a String, as a String is data, while an identifier is part of your code. In JavaScript, there is no way to convert identifiers to strings, but sometimes it is possible to parse strings into identifiers.

We **cannot use [reserved keywords] (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#reserved_words)** of JavaScript as an identifier.

## Let's see some examples of valid identifiers

```js
let name = "CapsCode"
let Name = "CapsCode"
//javascript variables are case sensitive

let firstName = "John" //any combination of characters

let _name="john" //can start with underscore

let first_name = "john" //can contain underscore

let name_="john" //can end with underscore

let $name = "john" //can start with dollar

let first$name = "john" //can contain dollar

let name$ = "john" //can end with dollar

let first123name = "john" //can contain number

let name123 = "john" //can end with number
```


## Let's see some examples of invalid identifiers

1. JavaScript variables do not contain spaces.
```js
let first name = "John" //SyntaxError
```


2. JavaScript variables do not start with numbers.
```js
let 1qw = "Rahul" //SyntaxError
```

3. Can contain **only** $
```js
let first#name = "john" //SyntaxError
let name#="john" //SyntaxError
let #name="john" //SyntaxError
```

4. do not start with the number
```js
let 123name = "john" //SyntaxError
```

5. should not be reserved keywords
```js
let switch = "john" //SyntaxError
let export = "john" //SyntaxError
let new = "john" //SyntaxError
```

## Conclusion
This is a brief introduction to what an identifier is and the various ways to define/ create a valid identifier in JavaScript.

If you find this article useful, share this article. Someone could find it useful too. If you find anything technically inaccurate, please feel free to create an [issue](https://github.com/CapsCode-Website/blogfiles/issues).

Hope it's a nice and informative read for you.
VISIT https://www.capscode.in/blog TO LEARN MORE...
See you in my next Blog article, Take care!!

Thanks,
CapsCode
Unleashing Roadmap Success
Tags: framework, nitric, cloudcomputing, leadership
Published: 2023-05-15 15:35:45

_As technology advances at a rapid pace, technical leaders often find themselves struggling to meet roadmap milestones. In this article, we explore the common obstacles that hinder progress and present the Nitric Framework as a solution._

By leveraging the benefits of standardization, controlled scalability, and on-demand productivity, technical leaders can effectively overcome these roadblocks and drive their projects toward successful milestone achievement.

The Nitric Framework offers several capabilities that help technology leaders reach their milestones more efficiently:

1. Accelerated Development and Deployment: Nitric provides a self-service runtime environment that allows developers to build and deploy applications quickly. This not only speeds up development cycles but also reduces time-to-market, increasing the likelihood of meeting milestones within the planned timeline.

2. Enhanced Productivity and Efficiency: Nitric automates infrastructure provisioning, significantly reducing the time developers spend on infra-related debugging and setup. This increased free time can improve productivity and efficiency, enabling teams to deliver results faster and stay on track with roadmap milestones.

3. Controlled Scalability for Resource Optimization: Nitric's controlled scalability feature optimizes resource allocation based on project needs, ensuring the availability of the right resources at the right time. This enhances productivity and maintains momentum towards milestone achievement.

4. Standardization and Consistency: Nitric promotes standardized practices across projects and teams, reducing errors and improving efficiency. Resources are provisioned in the same way across all teams, enabling quick and effective resolution of infra-related issues.

5. Streamlined Communication: Nitric's framework automates the inference of required resources and produces a resource specification that can easily be consumed by your team. This saves time and improves collaboration, allowing team members to focus on designing, writing, and testing application code while operations prioritize pressing platform issues such as compliance and security.

By leveraging these benefits, technology leaders can optimize productivity, resource allocation, and collaboration within their teams, ultimately increasing the likelihood of successfully meeting roadmap milestones.

If you're looking for ways to improve your roadmap success, we invite you to reach out to us. Thirty minutes of your time could save you hundreds of hours. [Let us show you how Nitric can help](https://calendly.com/d/2hs-96w-9gd/nitric-demo-30-min?month=2023-05)
Taking the plunge into Playwright!
Tags: testing, automation, playwright, selenium
Published: 2023-05-15 15:30:19

I've finally got to a point where we decided to experiment with Playwright. There were some very good reasons for this:

1. Our old WebDriver tests couldn't really be trusted anymore. This wasn't really a problem specific with WebDriver, it was just unfortunate that this happens when tests aren't run regularly (daily/weekly), maintenance isn't prioritized, and tests were just written poorly from the beginning. Just to note: We support a product where our WebDriver tests _are_ maintained & architected properly and executed on a weekly basis, and things are going swimmingly there. It's only when that cadence is abandoned where things can really really go south.

2. Running them in CI (even as simple as in a Bitbucket pipeline) was a huge pain, with a ton of custom work. This included containerization of our test code, pushing to ECR, starting an ECS instance, developing highly customized HTML reporting, and highly customized retry mechanisms. It was not the friendliest thing to deal with on a long-term basis.

3. Writing tests in Ruby is great, but with the limited team size, it seemed that moving to a language that aligned with the dev team has _some_ potential benefits. While expectations are low that the entire dev team would jump into writing e2e tests, I felt that breaking the language barrier was at least the bare minimum.

4. Finding opportunities for upskilling my team is always a priority. Always valuable to learn things that are on trend and desirable in the market.

I'll share some more thoughts and quick takes in another post. But so far, Playwright has made things very easy to get started. But as always, automation is easy to start, and difficult to master.
Advantage and disadvantage of vulnerability
Published: 2023-05-15 15:26:56

**Vulnerability** is the quality or state of being exposed to the possibility of being attacked or harmed, either physically or emotionally.
               **ADVANTAGE OF VULNERABILITY**
      One of the most crucial benefits of vulnerability is that it builds trust and intimacy in relationships. 
      Less stress/tension By being vulnerable, on the other hand, you eliminate this unnecessary tension and experience a higher level of freedom.
DISADVANTAGE OF VULNERABILITY
vulnerability is appealing, it can be risky. We may be hurt, laughed at, betrayed, criticized, shamed, bullied, or made to feel guilty about our behavior.
We may fear that we will be viewed negatively—as naïve, immature, unintelligent, neurotic, or perverted in some way-- after revealing too much. The worry underlying such fears is that if others really knew us, they would think less of us.
Other risks of vulnerability are losing control of the situation, being disappointed at another person’s reaction, and rejection. Telling someone that we are depressed, for example, may lead to too many phone calls and other intrusive queries that we may grow to resent. Or we may relate a painful life story, only to have the other person react indifferently, angrily, or critically, thus adding insult to injury. Then, too, we may fear that after sharing something important, the other person will turn their back on us and walk away.
Nextend Social Login Integration in User Meta Forms
Tags: wordpress, login, user, programming
Published: 2023-05-15 15:24:20

Nextend Social Login enables you to rapidly establish a thriving community. Users can effortlessly register using their social media accounts, including Facebook, Twitter, Google+, and LinkedIn, in a single click. In this video, we'll show you how to integrate Nextend Social Login into your user meta forms. This will allow users to login directly from your user meta forms, without having to enter their username and password separately.

As the video progresses, we dive into the setup process, guiding you through the configuration of Nextend Social Login within User Meta Forms. This is a great way to reduce user friction and make your user experience more seamless. Plus, it's easy to implement and you can get started right away! So if you're looking to improve your user experience, be sure to check out this video!

https://www.youtube.com/watch?v=8h726TfuyBk