PostgreSQL — pg_dump permission denied – LOCK TABLE

Check if the user running pg_dump has access to the tables.

For me, I had 2 tables owned by postgres instead of my usual user for some reason.

Check by going into psql, connecting to your DB, and typing \d

To change your table owner, type

ALTER TABLE tablename USER TO user;

Linode apache mod_wsgi django setup for future reference

My django server setup for future reference, because it’s too easy to forget exactly who’s talking to what file in 2 months.
Will put nginx front end proxy soon.
  • Apache listens on port 80
  • Port 80 is a VHOST in sites-available / apache2.conf
  • Apache Vhost points to WSGI Script in /srv/anuva/_project/apache/django.wsgi
  • WSGI Script adds anuva project to PYTHONPATH
  • WSGI Script defines which  anuva.settings as project, and django’s WSGIHandler processes the request.
  • Apache displays request.

Things I’ve done this time for better management:

The project itself is now in a folder called anuva_project, alongside a logs folder, and apache folder.

I can now add all project specific things in one folder instead of everywhere. Logs are easily accessible instead of at /var/log/apache2/site .

I can add a directory for site specific python packages by adding the directory to the pythonpath in the WSGI script.

Gmail — Open attachments right away, skip virus scan or other bugs

Gmail always gives me trouble when trying to download an attachment. Just now, I couldn’t download my attachment for no reason. There was no error message, it just wouldn’t make a download button.

If you want to skip it, pretend you’re forwarding the message and the attachment will appear as an attachment that you can just click to reliably download it.

JavaScript — Accessing functions defined in jQuery scope / ReferenceError setInterval

To trigger a function defined in your document.ready function, you need to define a variable before the $(document).ready() that references the new function.

For example, function test() defined inside $(document).ready() is not accessible with setInterval('test()', 500), or something like onclick="javascript:test()"

$(document).ready( function() {
function test() { alert('test'); }
setInterval("test()", 500);
});

Will fail with ReferenceError

The following will work though:

var test;
$(document).ready( function() {
test = function() { alert('test'); };
setInterval("test()", 500);
});

Will work.

Fantastic writeup of Anuva Wines on ArgentinasTravel.com

Jon masterfully captures the essence of the private wine tastings, all the way from his initial skepticism to his overwhelming support.

…this is a family business, and not a faceless corporation. I’ve been to those large tastings where you, like a bottle in the assembly line, are pushed in and out so quickly that you don’t even have time to ask what you just drank.

http://argentinastravel.com/4474/anuva-wines-a-special-introduction-to-argentinean-wine/

Let me know what you think!

Python — Quickly Debug a Variable Value

raise Exception, “an error message string”
Will raise an exception and print the string.

raise Exception, str(my_variable)

raise Exception, str(myDictionary)

raise Exception, ” %s %s %s” % (v1, v2, v3)