Latest stories

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

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.

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.

The problem of “Poisonous Plants” – C Source code

There are a number of plants in a garden. Each of these plants has been treated with some amount of pesticide. After each day, if any plant has more pesticide than the plant on its left, being weaker than the left one, it dies. You are given the initial values of the pesticide in each of the plants. Print the number of days after which no plant dies, i.e. the time after which there are no plants...

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