Monthly Archives: May 2012

Backup / Export users from MySql

put this on your ~/.bashrc

mygrants()
{
  mysql -B -N $@ -e "SELECT DISTINCT CONCAT(
    'SHOW GRANTS FOR ''', user, '''@''', host, ''';'
    ) AS query FROM mysql.user" | \
  mysql $@ | \
  sed 's/\(GRANT .*\)/\1;/;s/^\(Grants for .*\)/## \1 ##/;/##/{x;p;x;}'
}

usage

mygrants --host=[HOST] --user=[USER] --password=[PASSWORD]

I found this solution on: http://bit.ly/JMFCOd

List installed / loaded modules on apache2

sudo apache2ctl -M

Enable htaccess rewrite on Apache2 Ubuntu 12.04

sudo a2enmod rewrite

Edit /etc/apache2/sites-available/default, change “AllowOverride None” to “AllowOverride All”

sudo service apache2 restart

Install Java Runtime Environment on Ubuntu 12.04

To install the Oracle version of JRE and JDK, you should update your PPA to add this new repository:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update

And then install it ! =)

sudo apt-get install oracle-java7-installer

Ignore chmod changes on GIT

git config core.filemode false

thanks Piero http://twitter.com/#!/pierophp

PHPMyAdmin install on ubuntu

sudo apt-get install phpmyadmin
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
sudo service apache2 reload

Desktop Shorcut on Ubuntu

gnome-desktop-item-edit --create-new ~/Desktop

Install PHPunit on Ubuntu

Install the package

sudo apt-get install phpunit

Upgrade PEAR

sudo pear upgrade pear

Install all the dependencies

sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover components.ez.no
sudo pear channel-discover pear.symfony-project.com
sudo pear install --alldeps phpunit/PHPunit

Test

phpunit --version

update
If you have any problem you can try this:
http://stackoverflow.com/questions/9186000/call-to-undefined-method-php-codecoverage-filtergetinstance

Install MySQL Workbench on Ubuntu 12.04

download MySQL Workbench on http://www.mysql.com/downloads/mirror.php?id=406525#mirrors

wget https://launchpad.net/ubuntu/+archive/primary/+files/libzip1_0.9.3-1_i386.deb
sudo dpkg -i libzip1_0.9.3-1_i386.deb

64bits => https://launchpad.net/ubuntu/+source/libzip/0.9.3-1/+build/1728114/+files/libzip1_0.9.3-1_amd64.deb

This package (libmysqlclient16) was removed from 12.04 repos, so you need to grab the old one.

wget http://launchpadlibrarian.net/94563300/libmysqlclient16_5.1.58-1ubuntu5_i386.deb
sudo dpkg -i libmysqlclient16_5.1.58-1ubuntu5_i386.deb

64bits => http://launchpadlibrarian.net/94808408/libmysqlclient16_5.1.58-1ubuntu5_amd64.deb

sudo apt-get install python-paramiko python-pysqlite2 mysql-client mysql-common libctemplate0 libgtkmm-2.4-1c2a

now install MySQL Workbench

sudo dpkg -i mysql-workbench-gpl-5.2.38-1ubu1104-i386.deb

Output while running (PHP)

ob_start();
for($i=0; $i<3; $i++)
{
   echo 'printing...';
   echo str_repeat(' ', 65536); // set a minimum output
 
   ob_flush();
   flush();
   usleep(300000);
}
Page 1 of 212