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 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

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

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

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