Monday, November 22, 2010

the difference between include and require in php

The documentation below also applies to require(). The two constructs are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error.

Friday, November 05, 2010

Remote MySQL Access

GRANT ALL ON *.* TO root@192.168.1.1   IDENTIFIED BY 'palavra-pass'   WITH GRANT OPTION;
FLUSH PRIVILEGES;
We just have to tell Mysql to allow remote logins.
sudo vi /etc/mysql/my.cnf
Out-of-the-box, MySQL only allows connections from the localhost identified by the IP Address of 127.0.0.1.
We need to remove that restriction, so find the line that says
bind-address = 127.0.0.1


netstat -tupan | grep mysql

Recursively delete .svn directories

$ rm -rf 'find . -type d -name .svn'
or
find . -iname ".svn" -print0 | xargs -0 rm -r

Install subversion in ubuntu 10.10

First start off by installing Apache:


sudo apt-get install apache2


Enter the root password and follow the instructions. Check that is it installed correctly by going to http://localhost and checking that you see the standard Apache "It works!" message. Then install subversion and the subversion Apache module:


sudo apt-get install subversion libapache2-svn

Then create a directory to store repositories in:

sudo mkdir /var/svn/
sudo mkdir /var/svn/repositories

and create a test repository:

sudo svnadmin create /var/svn/repositories/test

So that Apache can read and write the repository its user (www-data) needs to be given ownership of it:

sudo chown -R www-data:www-data /var/svn/repositories/test

To be able to authenticate users who access the repository a password file is needed:

sudo htpasswd -c /etc/subversion/passwd paul

Enter a password for the user paul. For additional users repeat the command without the -c option to make sure the existing file is appended to rather than replaced.
Then edit the Apache config file:

sudo gedit /etc/apache2/apache2.conf

Add the following to the end of the file:


#svn users
<Location /svn>
     DAV svn
     SVNParentPath /var/svn/repositories/
     SVNListParentPath On
     AuthType Basic
     AuthName "Test"
     AuthUserFile /etc/subversion/passwd
     <LimitExcept GET PROPFIND OPTIONS REPORT>
        Require valid-user
     </LimitExcept>
  </Location>

 

Save the config file and restart Apache:

sudo /etc/init.d/apache2 restart

The Test repository can now be accessed via

http://localhost/svn/test

How to get the IP address of the docker host from inside a docker container

/sbin/ip route|awk '/default/ { print $3 }'