7/04/2018

get files list in a directory in ubuntu

refer to below code:

..
std::vector<std::string> list_files_in_dir(const char* dirPath)
        {
    DIR *dir;

    std::vector<std::string> files;

    struct dirent *ent;
    if ((dir = opendir (dirPath)) != NULL)
    {
        /* print all the files and directories within directory */
        while ((ent = readdir (dir)) != NULL)
        {
            if (strcmp(ent->d_name, ".") != 0 && strcmp(ent->d_name, "..") != 0)
            {
                stringstream fullpath;
                fullpath << dirPath << "/" << ent->d_name;
                files.push_back(fullpath.str());
            }
        }
        closedir (dir);
    }
    else
    {
        /* could not open directory */
        perror ("");
        return files;
    }

    return files;
}
..

7/03/2018

opencv install on ubuntu

Simple and easy way

1. install opencv from the official site
sudo apt-get autoremove libopencv-dev python-opencv


2. download sh file
https://github.com/milq/milq/blob/master/scripts/bash/install-opencv.sh

3. run sh file
bash install-opencv.sh
4. test
cd build/bin
./example_cpp_edge ../../samples/data/fruits.jpg


That's all

Thank you.

more detail refer to here :https://milq.github.io/install-opencv-ubuntu-debian/

6/29/2018

Pycharm does not show plot

just use "plt.show()"


for example
...
plt.figure(figsize=IMAGE_SIZE)
plt.imshow(image_np)
plt.show()
...

Thank you.

6/26/2018

Install Hangul(Korean) on Utubu

type this on terminal

..
dpkg -l | grep ibus-hangul
or
sudo apt-get install ibus-hangul
..


Ubuntu CUDA install on Console

Uninstall previous version
..
sudo apt-get purge cuda
sudo apt-get purge libcudnn6
sudo apt-get purge libcudnn6-dev
..


Install cuda 9.0, cuDnn 7.0
..
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7_7.0.5.15-1+cuda9.0_amd64.deb
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7-dev_7.0.5.15-1+cuda9.0_amd64.deb
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libnccl2_2.1.4-1+cuda9.0_amd64.deb
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libnccl-dev_2.1.4-1+cuda9.0_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
sudo dpkg -i libcudnn7_7.0.5.15-1+cuda9.0_amd64.deb
sudo dpkg -i libcudnn7-dev_7.0.5.15-1+cuda9.0_amd64.deb
sudo dpkg -i libnccl2_2.1.4-1+cuda9.0_amd64.deb
sudo dpkg -i libnccl-dev_2.1.4-1+cuda9.0_amd64.deb
sudo apt-get update
sudo apt-get install cuda=9.0.176-1
sudo apt-get install libcudnn7-dev
sudo apt-get install libnccl-dev
..


Add below code the end of ./bashrc file
..
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
..

And reboot.


refer to here : https://yangcha.github.io/CUDA90/


Linux wifi driver on Mac device

just input this command


sudo apt-get update
sudo apt-get install firmware-b43-installer

Tip, uninstall virtualbox on ubuntu


find virtualbox s/w

$> dpkg -l | grep virtualbox

the name is depends on your installation name

uninstall virtualbox
$> sudo apt-get remove --purge virtualbox-5.2