emacs Settings

emacs is incredibly powerful, but configuration can be a royal pain sometime.

Here’s me trying to set the indentation levels when editing HTML. (Because it’s not obvious at all.)

Go to Nxml Child Indent, set that to what you want. In my case, I use 4 spaces per TAB.

These are the settings in my .emacs (you can see that I’m really trying to just set 4 spaces per TAB for all the modes):

Emacs can be annoying in the sheer number of uncorrelated variables it uses for the various modes.

Building An Assets Subdirectory When Using Brunch

Brunch has an opinion about the app/assets/ directory that it generates as part of an app skeleton. It simply copies these files over to the deployment directory, w/o running them through any minification.

But let’s say I want to build a standalone page under the assets/ directory, maybe for a signup form for my website (which I don’t really feel like making into a Backbone View). This form could share the vendor/ minified files, but would not have a need for the app.js or app.css files.

By default, Brunch wouldn’t process those files, as they would be somewhere under, say, app/assets/signup.

Here’s a custom config_signup.coffee file that builds files in the assets/signup/ directory and copies them where I expect. It would be pretty sweet if this could be somehow chained onto the main CoffeeScript file.

Now when I run brunch build -c config_signup.coffee –minify, I can get the same processing on this particular subset of the site.

spatial_ref_sys and geometry_columns

Let’s say you have a little accident while messing with the schema of your PostGIS-enabled database, and the spatial_ref_sys and geometry_columns tables get wiped out. When you go to install a GeoDjango-enabled app such as the example “world” app, Python will yell at you, and you will be very sad:

It fails, because you accidentally dropped some very important PostGIS tables from the database. So you google a bit and find this: http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id418654 which tells you what you need to do to set up a clean PostGIS installation.

So you dig around in the shared host, until you find where the PostGIS files are, and in particular spatial_ref_sys.sql:

So you try to run spatial_ref_sys.sql, and it fails, and you are sad:

Normally to create the missing table, you would run the postgis.sql script, and it would create these tables alongside the various GIS stored procedures. On a shared host, this probably won’t be possible, because you won’t have the permissions:

If you dig through postgis.sql for the proper CREATE TABLE statements, you’ll see something like:

You can pop these into a PostgreSQL admin shell and recreate these tables. Then you just have to rerun the spatial_ref_sys.sql file, and you should see:

Then, when you run the Django management script again, it should succeed.