Docker VirtualBox with Vagrant

if you have installed Vagrant CLI, just run the following command to create docker installed virtual box.

The following command will download a Vagrantfile file from Vagrant company in the current directory.

vagrant init kenanhancer/DockerMachine

This command will start the virtual machine.

vagrant up

If you want to check status of virtual machine, run the following command.

vagrant status

If you want to see ports of virtual machine, run the following command.

vagrant port

to connect created virtual machine, run the following command in the Vagrantfile directory.

vagrant ssh

if you want to see details of Vagrantfile, check it as below.

Creating a Vagrant Package file

vagrant package --output dockermachine.box --vagrantfile Vagrantfile

C# LocalDataStoreSlot, ThreadStatic, and ThreadLocal To Pass Thread Specific Data

Every thread will have isolated data. I try to show that concurrent web requests are coming to Controller classes and different data is passed to the threads. Lastly, don’t use with async/await, it is not working properly.

LocalDataStoreSlot

ThreadStatic

ThreadLocal

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.

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

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