Monday, December 17, 2018

Limitation of golang

The following are not yet feasible in golang compared to C/C++ (according to my understanding in Dec 2018):
  • const could not be specified for a function parameter.  const could be specified in C/C++ so that compilation error is shown if modification is attemped. This is not possible in golang.
  • Template is not available

Friday, December 14, 2018

Protocol Buffer processing with Golang

Assuming that you have installed Golang and protoc, you just need to run the following command
go get -u github.com/golang/protobuf/protoc-gen-go

You should be able to generate the corresponding protocol buffer implementation with the following command
protoc --go_out=. *.proto

References:
  1. https://github.com/golang/protobuf

Wednesday, December 12, 2018

Form a new repository with a directory in Git repository and upload

The following are the steps:
  1. git filter-branch --subdirectory-filter <target_directory>
  2. git remote set-url origin <new_git_url>
  3. Check whether remote url is changed:
    git remote -v
  4. git push

Monday, December 10, 2018

Setup Visual Studio Code on Ubuntu for C++ Debugging

  1. Install Visual Studio Code
  2. Update CMake to 3.7 or above
    1. "cmake --version": Check cmake version with execution of "cmake --version" on terminal. The following steps can be skipped if the version is 3.7 or above
    2. Visit https://cmake.org/download/ and download the latest binaries, eg. cmake-3.12.4-Linux-x86_64.sh
    3. "chmod +x /path/to/cmake-3.12.4-Linux-x86_64.sh" (use your own file location here, chmod makes the script executable)
    4. "sudo apt remove cmake": Remove existing version of cmake
    5. "sudo /path/to/cmake-3.12.4-Linux-x86_64.sh" (you'll need to press y twice)
    6. The downloaded cmake package will be found in directory "cmake-3.12.4-Linux-x86_64". You could consider to move the cmake package into /opt with "sudo mv /path/to/cmake-3.12.4-Linux-x86_64 /opt". This step is optional.
    7. If you have moved the package under "/opt", create soft link with "sudo ln -s /opt/cmake-3.12.4-Linux-x86_64/bin/* /usr/local/bin". If you have not, create soft link under "/usr/local/bin" for the cmake binary tools in your desired directory.
  3. Install following Visual Studio Code Plugins
    • "C/C++" from Microsoft
    • "CMake" from twxs
    • "CMake Tools" from "vector-of-bool"
References:
  1. https://askubuntu.com/questions/829310/how-to-upgrade-cmake-in-ubuntu

Wednesday, December 5, 2018

Clone SVN with Git

git svn clone <svn_repo_path>
git remote add origin <git_repo_path>
git push --set-upstream origin master