C# Asynchronous Programming Patterns

There are 3 Asynchronous Programming Patterns in C#.

1- Asynchronous Programming Model (APM)
2- Event-based Asynchronous Pattern (EAP)
3- Task-based Asynchronous Pattern (TAP)

 

1- Asynchronous Programming Model (APM)

Asynchronous Programming Model using Delegates

you can reach that article from Calling synchronous methods asynchronously

2- Event-based Asynchronous Pattern (EAP)

3- Task-based Asynchronous Pattern (TAP)

Kubernetes multi node cluster with Vagrant (included Kubernetes Dashboards, Grafana, Prometheus)

The following Vagrantfile code(syntax is Ruby) is creating one master node and two worker nodes for Kubernetes.

Go to Vagrantfile directory in Terminal and run the following code to create virtual machines.

The following Vagrantfile code(syntax is Ruby) is creating one master node and two worker nodes for Kubernetes.

Go to Vagrantfile directory in Terminal and run the following code to create virtual machines.

As you can see in the below picture, three virtual machines are obtained and running.

But, Kubernetes cluester is still not ready. We created just an environment to install the cluster.
Continue reading

Chain of Responsibility Pattern and Aspect Oriented Programming with C#.NET

Each class contains only the business logic code, while the aspects will be responsible of intercepting the code in order to inject the cross-cutting concerns.

This is first version of example code.

This is second version. You can find MethodInfo and parameter values in the aspect classes.

Uninstall Vagrant on Ubuntu

Uninstall just vagrant

This will remove just the vagrant package itself.

sudo apt-get remove vagrant

Uninstall vagrant and its dependencies

To remove the vagrant package and any other dependant package which are no longer needed from Ubuntu.

sudo apt-get remove --auto-remove vagrant

Purging vagrant (your config/data too)

If you also want to delete your local/config files for vagrant then this will work.

sudo apt-get purge vagrant

To delete configuration and/or data files of vagrant and it's dependencies from Ubuntu then execute.

sudo apt-get purge --auto-remove vagrant

Bash Shortcuts

CommandDescription
CTRL + AMove to the start of the line.
CTRL + EMove to the end of the line.
CTRL + BMove back one character.
CTRL + FMove forward one character.
CTRL + DDelete one character after cursor.
CTRL + HDelete one character after cursor.
CTRL + UDelete from the cursor to the beginning of the line.
CTRL + KDelete from the cursor to the end of the line.
CTRL + WDelete from the cursor to the start of the word.
!!Execute last command in history.
!nExecute nth command in history.
!$Last argument of last command.
!^First argument of last command.

C# and RabbitMQ PubSub Example

Before you run the following C# code, run the below docker code to have a RabbitMQ applicaton locally.

docker run -d –hostname my-rabbit –name some-rabbit -p 8080:15672 -p 5672:5672 rabbitmq:3-management

After run Docker RabbitMQ container, you can reach from http://localhost:8080/ as shown in following picture.