2016年10月23日星期日

让 Windows 中的 LaTeXTools 支持中文目录

LaTeXTools 是 Sublime Text 的一个插件,可以用来方便地在 Sublime Text 中处理 LaTeX 文件。

我目前所使用的 v3.11.2 版稍有问题,无法正确处理中文目录,原因是其 makepdf.py 文件使用 subprocess.Popen 调用 Latex 的外部指令时,对传入的工作目录 cwd 没有进行特殊字符判断,直接给了 Popen。如果工作目录含有中文字符的话,就会报一个
UnicodeEncodeError: 'ascii' codec can't encode characters in position xx-xx: ordinal not in range(128)
的错误。

解决方案:
自己 encoding 一下 cwd,再传给 Popen。
在第 142 行,
if self.caller.plat == "windows":
之后另起一行,缩进并加入下列内容

fixed_tex_dir = self.caller.tex_dir
if isinstance(fixed_tex_dir, unicode):
    fixed_tex_dir = fixed_tex_dir.encode(sys.getfilesystemencoding())

将紧随其后的
cwd=self.caller.tex_dir
替换为
cwd=fixed_tex_dir
注意上述内容中,所有四个空格都要替换为 tab 缩进。

参阅
1. Sublime Text 2的Tortoise插件中文路径问题
2. subprocess.call fails with unicode strings in command line - Python tracker

2016年6月27日星期一

Minecraft 开服指导:同时兼容 Forge 和 Essentials 类插件

本文为截止当前( 2016年06月27日)对 Minecraft 开服方式的小结

主要目标是:同时兼容 Forge 和 Essentials 类插件

  1. 对于 1.7.10
    1. 对于早于 forge1403 的版本:直接使用 Cauldron 
      1. https://sourceforge.net/projects/cauldron-unofficial/files/1.7.10/
    2. 对于后续版本
      1. 考虑使用 Kcauldron
        1. https://prok.pw/downloads.html
        2. 但已经废弃
      2. 考虑使用 Thermos
        1. http://cyberdynecc.github.io/Thermos/
    3. 上述都直接支持标准 essentials 插件
      1. http://dev.bukkit.org/bukkit-plugins/essentials/
    4. 使用 forge + forge essentials
      1. 代价是禁怪不如原始 essentials 方便,但有其它功能
      2. http://files.minecraftforge.net/
      3. http://minecraft.curseforge.com/projects/forge-essentials-74735/files
  2. 对于 1.8
    1. 使用 spigot + 相关 essentials
      1. 代价是不支持 forge mod
      2. https://www.spigotmc.org/
      3. 第三方构筑 https://www.getbukkit.org/spigot.html
      4. 插件: https://hub.spigotmc.org/jenkins/job/Spigot-Essentials/
    2. 使用 forge + forge essentials
      1. 同1.7.10
      2. 但暂无1.8.9编译版本?
    3. 使用 forge + sponge + sponge essentials
      1. http://files.minecraftforge.net/spongepowered/
      2. https://forums.spongepowered.org/t/essentialcmds-v8-1-11/
  3. 对于 1.9
    1. 使用 spigot + essentials
      1. 没 mod
    2. 使用 forge + sponge + sponge essentials
  4. 对于 1.10
    1. 使用 forge
      1. 没插件
    2. 使用 spigot
      1. 没 mod