Posts

Showing posts from January, 2014

Ubuntu - resize window with alt-right click

To enable this functionality in ubuntu, install gconf-editor:
sudo apt-get install gconf-editor
run it, and navigate to apps/metacity/general and enable "resize_with_right_button"  key.



In Ubuntu 14.04
sudo apt-get install compizconfig-settings-manager
ccsm
Click Window Management and Resize Window.

Set the key to "<Alt>Button3"



For Linux Mint (version now: 17):
gsettings set org.cinnamon.desktop.wm.preferences resize-with-right-button true

Pip PIL error: Could not find any downloads that satisfy the requirement PIL

When installing "PIL" with pip, I got this error:
Downloading/unpacking PIL
Could not find any downloads that satisfy the requirement PIL
 Fix: use "Pillow" instead of "PIL". Make sure you uninstall PIL first.
pip uninstall PIL
pip install Pillow

Slow SSH login on Ubuntu

I have recently experienced a slow ssh login issue on ubuntu 13.10 (xubuntu actually).
Tried all kind of solutions from internet, nothing worked, except this:

Edit the following file:
sudo nano /etc/nsswitch.conf
Find the following line:

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4


replace with

hosts: files dns
VoilĂ !
Ssh authentication working like a charm!

Compare integer variable in django templates

Ever needed to compare some variable (that may come from db, forms, etc) in django templates with an integer?
Example:
{% if some_var == 3 %}
working
{% endif %}
The above example will not work. Django's template engine interprets the variable as a string.

Workaround for integer comparison:
{% if some_var|add:0 == 3 %}
working
{% endif %}
By using the "add" filter, the variable is transformed into an integer.