Category: Programming

  • Simple Unit Testing for Types in C11

    Simple Unit Testing for Types in C11

    Sometimes I find myself doing coding tests to keep my problem-solving skills sharp. One of the platforms I use is CodeWars, a platform owned by Andela. My current stack is JavaScript (including NodeJS), PHP, and C/C++. I noticed the tests for the C and C++ exercises were written using a library called Criterion, which brings…

  • strlen vs mb_strlen in PHP

    strlen vs mb_strlen in PHP

    As a PHP developer, I am sure you use strlen often to check for the length of strings. strlen does not return the length of a string but the number of bytes in a string. In PHP, one character is one byte therefore for characters that fall within the 0 – 255 range in ASCII/UTF-8…

  • Quick one on Python random numbers sampling

    I have been working on a project to generate random data using Python. Since I am not using this project for any security application I opted for the Python pseudo-random number generator random . In order to randomly select items from a list three option presented themselves to me random.choice, random.choices and random.sample . random.choice…