Ars poetica

I like quality. I like elegance even more than quality.
I like solution based on sound theoretical background, because they are better in quality and elegance.
I prefer to be around engineers who share this view of values.
However, I know that software engineering needs to be pragmatic. And you cannot always follow your beautiful theory. And when I have good reasons, I can be pragmatic and compromise. In a way, balancing theory and practice is another kind of elegance. The next leve of elegance.

Virtualenv with python3

Environment

RH-based linux with python2.6 and python 3.3 (default is: python 2.6)

Problem

[ec2-user@h1 django-test-project]$ virtualenv -ppython3 env
Running virtualenv with interpreter /usr/bin/python3
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 21, in
from distutils.util import strtobool
File "/usr/lib64/python3.3/distutils/util.py", line 9, in
import imp
File "/usr/lib64/python3.3/imp.py", line 20, in
from importlib._bootstrap import new_module
ImportError: No module named 'importlib._bootstrap'

Solution

sudo rpm –nodeps -e python-importlib

Milestone

7 March 2015 – a special day in my programming life. I have my first contribution to a major open source project accepted and merged into master!

Just a tiny little ticket, but a great way to start contributing. (It’s one small step for a man… ) I have to say, that the process of contributing is super easy for such a big project. Yes, there are procedures in place, but they are all clear and make sense… and the community ensures that they run smoothly. The entire adventure, from picking the ticket to having it closed and merged into master took less than a day.

Django (see code on github) is an awesome project, and has a most awesome community, by the way! If you need a great web development framework, and you like python, use it!

And that’s my contribution:
django_contrib

Using git with alternative username

I have a regular git username which I use with key based authentication, and it’s set up the most standard way, following the excellent tutorial for it from github. I use this username for work.

I also have another git username which I use for my private stuff.
Whenever I need to commit to a repository where I want to commit with my alternative username, I need to do this magic.


$echo ~/.ssh/config
Host github-sztrovacsek
HostName github.com
User git
IdentityFile /home/hanna/.ssh/sztrovacsek/id_rsa
IdentitiesOnly yes

$git remote add privorigin github-sztrovacsek:sztrovacsek/django.git

$ git remote -v
origin git@github.com:sztrovacsek/django.git (fetch)
origin git@github.com:sztrovacsek/django.git (push)
privorigin github-sztrovacsek:sztrovacsek/django.git (fetch)
privorigin github-sztrovacsek:sztrovacsek/django.git (push)
upstream git@github.com:django/django.git (fetch)
upstream git@github.com:django/django.git (push)

I started a new project

I stared a new project at home, and I am really into it.
It’s a food-photo-sharing website. I intend to have a beta-release before Christmas.

I am using django in the backend and angular.js in the frontend. I really wanted to try out angular for some time now. At work we are using djnago, but not angular, and I found that django really needs a good frontend framework to complement it – and somethig more advanced than jquery. So, I am going to try out angular to see if it is as good as they say it is, and to see if it plays nicely with django.

I think that django, although a really powerful, and beautifully designed web framework, is not strong enough when it come to frontend. Why? Because in order to have a decent user experience, you will need to write a ton of client side logic, and that will be javascript. There is no going around that. And this client side code will have a thousand connections to your python-generated server-rendered html (e.g. specifying a div class in django, and referencing it from javascript). And it is hard to ensure that those links are not broken. (Who has unittests to test if a div is called the same in python and in javascript?). All in all, it is impossible to have all the ux logic in the backend, it is bloody hard to have it half in the frontend and half in the backend, so the only logical option remaining is to move it all to the frontend. And that’s where angular comes into play.

So, my technology stack will look like this:
– frontend in angular.js
– rest api in django
– database connection – comes with django for free
– admin interface – comes with django for free
– async tasks (e.g. creating thumbnalis) – celery