Archive for the ‘Tricks’ Category

技巧: 合并多份Word文档的评注信息

January 13th, 2016 No comments


7. 在“修订的显示位置”下,单击“原文档”

如何在大陆构建 Firefox for Android

October 29th, 2015 No comments

大陆由于墙的缘故, 不仅Google的服务没有正确的部署, 所有依赖于Google的服务都会出现问题. Firefox for Android (以下称 Fennec) 需要使用 Android SDK 和 NDK 进行构建, 因此也就遇到了同样的问题, 导致了 Mozilla 仓库中的 mach bootstrap 命令无法正确执行.

一种方式是不使用 mach bootstrap 命令初始化的 toolchain, 利用你之前手工下载的 Android SDK/NDK 进行构建. 方法是配置 mozilla 仓库根目录下的 mozconfig 参数, 指定好路径.

另一种方式是死磕, 在 mach bootstrap 过程中加入一点手工的方法来绕过. 以下是方法:

  1. 首先你需要 google hosts 能够下载基本的SDK等; 具体可以自行上 github 上找找;
  2. 运行 mach bootstrap, 在尝试 refresh android repository addons list-2.xml 或者类似的文件的时候会显示读取失败.
  3. 手工的切换到 $HOME/.mozbuild 中的目录. 找到 Android 工具并运行, 一般是 $HOME/.mozbuild/android-sdk-linux/tools/android
  4. 这是就看到了熟悉的 Android SDK 管理页面. 在配置中取消 HTTPS, 强制使用 HTTP. 安装所有需要的 SDK.
  5. 回到 mozilla-central 目录下运行 mach build
  6. 这个时候可能会遇到说找不到正确的 SDK 和 NDK 路径, 这是因为 bootstrap 没有正确执行结束导致的. 解决方法是修改 mozconfig 配置文件中”–with-android-sdk”和”–with-android-ndk”选项, 指向具体的位置.

之后就可以执行 mach build & mach package 正确的编译出 apk 了.

PS: 当然还有一种最为高大上的方式就是VPN了…然而下载量很大的说…

Code Review Checklist

June 27th, 2015 No comments

Nice Checklist.

我之前并未整理出这样的清单。可以实践一下。 🙂

Code Review Checklist


* Does the code work? Does it perform its intended function, the logic is correct etc.
* Is all the code easily understood?
* Does it conform to your agreed coding conventions? These will usually cover location of braces, variable and function names, line length, indentations, formatting, and comments.
* Is there any redundant or duplicate code?
* Is the code as modular as possible?
* Can any global variables be replaced?
* Is there any commented out code?
* Do loops have a set length and correct termination conditions?
* Can any of the code be replaced with library functions?
* Can any logging or debugging code be removed?


* Are all data inputs checked (for the correct type, length, format, and range) and encoded?
* Where third-party utilities are used, are returning errors being caught?
* Are output values checked and encoded?
* Are invalid parameter values handled?


* Do comments exist and describe the intent of the code?
* Are all functions commented?
* Is any unusual behavior or edge-case handling described?
* Is the use and function of third-party libraries documented?
* Are data structures and units of measurement explained?
* Is there any incomplete code? If so, should it be removed or flagged with a suitable marker like ‘TODO’?


* Is the code testable? i.e. don’t add too many or hide dependencies, unable to initialize objects, test frameworks can use methods etc.
* Do tests exist and are they comprehensive? i.e. has at least your agreed on code coverage.
* Do unit tests actually test that the code is performing the intended functionality?
* Are arrays checked for ‘out-of-bound’ errors?
* Could any test code be replaced with the use of an existing API?

You’ll also want to add to this checklist any language-specific issues that can cause problems.

The checklist is deliberately not exhaustive of all issues that can arise. You don’t want a checklist, which is so long no-one ever uses it. It’s better to just cover the common issues.



修改 XMind 默认的中文字体

June 20th, 2015 No comments

XMind 在 Windows 7 下的默认中文字体不太好看,在其配置选项中没有提供该选项。一位使用者提供了一种直接修改配置文件的方式,可以参考:

在 Windows 7 下,可以将默认字体改成“SimSong”或者“Microsoft YaHei”; Linux 下可以改成 “WenQuanYi Zen Hei”。

[Howto] 修订github仓库中的提交信息

June 22nd, 2013 No comments


如果在你第一次错误的 push 之后,没有人 pull 过那个仓库,那么你的修改就完成了。如果已经被人 pull 过了你的改动,就不太可能改过来了(“The already pushed change, if people have pulled it, is something you’ll have to live with. [1]”)。

有此需求的同学可以参考[1]、[2]和[3],希望对你有帮助。 😉

[1]: stackoverflow: amend-username-for-a-pushed-commit-on-github

[2]: stackoverflow: github-doesnt-show-the-right-author-of-a-commit

[3]: github help: can-i-delete-a-commit-message