Accessing Files in a JAR

May 28, 2015

I wanted to have text files in my Java project that I could read and process in a Java program. I wanted this to work both when running code in Eclipse, and when running an executable JAR file of the same code.

I added a marker.txt file at top ...

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 ...