Google Data API: Unsupported browser. Continue at your own risk.
Opera is not officially supported in the Google Data API and the following error message is thrown as an alert(!) when loading the API: Unsupported browser. Continue at your own risk.
Remove the error message by sending an empty anonymous function to the init method:
google.gdata.client.init(function() {});
var service = new google.gdata.calendar.CalendarService('my-calendar');
Translation of Django Core
cd django_trunk svn update # Generate .po files: bin/django-admin.py makemessages -l nn bin/django-admin.py makemessages -d djangojs -l nn cd conf/locale/nn/LC_MESSAGES
Edit .po files. Search for text string fuzzy and empty double quotes (“”) to find untranslated strings.
Finally, create diffs:
svn diff django.po > nn-django-translation-update.diff svn diff djangojs.po > nn-djangojs-translation-update.diff
SSH aliases
In ~/.ssh/config add the following:
Host ALIAS HostName DOMAIN User USERNAME Port PORT_NUMBER
Compile Vim in Snow Leopard
./configure –enable-pythoninterp –with-macsdk=10.6
Git: Start a new branch after making changes
Sometimes I realize that my latest changes actually should belong to another branch than the one I’m currently working on. The easy way to add the changes to a new branch is to use the stash command.
[… changes …] git stash git stash branch name_of_new_branch git commit […] git push origin name_of_new_branch
Ref. git stash.
Translation of Django Apps
I recently created a Django app that needed translation of the Django administration. It took some googling and messing around to make it work, so this quick and dirty walkthrough will hopefully be helpful for others.
Here’s how I did it:
Add translations for all model fields:
class Stuff(models.Model): title = models.CharField(_('title'), max_length=255) the_other_model = model.ForeignKey('othermodel', verbose_name=_('the other model'), verbose_name_plural=_('the other models')) class Meta: verbose_name = _('stuff') verbose_name_plural = _('stuffs')
Then the language (.po) files must be created:
mkdir locale python manage.py makemessages -l LANG_CODE
Then edit your language files in locale/_LANGUAGE_/LC_MESSAGES/django.po. When you’ve finished editing the language file must be compiled:
python manage.py compilemessages
If you want to translate app names as well, you can add something like this to your project __init__.py:
from django.utils.translation import ugettext_lazy as _ _(u'auth') _(u'configuration') _(u'sites') _(u'appname') _(u'Auth') _(u'Configuration') _(u'Sites') _(u'Appname')
This feels like a dirty hack but I couldn’t find any other way to do it.
Source: Django documentation – Internationalization and localization, and some Google Groups thread that I can’t find right now, for the app name translation.
Install PIL (Python Imaging Library) in Leopard
Installing modules when using pip, virtualenv and virtualenvwrapper is a breeze, but it took some time before I realized what was the easiest way to install PIL.
I do it this way:
pip -E PATH_TO_VIRTUALENV install http://dist.repoze.org/PIL-1.1.6.tar.gz
This installs a slightly repackaged version of PIL. The latest PIL version is 1.1.7, but as far as I know it’s not available in this form.
Exclude several files or directories from tar
It’s very useful to be able to exclude certain files or directories when using tar. Here’s how I did in Leopard:
tar czvf FILENAME.tgz --exclude={.svn,wiki*,static} FILES_OR_DIRS_TO_TAR
Passwordless login with MacFusion
Put a reference to the private key file in ~/.ssh/config, for example:
IdentityFile ~/.ssh/id_rsa
Source: FAQS.org
Make SSHKeychain work in Leopard
Here’s how I set up SSHKeychain on my Mac:
- Modify the package content as described
- Add stuff to .bashrc/.profile
- Add keys to SSHKeychain: Preferences > SSH Keys
- Check Manage (and modify) global environment variables (this probably has no effect, ref 2.)