Articles in the programming category

  1. 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 …
  2. Socket Timeouts in urllib2

    Python logo -rightOne 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.

    ::: highlight @@ -8,6 +8,7 @@ import os import random import shelve +import socket import sys import …

  3. UnicodeDecodeError: 'ascii' codec can't decode byte

    Jinja2 logo -rightAlthough 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:

    '{:,.2f …

  4. Python: Empty String?

    Python logo -rightI'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:

    <p>
    
    <script src="https://gist.github.com/slaptijack/08d554b307fa7b9d2722.js?file=empty_string.py"></script>
    
    </p>
    

    That pretty much worked out just …

  5. Using Pelican's article.summary

    Jinja2 logo -rightI'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 …

  6. Agreeing to the Xcode/iOS license...

    FinderSometimes this pops up when you least expect it:

    Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
    

    This morning, I went to refresh one of my git repo's for work, and make spit that out. What the heck happened last night? Anyway, the …

Page 1 / 8 »

My Bookshelf

Reading Now

Other Stuff