I'm looking for a job - Python / Django Developer (remote work is preferable, but Google HR are welcome)
Brief Curriculum Vitae
Keywords: Linux, Free Software, Python, PyGTK, Django, Resume :-)
Friday, December 31, 2010
Looking for a job...
Wednesday, December 23, 2009
Thursday, December 3, 2009
Convert SVG to PNG
1. sudo apt-get install librsvg2-bin
2. for i in *.svg; do rsvg -h 96 -w 96 $i `echo $i | sed -e 's/svg$/png/'`; done
PS: man rsvg for more options and command description.
Thursday, November 19, 2009
What is the best comment in source code you have ever encountered?
Read this topic on StackOverflow and have fun! :)
//When I wrote this, only God and I understood what I was doing //Now, God only knows
Friday, September 4, 2009
Django: ManyToMany field and custom CheckboxSelectMultiple widget
In one of the previous posts I showed how to create a custom widget to use with Multiple Choice model field, but you can also use it as widget for ManyToMany field.
Models/fields definition:
class Genre(models.Model):
slug = models.CharField(primary_key=True, max_length=32)
title = models.CharField(unique=True, max_length=64)
class Movie(models.Model):
title = models.CharField(blank=True, max_length=70)
director = models.CharField(blank=True, max_length=100)
genres = models.ManyToManyField(Genre, blank=True, null=True)
...
And here a form based on a Movie model:
from model import Movie
from widgets import CustomCheckboxSelectMultiple
class MovieForm(forms.ModelForm):
class Meta:
model = Movie
def __init__(self, *args, **kwargs):
super(MovieForm, self).__init__(*args, **kwargs)
# Custom widget for genres selection
self.fields['genres'].widget = CustomCheckboxSelectMultiple(
choices=self.fields['genres'].choices)
# Removing "Hold down "Control", or "Command" on a Mac, to select more than one."
self.fields['genres'].help_text = ''
Sunday, August 30, 2009
Cinemania: First Blood
Cinemania 0.2 (codename 'First Blood') is ready for testing ;-)
Bellow is a short installation instruction:
- Install prerequisites:
apt-get install python-imdbpy python-imaging
- Checkout cinemania buildout from SVN:
svn co https://cinemania.svn.sourceforge.net/svnroot/cinemania/buildout cinemania_buildout
- Bootstrap the buildout:
cd cinemania_buildout/
and run buildout script:
python2.5 ./bootstrap.py./bin/buildout -c devel.cfg
- Setup initial database and run django web server:
./bin/django syncdb
./bin/django runserver - Point your browser at http://localhost:8000/
for site administration http://localhost:8000/admin/
Saturday, August 29, 2009
Quick and simple vsftpd configuration
- Install vsftpd server:
apt-get install vsftpd - Edit
/etc/vsftpd.conffile:...
First we close anonymous access to FTP, but instead allow local users to log in and grant them permission to write on FTP.
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
......
Next we restrict local uses to
# You may restrict local users to their home directories. See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
chroot_local_user=YES
...
# Specifies the directory vsftpd changes to after a local user logs in.
# There is no default value for this directive.
local_root=/home/ftp
.../home/ftpdirectory. - By default
/home/ftp, doesn't have a write permission for unprivileged users (i.e. not root). There are two possible solutions: made/home/ftpdirectory writable for all users, i.e.chmod a+w /home/ftpor limit write access to group members only, it's a better approach so you can easily grant/close write access to any appropriate user by changing their membership in privileged group:# addgroup ftpusers
# chgrp ftpusers /home/ftp
# chmod g+w /home/ftp
# adduser username ftpusers
Subscribe to:
Posts (Atom)
