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.

Continue reading Encoding Bangla (Unicode) SMS for SSLWireless in Python

Beginners’ Guide to Effortless Doctests in Python


Notice: A non well formed numeric value encountered in /home/adhikary/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118

Notice: A non well formed numeric value encountered in /home/adhikary/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

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. Continue reading Beginners’ Guide to Effortless Doctests in Python

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. Continue reading Simple Python Profiling with IPython