Hasan Hasanov’s Blog

How to Parse Wav File

Introduction Audio analysis is hard. Recently, I needed a small code sample to parse a .wav file but couldn’t find anything that was working. I learned the hard way that there are a lot of combination of structures that we can take into account. In this article we will not discuss what each header does and how to use them. There are a lot of articles about that, which explain them far better than I ever could....

October 8, 2023 · Hasan Hasanov

How to Use BLE With WPF or Forms

Introduction Recently I had an idea of a project which requires using the Bluetooth API. I wanted to create something simple and did not want to use UWP for 2 reasons: I wanted to have a tray icon. This is also possible with UWP but creating a full-trust application seemed way more complicated for my scenario. I wanted a simple self-contained application which can run without the need of enabling developer mode for the end users....

April 19, 2021 · Hasan Hasanov

Back to Basics: What Is a Delegate?

Introduction One of the hardest things to explain to a beginner developer is delegate. It usually proves to be difficult because this piece of functionality’s use case is not obvious like variables, loops, collections etc. In this blog post we will explore exactly what is that thing called a delegate, where do we use them in our daily work or even if it is that important, so… What is a Delegate?...

April 5, 2021 · Hasan Hasanov

How to Docker Compose Vue.js, .NET Core and MSSQL

Introduction In this blog post we will see how to dockerize ASP.NET Core application, which connects to a MSSQL database and uses Vue.js as front-end. After that we will use them together with Docker Compose. We will use these projects in this tutorial. I have to admit it was harder than I thought it would be. Backend Application Let’s start with exploring our backend application. It consists of a single endpoint which returns information about a phone book entry:...

March 21, 2021 · Hasan Hasanov

How to Debug Live .NET Application

Introduction One of the most time-consuming parts of application development is debugging. This already hard part of our day to day life can easily become a nightmare if the application crashes only on production and you cannot reproduce it on your local machine. Fortunately, we have .NET tools which can come really handy in these scenarios. The Problem To demonstrate what I am talking about imagine that we have an API that serves weather data....

February 27, 2021 · Hasan Hasanov

How to Host .NET Core Applications in VPS Using Docker

Introduction This is a continuation from my previous article Where To Host .NET Applications . Go check that one too. In this blog post we will create a simple .NET application. Then we will dockerize it the easy way and host it in a Linux VPS so that the whole world can see it. Create simple application Let’s start with creating the application. As I said the application will be a simple one....

February 13, 2021 · Hasan Hasanov

Unit Test the Untestable

Introduction In this article I will go through some untestable classes and make them testable without third party dependencies. The best way of doing this is using delegates that we can provide in the class’s constructor and then configure them while testing. Let’s find out how to do that but first… What is untestable code? There are some things that makes our code untestable such as: Not programming to interfaces Newing up objects instead of using IOC Not using dependency injection As programmers we can take some steps to reduce or even eliminate these scenarios....

February 2, 2021 · Hasan Hasanov

Be Careful With ZipArchive

ZipArchive’s interesting behavior Today I had an ordinary assignment. Generate an in memory .zip archive with one text file inside and send it to a web api. With C# this is straight-forward. Here is my oversimplified first attempt: using var zipStream = new MemoryStream(); using var archive = new ZipArchive(zipStream, ZipArchiveMode.Create, true); var textFileEntry = archive.CreateEntry("Test.txt", CompressionLevel.Optimal); new MemoryStream(Encoding.UTF8.GetBytes("In memory file Content")) .CopyTo(textFileEntry.Open()); // Server sending logic The code above first creates a MemoryStream which represents the complete in memory zip archive....

January 18, 2021 · Hasan Hasanov

Where to Host .NET Core Applications

Where to host .NET Core applications? When I first started programming, I was eager to build an application and show it to the whole world. I could write some simple web sites, but I have no idea what a hosting is. In this post I want to help some new programmers to showcase their ideas and applications. A hosting is not necessarily something expensive. On the contrary if it is a brand-new site you probably do not want to go big in the beginning....

January 10, 2021 · Hasan Hasanov

Start Windows Sandbox With Preinstalled Apps

Introduction This is a part 2 of a previous post - ScoopBox. If you haven’t read it yet go check it out. It goes into details about Windows Sandbox and its configuration system. Also, there is a very detailed explanation how you can make a script without using any third party tools. What is Boxer Boxer is a cli tool that launches Windows Sandbox with preinstalled applications or execute scripts at startup....

December 24, 2020 · Hasan Hasanov

Code First With EF Core - the Easy Way

Imagine the following situation… That you are new in the world of programming minding your own business and suddenly decide to develop a .NET Core application with a pretty simple database access using code first approach. You did some research and conclude the use of Entity Framework as your ORM of choice. First few lines of code Since .NET Core bootstraps a weather application out of the box you decide to just to extend it....

December 20, 2020 · Hasan Hasanov

Developer Tools

Developer Tooling When it comes to programming there is one area that is overlooked by most. This is area is the developer tooling and customizing the environment. On this blog post I will focus on the first one. Many beginners do not invest enough time to learn what tools there are, which can make their lives easier. I want to share with you what I use and for what purpose. Let’s get started....

December 6, 2020 · Hasan Hasanov

ScoopBox

What is Windows Sandbox? Technically Windows Sandbox is a lightweight virtual machine created on demand which a user can safely run applications in isolation. This virtual machine is using the same OS image as the host machine. Software installed inside the Windows Sandbox environment remains “sandboxed” and runs separately from the base machine. This is ideal when trying to analyze some programs in isolation. How to enable Windows Sandbox? First of all the machine should be using Windows 10 Pro or Enterprise, build version 18305 or later....

November 25, 2020 · Hasan Hasanov