2012/03/30
2012/03/06
Configure Plone and Joomla RSS Feeds
這算是 Plone User's Joomla Adventure 第二集,比較兩者設定 RSS Feed 的方法。
Plone 的 RSS 設定對象是 collection,在網址後面加上 /RSS 就行,例子像是 http://localhost/news/aggregator/RSS,搭配 portal_actions 還可以自動產生 RSS link/icon。
Joomla 的設定對象通常是 category 和 section,也可以首頁之類的任何網址,在網址後面加上 ?format=feed&type=rss 就行,例子像是 http://localhost/index.php?format=feed&type=rss 或 http://localhost/index.php?option=com_content&view=category&id=48&format=feed&type=rss。
2012/02/09
Interactive Programming Learning
在 http://ask.inside.com.tw/ 看到「如何教國一的弟弟寫程式」,順便找到幾個線上資源:
- http://www.codecademy.com/
- http://tryruby.org/
- http://www.trypython.org/
2012/02/03
2012/01/17
Plone User's Joomla Adventure
我下載的說明文件是 http://downloads.joomlacode.org/docmanfileversion/1/6/0/16087/1.5_Installation_Manual_version_0.4.pdf 寫得很詳細,像是在讀論文,常讓我有找不到重點的感覺。作業系統環境是 CentOS,第一個卡關的地方,新版的 PHP 把 MySQL 的支援設定,改到 php.ini 檔案裡,這在文件裡是寫成 You must ensure that you have the MySQL, XML, and Zlib modules functionality enabled within your Apache Web server installation. These are controlled within the php.ini file. 平常太少跟 Apache 打交道,所以遇到 configuration.php Writable 的問題,把目錄擁有者改成 apache.apache 就行了。 進入管理介面後,沒馬上搞懂的是: extension, module, plugin 有何差別,對於 Category 也不清楚。
以上是初體驗的心得。
2012/01/03
Vim Auto-indenting for Code Paste
編輯程式碼時,雞婆聰明的 Vim 會自動縮排,這時可以用 :set paste 來處理,更多資訊可參考 http://vim.wikia.com/wiki/VimTip906
2011/12/10
Firewall Port Config
想要新增能通過 firewall 的 port 號碼,在 Mandriva 環境常用 drakconf,在 CentOS 環境,了解詳細的設定方式之餘,也可以用 system-config-securitylevel 來直接設定。在 Ubuntu 環境可用 ufw
2011/12/06
PHP is Object Capable
Of course, PHP is not Object Oriented. Luckily, most software written in PHP does not care much about objects, I guess.
2011/11/26
rsync + ssh on different port
$ cat .ssh/config
Host another.site.IP
Port 8022
User marr
Hostname another.site.com
$ rsync -av --progress --inplace --rsh=ssh another.site.com:my_folder/* my_backup
# and this is for normal cases:
$ rsync -av -e ssh myid@mysite.com:/my_folder/my_file .
2011/11/09
Apache Plone Maintenance
檢查已啟用的 module 清單:
$ ls /etc/apache2/mods-enabled/ alias.conf authz_host.load deflate.conf mime.load setenvif.load alias.load authz_user.load deflate.load negotiation.conf status.conf auth_basic.load autoindex.conf dir.conf negotiation.load status.load authn_file.load autoindex.load dir.load reqtimeout.conf authz_default.load cgid.conf env.load reqtimeout.load authz_groupfile.load cgid.load mime.conf setenvif.conf
確認啟用 proxy 不然會遇到錯誤: Invalid command 'ProxyPass', perhaps misspelled or defined by a module not inclu ded in the server configuration
$ sudo a2enmod proxy $ sudo a2enmod proxy_http $ sudo a2enmod rewrite $ sudo vim /etc/apache2/sites-available/www.mysite.com $ sudo a2ensite www.mysite.com $ sudo /etc/init.d/apache2 restart
設定內容範例如下:
<VirtualHost *:80>
ServerName www.mysite.com
ErrorLog /var/log/apache2/mysite_error.log
CustomLog /var/log/apache2/mysite_access.log combined
LogLevel warn
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteLog /var/log/apache2/mysite_rewrite.log
RewriteLogLevel 5
RewriteRule ^($|/.*) http://127.0.0.1:6543/VirtualHostBase/http/www.mysite.com:80/mysite/VirtualHostRoot$1 [L,P]
</IfModule>
ProxyPass / http://localhost:6543/mysite
ProxyPassReverse / http://localhost:6543/mysite
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
</VirtualHost>
2011/10/30
CMS Comparison
This is a historical document by marr, Open Source Software Foundry first published on 2006/12/15, last edited on 2008/06/11
我們以 Packt Open Source CMS Award 2006 年的前三名,做為比較對象,並參考 Gnome.Org CMS requirements 的技術要求,整理出合適的比較項目,包括有:核心開發隊員的規模、擴充模組的集散處、開發工具、測試工具、多國語文支援等。
Open Source CMS Comparison Matrix
| Joomla | Drupal | Plone | |
|---|---|---|---|
| Language | PHP 4.2 for 1.0.3 PHP 4.3 for 1.5 | PHP 4 for 4.5 and earlier PHP 5 for4.6 and 4.7 | Python 2.3.5 for 2.1 Python 2.4.2 for 2.5 |
| Core Team Members | ~20 | ~15 | ~42 |
| Extension | Extensions Directory | Modules Directory | Products Directory |
| IDE Tools | PHPelipse | Module Builder Zend Studio * |
Eclipse (PyDev) WingIDE * |
| Testing Tools | TestComplete * Web Vulnerability Scanner * FIT for PHP |
Selenium module for PHP | unittest module in Python PloneSelenium |
| I18N | i18n Package | multi-langual modules | LinguaPlone |
| Local Group | Joomla Taiwan | Drupal Taiwan | Python Taiwan |
| OpenID Support | on the way | Customer Module v1.1.1 | scheduled in 3.0 alpha |
簡言之,目前 Joomla 處於將 Unit Testing 或 Selenium 服務納入架構的過渡階段,而 Drupal 已有 Selenium 的模組。另外,以 Python 為基礎的 Plone 可以搭配 UML 工具快速產生架構圖及原始碼。
- * 符號代表該軟體為版權專有的商業產品。
- 註: Joomla 官方選用的 TestComplete 及 Web Vulnerability Scanner 分別是 AutomatedQA 及 Acunetix 公司的商業產品。
2011/10/17
Ubuntu Locale
sudo apt-get install update-locale sudo apt-get install localization-config sudo update-locale LANG=en_US.UTF-8完成設定後的內容存在 /etc/default/locale 檔案裡。
Ubuntu Mounts Windows
首先要設定 Windows 檔案分享,成功的話,可以在 Ubuntu Network - Windows network 看到分享出來的目錄,接著再執行 mount 指令,主要步驟如下:
sudo apt-get install smbfs sudo mkdir /media/sharename sudo vi /etc/nsswitch.conf sudo mount -t cifs //netbiosname/sharename /media/sharename -o username=winusername,password=winpassword,iocharset=utf8,file_mode=0777,dir_mode=0777當然,還可以把設定值寫進 /etc/fstab 裡。
2011/08/15
2011/07/19
Online FlowChart
版本 beta 2.4-r23 在匯出 PNG PDF 時,圖案會移位,只好手動抓圖。
2011/07/08
ffmpeg + libmp3lame
sudo apt-get install libavcodec-extra-52
ffmpeg -i myfile.mp4 -acodec libmp3lame -ab 192k myfile.mp3
2011/06/22
User Experience in an OpenSource Fashion
有反例嗎? Firefox 和 Gnome 似乎證實沒那麼糟。
另外,網頁或 thin client UX 的進展速度較快,甚至進而影響 fat client 的設計。
終究 UX 也可以用 Open Source 方式來搞嗎? 我還不知道答案,但看到 Art will stay Art. 這句時,我笑了。
random read: CodePlex example by Microsoft
2011/06/11
SWFTools
yum --nogpgcheck install在 Ubuntu 是把 deb http://free.nchc.org.tw/ubuntu/ hardy main universe 加進 /etc/apt/sources.list 這樣較簡單。
swftools-0.8.1-1.el5.rf.i386.rpm
libmp3lame0-3.98.4-22.el5.i386.rpm
t1lib-5.1.2-5.i386.rpm
實際上傳 PDF 時,日誌檔裡會記錄
INFO wc.pageturner Running command /usr/bin/pdf2swf /tmp/tmp_oIQQW -o /tmp/tmpODfpYG -T 9 -f -t -G
------
INFO wc.pageturner Finished Running Command /usr/bin/pdf2swf /tmp/tmp_oIQQW -o /tmp/tmpODfpYG -T 9 -f -t -G
不過,根據中文字型的測試結果,CentOS 5.4 的 freetype 2.2.1 無法處理 PDF 中文字型,改用 2.3.12 版本能改善。
2011/05/06
Selenium Basic
self.selenium = selenium(
"localhost", 4444, "*chrome", "http://google.com/")
想把上述程式碼改在雲端執行,可藉助 OnDemand 服務,並把內容修改成下列這樣:
self.selenium = selenium(
'http://ondemand.saucelabs.com',
80,
"""{
"username": "USERNAME",
"access-key": "ACCESS_KEY",
"os": "Windows 2003",
"browser": "firefox",
"browser-version": "3.",
"name": "This is an example test"
}""",
'http://google.com')
這樣一來,就不必自己跑 Selenium RC 囉。
2011/05/04
plone.dexterity zh_TW translation
# Copyright (C) 2010 Plone foundation
# This file is distributed under the same license as the plone.dexterity
# project.
# marr <marr.tw@gmail.com>, 2011.
#
msgid ""
msgstr ""
"Project-Id-Version: plone.dexterity 1.0b3\n"
"Report-Msgid-Bugs-To: dexterity-development@googlegroups.com\n"
"POT-Creation-Date: 2010-07-09 15:38+0200\n"
"PO-Revision-Date: 2011-05-04 10:10+0800\n"
"Last-Translator: marr <marr.tw@gmail.com>\n"
"Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 0.9.5\n"
#: plone/dexterity/browser/add.py:82
#: plone/dexterity/browser/edit.py:15
msgid "Save"
msgstr "儲存"
#: plone/dexterity/browser/add.py:92
msgid "Item created"
msgstr "項目已新增"
#: plone/dexterity/browser/add.py:94
#: plone/dexterity/browser/edit.py:25
msgid "Cancel"
msgstr "取消"
#: plone/dexterity/browser/add.py:96
msgid "Add New Item operation cancelled"
msgstr "新增項目已取消"
#: plone/dexterity/browser/add.py:112
msgid "Add ${name}"
msgstr "新增 ${name}"
#: plone/dexterity/browser/base.py:14
msgid "Content"
msgstr "內容"
#: plone/dexterity/browser/edit.py:22
msgid "Changes saved"
msgstr "更改已儲存"
#: plone/dexterity/browser/edit.py:27
msgid "Edit cancelled"
msgstr "編輯已取消"
#: plone/dexterity/browser/edit.py:48
msgid "Edit ${name}"
msgstr "編輯 ${name}"