Categories
Uncategorized

Encoding Bangla (Unicode) SMS for SSLWireless in Python

If you are wondering why you cannot send Bengali text encoded in Unicode properly through the SSLWireless Push API in Python, well you are not alone. The solution is, encoding your UTF-8 text into UTF-16 (Big Endian) and then taking the hexadecimal value of it, transformed into uppercase.

Categories
Hacks

pyenv build depencies on Ubuntu

pyenv can get particularly annoying during building Python. Dependencies are often missing resulting in failed builds. This short blog post is outlining the required dependencies to reduce headaches for future me, and anyone else reading this.

Categories
Testing

Beginners’ Guide to Effortless Doctests in Python

Doctests are essentially tests embedded in a docstring. They serve both as example use cases and test cases! A Python expression is provided along with an expected outcome, a test runner collects that and evaluates the expression. This post explains the basics and goes up to using doctests in production.

Categories
Hacks

Simple Python Profiling with IPython

Profiling is imperative to understand your application. However, getting started with profiling might seem to be a steep learning curve; but it doesn’t have to be! IPython has a lot of built-in magic commands, and some of them are helpful to profile your Python code. %timeit and %prun are among the ones I found most useful.