Vim/Python Compatibility Issue

Date Tags python / vim

Found out the hard way that certain versions of Vim are not compatible with certain versions of Python. I keep my installation of Vim 7.3.712 on Dropbox so I can use it across multiple computers. While trying to run gVim on a new PC with Python 2.7.11 installed, gVim would close without warning or an error message when trying to open files.

Found out the cause was the one plugin I …

more ...

Weekly Picks - Systems

Some system related picks this week.


  • System Smarts - New podcast focusing on all aspects of systems.


  • Graphviz - Diagramming and visualization tool that uses a text-based markup. Works well for documenting system design.
  • Mscgen - Message diagramming tool that uses a text-based markup. Great for documenting any system that has intercommunicating components.
more ...

Automate Stdin For Python Tests

Date Tags python

NOTE: The information in this post applies to Python 2.x only. See this post for Python 3.x support.

While working on Qprompt (a Python CLI based user input libary), I wanted to write some tests to check for regressions. The following lambda function allows stdin to be programmatically set:

import StringIO, sys
sys.stdin = StringIO.StringIO()
setinput = lambda x: [sys.stdin.truncate(0), sys.stdin.write(x),]

The following …

more ...

Python Pattern Matching, Sorta

Date Tags python

This trick is neat and potentially useful although maybe not very Pythonic:

txt = "two"
val = (
        1 if txt == "one" else
        2 if txt == "two" else
        3 if txt == "three" else
print val

The following form can be used instead:

txt = "three"
val = \
        1 if txt == "one" else \
        2 if txt == "two" else \
        3 if txt == "three" else \
print val
more ...

Resolutions That Work

Date Tags misc

Last January, I made a resolution to walk 3 million steps during the year. With the help of a cheap step counter and a spreadsheet, I am happy to say it may have been the first New Years resolution that I actually completed! While preparing a list of resolutions for 2016, the following criteria will help guarantee success:

  • Progress must be measurable! - Keep track of your progress periodically to make sure you will hit your …
more ...

Wordless - A Better Document Toolchain

Date Tags docs

I was raised during a generation where writing on a computer was virtually synonymous with using Microsoft Word (little has changed since). However, as I grew versed in the landscape of software development utilities, I knew there had to be a better way to write. For me, the perfect writing toolchain needed the following qualities:

  • Content should be portable.
  • Content should play nice with version control and diff tools.
  • Content should be grep-able.
  • Structure emphasized …
more ...

Introducing Qprompt

Date Tags python

Python is an excellent multipurpose language. However, when writing scripts (in the shell script sense), a decent command-line user interface is necessary. Qprompt is a library of simple command-line interface functions that should simplify common tasks. For example, to ask the user for an integer between 1 and 100, simply use the following:


Menus are straightforward as well:

menu = qprompt.Menu()
menu.add("1", "Item 1")
menu.add("2 …
more ...

Properly Plural Python Printing

Date Tags python

This one is kind of silly but sometimes you just want messages to use the proper plural case. Here is an example in Python 2 (with a little help from Qprompt):

import qprompt
num = qprompt.ask_int("How many beers?", vld=[1,2,3])
print "Okay, %u %s." % (
        "beer" if num == 1 else "beers")
more ...

Hi, I am Jeff Rimko!
A computer engineer and software developer in the greater Pittsburgh, Pennsylvania area.