teleren/devto huggingface dataset:
C#: Pass Lambda Expression to Where LINQ at Runtime
Tags: csharp, linq, lambda
Published: 2023-03-29 06:47:28

I often use LINQ query in my projects, and I sometime needs to pass the lambda expression at the run time, rather than compile time. In this article, I show some samples to achieve this.

## Install Library

I create a console application with .NET 7 this time. One library I need to include is [``System.Linq.Dynamic.Core``](https://github.com/zzzprojects/System.Linq.Dynamic.Core).

## Where LINQ

Let's write a code for ``Where`` LINQ query. The ``Where`` extension method takes ``Func<T, bool>`` delegate. The ``T`` changes depending on what you query against. 

I use ``List<string>`` to simplify the sample for now.

- Define input type and variable name as ``ParameterExpression``
- Define expression and return type
- Define lambda

```csharp
ParameterExpression param = Expression.Parameter(typeof(string), "x");
Expression expression = new ExpressionParser(
    new ParameterExpression[] { param }, 
    "x==\"1\"", 
    null, 
    new ParsingConfig())
    .Parse(typeof(bool));

Expression<Func<string, bool>> lambda = 
    Expression.Lambda<Func<string, bool>>(expression, param);
```
The first statement is to define the input type, which is ``string`` and I name it as ``x``.

Then I create the expression as ``x=="1"``. The return type is always ``bool`` for ``Where`` method.

Then finally, create the lambda expression object.

Let's use it.

```csharp
List<string> inputs = new() { "1", "2" };
List<string>result = inputs.AsQueryable().Where(lambda).ToList();
```
This is equivalent to ``inputs.Where(x=>x == "1").ToList()``.

The result is:

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

Now, change it to dynamic by using Console.ReadLine();

```csharp
string query = Console.ReadLine();

ParameterExpression param = Expression.Parameter(typeof(string), "x");
Expression expression = new ExpressionParser(
    new ParameterExpression[] { param },
    query, 
    null, 
    new ParsingConfig())
    .Parse(typeof(bool));
```

Then, I can pass query from console.

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

## Summary

I hope you get some idea how to dynamically create the lambda expression object. In the next article, I will show other LINQ examples.
10 Tips for Making Your Website Accessible in 2021
Tags: a11y, webdev, rgaa, programming
Published: 2023-03-29 06:30:00

1. **Use descriptive and meaningful HTML headings**: The headings help users navigate the page and provide context for the content. Use H1 for the main heading and H2 to H6 for subheadings, in a hierarchical order.

2. **Provide alt-text for images**: Alt-text allows users with visual impairments to understand what the image is about. Make sure the text accurately describes the image and provides context for it.

3. **Make sure your website is keyboard accessible**: Allow users to interact with the site using only the keyboard. This includes providing clear focus indicators, allowing users to tab through links and form elements, and ensuring that dropdown menus and modal windows are accessible.

4. **Use appropriate color contrast**: Ensure that the text and background colors have enough contrast so that users with color blindness or low vision can see and understand the content.

5. **Use clear and simple language**: Avoid using technical jargon and make sure the text is easy to read and understand. This includes using clear font sizes, styles, and colors.

6. **Provide transcriptions for audio and video content**: This allows users with hearing impairments to access and understand the content.

7. **Make sure your website is responsive**: Ensure that the site adjusts to different screen sizes and orientations, making it accessible on a variety of devices.

8. **Provide captions and subtitles for videos**: Captions allow users with hearing impairments to understand the audio content and subtitles provide support for users with language disabilities.

9. **Allow users to adjust the text size**: Provide an option for users to adjust the text size to meet their individual needs.

10. **Test and monitor accessibility**: Regularly test the site for accessibility issues and use tools to monitor accessibility, such as accessibility checkers and screen readers. Make sure to address any issues that are found and make updates as necessary to ensure that the site is accessible to everyone.

By following these best practices, you can ensure that your website is accessible to a wide range of users, including those with disabilities. This not only meets the requirements of accessibility laws, but it also helps create a more inclusive and user-friendly experience for everyone.

And that's it ! See U next level Doobs !
Hire a Comprehensive Crypto Exchange Development Service Provider
Tags: webdev
Published: 2023-03-29 06:27:30

For businesses thinking to break into the competitive cryptocurrency market, it is pivotal to choose a crypto exchange development company that offers a comprehensive spectrum of services ranging from consultancy, development, marketing, post-development support, etc. Antier, being a top-notch cryptocurrency exchange development company helps you launch your crypto exchange without any hassles. They have exclusive expertise in building solutions including:
-          Centralized Exchange
-          Decentralized Exchange
-          P2P Exchange
-          Bitcoin Exchange
-          Derivatives Exchange
-          Marginal Trading Exchange
-          NFT Exchange
-          Security Token Exchange
-          Over-the-counter Trading Platform
Draft your unique success story with us; develop your exchange platform using our blue-chip turnkey solutions or get it built from scratch. Share your project requirements with Antier today.
Zerando HackerRank ( 24 )
Published: 2023-03-29 06:24:02

E no vigésimo quarto episódio desta serie que queima os miolos, vamos abordar um problema envolvendo uma pilha de meias.

Neste problema, temos uma grande pilha de meias que devem ser combinadas por cor. Vamos receber um array de números inteiros representando a cor de cada meia, com isso devemos determinar quantos pares de meias com cores iguais existem.

Exemplo:
n = 7
ar = [1, 2, 1, 2, 1, 3, 2]

Há um par de cor e um de cor. Restam três meias ímpares, uma de cada cor. O número de pares é.

Para resolver este problema, resolveremos a função "sockMerchant". Está função recebera os seguintes parâmetros:

n: o número de meias na pilha.

ar[n]: as cores de cada meia.

Por sua vez deve retornar o numero de pares.

O objetivo da função é contar quantos pares de meias existem. Para isso, ela começa criando um novo array chamado _uniqueValues_, que contém apenas as cores únicas das meias. Isso é feito usando o construtor **Set**, que remove automaticamente os elementos duplicados do array original _ar_, e em seguida transforma-o novamente em um array usando o operador de propagação "...".

Em seguida, a função itera sobre cada um dos valores únicos do array, contando quantas vezes cada um aparece no array original ar. Para cada valor, a função usa o método _filter_ para criar um novo array chamado _filterValues_ que contém apenas os elementos que correspondem a esse valor. Em seguida, a função usa o método _Math.floor_ para calcular quantos pares podem ser feitos a partir desse array, e adiciona esse número ao contador _count_.

Finalmente, a função retorna o valor de _count_, que representa o número total de pares de meias encontrados no array original ar.

Nossa função deve ficar assim:

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

E assim fechamos mais um desafio.
Only 34% of developers got this JS concept right 😱❗️❗️
Tags: javascript, beginners, webdev, programming
Published: 2023-03-29 06:17:33

---
title: Only 34% of developers got this JS concept right 😱❗️❗️
published: true
description: Don’t make this mistake in your code
tags: javascript, beginners, webdev, programming
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-03-29 05:59 +0000
---

![Image JS Concept poll](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/imdzwsikwbyaempon5jb.png)

The question in that poll may *seem* simple but in reality, there is a few things going on.

If you are wondering the answer to that question is `steak`.

Let’s break that down.

### Pass By Reference

![Image Javascript Pass By Reference illustration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fpbu4y70l1u4k80qmn14.png)

Objects within Javascript are pass by reference by default.

What that means is variable definition and assignment are linked to the object as a reference.


So, any changes to that object means... **You are changing the original object** ❗️

The reason this is not ideal is because you are mutating the value of an object for all the code using that object.

And that can lead to really hard to debug bugs.

So, what can you do about it ?

Well, that’s where cloning comes in.

Let‘s see how that works.

### Object Cloning


![Image Object Cloning illustration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h6rviq6t27gcjuz59lo3.png)

One way to combat against this issue is through cloning of the object when re-assigning or when you are changing it.

When you clone an object, you are essentially creating a new copy of it.

So, that variable no longer references the original, it now references the new copy.


This way when you make changes to that object, it doesn’t affect the original object.

So, how do you do this in Javascript ?

Let’s look at some techniques you can use to achieve this.

### Object Cloning techniques (Javascript)

![Image Javascript Object Cloning Techniques](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gzx4v91cge5dchige280.png)

**Here are 3 methods for cloning objects:**

1. **Object.assign** - creates a shallow copy of the object

2. **Spread operator** - creates a shallow copy of the object

3. **structuredClone** - creates a deep copy of the object


The difference between shallow and deep is that deep will copy all the nested objects within the object. Shallow will not do this.

And there you have it!

Remember be careful when mutating or changing references to objects.

It can leads to nasty bugs!

If you learned something new or enjoyed this article, be sure to give it a like or share with someone you know!
React Query - useIsFetching & useIsMutation
Tags: react, reactquery, reacthooks
Published: 2023-03-29 05:56:58

---
title: React Query - useIsFetching & useIsMutation
published: true
date: 2023-03-29 05:49:40 UTC
tags: react, reactquery, reacthooks
canonical_url: https://blog.delpuppo.net/react-query-useisfetching-useismutation
cover_image: https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/aZsn0bJYqBU/upload/52ec4822b648fb481862c9cdb77091a2.jpeg
series: React Query
---

Hey folks,

Today it is time to talk about two hooks exposed by react query: useIsFetching and useIsMutation.

Each of these hooks could be used to understand if there is a fetching request or if there is a mutation request ongoing in the application.

They are useful if we need to create a global loader that appears when there are one or more requests on going.

But how can you use them?

Let's start with the useIsFetching.

```ts
import { useIsFetching } from '@tanstack/react-query';

export default function Loader() {
  const isFetching = useIsFetching();
  if (!isFetching) return null;

  return <>Fetching...</>
}
```

As you can see, the syntax is pretty simple. You can import the hook from the library and you can use the hook in your components. The hook returns only a boolean value that indicates if there are one or more fetching requests in the application. Then with this data, you can decide if you have to show a loader or not. Easy peasy!

Now it's time to move to the useIsMutation hook. This hook is similar to the previous one, the only different concept is that this hook handles the mutation requests. Let's see an example!

```ts
import { useIsMutating } from '@tanstack/react-query';

export default function Loader() {
  const isMutating = useIsMutating();
  if (!isMutating) return null;

  return <>Mutating...</>
}
```

As you can notice, the syntax is the same as the previous one, the only difference stands in the name of the hook and in its concept.

If you want to find more about these two hooks see my Youtube video about them.

{% embed https://youtu.be/dWuUjDNB6Yc %}

Ok, I think you have an idea of how these two hooks work. I hope you enjoyed this content.

See you soon folks

Bye Bye 👋

p.s. you can find the code of the video [here](https://github.com/Puppo/learning-react-query/tree/03-isfetching-and-mutating)

_Photo by [Rahul Mishra](https://unsplash.com/@rahuulmiishra?utm_source=Devto&utm_medium=referral) on [Unsplash](https://unsplash.com/?utm_source=devto&utm_medium=referral)_

{% embed https://dev.to/puppo %}
The Reasons Why CompTIA Security+ Worth It in 2023
Published: 2023-03-29 05:49:35

In 2023, CompTIA Security+ certification will still be a valuable and worthwhile investment for those interested in pursuing a career in cybersecurity or IT. Here are some of the reasons why:

Widely Recognized: 
CompTIA Security+ is one of the most recognized and respected certifications in the cybersecurity industry. It's vendor-neutral, meaning it's not tied to any specific technology or company, making it applicable across a wide range of organizations and industries.
Demonstrates Competency: 
Achieving CompTIA Security+ certification demonstrates a level of competence and knowledge in essential cybersecurity concepts such as risk management, access control, cryptography, and network security. Employers can be confident that certified professionals possess the skills necessary to protect their organization from cybersecurity threats.

Career Advancement: 
Holding a CompTIA Security+ certification can help individuals advance their careers in the cybersecurity field. It's a well-regarded credential that can open doors to higher-level positions and better-paying jobs. Additionally, many employers require or prefer candidates with this certification for roles in cybersecurity.

Industry Demand: 
The demand for cybersecurity professionals continues to grow, and employers are looking for individuals with the knowledge and skills to keep their organizations secure. According to the Bureau of Labor Statistics, employment in the cybersecurity field is projected to grow 33% from 2021 to 2030, much faster than the average for all occupations.

Continuing Education: 
CompTIA Security+ certification requires ongoing professional development to maintain the credential. This ensures that certified professionals stay current with the latest developments in cybersecurity and continue to hone their skills.

Versatility: 
As mentioned earlier, CompTIA Security+ is vendor-neutral, which means it's applicable across a wide range of industries and organizations. This versatility makes it an attractive credential for individuals interested in cybersecurity who may not want to limit themselves to a particular technology or industry.

Conclusion:
[CompTIA Security+ certification](https://www.edureka.co/comptia-security-plus-certification-training) is an excellent investment for individuals interested in pursuing a career in cybersecurity or IT. It's widely recognized, demonstrates competence, can lead to career advancement, is in high demand, requires ongoing education, and is versatile. With the continued growth of the cybersecurity field, having this certification will be even more valuable in 2023 and beyond.
How Much Does Magento 2 Cost
Tags: webdev, magento, magento2tutorial
Published: 2023-03-29 05:40:13

Magento 2 is a strong open-source internet business stage that permits organizations to make and deal with their own web-based store. The stage is intended to be adaptable, versatile, and adjustable, making it an incredible choice for organizations, all things considered. 

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

Notwithstanding, likewise with any web based business stage, there are expenses related with utilizing Magento 2, and it's critical to comprehend how much does Magento 2 cost prior to settling on a choice to introduce and arrange a Magento 2 Store.

For more info, visit https://webguru.dev/how-much-does-magento-2-cost/
Tips To Network Like A Pro
Tags: tutorial, beginners, productivity, career
Published: 2023-03-29 05:37:49

Networking is an important part of building professional connections, uncovering job opportunities, and advancing your career. Here are some tips to network like a pro:

1. Set clear goals: Before attending an event, set clear goals for what you want to accomplish. Identify the people you want to meet and the information you want to obtain.

2. Be prepared: Make sure you have business cards, a pitch ready, and a pen to take notes. Dress appropriately for the event and arrive early to have enough time to prepare.

3. Start conversations: Don't be afraid to start conversations with strangers. Introduce yourself, ask questions and show genuine interest in what others have to say.

4. Active listening: Listening is key to building relationships. Listen carefully to what others are saying and ask follow-up questions to show you understand and care.

5. Follow up: After meeting someone, follow up with them to continue the relationship. Send a thank-you note or a personalized email to show appreciation for their time.

6. Attend industry events: Attend industry events relevant to your field and meet other professionals in your industry. This can help you stay up-to-date on trends and make valuable connections.

7. Give value: Offer to help others and share relevant information or resources. This can help build trust and strengthen relationships.

8. Connect online: Use social media platforms like LinkedIn to connect with new people and keep in touch with existing contacts.

Remember, networking is about building relationships, and it takes time and effort. By setting clear goals, being prepared, starting conversations, active listening, following up, attending industry events, giving value, and connecting online, you can network like a pro and make valuable connections that can help you achieve your professional goals.
What is Apache Camel
Published: 2023-03-29 05:35:31

Apache Camel is an open-source integration framework that provides a lightweight and flexible way to integrate various systems and technologies. With Camel, developers can easily build integration solutions using a variety of programming languages, message formats, and protocols. Well one might ask what do we mean by integration solutions.
Integration solutions refer to the process of connecting different systems or technologies together so that they can exchange information and work together seamlessly. In today's technology landscape, it's common for organizations to use multiple systems and applications to support their business processes. For example, a company might use one system for customer relationship management (CRM), another for supply chain management, and yet another for financial management.

Integration solutions are needed to ensure that these systems can communicate and share data with each other effectively. This can involve tasks such as data mapping, transformation, and synchronization, as well as the implementation of protocols and standards for exchanging data between systems. Integration solutions can be implemented using middleware tools such as Apache Camel, which provides a set of patterns and components for connecting different systems and technologies together.

By implementing integration solutions, organizations can improve their operational efficiency, reduce data inconsistencies, and provide a better experience for both internal and external stakeholders. For example, integration solutions can enable a company to provide a single view of customer data across multiple systems, reducing the need for manual data entry and improving the accuracy of data. Integration solutions can also enable real-time data processing and analysis, enabling companies to make better decisions based on up-to-date information.

Overall, if you are new to Apache Camel, it may take some time to get up to speed with its concepts and patterns. However, if you are interested in building integration solutions or messaging architectures, Camel can be a powerful tool that can help you build complex systems in a flexible and maintainable way.
Need Help with Statistics Homework? Here are some Useful Tips
Tags: homeworkhelp, statisticshomeworkhelp, statistics, helpmewithmystatisticshomework
Published: 2023-03-29 05:28:40


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cg87scypm14eycvtzl5v.png)Are you struggling with your statistics homework? Don't worry, you're not alone! Statistics can be a challenging subject for many students, especially if you're new to the field of data analysis.

Fortunately, there are plenty of resources available online that can help you with your statistics homework. In this post, we'll provide some useful tips and tricks to help you complete your statistics assignments successfully.

First, make sure you understand the concepts. Statistics is a broad field, and it's easy to get lost in the details. Take the time to review your notes, read your textbook, and watch online videos that explain the concepts in simple terms.

Next, practice, practice, practice! Statistics is a skill that requires practice to master. The more problems you solve, the better you'll get at it. Look for practice problems and exercises online, and try to solve them on your own before checking the answers.

If you're still struggling, consider seeking help from online resources. There are many websites and forums dedicated to [statistics homework help](https://www.statisticshomeworkhelp.com/). You can ask questions, get feedback, and connect with other students who are in the same boat.

Finally, don't be afraid to ask for help from your teacher or professor. They are there to help you succeed and are usually happy to answer your questions or provide extra assistance.

In conclusion, statistics homework can be challenging, but with the right approach and resources, you can succeed. Keep practicing, seek help when you need it, and don't give up! Good luck!