4/29/2016

How To Port a CMake build project to Bazel

For large project, say OpenCV, the CMake build can be very complicated, which makes it difficult to create a BUILD file directly for Bazel. This article will describe an easy way to add a BUILD file.

1. cmake and make the project to create pre-compiled .a files.


2. Find all the header files in the project packages. Usually they're included in folders named with "include". A command to find all "include" folders.
find . -iname include

3. Create a new git repository on github.com. Check in all the .a and header files to the repository. The repository can be 'projectname'-'version'-precompiled, e.g. opencv-3.1.0-precompiled. Also, a BUILD file should be checked in with them. An example of the BUILD file: https://github.com/zoukyle/opencv-3.1.0-precompiled/blob/master/BUILD

4. Then the project can be depended by your own project. In your Bazel WORKSPACE file, you'll need to add:
git_repository(
    name   = "precompiled_opencv_git",
    commit = "cac2317cde1d4c9b68c6c4425d7171322d52aaed", # The latest commit id
    remote = "https://github.com/zoukyle/opencv-3.1.0-precompiled.git"
)

bind(
    name   = "opencv",
    actual = "@precompiled_opencv_git//:opencv_lib",
)

 
5. Say you want to bazel build a binary. In the BUILD file, you can add the dependency:
deps = [
    "//external:opencv",
], 

4/28/2016

Software Development Tech Stacks

Software Development Tools

Build Tool: Bazel
Source Control: git
Code Review: gerrit
Bug Tracking: Jira
Message: Protocol Buffer
RPC: gRPC
Continuous Build: Jenkins
Machine Learning: TensorFlow
Deployment: Docker
Logging: loggly (Need to research on it)
Code Diff: meld (On Mac: port install meld)

Java:
1. Jetty: HTTP server
2. Jersey: Maps URL to functions
3. gson: Java object to JSON 
4. CometD: Comet is a set of techniques which allows web applications to push data to the browser. It is also known as Ajax Push, Reverse Ajax and HTTP push server among others.

Java Unit Test:
1. JUnit
2. mockito: mock

C++:
1. glog
2. gtest

Python:
1. Django: web framework

4/26/2016

How to use .bashrc file on Mac for the terminal

In /etc/profile add:
if [ -n "$BASH_VERSION" ] && [ -f $HOME/.bashrc ];then
    source $HOME/.bashrc
fi


Under $HOME, create .bashrc file. The content should be: http://liangzou.blogspot.com/2016/06/commonly-used-linux-aliases.html


 

How to install SciTE on Mac

Install MacPorts

sudo port install scite

You also needs to install X11. http://www.xquartz.org/

That's it.

How to set SciTE as the default editor?

Open Script Editor and Save the following script as an Application:

(* This script is destined to be saved as an application droplet. It will process the items dropped onto it. *)

-- This routine processes the dropped item(s)
on open theDroppedItems
repeat with i from 1 to the count of theDroppedItems
set aDroppedItem to item i of theDroppedItems
processItem(aDroppedItem)
end repeat
end open

-- This routine processes an item
on processItem(anItemToProcess)
set pathUnix to POSIX path of anItemToProcess
set pathUnixQuoted to quoted form of pathUnix
-- Here you make your shell command !
set commandToRun to "/opt/local/bin/SciTE " & pathUnixQuoted
do shell script commandToRun & " &> /dev/null &"
end processItem

Best Mac Apps

Video Player: MPlayer(SMPlayer)
Image Viewer: xee
Window Management: Spectacle
Instant Messenger: The System Message App, which support Google Talk and Other Services
Text Editor: Emacs (emacs on Mac OS) or TextWrangler if you don't know how to use emacs

Screen recording: Quicktime
Webcam: CamTwist which can convert your DSLR camera to a webcam. Basically it can pull video stream from a window to serve as a fake camera.

VNCViewer: RealVNC
Hex Binary Viewer: Hex Fiend