CategoryProgramming

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

C# Sending an e-mail

This is something that may sound simple but looking around the internet you will find several solutions that … most of them are NOT working at all. For that reason, I decided to post the following solution which is working perfectly with Outlook and it is also tested with Gmail. (And of course, have a personal backup of this piece of code a.k.a snippet). (Just for those who will try to use...

C# Extension methods for everyday usage

Following up a previous post:  , in this post there will be listed some quite useful and commonly used extension methods for simple operations. (Basically, I do not currently maintain the NuGet package -lack-of-time-) I have various extension methods in my CommonLib file, however, in this post, I will only enumerate some of them. “Extension methods enable you to add...

C# Flexible API for PEAK-CAN USB (PCANBasic)

There are several USB-to-CAN devices, however for developers usually there is limited support (at least free) and when you have to do things quick could lead to unexpected problems. For that reason, and due to the fact that nowadays several devices are using CANBuses below is a quick-n-dirty way to interface your PC application to a CANbus. In this post, you will find a simple yet effective way...

STM32 video player over network

This example presents a simple video streaming(PC) and video player(STM32F746 board). The video streaming solution is designed to be flexible with a simple “threading” architecture that allows customization. Due to the image processing limitations (missing JPEG decoder) of the STM32F746) which acts as a client, the server (linux PC) is responsible to decode the selected media files and transmit...

I2C Bitbanging for Embeded Systems

Interacting with I2C devices is usually done with a microcontroller and an I2C library, but sometimes either the microcontroller is not supporting I2C or you have some other restrictions which do not allow you to use the provided I2C library. For that reason you can always Bitbang the I2C protocol a.k.a emulate the behavior of this protocol by manually toggling the pins. The following example is...

Android bottom navigation menu example using activities

Android design supports library that provides a Bottom Navigation Bar where is an important widget in the Android application. Is a simpler way to look between 3 to 5 screens, if you have more than 5 screens is better to use slide navigation drawer. Mostly, used fragments in navigation view to load different screens based on the user selection the usage of Fragments with Navigation may lead to...

How to add Hotkeys/Shortcuts in WPF

In any application, hotkeys (shortcuts) are useful for navigation as well as to launch a control’s code, unfortunatelly Hotkeys in WPF are not as easy as in Windows Forms. In this post we will briefly present an example of how keyboard shortcuts can be used to execute commands using key bindings. What you will need is to create a new WPF window and follow the instructions below. Step 1: In...

Disclaimer: The present content may not be used for training artificial intelligence or machine learning algorithms. All other uses, including search, entertainment, and commercial use, are permitted.

Categories

Tags