Hi, I'm Harlin and welcome to my blog. I write about Python, Alfresco and other cheesy comestibles.

Python - A Simple Method for Refactoring Your Code For Extensibility

I am talking to the beginning Python programmer here. Or to someone who has avoided object oriented programming and has used procedural programming. Or to someone who mainly uses Python to write scripts -- though you can definitely use the ideas I have here for bigger applications. In fact, you will ...

Read More

Alfresco - Alfresco Setup for Sysadmins and QA Testers

I have a few conventions on the organization of Alfresco installations to make my job (and life) easier. Since I may be also testing multiple Alfresco installations, I try to setup installs in a particular way so that different versions are easier to find. Also, it helps to have some ...

Read More

Python - How To Get Started

I get asked quite often something along the lines of:

I am new to programming. I would like to learn Python and/or Django. What is the best way for me to go about learning it and mastering it? or Can you recommend any good learning resources?

The answer may ...

Read More

Python - All Things Being Equal: "is" vs "=="

In the world of drink branding it is very important that all of your products of the same line of drinks taste exactly the same. Companies like Coca Cola, Pepsi, Budweiser and all the rest go through great lengths to make sure that their drinks taste exactly the same. This ...

Read More

Python - How to Use Underscores in Your Code

Note: This post was derived from Dan Bader's post on underscores that explains the subject in a lot more detail. If you are interested in reading his article, go here.

If you're a new Python programmer, you are likely encouraged to have a look at other programmer's ...

Read More

Python - Comprehending List Comprehensions

List comprehensions have been in Python since 2.6.x. If you're not using list comprehensions with Python, you are likely using a for statement and iterating through an iterable like this:

trees = 'oak', 'pecan', 'hickory', 'cherry'

for tree in trees:



You ...

Read More

Python - PEP 8 Series - Whitespace

Python is one of the few languages out there which takes whitespace into consideration for the purpose of readabilty. This is why this code is more elegant and flowable as you type:

def add_and_double(num1, num2):
    addition = num1 + num2
    product = addition * 2
    return product


public int (int num1, int ...

Read More

Python - How to Group Imports

In case you were ever wondering, here is the standard way to group your imports.

# Standard library imports
import os
import sys

# 3rd party modules
from django.http import HttpResponseRedirect
from django.shortcuts import render

# My project-wide modules
from blog.settings import THEME
from lib.util import get_http_referer

# From separate ...

Read More

Python - PEP 8 Series - Indentation

Consistent indentation of code is key for Python as you can get some painful indentation errors. If you really want to avoid that problem all together, always use 4 spaces for indentation. Also, avoid tabs, you don't need them.

Keep your lines at 79 characters or less. Continue to ...

Read More

Python - The Right Way to Ask Questions that Get Answers

Starting off in any endeavor -- especially as it relates to technology, you're going to need to ask questions so that you can get answers and learn. Sure, you can't avoid reading the manual or googling but often (especially in the beginning), you'll need to ask questions so ...

Read More