10/22/2015

C++ Boost lib to scan directory

library(-l) : boost_system boost_filesystem 
Include(-I) : /usr/include/boost
#include <boost/filesystem.hpp>

namespace fs = boost::filesystem;

std::string dirPath = "/home/darrenl/Pictures/person";
fs::path someDir(dirPath);
fs::directory_iterator end_iter;

typedef std::multimap<std::time_t, fs::path> result_set_t;
result_set_t result_set;

if (fs::exists(someDir) && fs::is_directory(someDir)) {
    for (fs::directory_iterator dir_iter(someDir); dir_iter != end_iter;
            ++dir_iter) {
        if (fs::is_regular_file(dir_iter->status())) {
            result_set.insert(
                    result_set_t::value_type(
                            fs::last_write_time(dir_iter->path()),
                            *dir_iter));
            LOG(INFO)<< dir_iter->path().string();

        }
    }
}

10/15/2015

Ubuntu Quick install Apache, PHP, and create public_html


Install Apache and MySQL

sudo apt-get install apache2 mysql-client mysql-server php5-mysql

Visiting your server in your web browser
















Create a public_html folder by User

sudo a2enmod userdir
sudo service apache2 reload
Of course, you'll also need to make sure that the permissions on your public_html folder allow the www-data user to see the files in there -- 755 usually works well. To do this:
mkdir ~/public_html
chmod -R 755 ~/public_html
So that, Apache can access files in Home directory

Install PHP 

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

Test PHP

<?php
phpinfo();
?>
The address you want to visit will be:
http://localhost/info.php















Enable PHP in UserDir
sudo vim /etc/apache2/mods-enabled/php5.conf






sudo /etc/init.d/apache2 restart