teleren/devto huggingface dataset:
Simplify Component Communication in .NET with MediatR
Tags: programming, dotnet, cleancode, csharp
Published: 2023-07-03 18:54:46

MediatR, the acclaimed NuGet package, is a game-changer for .NET development, revolutionizing the way we handle communication and achieve loose coupling between components. Let's explore the key features of MediatR in this LinkedIn post:

🔹 Mediator Pattern Made Easy:

MediatR provides a robust implementation of the mediator pattern for .NET, enabling seamless communication and decoupling between components. Say goodbye to rigid dependencies and welcome scalable and maintainable applications.

🔹 Request/Response Messages:

With MediatR, you can dispatch request/response messages effortlessly. These messages are directed to a single handler responsible for processing them. This approach streamlines your codebase and promotes a clear separation of concerns, enhancing the overall maintainability and testability of your application.

🔹 Notification Messages:

MediatR takes it a step further by enabling the dispatching of notification messages. These messages are distributed to multiple handlers, allowing you to implement publish/subscribe or observer patterns within your application. This flexibility empowers you to build highly extensible and event-driven systems.

By leveraging MediatR in your .NET projects, you unlock the following benefits:

✅ Simplified communication and reduced coupling between components.

✅ Clean separation of concerns, resulting in highly maintainable code.

✅ Improved testability with easy mocking and unit testing of individual handlers.

✅ Enhanced extensibility through the publish/subscribe mechanism for notification messages.

Join the growing community of developers embracing MediatR and revolutionize your application architecture today!

```
//Inject MediatR to your DI container
services.AddMediatR(cfg => {
    cfg.RegisterServicesFromAssembly(typeof(Program).Assembly);
});

// Request/response messages
public class CreateTodoItemCommand : IRequest<int> { }
public class CreateTodoItemCommandHandler : IRequestHandler<CreateTodoItemCommand, int>
{
    public Task<int> Handle(CreateTodoItemCommandrequest, CancellationToken cancellationToken)
    {
        // Your application logic
       return Task.FromResult(0);
    }
}

// Notification messages
public class TodoItemCompletedEvent: INotification { } 

public class TodoItemCompletedEventHandler : INotificationHandler<TodoItemCompletedEvent>
{
    public Task Handle(TodoItemCompletedEvent notification, CancellationToken cancellationToken)
    {
        // Your application logic
        return Task.CompletedTask;
    }
}

public class TodoItemCompletedSendMailEventHandler : INotificationHandler<TodoItemCompletedEvent>
{
    public Task Handle(TodoItemCompletedEvent notification, CancellationToken cancellationToken)
    {
        // Your application logic
        return Task.CompletedTask;
    }
}

// Let's Call
// private ISender _mediator;
_mediator.Send(new CreateTodoItemCommand())

// private IPublisher _publisher;
_publisher.Publish(new TodoItemCompletedEvent());

```
First Post
Published: 2023-07-03 18:52:27

I started going through the Code academy full stack course yesterday. So far i can make a plain web page with pictures and videos embedned. I have learned about the parent and child relationships elements have to each other. One particularly interesting part of HTML is the attributes. Its neat how a block of text can be assigned an id like a variable and perhapse be recalled later or reused with out havign to retype the code.
Omit<Type, Keys> and Pick<Type, Keys>
Tags: 100daystooffload, typescript, utilitytypes
Published: 2023-07-03 18:50:38

Are these utility types in TypeScript friend or foe?

Here are some examples of these types from [typescriptlang.org](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys)

```typescript

// Pick<Type, Keys>
interface Todo {
  title: string;
  description: string;
  completed: boolean;
}
 
type TodoPreview = Pick<Todo, "title" | "completed">;
 
const todo: TodoPreview = {
  title: "Clean room",
  completed: false,
};

// Omit<Type, Keys>
interface Todo {
  title: string;
  description: string;
  completed: boolean;
  createdAt: number;
}
 
type TodoPreview = Omit<Todo, "description">;
 
const todo: TodoPreview = {
  title: "Clean room",
  completed: false,
  createdAt: 1615544252770,
};
```

They look very neat in a small example or in a well constrained domain context. And hey, there is less code to write.

However I have maintained a code base where these utility types has been overused and I'm therefore skeptical to them at this moment. The main problem is for me is that they are making the code less readable and therefore the code is less maintainable. It is also not obvious when changing a "parent" type what consequences that will cause elsewhere in the code. Then there is that feeling of OOP inheritance when using them.

My conclusion right now is to avoid these types when creating the domain model for an application and there has to be a very good reason to add them in my code, but I'm open to change my opinion! Someone has taken the time and effort and added them to TypeScript, and it's probably a good reason behind it (but not clear to me why though).
Blog.posts.first
Tags: beginners, javascript, career, github
Published: 2023-07-03 18:48:22

Ever since I started learning the principles of becoming a software developer, through the Flatiron software developer program. As I am learning HTML, Java, and CSS, I am understanding the essentials of coding. Before this program I had no experience with coding, it always seems like an interesting skill to learn. From watching the matrix to seeing the Decepticons in Transformers hack into the system to find their leader, to playing Watch Dogs on the PS5 hacking into anything at my disposal to do my bidding. I used HTML or its real name, HyperText Markup Language, to create the colors for my project, by using rel = "stylesheet" and href = "styles.css" to connect to "main.js." in addition, I connect styles.css to create the background color for my project.
DynamoDB GSI vs LSI Unleashed! Explained like you're five!
Tags: aws
Published: 2023-07-03 18:35:27

Imagine having a big box filled with a wide variety of toys.

**Cars**, **dolls**, and **balls** are all examples of toys. Now imagine that you want to locate every red car in the box. 

### GSI
A _global secondary index_ (**GSI**) functions similarly to a separate list or index that reveals the precise locations of all the red cars inside the box. 
So, instead of having to go through the entire box when someone asks for the red vehicles, you can easily look at this list and find them.

### LSI
In contrast, a _local secondary index_ (**LSI**) is similar to having smaller boxes inside a bigger one, each of which is for a certain kind of toy. 
There are boxes specifically designated for cars, dolls, and balls, for instance. You may discover the toys within each smaller box using a list or index that is specific to that box. 
Therefore, if you want to locate every red car, you may head to the car box, check its index, and only locate red cars in that particular box.

##TL;DR
In conclusion, a global secondary index aids in finding items throughout the whole box, whereas a local secondary index aids in finding items inside a specific area of the box.
There is a simple solution with CSS
Tags: stackoverflow, answers, css, react
Published: 2023-07-03 18:35:23

Usually CSS is hard! but not this time😄, an answer from Stack Overflow saved me a lot time and unwanted code. The requirement was to show icons onHover of a list item using react.

Came across this simple and efficient CSS solution without overengineering by [@arunkhot](https://stackoverflow.com/users/4758519/arun-khot),

{% stackoverflow 75562194 %}

Writing this appreciation post with the time saved😌
What is NGINX and how reverse proxies work?
Tags: javascript, webdev, programming, networking
Published: 2023-07-03 18:33:49

Every domain name resolves to a unique IP address. 
For example: `www.gooogle.com` is mapped to `142.250.191.78` ipv4. 

Whenever you host your program (for example: nodejs server or php server) on a remote machine (for example: AWS EC2 instances or Digitalocean), you are given a reserved public IP address with which you can connect with that remote device through SSH Terminal or any SSH client like PuTTY.

Now, suppose you visit `www.google.com/maps`. When you hit enter, your request is sent to the unqiue server which has the IP address `142.250.191.78`. Now your request has reached to the correct device, but how does `/maps` goes to the correct program running inside that device? Suppose you want that every `www.google.com/maps` must be served by a Nodejs server running inside that EC2 instance and `www.google.com/docs` must be served by a PHP server. How can we forward the `/maps` request to Nodejs server and `/docs` request to PHP server?

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

In the above diagram it is clearly shown that multiple requests are resolved by different app servers inside our machine. 
For example: `/maps` can be served by a Nodejs server, `/docs` can be served by a PHP server etc. 



**Solution**
This is done by NGINX server which is installed on the physical machine. 

NGINX maps the incoming request to be resolved by some other backend server. This process is called reverse proxy.

> A reverse proxy server is a type of proxy server that typically sits behind the firewall in a private network and directs client requests to the appropriate backend server.

An other popoular proxy server is HAproxy.

Now I am diving deep into the topic, so be attentive.
First of all let me make a quote.

> By default, all HTTP requests are served on port 80. 
> By default, all HTTPS requests are served on port 443.

Let suppose your `/maps` request is to be served by a Node server listening on port 1234 and your `/docs` request is to be servered by a PHP server on port 1235.

Now any request coming from client in the form of `/maps` or `/docs`, carries a default port 80 if it is an http request and 443 if it is an https request.

So, we must map the incoming request to different ports, which is done by NGINX.

Following image illustrates the process:


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

NGINX is written in C and it is very performant. It can handle ~10000 concurrent requests!
It can do multiple things like:

- Load balancing
- Rate limiting
- Http caching
- Reverse proxy
- Websocket connection
- Handling of static files, index files, and auto-indexing.
- URL redirection and rewriting...

Following image illustrates the load balancing part:

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

Thanks, please upvote.
🔗🌍🔒 Embrace the Future with Blockchain! 🚀
Tags: blockchainrevolution, decentralization, cryptoenthusiast
Published: 2023-07-03 18:30:18


Hey! Let's dive into the revolutionary world of Blockchain today! 🎉

Blockchain is a game-changing technology that has the power to transform industries and reshape the way we communicate, transfer value, and secure information. 🌐💰

Imagine a world where information is no longer confined to centralized servers owned by a few entities. With blockchain, we enter a decentralized realm where data is stored across multiple locations, making it tamper-proof, transparent, and highly secure. 💪✨

🌐🔐 Peer-to-Peer: No More Middlemen! 🤝

Traditional systems rely on intermediaries to facilitate transactions and verify information. Think about how we currently communicate over the internet—our data passes through servers owned by companies. The same goes for money transfers, where banks act as intermediaries. Blockchain disrupts this status quo by enabling direct, peer-to-peer interactions. No more middlemen! 😎

💡 Here's how it works: Every transaction or piece of information added to the blockchain is stored in a "block" that links to the previous one, forming an unalterable chain. This distributed ledger is maintained by a network of participants (nodes) who collectively validate and verify transactions. It's a democratic and transparent process! 🌐✨

👉 What does this mean for you as a professional, entrepreneur, or tech enthusiast? Blockchain opens up a world of possibilities! 🌍💼

✅ Enhanced Security: Say goodbye to data breaches and hacks. Blockchain's cryptographic algorithms ensure your information remains safe and intact. Your trust in the system is restored!

✅ Transparent Transactions: Thanks to the public nature of blockchain, all transactions are visible and verifiable. This fosters trust and accountability in various industries, from finance to supply chain management.

✅ Improved Efficiency: With blockchain's decentralized nature, transactions can be executed swiftly, removing the need for lengthy processing times and excessive paperwork. Time is money, after all! 💸⏰

✅ Empowering Innovation: The blockchain landscape is ripe with exciting opportunities. As a blockchain developer, you have the chance to build decentralized applications, smart contracts, and explore the realms of decentralized finance (DeFi), non-fungible tokens (NFTs), and much more!

Let's ride the blockchain wave together and unlock a future filled with trust, transparency, and endless possibilities. 🌊🔓

✨ If you're as passionate about blockchain as I am, hit that "Follow" button! Let's embark on this incredible journey together. 🚀💼
Who Writes Helm Charts?
Tags: kubernetes, devops, cloud
Published: 2023-07-03 18:03:03

It seems like for Helm charts (and their values files) the whole IT department needs to provide input:

- What are the dependencies of the application?
- What settings are available to customize the application?
- Server names, URL of DB, storage settings, maybe also message broker, and all other infrastructure/platform requirements
- Initial resource allocation, scaling settings, deployment strategy, HA settings (if on application level)
- Internal network settings like ports to be opened between your pods, service mesh settings & mTLS, certificates & their renewal
- Usernames and passwords in the different stages, path to secrets, additional certificates that need to be imported
- Backup settings, agents, storage path, interval settings
- Monitoring & logging agents, forwarding settings

If you work at a small company you might only have 2 or 3 people filling all these roles. But imagine working at a big company, where you really have 10 different people. Is it even possible under these circumstances to write Helm charts (and their values files) for an application in a single sprint?

So what's the solution? **Who writes Helm charts (and their values files) at your workplace?** Is splitting responsibility between charts and values files a good start? Where do you draw the line between things that belong into Terraform scripts and things that go into Helm charts?
Exploring Dedicated Virtualization Types in AWS
Tags: dedicatedhost, dedicatedinstance, dedicatedvirtualization, aws
Published: 2023-07-03 17:20:57

**Exploring Dedicated Virtualization Types in AWS**
AWS offers two distinct types of dedicated virtualization to cater to different needs: at the host level and at the instance level. This post aims to outline the disparities between these two offerings.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0rpe1ea2nvhimv1ycndh.jpg)

**Dedicated Host:**

A Dedicated Host consists of dedicated physical hardware exclusively allocated to a single AWS account. It enables the execution of instances of various sizes within a specific instance type. The number of instances is constrained by the available cores on the host.

A Dedicated Host can be shared among multiple organizations or accounts, providing flexibility and resource optimization.

**Bring Your Own License (BYOL):**
Software licenses often correlate with the number of CPUs, cores, and sockets utilized. With a Dedicated Host, visibility into the core usage of each deployed instance is provided. This enables accurate tracking and validation of license compliance, making it a significant advantage of opting for a Dedicated Host.

Simplified license management can be achieved by utilizing AWS License Manager, which automatically monitors licenses when launching AMIs belonging to a license group.

**Host Affinity:**
When launching an instance, it is possible to target a specific Dedicated Host by specifying its host ID. This ensures that the instance maintains host affinity upon restarts, maintaining consistent performance and configuration.

**Restrictions:**

**AMIs:**

Certain operating systems (OSes) and SQL Server instances require the usage of custom AMIs, as AWS's AMIs are incompatible with Dedicated Hosts.

**Host Limit:**
While there is a soft limit of 2 Dedicated Hosts per family per region, it can be increased to accommodate higher requirements.

**RDS:**
AWS Relational Database Service (RDS) instances cannot be launched on Dedicated Hosts.

**ASG:**
Instances within an Auto Scaling Group (ASG) that target a Dedicated Host must be launched via a Launch Template.

**Dedicated Instance:**
A Dedicated Instance guarantees that it will be launched on hardware dedicated solely to the corresponding AWS account, without any instances from other accounts. However, it does not provide visibility into the underlying core utilization.

**Host Affinity:**
Upon restart, a Dedicated Instance may or may not be instantiated on the same physical hardware. Nevertheless, it ensures that the underlying hardware exclusively hosts instances belonging to the same AWS account.
My Android Learning Journey: Day 2
Tags: android, developer, kotlin, androidstudio
Published: 2023-07-03 17:22:16

---
title: My Android Learning Journey: Day 2
published: true
description: Welcome to my Android learning journey!
tags: android, developer, kotlin, androidstudio
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9y90k98uhvfj3t23ivqs.png
# Use a ratio of 100:42 for best results.
# published_at: 2023-07-03 16:19 +0000
---

So, it's Day 2 of learning Android. The voyage continued into setting up Android Studio with a little overview of what it is all about.

Then we dive right into building our first app. No, it's not one of those beautiful Material UI apps. It's kinda like a "Hello World" program, but in Android. The course uses it to introduce several things in the code like "Composable functions", "The Surface Widget".

After a little playing around with the code, the course continued into explaining how to setup an Android emulator to test the app. It also explained how to use a physical device to test the app.

Here's the badge for the day:

![Set up Android Studio](https://developers.google.com/static/profile/badges/playlists/android/android-basics-compose-unit-1-pathway-2/badge.svg)

Visit it [here](https://developers.google.com/profile/badges/playlists/android/android-basics-compose-unit-1-pathway-2).

Finally, to end the day, I went on to study the next pathway and read a little about what in the world this "Jetpack Compose" is.

Today felt more like revision than learning something new because I'm already used to Android Studio from my Flutter practice. It may sound a little weird but yes, I' coming to Android from Flutter. Like I mentioned in my [first post](https://dev.to/charanmn7/my-android-learning-journey-day-1-4797), despite having myself familiarized with a ton of technologies, I didn't have enough experience and work to showcase. Anyway, I'm trying to gain exactly those, with this entirely new journey of mine... Experience and work that I can showcase publicly showcase to the world.

That's all for the day.
Thanks for reading! Do share your thoughts and experiences in the comments. I'd love to hear from real people like YOU!
Import Gmail MBOX to Outlook
Published: 2023-07-03 17:12:09

I advise using the **eSoftTools [MBOX Converter](https://www.esofttools.com/mbox-converter.html) Software** if you are wanted to Import Gmail MBOX to Outlook with ease. The software enables users to convert MBOX files from more than 20 supported email applications, including Apple Mail, Entourage, and Thunderbird. It can quickly save MBOX emails to many different file formats, including, EML, HTML, and many more. It is an effective tool for safely converting Gmail MBOX files to Outlook files. Additionally, a trial edition option is included, which is free of cost.
Read More - [How to Import Gmail MBOX to Outlook PST file easily?](https://www.esofttools.com/blog/import-gmail-mbox-to-outlook/)
Encapsulamiento en JavaScript
Tags: javascript, beginners, spanish
Published: 2023-07-03 16:44:35

El encapsulamiento es una parte importante en POO. La encapsulación como concepto central es que tanto las propiedades no puedan ser accesibles de manera directa desde fuera del objeto.


![Clase con getter y setter](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rfjbim785g9dncm6l6jf.png)

Hay que notar algo importante es que las propiedades tiene un guión bajo (_) como prefijo del nombre esto es una buena práctica para denotar que esta variable de clase es privada. La sintaxis set se asigna a una variable para tener la posibilidad de asignar un nuevo valor a la variable de clase. No solo sirve para eso sino que también se puede ocupar para validar que la nueva propiedad cumple con ciertos requerimientos.


![Ejemplo set name](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dqns73qflj1io8upvlb3.png)

En lo anterior se puede observar que la propiedad de nuevo nombre se valida que cumpla con la condición de que al menos sea mayor de 2 caracteres en caso de que no sea así se lanza un error. La sintaxis get se ocupa para obtener el valor de la propiedad. También se puede utilizar para que se realice cualquier cambio a la propiedad para que sea más acorde a las necesidades que se tengan. Como se muestra a continuación.


![Ejemplo get name](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ymekk1ge7srdoob2esqd.png)

En el caso anterior lo que se hace es que la propiedad de nombre la cambia para que la primera letra del mismo sea en mayúsculas. Si te gusto este artículo o aprendiste algo nuevo te agradecería bastante que me ayudaras a compartir y seguirme para más.