Posts for the month of 二月 2013

thinkbase.net 升级到 Trac 1.0.1

Trac 1.0 分支已经发布版本 1.0.1(参见 http://trac.edgewall.org/wiki/TracDev/ReleaseNotes/1.0#MaintenanceReleases), 因此今天将 http://thinkbase.net 站点(及其运行环境 PortableTrac)升级到这个版本.

主要工作

升级过程的主要工作包括升级 Trac 1.0.1 egg 包升级 Trac 环境, 详细步骤参见 TracUpgrade 或者 http://trac.edgewall.org/wiki/TracUpgrade ;

1. 安装 Trac 1.0.1

由于安装之前需要测试, 因此安装过程是在测试系统中进行的, 安装测试成功后, 将调整后的 PortableTrac 提交到 PortableTrac GitHub Repositories, 然后在正式系统中更新这个运行环境;

  • 主要命令:
    I:\thinkbase.net\github\PortableTrac-git>easy_install --upgrade Trac==1.0.1
    

2. 升级 Trac 环境

升级过程直接在正式系统中进行(此前已经在测试系统中经过测试了).

  • 主要命令:
    D:\thinkbase.net\PortableTrac-git>set SITE_BASE=D:\thinkbase.net\trac-thinkbase.net-git
    D:\thinkbase.net\PortableTrac-git>trac-admin.cmd trac upgrade
    D:\thinkbase.net\PortableTrac-git>trac-admin.cmd main upgrade
    D:\thinkbase.net\PortableTrac-git>trac-admin.cmd trac wiki upgrade
    D:\thinkbase.net\PortableTrac-git>trac-admin.cmd main wiki upgrade
    

详细操作日志

I:\thinkbase.net\github\PortableTrac-git>easy_install --upgrade Trac==1.0.1
[Current timestamp: 2013-02-18 周一 13-52-58.93]

>>> call easy_install.exe --prefix="I:\thinkbase.net\github\PortableTrac-git\trac" --upgrade Trac==1.0.1
Searching for Trac==1.0.1
Reading http://pypi.python.org/simple/Trac/
Reading http://trac.edgewall.org/
Reading http://trac.edgewall.org/wiki/TracDownload
Reading http://trac.edgewall.com/
Reading http://projects.edgewall.com/trac
Reading http://projects.edgewall.com/trac/wiki/TracDownload
Best match: Trac 1.0.1
Downloading http://download.edgewall.org/trac/Trac-1.0.1.win32.exe
Processing Trac-1.0.1.win32.exe
Deleting d:\temp\easy_install-yza88_\Trac-1.0.1-py2.7-win32.egg.tmp\EGG-INFO\scripts\trac-admin-script.py
Deleting d:\temp\easy_install-yza88_\Trac-1.0.1-py2.7-win32.egg.tmp\EGG-INFO\scripts\trac-admin.exe
Deleting d:\temp\easy_install-yza88_\Trac-1.0.1-py2.7-win32.egg.tmp\EGG-INFO\scripts\tracd-script.py
Deleting d:\temp\easy_install-yza88_\Trac-1.0.1-py2.7-win32.egg.tmp\EGG-INFO\scripts\tracd.exe
creating 'd:\temp\easy_install-yza88_\Trac-1.0.1-py2.7-win32.egg' and adding 'd:\temp\easy_install-yza88_\Trac-1.0.1-py2.7-win32.egg.tmp' to it
Moving Trac-1.0.1-py2.7-win32.egg to i:\thinkbase.net\github\portabletrac-git\trac\lib\site-packages
Removing trac 1.0 from easy-install.pth file
Adding Trac 1.0.1 to easy-install.pth file
Installing trac-admin-script.pyc script to I:\thinkbase.net\github\PortableTrac-git\trac/Scripts
Installing tracd-script.pyc script to I:\thinkbase.net\github\PortableTrac-git\trac/Scripts
Installing trac-admin-script.py script to I:\thinkbase.net\github\PortableTrac-git\trac/Scripts
Installing trac-admin.exe script to I:\thinkbase.net\github\PortableTrac-git\trac/Scripts
Installing trac-admin.exe.manifest script to I:\thinkbase.net\github\PortableTrac-git\trac/Scripts
Installing tracd-script.py script to I:\thinkbase.net\github\PortableTrac-git\trac/Scripts
Installing tracd.exe script to I:\thinkbase.net\github\PortableTrac-git\trac/Scripts
Installing tracd.exe.manifest script to I:\thinkbase.net\github\PortableTrac-git\trac/Scripts

Installed i:\thinkbase.net\github\portabletrac-git\trac\lib\site-packages\trac-1.0.1-py2.7-win32.egg
Processing dependencies for Trac==1.0.1
Finished processing dependencies for Trac==1.0.1

I:\thinkbase.net\github\PortableTrac-git>

================================================================================
================================================================================

D:\thinkbase.net\PortableTrac-git>set SITE_BASE=D:\thinkbase.net\trac-thinkbase.net-git

D:\thinkbase.net\PortableTrac-git>trac-admin.cmd trac upgrade
[Current timestamp: 2013-02-18 星期一 15-12-12.14]

>>> call python.exe  "D:\thinkbase.net\PortableTrac-git\trac\Scripts\trac-admin-script.py" "D:\thinkbase.net\trac-thinkbase.net-git\tracenv\trac" upgrade
Database is up to date, no upgrade necessary.

D:\thinkbase.net\PortableTrac-git>trac-admin.cmd main upgrade
[Current timestamp: 2013-02-18 星期一 15-12-26.48]

>>> call python.exe  "D:\thinkbase.net\PortableTrac-git\trac\Scripts\trac-admin-script.py" "D:\thinkbase.net\trac-thinkbase.net-git\tracenv\main" upgrade
Database is up to date, no upgrade necessary.

D:\thinkbase.net\PortableTrac-git>trac-admin.cmd trac wiki upgrade
[Current timestamp: 2013-02-18 星期一 15-12-35.62]

>>> call python.exe  "D:\thinkbase.net\PortableTrac-git\trac\Scripts\trac-admin-script.py" "D:\thinkbase.net\trac-thinkbase.net-git\tracenv\trac" wiki upgrade
  CamelCase is already up to date
  InterMapTxt already exists
  InterTrac is already up to date
  InterWiki is already up to date
  PageTemplates imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\PageTemplates
  RecentChanges is already up to date
  SandBox is already up to date
  TitleIndex is already up to date
  TracAccessibility is already up to date
  TracAdmin is already up to date
  TracBackup is already up to date
  TracBatchModify is already up to date
  TracBrowser is already up to date
  TracCgi is already up to date
  TracChangeset is already up to date
  TracEnvironment is already up to date
  TracFastCgi imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\TracFastCgi
  TracFineGrainedPermissions is already up to date
  TracGuide is already up to date
  TracImport is already up to date
  TracIni is already up to date
  TracInstall is already up to date
  TracInterfaceCustomization imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\TracInterfaceCustomization
  TracLinks is already up to date
  TracLogging is already up to date
  TracModPython is already up to date
  TracModWSGI is already up to date
  TracNavigation imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\TracNavigation
  TracNotification is already up to date
  TracPermissions imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\TracPermissions
  TracPlugins is already up to date
  TracQuery is already up to date
  TracReports imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\TracReports
  TracRepositoryAdmin imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\TracRepositoryAdmin
  TracRevisionLog is already up to date
  TracRoadmap is already up to date
  TracRss is already up to date
  TracSearch is already up to date
  TracStandalone imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\TracStandalone
  TracSupport is already up to date
  TracSyntaxColoring is already up to date
  TracTickets is already up to date
  TracTicketsCustomFields is already up to date
  TracTimeline is already up to date
  TracUnicode is already up to date
  TracUpgrade imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\TracUpgrade
  TracWiki is already up to date
  TracWorkflow imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\TracWorkflow
  WikiDeletePage is already up to date
  WikiFormatting is already up to date
  WikiHtml is already up to date
  WikiMacros imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\WikiMacros
  WikiNewPage imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\WikiNewPage
  WikiPageNames is already up to date
  WikiProcessors imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\WikiProcessors
  WikiRestructuredText is already up to date
  WikiRestructuredTextLinks is already up to date

D:\thinkbase.net\PortableTrac-git>trac-admin.cmd main wiki upgrade
[Current timestamp: 2013-02-18 星期一 15-12-46.85]

>>> call python.exe  "D:\thinkbase.net\PortableTrac-git\trac\Scripts\trac-admin-script.py" "D:\thinkbase.net\trac-thinkbase.net-git\tracenv\main" wiki upgrade
  CamelCase is already up to date
  InterMapTxt already exists
  InterTrac is already up to date
  InterWiki is already up to date
  PageTemplates imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\PageTemplates
  RecentChanges is already up to date
  SandBox is already up to date
  TitleIndex is already up to date
  TracAccessibility is already up to date
  TracAdmin is already up to date
  TracBackup is already up to date
  TracBatchModify is already up to date
  TracBrowser is already up to date
  TracCgi is already up to date
  TracChangeset is already up to date
  TracEnvironment is already up to date
  TracFastCgi imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\TracFastCgi
  TracFineGrainedPermissions is already up to date
  TracGuide is already up to date
  TracImport is already up to date
  TracIni is already up to date
  TracInstall is already up to date
  TracInterfaceCustomization imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\TracInterfaceCustomization
  TracLinks is already up to date
  TracLogging is already up to date
  TracModPython is already up to date
  TracModWSGI is already up to date
  TracNavigation imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\TracNavigation
  TracNotification is already up to date
  TracPermissions imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\TracPermissions
  TracPlugins is already up to date
  TracQuery is already up to date
  TracReports imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\TracReports
  TracRepositoryAdmin imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\TracRepositoryAdmin
  TracRevisionLog is already up to date
  TracRoadmap is already up to date
  TracRss is already up to date
  TracSearch is already up to date
  TracStandalone imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\TracStandalone
  TracSupport is already up to date
  TracSyntaxColoring is already up to date
  TracTickets is already up to date
  TracTicketsCustomFields is already up to date
  TracTimeline is already up to date
  TracUnicode is already up to date
  TracUpgrade imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\TracUpgrade
  TracWiki is already up to date
  TracWorkflow imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\TracWorkflow
  WikiDeletePage is already up to date
  WikiFormatting is already up to date
  WikiHtml is already up to date
  WikiMacros imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\WikiMacros
  WikiNewPage imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\WikiNewPage
  WikiPageNames is already up to date
  WikiProcessors imported from C:\Documents and Settings\Administrator\Application Data\Python-Eggs\trac-1.0.1-py2.7-win32.egg-tmp\trac\wiki\default-pages\WikiProcessors
  WikiRestructuredText is already up to date
  WikiRestructuredTextLinks is already up to date

D:\thinkbase.net\PortableTrac-git>

使用 x3dom 框架及 WebGL 在浏览器上显示 3 维模型

如果需要在浏览器上显示 3D 画面的话, 现在一般会使用 WebGL, 典型的例如 three.js(http://mrdoob.github.com/three.js/), 但是 WebGL 对浏览器版本以及显卡的要求比较高, 很多客户端无法正常使用 ———— 当然现在新买的机器是毫无压力的.

后来在网上查找到了 X3DOM(http://www.x3dom.org/), 通过使用不同的后端(backend), X3DOM 可以兼容较低版本的浏览器(主要是指 IE 系列), 也可以在没有显卡支持的情况下运行, 常用的非 WebGL 后端是 Adobe Flash Player 11, IE 也可以通过使用 Google Chrome Frame 实现对 WebGL 的支持, 注意 Flash 11 以下的版本是不能正常运行的.

X3DOM 通过在标准的 HTML5 DOM 中加入 X3D 格式的 XML 元素, 实现将 X3D 格式的 3D 模型嵌入到 HTML 页面的功能; 在 http://www.x3dom.org/ 网站上有丰富的示例以及较详细的文档, 不过彻底搞懂估计需要一些 3D 建模的知识, 比如 fieldOfView 这样的专业术语.

另外 web3D Consortium 也有大量关于 X3D 的资料, 尤其是 X3D tooltips(http://www.web3d.org/x3d/content/X3dTooltips.html), 是一份全面的 X3D 节点元素速查手册(有中文版)(不知道为什么 www.web3d.org 被 GWF 了, 如果要下载也可以到 这里);

在初步了解 x3dom 的基础上, 以显示货物装箱为例, 对 x3dom 进行了简单的封装, 重点关注 货物在集装箱等容器中的堆放方式的显示, 可以实现以 "Box" 的方式加入不同尺寸的货物(长方体), 以不同的角度查看堆放情况, 以及对这些长方体的选择/加亮显示等等, 具体代码可以到 https://github.com/thinkbase/dev-thinkbase.net/tree/master/.research/x3dom-container-fill 下载, 注意测试用的 html 文件不能直接在本地打开, 必须部署到 HTTP 服务器上才能正常运行; 如果不想麻烦的话,在这里可以看到 在线演示.

实际显示的效果如下图所示(使用 Flash backend 的效果, 如果系统支持 WebGL 的话效果应该要好很多):