Skip to main content

amandabytes

Refit

Recently, I had the opportunity to test a great C# library that significantly improves the development of an SDK.

In later experiences develop an sdk project was something really honorous, wee need to create a lot of classes and methods to handle with the api request and response. Then, during my researchs I found Refit.

Refit is an rest library that helps a lot during an sdk develpment, you just need to create the contract classes (if you already has in an side project is even easyer), and create the interfaces for each controller. Simple as that.

An easy way to measure your method performance

Measuring method execution time is essential for optimizing applications, whether for profiling, performance monitoring, or detecting degradation over time. Although there are many tools and libraries available for this purpose, we often seek straightforward and non-intrusive solutions.

# The Solution: MethodTimer

One of the most efficient and cleanest ways to measure method performance in C# is by using the MethodTimer.Fody library. This tool automatically adds timers to the desired methods through a simple attribute, without modifying the existing code.

Removing sensitive data from commit history

Today, I learned something extremely useful: how to efficiently remove sensitive information from commit history.

At some point, many of us make the mistake of accidentally pushing sensitive information to a GitHub repository. Simply deleting the information from the current repository does not solve the problem, as the commit history will still show the previous version with that information.

To address this issue, many turn to git-filter-branch. However, I want to introduce an even better alternative: BFG.

Implementing Redis Caching with .NET

# Introduction

Recently, I had to implement a cache in an application to avoid unnecessary database queries. Having worked with Redis in the past, I realized that implementing a cache with Redis can be quite straightforward and effective when done correctly.

# Redis vs Memcached

Redis is almost like a NoSQL database but excels as a cache due to its key-value storage model. The choice between Redis and Memcached depends on the use case and data volume. If you need to store session information, Memcached is a good choice. However, for extensive queries involving larger data sets, Redis is more suitable. Memcached uses the application’s memory to store data, while Redis is a distributed cache, independent of the application’s memory, allowing it to scale vertically as demand grows.

Implementing an SQS Publisher and Consumer Using .NET

In a previous post, I introduced the concept of queues and their usage. Now, I will explain how to implement an SQS consumer and publisher using C# and .NET.

# SQS

SQS (Simple Queue Service) is an Amazon Web Services offering that enables the sending, storing, and receiving of messages between software components at any volume, ensuring no message loss and eliminating the need for immediate availability of other services.

Curly braces on new line in vscode

This past week, I dedicated my mornings to a single goal: configuring Visual Studio Code to automatically insert a new line before braces {}.

How it was:

if (true){
  // do something
}

How I wanted it to be:

if (true)
{
  // do something
}

The task proved to be more challenging than I expected. I found many discussions about the same issue in forums and on Stack Overflow, but no definitive solution. So I’m here to share the solution I discovered.

Understanding directories in Linux

If you just installed Linux and are used to the Windows directory structure, you might be wondering where the “C: drive” is. Understanding Linux directories can help you manage the system and understand how it works.

# Directory structure: Windows vs. Linux

Windows and Linux have evolved differently in terms of directory structure. Linux is more similar to other Unix-like systems, such as macOS. In fact, Windows is the most different from most operating systems in terms of organization.

Uses for a queue

# What is a Queue?

A queue is a dynamic data structure that allows for the removal of elements and the insertion of new objects. More specifically, a queue is a structure that follows the rule of operation where whenever there is a removal, the element removed is the one that has been in the structure the longest. Queues follow the FIFO (First In, First Out) principle, where the first element added is the first to be removed. This is useful for many applications in distributed systems, where the order of operations is important.