25th
Now MySQL also has a memcached interface.
Now MySQL also has a memcached interface.
Interesting approach to getting higher qps from MySQL databases.
MySQL-proxy doesn’t seem to be able to connect to MySQL servers and use the utf-8 encoding. In order to ensure that the character set is always utf-8, you need to add the following lines to every MySQL server in your setup within the [mysqld] section.
skip-character-set-client-handshake
init-connect=’SET NAMES utf8’
default-character-set=utf8
There are times when in your Django application, displaying unicode strings can throw an except similar to:
UnicodeDecodeError at /contact/export
‘utf8’ codec can’t decode byte 0x92 in position 2: unexpected code byte
I’ve discovered that this might be due to a LOCALE setting that doesn’t support those unicode characters. To solve this problem, you have to change your LOCALE to something like UTF-8 that supports unicode characters.
From your shell, simply type:
update-locale LANG=en_US.UTF-8
brew install xdebug
Then follow the instruction on how to enable it in php.ini
You’ll likely get a 500 error if you do this, you’ll need to create your 404.html and optionally 500.html templates to get this to work.
I just learned about model versioning today. With model versioning, you can maintain history of all modifications made to your models (creation, deletion and updates) and have the ability to roll back (if necessary) those actions.
You can find a list of projects offering model versioning here: http://djangopackages.com/grids/g/versioning/
If you ever find yourself needing to create django fixtures from a select records in your database, here are steps that can help.
For the model you intend to export, you’ll need to modify your default object manager. I’ve include a snippet below showing an object manager with a modified get_query_set method:
class LocationManager(models.Manager):
def get_query_set(self):
return super(LocationManager, self).get_query_set().filter(type__name=”Registration Center”)
Next, set your default object manager to this:
class Location(models.Model):
…
objects = LocationManager()
Now you can do a ./manage.py dumpdata locations.Location and your generated fixture will be filtered based on your modified get_query_set.
If you’ve ever worked on a git repository that was growing large and need to split some of the functionality into separate modules or repositories, this stackoverflow question and the corresponding answers, describes how to.