The purpose of ISO 3166 is to define internationally recognized codes of letters and/or numbers that we can use when we refer to countries and their subdivisions. However, it does not define the names of countries – this information comes from United Nations sources (Terminology Bulletin Country Names and the Country and Region Codes for Statistical Use maintained by the United Nations...
A simple way to establish communication between applications (IPC)
One extremely interesting feature that modern applications are using is the Interprocess communication (IPC). It is a really important especially for designing a well established architecture having in mind the extendability. In this tutorial we will see a simple IPC made with Named Pipes. Keep in mind that the following is just an example and should not be used in production. For this example...
Using Bluetooth communication in C#
Bluetooth is a useful communication method especially in the era of IOT. Several devices around the house have a build-in buetooth transceiver and most of them provide really useful capabilitites to automate jobs. For example, imaging your wakeup in the morning, Your alarm clock rings and the coffe machine starts preparing the coffe. Unfortunately these automated procedures are not yet available...
Simple WCF service hosted in Windows service
WFC services are a good way to spit a complex and demanding application into smaller parts and use more system resources, but not only. In the literature there are several information why you should use WFC (ex: Distributed apps in a local network etc)… In this example you will find a complete Visual studio project which hosts a wcf service inside a windows service. Our service has two...
WPF useful Extension methods
It is quite common the need of several extension methods in WPF which could help you develop faster and better apps without strange workarounds. Below I list some of them that are where quite important for me during the years.
C# WPF Canvas – Move shapes around
Recently, I needed to support dragging shapes and some other elements on a Canvas in WPF. However, looking online I found several implementations that were more complex than needed and/or not well functioning and I just wanted something very simple and solid. For that reason, below you will find a simple, yet useful implementation which can be easily adapted according to you needs. Step 1: Create...
Funny C# app for Mouse Faking
The purpose of this application is just for fun. It started initially by figuring out a way to fake skype that you are in front of your PC but also to randomly create a picture. The application takes control of your mouse and start drawing random pixels in the main area of the window thus generating mouse position and click events.
Below is a sample picture as well as the binary:
Extended functionalities of File Read/Write in C#
Messing around with files, i found that i needed some extra functionalities when i Read/Write in a (binary) file. For example i need to read a specific block of bytes with an offset (if exists – not out of bound) as well as write a given block of bytes to a certain address and select if the current block will override the existing data etc… Unfortunately, some of those functionalities...
Thread-safe singleton class in C# (use it instead of static..but not always)
Static and Singleton are very different in their usage and implementation. So we need to wisely choose either of these two in our projects.Singleton is a design pattern that makes sure that your application creates only one instance of the class anytime. It is highly efficient and very graceful. Singletons have a static property that you must access to get the object reference. However, singleton...
Convert Motorola-S file to bytes array in C# (limited to S3 record)
Motorola S-record is a file format, created by Motorola, that conveys binary information in ASCII hex text form. This file format may also be known as SRECORD, SREC, S19, S28, S37. It is(was) commonly used for programming flash memory in microcontrollers, EPROMs, EEPROMs, and other types of programmable logic devices. In a typical application, a compiler or assembler converts a program’s...