Encoding in Base64 (C Source Code)

Base64 encoding schemes are generally used when there is a need to encode binary information that needs to be stored and transferred over media that are developed to deal with textual information. This guarantees that the data stays unchanged without modification during transfer. Base64 is generally used in a number of applications including electronic mail via MIME, and keeping complex...

STM32L4 Sleep mode using FreeRTOS

A useful functionality in low-powered applications is to set the microcontroller in sleep mode for a specific time. This will reduce the overall consumption of the system, and depending on the application it can dramatically improve the battery life. However, using FreeRTOS, the activation of this mode is a bit tricky due to the fact that you have to take into account several other parameters. In...

STM32 UART – Receive unknown size data using DMA and FreeRTOS

There are several situations where we need to use a UART/Serial interface to connect our microcontroller with an external device. However, a common issue is that in most of those cases we do not know in advance the size of the messages thus, our final application needs to use either per character interrupt or a more advanced way like DMAs. Each method has it’s own pros/cons. As you can...

HowTo: STM32 Custom Bootloader/Application

It is a common practice in embedded system these days to use a bootloader-application architecture. The following source code snippets will help you to build you own bootloader/application project providing by the minimum code that is required to jump from one to the other. The example also works with FreeRTOS. First we need to understand 2 simple things. Each binary will be placed in different...

How to restore corrupted excel files using python

In this post you can find how to recover corrupted .xls or .xlsx files, using Python. Corrupt in the sense we are able to view the file in excel, but not using Python. The following was the error that is displayed while opening the file using excel. And this is the error when you trying to open it through python: XLRDError: Unsupported format, or corrupt file: Expected BOF record; found...

All-around function to find mins/maxs, in order, distinct elements in array

It this post you can find a function in C which is a able to find X minimum or maximum elements in a given array, order the output either ascended or descended and get either distinct elements or duplications. Of course this function is far away from optimal solutions as it is better to use specific algorithms depending on your needs, however for fast experimentation it is useful. You can use...

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

Find masked pattern in 1D array – C source code

The following example finds the first occurrence of pattern in a given array and returns the address of that position. Moreover it takes into account a mask, which is helpful for inconsistent pattern formats like : 2,3,X,X,3,1 where X should be ignored. Below you will find the source code and a working sample.

Categories

Tags