Blog Posts

Function Overload In Python With Single Dispatch

Sep 17th, 2021

Python supports overloading functions via single dispatch. With single dispatch we can define multiple implementations of a function and have it chosen based on a single argument. In this post we will look at how single dispatch works with example.

Partial Function Application In Python

Sep 10th, 2021

Partial function application is a useful tool to reduce the signature of a function by fixing the first arguments which then result in a new function with the remaining arguments. In this post, we will see when partial application is useful in Python and how we can implement it.

Depth First Seach And Breath First Search In Python

Sep 3rd, 2021

In Python, it is very easy to implement depth first search (DFS) and breath first search (BFS) algorithms using the built in data types and recursion. In today’s post, we will look at some different flavours of DFS and BFS together with examples where they are used.

Random Module In Python

Aug 27th, 2021

The random module in Python provides a way to generate pseudo-random numbers for various distributions. In this post, we will explore the most commmonly used functionalities of the random module; generating random integers and selecting randomly from sequences.

Python Built In Functions

Aug 20th, 2021

Python comes with a handful of built in functions provided by the standard library. In today’s post, we will look some of them which are very useful in day to day programming.

List Slicing In Python

Aug 13th, 2021

Lists are one of the most versatile structures in Python. They allow us to keep lists elements which can be of different types and access them by index with constant time complexity. One of the best features of lists in Python is the slicing mechanism.

Python Priority Queue

Aug 6th, 2021

Priority queues are useful to keep track of smallest elements in Python. A typical example would be to keep track of the smallest elements of a collection, for example first, second, third elements, we can simply keep popping out of the priority queue to get them. Python comes with a built in pirority queue via the library heapq. In today’s post, we will look at the main functionalities of heapq with examples.

Python Dictionary

Jul 30th, 2021

Python dictionary is a structure that can be used to store key/value data with constant time for access. Dictionary structures in Python are very versatile which makes them popular and we can see them being used in many projects. They allow us to store keys and values of different types, provide us ways to iterate over the keys or values and have different ways to delete values. In today’s post, we will explore all the functionalities of dictionaries in Python.

Python Class Attribute Versus Instance Attribute

Jul 23rd, 2021

In Python, we can define variables on the class level or the instance level. In today’s post we will look at the differences in behavior.

Pointers To Functions In C

Jul 16th, 2021

Last week we covered the basics of C pointers with their definitions and how to use them in variables and functions. In today’s post we will look at pointers to function and more specificities around pointers like NULL pointer or void return.

Pointers In C

Jul 9th, 2021

Pointers are variables containing addresses of other variables. In C, pointers are used in many scenarios where they improve the code readability or where they are just necessary. In this post, we’ll explore what C pointers represent, how they can be used in functions, and explore the relationship between pointers and arrays.

Visual Studio Code Shortcuts

Jul 2nd, 2021

I have been using Visual Studio Code for many years, starting from frontend development with Angular and React, then moving to work on Python and lately working on C# projects. Visual Studio Code has always been at the top of my favorite editor to use as it is very lightweight, responsive and fast. It’s quick to open files, quick to load projects, it has a clean and minimal interface and has a strong community. Over the years of using it, I realised that there are a couple of shortcuts that I keep using in repetition and that I found missing when using other IDE. In today’s post I’ll go through those keyboard shortcuts.

Two's Complement

Jun 25th, 2021

Last week we looked at bitwise operators in Python. We briefly went through all of them without looking into how signed intergers were represented. In this post we will be looking at Two’s complement, Python’s way of storing signed integers, and finally answer the question of why ~9 = -10.

Bitwise Operators In Python

Jun 18th, 2021

When working with cryptographic algorithm and hashes, it’s quite common to operate at the bit and byte level. For those situations, Python provides functionalities to convert int to byte and vice versa and bitwise operators to operate on bits. In today’s post we will look at the different bitwise operators available with examples.

How Time Based Otp Work

Jun 11th, 2021

One-time passwords (OTP) are a great way to provide a second factor of authentication to an application. They are commonly distributed through channels like SMS, voice call, email, or physical token generator - common with banks. Although very useful, each of those distribution channels have limitations on both side; for the user and for the application developer. For example, for the user, SMS or voice call needs network connectivity which isn’t always available, and from the application developer, we need to rely on third party SMS gateway or voice call gateway which don’t support all countries, making 2FA unavailable for some. HMAC-based OTP (HMAC) and later on Time-based OTP (TOTP) were algorithms invented to address those problems providing a way for a prover to generate a valid OTP without the need of the verifier to send it to the prover. In today’s post we will see an example of TOTP implementation and look at how it is constructed.

Designed, built and maintained by Kimserey Lam.