Fork me on GitHub

Suhosin and memory_limit

I had some problem with a script that needed more memory to be executed and was using ini_set(‘memory_limit’, ’50M’). For some reasons the memory was not incremented as expected.
After googleing around for a solution I just had an intuition: could be suhosin? Indeed, the problem was in the suhosin module that is enable by default on Ubuntu: it does not allow to redefine the memory limit over the limit specified in the php.ini file.
To make ini_set work normally under Ubuntu, comment out the suhosin extension in /etc/php5/apachew/conf.d/suhosin.ini

;)

PHP 5.3 and more on Ubuntu

Thanks to Dotdeb guys is now possible to upgrade PHP easly on your Ubuntu machine.
Just add their repository to your sources.list. You can find more detailed instructions here!

Have fun. ;)

SQL JOINs for who keeps forgetting …

Here a superb JOINs Cheat Sheet from codeproject

Visual SQL JOINS

PulseAudio Equalizer

I’ve always thought the the linux community is made by brilliant minds and here is one: psyke83 from the ubuntu forum. Here is his script that finally brings an always wanted equalizer in our Ubuntu desktops : http://ubuntuforums.org/showpost.php?p=8210866&postcount=1
I’ve installed it on my machine and my ears are happy now :)

youtube: even the big fall!

Tonight screenshot
youtube_internal_server_error

Macports, Snow Leopard and XCode 3.2

When I upgraded my macbook to Snow Leopard, macports just worked as it was before, or so I thought, until yesterday when I tried to install ImageMagick and rmagick ruby gem and I got this error:
gem install rmagick
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/opt/local/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.3.5... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... no
checking for sys/types.h... no
checking for wand/MagickWand.h... no
Can't install RMagick 2.11.1. Can't find MagickWand.h.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/opt/local/bin/ruby

After having lost the best of my youth trying to fix this issue, I can’t remember exactly how I did it, but I came up with this idea of reinstalling ruby and… guess what? It did work!
So the lesson here is … whenever you upgrade to a major release of XCode, you have to reinstall all your macports. These commands can save your day or two:
$ sudo port selfupdate
$ sudo port sync
$ sudo port upgrade --force installed

;)

super-easy Git remote repository

1. Creating a remote repository before the local one

Step 1: create the folder on the remote server and initialise the empty bare repository

ssh username@yourserver
mkdir yourgitremoterepo.git
cd yourgitremoterepo.git
git --bare init

Step 2: back to your machine, clone the repository

git clone username@yourserver:yourgitremoterepo.git

2. Making your existing local repository available on remote

Step 1: I assume that you have done something like this

cd yourlocalrepo
git init
git add .
git commit -a -m "first commit"

Step 2: to create the remote repository, login to your remote server and initialise an empty bare repository

ssh username@yourserver
mkdir yourgitremoterepo.git
cd yourgitremoterepo.git
git --bare init

Step 3: now back to your machine, link your remote repository with the local one and push all your files

git remote add origin username@yourserver:yourgitremoterepo.git
git push origin master

done!

sudo gem update –system under ubuntu/debian

If you have tried that command, you already know that doesn’t work!
Here is the correct procedure to update gem under ubuntu/debian without using apt-get/aptitude

$ sudo gem install rubygems-update
$ cd /var/lib/gems/1.8/bin
$ sudo ./update_rubygems
$ gem -v
$ 1.3.5

Happy rubying :)

the GIT cheatsheet

Finally the cheatsheet I was waiting for available here
;)

php 5.3, time and date functions and timezone

After installing PHP 5.3, you may get a warning for every function involving date and time like
Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/London' for [...]
To fix this, you can set the timezone in your script using date_default_timezone_set(‘Europe/London’); or set it into the php.ini file with date.timezone = ‘Europe/London’

;)