Django Sites framework for local development

Recently, in an application I am writing with Django, I needed to get the domain name for an email that was being sent with django-registration. Django-registration generates a unique code to activate a user account. You know, the typical workflow of register on the website, receive a confirmation email, click an activation link, done. Since django-registration relies on you to create the URL with the unique code on it, and it only gives you a site variable, which is an instance of django. »

Author image Raúl Santos

O que os gestores consideram bons programadores

Como convencer o teu gestor de que és um bom programador de PHP, quando na verdade és pouco mais do que um “script kiddie”? Escreve código como este: empty ($instance) AND $instance = new self($config); Se és um bom programador, podes parar aqui, já terás entendido a ideia. Se és um gestor, continua a ler. A reacção do gestor: “Wow, este tipo conseguiu evitar utilizar um if()! Que truque tão giro! »

Author image Raúl Santos

Alternativa a VPNs, fácil e segura

Tendo vivido um ano num apartamento que pertence a uma universidade, durante esse tempo usei a rede deles para aceder à internet - e vou sentir falta dos downloads a 8 megabytes/seg (sim, megaBYTES, não megaBITS). Mas nem tudo era bom: havia imensas restrições, o que até compreendo, dado que é uma rede de uma universidade com vários milhares de utilizadores e há sempre aqueles que gostam de se portar mal. »

Author image Raúl Santos

Easy and secure VPN alternative

Having lived for a year in a flat that is owned by a University, I was using their internet connection, of course - and damn, will I miss having sustained 8 megabytes/sec downstream (yes, that’s megaBYTES, not megaBITS). But not everything was roses: there were lots of restrictions in place, which I could understand, since it’s a university network with several thousands of users and there are always those who like to misbehave. »

Author image Raúl Santos

JPEG, Zlib and Freetype not available for PIL in a virtualenv in Ubuntu

When installing PIL, the Python Imaging Library, in a virtualenv in Ubuntu with pip install PIL, the installer reports that there’s no JPEG, Zlib or Freetype2 support available, even though I had installed all the corresponding packages. It turns out that the PIL installer looks for the libraries in /usr/lib/ but in Ubuntu they are in /usr/lib/i386-linux-gnu/ or /usr/lib/x86_64-linux-gnu/, depending on the architecture you use. A quick and dirty solution for this is to create symlinks to those libraries in /usr/lib/, like this: sudo ln -s /usr/lib/i386-linux-gnu/libfreetype. »

Author image Raúl Santos

JPEG, Zlib e Freetype indisponíveis ao instalar a PIL num virtualenv no Ubuntu

Ao instalar a PIL, a Python Imaging Library, num virtualenv no Ubuntu com pip install PIL, o script de instalação diz que não tem suporte para JPEG, Zlib e Freetype2, apesar de eu ter instalado todas as bibliotecas correspondentes. Acontece que o script de instalação da PIL procura as bibliotecas em /usr/lib/ mas no Ubuntu elas estão em /usr/lib/i386-linux-gnu/ ou /usr/lib/x86_64-linux-gnu/, dependendo da arquitectura usada. Uma solução rápida e não muito elegante é criar symlinks para as bibliotecas em /usr/lib/, assim: sudo ln -s /usr/lib/i386-linux-gnu/libfreetype. »

Author image Raúl Santos

Como adicionar "applets" ao painel do Gnome clássico no Ubuntu 12.04

Após recuperar o Gnome clássico no Ubuntu 12.04, ainda tinha que recuperar outra coisa crucial para a minha utilização do dia-a-dia do Gnome: a possibilidade de adicionar/remover ao/do painel “applets” e atalhos para programas. Carregar com o botão direito do rato no painel não faz aparecer um menu como fazia - mas há uma forma de o obter: super + alt + botão direito (a tecla “super” também é conhecida como a tecla do windows) Já agora, isto é também como se podem mover ou remover elementos do painel. »

Author image Raúl Santos

Como recuperar o Gnome clássico no Ubuntu 12.04

Após muita resistência, lá acabei por ceder e instalar o Ubuntu 12.04 no meu computador. Até agora tinha o 11.04 porque odeio o Unity e o Gnome 3 com um ódio muito especial mas ao mesmo tempo estava a começar a sentir necessidade de ter bibliotecas e programas mais actuais. Felizmente descobri que posso evitar ficar louco, tendo a interface do Gnome “clássico” com um aspecto e comportamento muito semelhantes àquilo a que estava habituado no Gnome 2, com uma mudança muito simples: »

Author image Raúl Santos

Getting Gnome classic back in Ubuntu 12.04

So I finally gave in and installed Ubuntu 12.04 on my desktop computer. Until now it was running Ubuntu 11.04, because I loathe Unity and Gnome 3 but I was starting to feel the need to have more up-to-date libraries and programs. Fortunately I found out that I can avoid going insane, having the “classic” Gnome interface with pretty much the same look-and-feel as I was used to from Gnome 2, with a very simple change: »

Author image Raúl Santos

How to add applets to the Gnome classic panel in Ubuntu 12.04

After getting Gnome classic back in Ubuntu 12.04 I was missing something crucial for my every-day use of Gnome: the ability to add/remove panel applets and program launchers. Right-clicking on the panel doesn’t bring up a menu like it used to - but there is a way to get it: super-key + alt + right-click (the “super-key” is also called the windows-key) This is also how you move or remove items from the panel, by the way. »

Author image Raúl Santos