A Simple Tutorial: Create and Publish Chocolatey Packages

Last updated on October 1, 2016

Chocolatey is a Machine Package Manager, somewhat like Apt, RPM but built with Windows. When you want to install a Windows application, with Chocolatey, what you need to do is to simply run a one line command — Chocolatey will automatically download and install this application for you. While there is an official guide on how to create and publish a package, this tutorial is simpler.

Continue reading

Use Travis CI with Jython

Last updated on November 16, 2018

This post was updated on Feb 11, 2013, since the old way never works now.

Travis CI is a hosted continuous integration service for the open source community, helping run tests for your GitHub projects for every single push and pull request. However, by the time this post is written, Travis CI has not officially supported Jython, a Python interpreter written in Java. This post will help you setup a Jython testing environment for a Python project on Travis CI.

Continue reading

Archive a Git Superproject and Its Submodules

Last updated on May 5, 2021

While Git is a powerful and popular Distributed Version Control System, Git’s Submodule feature and Archive feature make Git even more powerful. However, the two features seems not working together well: Git’s archive command does not provide a way to archive a Git repository and all of its submodules (yet). Fortunately, many scripts that could do this for us are available online, but not all of them work like a charm. After browsing the Internet and trying them one by one, I found this python script every useful. It has helped me and I believe it will also bring you luck.

Continue reading

Attach a Pull Request to an Existing GitHub Issue

Last updated on October 1, 2016

GitHub users may have this experience: after reporting an issue for a project on GitHub, you suddenly found a solution to fix it. Then you want to attach a pull request to this issue, but by the time this article is written, GitHub does not provide a web interface to attach a pull request to an issue. However, no such web interface does not mean it’s impossible — a command line tool called hub could help you out.

Continue reading

Generate Ctags Files for C/C++ Source Files and All of Their Included Header Files

Last updated on October 10, 2016

This post is for those people who use Exuberant Ctags. If you are using other versions of ctags, this post may not be useful.

When using ctags to generate the tags file for C/C++ projects, usually we use the following command:

ctags -R .

For some users that need more info of the symbols, they may use this command instead:

ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .

No matter which one you use, the generated tags file only contains the symbols in the files in your project source tree, but not any external file, such as standard header files (e.g. stdio.h, stdlib.h), etc. thus editors or IDEs that use tags files, such as Vim, are not able to locate symbols in external header files. There was a solution: generate a tags file for any external header files first, and let the editor or IDE read both the generated tags file and the tags file for the project source tree. For example, the following command will generate a tags file for all your system header files on UNIX/Linux:

ctags -R --c++-kinds=+p --fields=+iaS --extra=+q /usr/include

This command usually takes a very long time to finish, and finally it gives a quite large tags file, which causes the editor or IDE a long time to search this tags file for symbols. To solve this problem, I came up with another idea.

Why must we generate a tags file containing all the symbols in the system header? If we only generate the tags file only for the header files that are related to our projects, would it be faster? That’s the point of this idea. We could first search for the header files that are included in our projects, and then we use ctags to generate a tags file for these files and our source files, in this way, a much smaller tags file that containing all the symbols that maybe useful for the project is generated.

Continue reading

Use EditorConfig to Maintain Consistent Coding Styles between Different Editors and IDEs

Last updated on October 1, 2016

Usually for a project with more than one developer involved, it is essentially important for the project to define and maintain a consistent coding style. Most code editors and IDEs, such as Vim, Emacs, Code::Blocks, provide settings related to coding styles, such as the width of tab, the size of indentation, end of line, etc. However, it is hard to provide the same settings for different Editors and IDEs: we have to maintain many config files for different editors and IDEs, such as .vimrc for Vim, .emacs for Emacs. In order to solve this, EditorConfig was born. By defining coding style in files named .editorconfig, the EditorConfig plugins for different editors and IDEs will automatically adjust your coding style.

Continue reading

Add a “Show Image” Switch for the Safari Browser on Your iPhone/iPad/iPod Touch

Last updated on October 1, 2016

When we are using the Mobile Safari Browser to surfing the Internet, sometimes the page loading speed will be largely slowed down because of the large size of the images on the web page. Surprisingly, as one of the world’s most popular browser, the Safari Browser on iOS (the mobile operating system running on iPhone/iPad/iPod Touch) does not provide a switch to turn on/off the image display. However, this does not mean you can not add such a switch by yourself.

Continue reading

Use SingleCompile to Compile and Run a Single Source File Easily in Vim

Last updated on October 1, 2016

Although Vim itself has already been a very powerful text editor, its plugins make it even better. SingleCompile is a plugin aimed at making it more convenient to compile or run a single source file without leaving Vim.

Consider this situation: you’ve just written a small C file (or small python script) with Vim for some tiny test, then you need to use :!gcc %:p to compile the C source file and run the executable with :!./a.out command (Or use :!python %:p to run the python script). Although a key mapping could make this process a bit convenient, but many of Vim’s advanced features will become unavailable, such as quickfix, compiler feature. SingleCompile was born to solve this problem, making this process more convenient and powerful than simply defining a few key mappings:

  • Compile or run the source file quickly using quickfix feature and compiler feature of Vim;
  • Auto detecting compilers and interpreters;
  • Fast switch between several installed compilers or interpreters;
  • Multi-language support;
  • Custom your own compiler/interpreter template;
  • View the result of last run command at any time(requires tee command);
  • Run the compiled program asynchronously and view the result at any time (see :SCCompileRunAsync in the help file).

Let’s see more about SingleCompile.

Continue reading