Okke's new blog
My thoughts and pointers (mainly just for myself) on Django development.
Wednesday, July 13, 2011
Tuesday, May 31, 2011
Python with virtualenv, fabric
Wow, after a couple of busy months I've finally found a little time to spend on getting some Django love going on. Today, I started off with getting the development environment ready.
Virtualenv:
http://www.saltycrane.com/blog/2009/05/notes-using-pip-and-virtualenv-django/
virtualenv wrapper:
http://www.doughellmann.com/docs/virtualenvwrapper/
make sure django-admin.py runs the local copy of django, not the os-wide:
http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ (tips section)
and setting up a decent postmkvirtualenv
http://blog.doughellmann.com/2010/01/virtualenvwrapper-tips-and-tricks.html
enable tab-completion for pip in bash:
pip completion --bash >> ~/.profile
~/.bashrc gained the following lines:
#set defaults for python development
#from http://www.doughellmann.com/docs/virtualenvwrapper/
export WORKON_HOME=~/python-environments
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
#from www.pip-installer.org/en/latest/
export PIP_RESPECT_VIRTUALENV=true
source /usr/local/bin/virtualenvwrapper.sh
maybe later some more nifty stuff, like automatically enabling a virtualenv when you cd into a directory
http://hmarr.com/2010/jan/19/making-virtualenv-play-nice-with-git/
maybe later for deployment:
http://www.caktusgroup.com/blog/2010/04/22/basic-django-deployment-with-virtualenv-fabric-pip-and-rsync/
Virtualenv:
http://www.saltycrane.com/blog/2009/05/notes-using-pip-and-virtualenv-django/
virtualenv wrapper:
http://www.doughellmann.com/docs/virtualenvwrapper/
make sure django-admin.py runs the local copy of django, not the os-wide:
http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ (tips section)
and setting up a decent postmkvirtualenv
http://blog.doughellmann.com/2010/01/virtualenvwrapper-tips-and-tricks.html
enable tab-completion for pip in bash:
pip completion --bash >> ~/.profile
~/.bashrc gained the following lines:
#set defaults for python development
#from http://www.doughellmann.com/docs/virtualenvwrapper/
export WORKON_HOME=~/python-environments
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
#from www.pip-installer.org/en/latest/
export PIP_RESPECT_VIRTUALENV=true
source /usr/local/bin/virtualenvwrapper.sh
maybe later some more nifty stuff, like automatically enabling a virtualenv when you cd into a directory
http://hmarr.com/2010/jan/19/making-virtualenv-play-nice-with-git/
maybe later for deployment:
http://www.caktusgroup.com/blog/2010/04/22/basic-django-deployment-with-virtualenv-fabric-pip-and-rsync/
Saturday, February 5, 2011
Google, stop stealing my keyboard focus!
For the last few weeks, I've become increasingly annoyed by google's search-as-you-type feature. I like it's speed and responsiveness. Yet, when I try to go back to the page I came from and hit `backspace`, the search input field is focussed and my query is edited. Obviously, this does not what I wanted.
I can disable search-as-you-type to get rid of this behavior, but that's like killing a mosquito with a laser.
Has anyone found a good workaround for this yet?
I can disable search-as-you-type to get rid of this behavior, but that's like killing a mosquito with a laser.
Has anyone found a good workaround for this yet?
Google, don't steal my keyboard focus!
Friday, January 28, 2011
Merge two directories on Linux using Tar
From linuxquestions.org:
tar cf - . |(cd /targetdir; tar xvf -)
or
alias merge=pushd $1 | tar cf - . |(cd $2; tar xvf -); popd
(untested)
tar cf - . |(cd /targetdir; tar xvf -)
or
alias merge=pushd $1 | tar cf - . |(cd $2; tar xvf -); popd
(untested)
Add all unversioned files with SVN
from stackoverflow:
svn status | grep '?' | sed 's/^.* /svn add /' | bash
svn status | grep '?' | sed 's/^.* /svn add /' | bash
Tuesday, January 25, 2011
Python unicode
Python doesn't strip the byte order marker when reading an UTF-8 file. Using unicode.strip() won't remove it from the first line either.
From the link:
From the link:
if u[0] == unicode( codecs.BOM_UTF8, "utf8" ): u = u[1:]
Monday, January 24, 2011
CKEditor
Wow, events in CKEditor are sometimes hard to decipher. For example: why does the dialog not close when the 'Ok' event is fired on a dialog?
Well, the ok event is not responsible for hiding the editor. That is something the ok-button.onClick() does. So, if you want to simulate hide the dialog as if the ok button was clicked, do the following:
Well, the ok event is not responsible for hiding the editor. That is something the ok-button.onClick() does. So, if you want to simulate hide the dialog as if the ok button was clicked, do the following:
if(dialog.fire('ok', {hide:true}).hide !== false) { dialog.hide(); }
Subscribe to:
Posts (Atom)