Django Invalid HTTP_HOST header

May 27, 2015

After upgrading to Django 1.7, I was getting error emails similar to the following:

Invalid HTTP_HOST header: 'XXX.XXX.XXX.XXX'. You may need to add u'XXX.XXX.XXX.XXX' to ALLOWED_HOSTS.

Request repr(): 
<WSGIRequest
path:/login.action,
GET:<QueryDict: {}>,
POST:<QueryDict:     {u'redirect:${#res=#context.get(\'com ...

Sorting Hashtable Keys in Java

April 30, 2015

I wanted to sort the keys in a hashtable in Java, this can be done with the following code:

 private void process(Hashtable<String, String> pColumnsHash)
  {
    List<String> lColumnNames = new ArrayList<String>(pColumnsHash.keySet());
    Collections.sort(lColumnNames);

    Iterator<String> lColumnNamesIterator = lColumnNames.iterator();
    ...
  }

Django User Profiles Deprecated

March 14, 2015

Django user profiles are deprecated in Django 1.6, but I have a legacy application that still needs to work with them. This post documents the steps used to remove this functionality, but still have the site work without making any database changes.

Change Profile Model

My existing model was ...

Installing Ansible on Ubuntu

March 6, 2015

I want to use Ansible to automate deploying software to servers. The version of Ansible in the Ubuntu repositories is old. To get a recent one, use the repository provided by rquillo.

$ sudo apt-add-repository ppa:rquillo/ansible
 More info: https://launchpad.net/~rquillo/+archive/ubuntu/ansible
Press [ENTER] to continue ...

Jenkins Null Pointer on CVS

February 10, 2015

I got this error trying to access CVS from one of my Jenkins projects:

Started by timer
Building in workspace /var/lib/jenkins/workspace/project
FATAL: null
java.lang.NullPointerException
    at hudson.scm.CVSSCM.getBranchName(CVSSCM.java:289)
    at hudson.scm.CVSSCM.buildEnvVars(CVSSCM.java:275)
    at hudson.model.AbstractBuild ...