Archive of articles classified as' "linux"

Back home

Create a thumbnail or resize an image with Imagemagick in PHP


This is the most elegant way I could find to create an thumbnail for an image I want to resize with PHP and Imagemagick. The function will return a filename.

To install imagemagick using Ubuntu, just run

sudo aptitude install php5-imagick

No Comments

massif-visualizer Ubuntu Install Notes


Here are the partial instructions for Ubuntu 10.04 with branch 8f84a30 from July 29, 2010

Get the depends:
#sudo aptitude install kdelibs
#sudo aptitude install cmake
#sudo aptitude install kdelibs4-dev
#sudo aptitude install kdebase
#sudo apt-get install libphonon-dev build-essential
#sudo aptitude install kde-devel

get kgraphviewer:

#sudo aptitude install graphviz-dev graphviz
#sudo aptitude install kdepimlibs5-dev
#sudo aptitude install boost-build libboost-all-dev

#mkdir kgraphviewer
#cd kgraphviewer/

#svn co svn:// .

Then follow their README and install

Then Get git:
#sudo aptitude install git-core

get the Massif-Visualizer from

#git clone git://

Then you can follow the massif-visualizer readme

See images at :


Simple Graphical Python Profiling with RunSnakeRun


sudo aptitude install python-wxtools

sudo easy_install runsnakerun

sudo aptitude install python-profiler

(If you are using Debian check this out :

run with:

python -m cProfile -o barbazzr.profile

Check out the output with:
runsnake name.profilepython -m cProfile -o barbazzr.profile

No Comments

Django 1.2 CSRF verification failed


Are you updating an old Django  project to use Django 1.2, and getting this error message when you try to login to the Django admin page?

403 Forbidden

CSRF verification failed. Request aborted.

Reason given for failure:

CSRF cookie not set.

Then you need to add  ‘django.middleware.csrf.CsrfViewMiddleware’, and  ‘django.middleware.csrf.CsrfResponseMiddleware’ your file. Mine looks like this:


Thanks to the Django docs


Set the default GRUB entry to boot from GRUB menu


You easily set the default GRUB entry to boot to in in Debian or Ubuntu by editing


and changing ‘default’ to the number of the record you want to boot from by default.  (Note: It is 0 indexed.)

# You can specify ‘saved’ instead of a number. In this case, the default entry
# is the entry saved with the command ‘savedefault’.
# WARNING: If you are using dmraid do not change this entry to ‘saved’ or your
# array will desync and will not let you boot your system.
default        2

No Comments