spirit  [ Profile ]

Sort by: Date / Title /

  1. 1 month ago
    1. function walkDom($node, $level = 0) {
    2.         $indent = '';
    3.         for ($i = 0; $i < $level; $i++)
    4.         $indent .= '&nbsp;&nbsp;&nbsp;&nbsp;'; //prettifying the output
    5.         if (true /*$node->nodeType == XML_TEXT_NODE*/) {
    6.                 echo $indent.'<b>'.$node->nodeName.'</b> - |'.$node->nodeValue.'|';
    7.  
    8.                 if ( $node->nodeType == XML_ELEMENT_NODE ) {
    9.                         $attributes = $node->attributes; // get all the attributes(eg: id, class)
    10.                         foreach($attributes as $attribute) {
    11.                                 echo ', '.$attribute->name.'='.$attribute->value;
    12.                         }                                                    
    13.                 }
    14.  
    15.                 echo '<br />';
    16.         }
    17.  
    18.         $cNodes = $node->childNodes;
    19.         if (count($cNodes) > 0) {
    20.                 $level++ ; // go one level deeper
    21.                 foreach($cNodes as $cNode)
    22.                         walkDom($cNode, $level);
    23.                 $level = $level - 1;
    24.         }
    25. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2092"></script>
  2. 2 months ago
    Create a specific user for backups purpose with read-only permissions
    1. GRANT SHOW DATABASES, SELECT, LOCK TABLES, RELOAD ON *.* to backup@localhost IDENTIFIED BY 'password';
    2. FLUSH PRIVILEGES;
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2082"></script>
  3. 4 months ago
    Il faut avoir un backup de base tel qu'il y ait un dossier par base de donnée, un fichier SQL compressé par table. "-P 4" désigne le nombre de core.
    1. find -print0 | xargs -0 -n 1 -P 4 -I {} sh -c "zcat '{}' | mysql mydatabase"
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2071"></script>
  4. sponsorised links
  5. 5 months ago
    svn switch --relocate svn://svnserver1 svn://svnserver2
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2062"></script>
  6. 5 months ago
    1. # htpasswd file is relative to nginx conf
    2. location  /  {
    3.   auth_basic            "Restricted";
    4.   auth_basic_user_file  conf/htpasswd;
    5. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2061"></script>
  7. 5 months ago
    Scripted install of MySQL
    1. echo mysql-server mysql-server/root_password select PASSWORD | debconf-set-selections
    2. echo mysql-server mysql-server/root_password_again select PASSWORD | debconf-set-selections
    3.  
    4. aptitude -y install mysql-server libmysqlclient15-dev
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2060"></script>
  8. 5 months ago
    shell,fuser,process,resource,bash,file
    1. fuser -v /var/cache/debconf/config.dat
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2059"></script>
  9. 7 months ago
    Prevents jobs to collide if they take longer to run than the frequency itself
    1. $fp = fopen('/tmp/lock.txt', 'r+')
    2.  
    3. if(!flock($fp, LOCK_EX | LOCK_NB)) { 
    4.    echo 'Unable to obtain lock'
    5.    exit(-1)
    6. } 
    7.    
    8. /* ... */ 
    9.  
    10. fclose($fp);
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2040"></script>
  10. 7 months ago
    it's also possibl with a .htaccess file and "deny from all " in that file
    1. if (isset($_SERVER['REMOTE_ADDR'])) die('Permission denied.');
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2039"></script>
  11. 7 months ago
    1. #someElement { 
    2.   background: red; /* modern browsers */ 
    3.   *background: green; /* IE 7 and below */ 
    4.   _background: yellow; /* IE6 exclusively */ 
    5. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2037"></script>

First / Previous / Next / Last / Page 1 of 18 (178 posteets)