Sunday, June 22, 2014

Linux mount NAS with NFS type

showmount -e IPAddress

sudo mount -t nfs IPAddress:/ShareFolder /MountPoint

Convert Big5 and UTF-8

convmv: http://www.j3e.de/linux/convmv/

convmv -f big5 -t utf-8 -r --notest folder

-f: from
-t: to
-r: recursive
--notest: do it. If not added, it only tests it

Thursday, April 24, 2014

MOOC (Massive Open Online Course)

UdaCity (Programming)
   https://www.udacity.com/

Coursera (Engineering)
   https://www.coursera.org/

Code Cademy (Programming)
   http://www.codecademy.com/

Academic room
   http://www.academicroom.com/

edX
   https://www.edx.org/

Khan Academy (Everything)
   https://www.khanacademy.org/

Code.org (For Children)

均一教育平台
   http://www.junyiacademy.org/

Saturday, October 12, 2013

Steps to install OpenCV on Mac OS X for XCode

Reference: http://tilomitra.com/opencv-on-mac-osx/

OpenCV installation steps:
1. Install MacPorts
2. Install CMake by "sudo port install cmake"
3. Get OpenCV source, http://opencv.willowgarage.com/wiki/InstallGuide, and untar it
4. Build OpenCV
   Go to the folder where you untar the OpenCV source to.
   Make a separate folder for building
   . make build
   . cd build
   . cmake -G "Unix Makefiles" ..
   Now make OpenCV
   . make -j8
   . sudo make install
   The OpenCV will be installed to /usr/local
5. Done installing the OpenCV on Mac OS X

Create a sample project on XCode with OpenCV
1. Start a new XCode "Command Line Tool" project with Type C++
2. Add all the libopencv*.dylib (or the ones you need) into the project from /usr/local/lib with "Copy items into destination group's folder (if needed)" checked
3. Add "/usr/local/include" into "Header Search Path" in Build Settings of project
4. Add "/usr/local/lib" into "Library Search Path" in Build Settings of project
5. Either 4.1 or 4.2
   4.1 Select "libstdc++ (GNU C++ standard library)" instead of "libc++ (LLVM C++ standard library with C++11 support)" in "Apple LLVM compiler 4.2 - Language" in Build Settings
   4.2 Select "LLVM GCC 4.2" instead of "Default compiler (Apple LLVM compiler 4.2)" in "Compiler for C/C++/Objective-C" in Build Settings
6. Write some codes to test OpenCV

#include
#include
#include "opencv2/core/core.hpp"

using namespace cv ;

int main(int argc, char** argv)
{
#if 0
    //get the image from the directed path
    IplImage* img = cvLoadImage("/Users/Howard/Desktop/Codes/OpenCV/CV/Lena_512.bmp", 1);
    //NSLog(img);
    //create a window to display the image
    cvNamedWindow("picture", 1);
    //show the image in the window
    cvShowImage("picture", img);
    //wait for the user to hit a key
    cvWaitKey(0);
    //delete the image and window
    cvReleaseImage(&img);
    cvDestroyWindow("picture");
#else
    Mat img = imread("/Users/Howard/Desktop/Codes/OpenCV/CV/Lena_512.bmp"    CV_LOAD_IMAGE_UNCHANGED);
    if (img.data == NULL)
    {
        printf("\n Image cannot be loaded") ;
        system("pause");
        return -1;
    }
    namedWindow("OrgImage", CV_WINDOW_AUTOSIZE);
    imshow("OrgImage", img);
    waitKey(0) ;

#endif
}

7. That's all

Thursday, May 9, 2013

Tuesday, November 20, 2012

Install Gitosis on CentOS for multiple developers

Install Gitosis

   [@Server]
   1. Download Gitosis from https://github.com/tv42/gitosis (or git clone git://eagain.net/gitosis )
   2. Install it by
       cd gitosis
       python setup.py install
       If you get errors, try yum install python-setuptools

Generate SSH public/private key (If you don't have one)

   [@Local]
   1. To generate a public/private key, run
       ssh-keygen -t rsa
   2. The newly generated public key will be at $Home/.ssh/ directory and named id_rsa.pub. Private key will be named id_rsa.
   3. Upload your public key to server's /tmp directory
       scp ~/.ssh/id_rsa.pub username@SERVER_IP_ADDRESS:/tmp/YourPublicKey.pub

Configure Gitosis

   [@Server]
   1. Create a user to own the repositories, usually called git
       adduser git
   2. Create the repository and add YourPublicKey into authorized keys
       sudo -H -u git gitosis-init < /tmp/YourPublicKey.pub

Configure the permissions

   [@Local]
   1. To configure who can access to your repositories, clone gitosis-admin first and then edit gitosis.conf in gitosis-admin directory
       git clone git@SERVER_IP_ADDRESS:gitosis-admin.git
       cd gitosis-admin
       vi gitosis.conf
   2. Add a repository, TestProject, and make user Howard has full access to it.
       [New group]
       members = Howard
       writable = TestProject
   3. Get Howard's public key, Howard.pub, from Howard and put it into keydir of gitosis-admin
       cp Howard.pub keydir
   4. Once done, commit it and push to remote server.
       git commit -m "Give Howard full access to TestProject"
       git push

Create the repository TestProject

   [@Local]
   1. User Howard creates the TestProject, initialize it and push it to remote server
       mkdir TestProject
       cd TestProject
       git init
       git remote add originServer git@SERVER_IP_ADDRESS:TestProject.git
       // create files, git add . and commit
       git add .
       git commit -m "Initial commit"
       git push originServer master:refs/heads/master
   2. Now TestProject is created and available on server
   3. To allow user Sibo accessing TestProject, edit gitosis.conf of gitosis-admin and add Sibo to members of [New group] and put Sibo's public key into keydir of gitosis-admin
   4. Commit it and push it remote server and now Sibo will be able to clone TestProject from remote server
       [@Sibo Local]
       git clone git@SERVER_IP_ADDRESS:TestProject.git


Wednesday, November 14, 2012

Git commands

git add . : stages new and modified, without deleted
git add -u : stages modified and deleted, without new
git add -A : stages All

Check clients which connect to Mac OS X Wi-Fi Internet Sharing

arp -i bridge100 -a bridge100 may be different on your Mac OSX