For Archetypes types, we can edit short name for their Add/Edit forms. For Dexterity, we have to create custom behaviors for such tasks. By default, Dexterity provides Title-to-ID behavior. However, CreationDate-to-ID behavior is more valid for my case. With help of @vitaliypodoba, I add NameFromCreationDate behavior in my recent project. To make it working Through The Web, be sure to uncheck the Name from title behavior, then check the Name from Creation Date behavior. Here is a similar implementation that might be of help. Also it is inspiring to learn the title computation and display technique.
2013/07/23
2013/06/22
Learning Path
這是十幾年前的事。小湯姆國小剛畢業,暑假空檔找了短期家教,想學怎樣架設 BBS 站。標準的學習內容和步驟大概是這些:首先,把 Linux 裝起來,學點 Shell 指令,再認識基本的 C 語言,從 Hello World 試起,不久,下載 Firebird 或 Maple,照著 README 編譯。
當年的小湯姆,現在已是技術高超的軟體好手。我常想,這些學習內容和步驟,很多部份現在還是適用,它們應該是程式人員學習路徑的一部份,依照成果標的,我們可以列出 skill set,由淺入深安排成教學項目,並整理項目之間的相依關係。
這種概念,應用在各種領域,幼兒學習、數位學習、應用軟體學習,ShowMeDo 也有使用這方法。
畫成捷運圖,也是很棒的圖解法。
2013/06/05
Plone Listing Localized Vocabulary
<tal:region condition="item_obj/region" tal:repeat="city item_obj/region"> <span tal:replace="city">Value</span> <span class="separator" tal:condition="not:repeat/city/end">,</span> </tal:region>
2013/06/04
AskBot Configuration
Check Ubuntu Postgresql Manual first, which needs more care. For example, who and where (listen_addresses) can access the database.
marr@thrust:~$ sudo apt-get install postgresql-9.1 postgresql-server-dev-9.1 postgresql-client-9.1 marr@thrust:~$ sudo -u postgres createuser -D -A -P myuser Enter password for new role: Enter it again: Shall the new role be allowed to create more new roles? (y/n) marr@thrust:~$ sudo -u postgres createdb -O myuser mydb marr@thrust:~$ sudo vi /etc/postgresql/9.1/main/pg_hba.conf marr@thrust:~/$ sugo apt-get install python-virtualenv marr@thrust:~/$ virtualenv myenv marr@thrust:~/$ cd myenv marr@thrust:~/myenv$ source bin/activate (myenv)marr@thrust:~/myenv$ git clone git://github.com/ASKBOT/askbot-devel.git (myenv)marr@thrust:~/myenv$ cd askbot-devel (myenv)marr@thrust:~/myenv/askbot-devel$ python setup.py develop (myenv)marr@thrust:~/myenv$ pip install psycopg2 $ askbot-setup Deploying Askbot - Django Q&A forum application Problems installing? -> please email admin@askbot.org To CANCEL - hit Ctr-C at any time Enter directory path (absolute or relative) to deploy askbot. To choose current directory - enter "." > /home/marr/askbot Adding new directories: /home/marr <-/askbot Accept? (type yes/no) > yes Please do not name your entire Django project 'askbot', because this name is already used by the askbot app itself Please select database engine: 1 - for postgresql, 2 - for sqlite, 3 - for mysql, 4 - oracle (type 1/2/3/4) Please enter database name (required) Please enter database user (required) Please enter database password (required) Copying files: * __init__.py * manage.py * urls.py * django.wsgi Creating settings file settings file created copying directories: * doc * cron * upfiles Done. Please find further instructions at http://askbot.org/doc/ $ python manage.py syncdb WARNING!!! You are using a 'locmem' (local memory) caching backend, which is OK for a low volume site running on a single-process server. For a multi-process configuration it is neccessary to have a production cache system, such as redis or memcached. With local memory caching and multi-process setup you might intermittently see outdated content on your site. Please run command python manage.py collectstatic current transaction is aborted, commands ignored until end of transaction block Syncing... Creating tables ... Creating table auth_permission Creating table auth_group_permissions Creating table auth_group Creating table auth_user_user_permissions Creating table auth_user_groups Creating table auth_user Creating table auth_message Creating table django_content_type Creating table django_session Creating table django_site Creating table django_admin_log Creating table south_migrationhistory Creating table livesettings_setting Creating table livesettings_longsetting Creating table djkombu_queue Creating table djkombu_message Creating table followit_followuser You just installed Django's auth system, which means you don't have any superusers defined. Would you like to create one now? (yes/no): $ python manage.py syncdb $ python manage.py migrate askbot WARNING!!! You are using a 'locmem' (local memory) caching backend, which is OK for a low volume site running on a single-process server. For a multi-process configuration it is neccessary to have a production cache system, such as redis or memcached. With local memory caching and multi-process setup you might intermittently see outdated content on your site. Please run command python manage.py collectstatic
Map Warper Configuration
The challenge is from bringing together old Ubuntu 10.10 and Rails with Geo libraries, especially GDAL, mapscript and mapserver.
update /etc/apt/sources.list source URL to old-releases.ubuntu.com and add deb http://ppa.launchpad.net/ubuntugis/ppa/ubuntu maverick main deb-src http://ppa.launchpad.net/ubuntugis/ppa/ubuntu maverick main
At http://code.mapwarper.net/wiki/DevServerConfig you will see instructions to install postgresql-8.3-postgis, but at http://code.mapwarper.net/wiki/InstallationOne says to install postgresql-8.4
My installation is postgresql-8.4
What is /var/lib/maps for? It is easy to run `sudo chgrp -R maps /var/lib/maps`, but I don't know why `mkdir /var/lib/maps` needed.
for Apache, don't know if Passenger and XSendFile are essential.
for PostGIS, it says postgis user, that I think it is typo for postgres user.
Make sure ruby1.8-dev is installed, or you will run into error "mkmf Not Found".
svnadmin init /var/local/svn --> sudo svnadmin create /var/local/svn
added sderle to group svn. --> sudo usermod -aG svn gis
imported r30 from http://svn2.geothings.net/warper/ to /warper --> not yet and don't know how
For Postgresql 8.4, lwpostgis.sql and spatial_ref_sys.sql files are changing their paths.
psql -f ... lwpostgis.sql --> psql -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql template_gis
psql -f ... spatial_ref_sys.sql --> psql -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql template_gis
At InstallationOne, it says template_gis, but at InstallationTwo, it says template_postgis.
Refer to Ubuntu Postgresql Manual, createuser sderle --> createuser -D -A -P gis
sudo apt-get install libgdal1-dev --> this helps to solve gdal-config not found issue.
Diazo: Bridging Designers and Programmers
很高興能在 PyConTW 2013 介紹 Diazo 工具,可惜準備時間不夠,沒辦法把 Diazo 多樣應用的可能性呈現出來,只能先簡介它的機制和概念。我在投影片裡整理的範例,主要是參考 David Bain 的文件,這也是既有文件中最詳實的內容。
有聽眾問到 Diazo 是否有支援 HTML5,網路上確實有範例,這些進階技巧,期待有機會試出來跟大家分享。
附上投稿時的文字:
Diazo is a smart approach to theming a website. Diazo does its magic by building on top of XSLT and provides a set of basic rules. Even better is that an easy-to-use in-browser rich editor is coming for designers. Most modern webservers supporting for XSLT transformations also ease the deployment. In this talk, we will learn and demo how Diazo is working.
In general, designers work with static HTML while programmers work on codes and frameworks. Often, they hardly collaborate without bumping into each other.
Diazo eases the process of theming a website, by isolating users from having to understand how developers build websites with frameworks. Diazo does its magic by building on top of XSLT. Raw XSLT is too complex for everyday use, so Diazo provides a simple and user-friendly set of basic rules that get compiled into XSLT behind the scenes. Even better is that an easy-to-use in-browser rich editor is coming for designers to create themes without needing filesystem access or knowledge of Python. Most modern webservers already support for XSLT transformations, so deploying Diazo via WSGI, Ngnix, Varnish or Apache is simple and straightforward.
2013/06/01
PyLadies Reviewed
PyLadies 是怎樣的團體呢? 透過學習和互助,像是提供專業能力和職涯成長的活動,它致力協助更多女生成為 Python 社群的一份子。Python 社群本身有個多樣化原則,鼓勵各式各樣使用者,依照自己最感興趣、最適合的方式,成為 Python 社群的一份子。
在三月間,PyCon 2013 舉辦義賣活動,獲得一萬美金的資助,用來協助更多女生進入 IT 圈,或是參與 open source 活動,初期的想法是贊助女生去參加 DjangoCon。
PyLadies 的成員散佈全球,目前已成立十餘個 chapter,有個 starting kit 說明成立 chapter 的注意事項:
Nashville PyLadies NYC PyLadies PyLadies Austin PyLadies DC PyLadiesLA PyladiesIndia PyLadies Montréal PyLadies PDX PyLadies SF PyLadies Stockholm PyLadies Vienna
參考 Plone 基金會的範本,PyLadies 也公佈自己的 Code of Conduct 公約,要求社群朋友共同維護平等友善的交流環境。
已經舉辦過的活動,包括 hackathon, ladies' night, workshop 等,網路上找得到許多影片記錄,包括 Selena Deckelmann 在 OSDC 的演講。
男生可以參加 PyLadies 活動嗎? 這點由活動主辦人決定,常見的方式是以女生優先為主,已參加的女生可帶一個男生到場。如果 PyLadies 活動和 User Group 合辦,就更容易達到性別中立的效果。不管男生是否能夠到場,早點明確宣佈原則,對大家都有好處。