Leitrim and Cavan county borders were broken in Open Street Map for about 2 days just now, and it caused the townlands to break. I've updated the code to break when this happens (it means those counties aren't in the DB now), but the border has been fixed. Those counties should appear tomorrow.
Oops. Turns out I had a bug in my "detect if this user is a bot" part, where my site would have an internal error if a bot when to it (and I'd get an error email from django obviously). I've fixed that now (hopefully).
And I wondered why there was like 1 or 2 pages coming up in the google search results for this site.... :P
You can migrate a django south app to a specific version with this command: python manage.py migrate $APPNAME $NUMBER, i.e. to migrate it to the one that starts with 0002_…, enter this command: python manage.py migrate $APPNAME 0002.
You can undo all the migrations by giving using zero, i.e. python manage.py migrate $APPNAME zero. I initially tried 0000, but that doesn't work. This will 'remove' all the migrations done for an app. (The migrations will still be there as files, but the models won't be there)
Sometimes you only want to distribute a single python file as a module. It might just be a few simple functions, and rather than have a whole directory, it's much easier to have a single python file that can be imported and used.
Assuming your python file is called name_of_file.py, then make a file setup.py with this content in the same directory as name_of_file.py:
I was doing some work on a git project, on the master branch, and made 2 commits. Then I thought I should really do this on a separate branch, instead of master. But I've already committed twice to master!
Luckily git is great.
Firstly, you want to move to your feature branch, so do git checkout -b name-of-new-branch, tis'll create a new branch with the 2 new commits.
Then switch to master with git checkout master, and look at the logs, with git log. You'll see your 2 new commits that you want to 'get rid of'. Look for the commit just before the 2 commits, and look at the commit: … line. Copy & paste the part after the :, it'll look something like: 09c171332d969c55bceb80db58c70a710be994e3.
This is the id of a commit, (and tree of files), and it can act like a branch. You can checkout that 'branch' with git checkout 09c171332d969c55bceb80db58c70a710be994e3, which will give you a few lines message about how it's a "detached HEAD". Once it's checked out, give this a name, with git checkout -b master2. We are calling this new branch, master2. It's got everything in master, but without the 2 commits which want to have on the feature branch. Then just delete the old master branch (git branch -d master), and rename master2 to master (git branch -m master2 master).
master will now have everything but without the last 2 commits, and name-of-new-branch will have master and the 2 commits, so you can continue work there.
Obviously things get a bit more complicated if you've pushed master somewhere or if you have a lot of local changes. Best to not do it in that case.
My Django application appeared to just freeze. When I open a webpage, it just hangs. There is no noticable high load or CPU or memory usage on my server. There is no apache access log or error log messages. Other static apache websites I have hosted on the same machine, with the same apache instance, work fine. It's just the Django… hanging.
This is a weird problem, and is caused by scipy being a python library that's written in C, and there's some complication with the python GIL and mos_wsgi, which means it'll hang.
Luckily, there's a simple fix. You have to add this line to your Apache configuration file.
If you want to resize a window on the Ubuntu command line you can use the cool tool wmctrl, and it works with the new Unity Desktop from Ubuntu. You can install wmctrl with sudo aptitude install wmctrl or click on this link
List all the windows currently open with this command: wmctrl -l, you'll get some output like this: