Articles in the programming category

  1. [Python] Popular Search Terms

    "Python logo" I thought it would be neat to keep an eye on the popular google search terms related to Python.

    The list below uses JavaScript from Google Trends. You can use the kebab menu icon to choose between "Top" and "Rising" search phrases.

  2. Two Column for Loop in bash

    I had this interesting question the other day. Someone had a file with two columns of data in it. They wanted to assign each column to a different variable and then take action using those two variables. Here's the example I wrote for them:

    IFS=$'\n';
    for LINE in $(cat …
  3. Socket Timeouts in urllib2

    Python logo One of my scripts that makes an API call has been failing silently lately. It appears that the connection is timing out, but I am not catching that particular error. So, I fixed that.

    @@ -8,6 +8,7 @@
     import os
     import random
     import shelve
    +import socket
     import sys
     import time …
  4. UnicodeDecodeError: 'ascii' codec can't decode byte

    Jinja2 logo Although I was getting this output in relation to one of my Jinja2 templates, it really isn't a Jinja2 problem.

    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 69: ordinal not in range(128)
    

    The bit of code here should be doing nothing more than printing a float …

  5. Python: Empty String?

    Python logo I've mentioned before that empty strings in Python are false. This leads to a common if not string paradigm. Unfortunately, this can be problematic. Check out this snippet:

    >>> string = ""
    >>> if not string:
    ...  print("empty")
    ... 
    empty
    

    That pretty much worked out just as we imagined. The empty string returned False and …

  6. Using Pelican's article.summary

    Jinja2 logo I'm using Jinja2 templates with my new Pelican-based articles. If you have Django experience, you'll feel right at home using Jinja2 templates. I decided early on that I wanted to create my own theme from scratch and keep it as basic as possible. (In fact, 'basic' is the name …

Page 1 / 8 »

My Bookshelf

Reading Now

Other Stuff