<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mFabrik - web and mobile development &#187; zope</title>
	<atom:link href="http://blog.mfabrik.com/category/zope/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mfabrik.com</link>
	<description>Freedom delivered.</description>
	<lastBuildDate>Thu, 02 Sep 2010 13:25:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Running 32-bit chroot on 64-bit Ubuntu server to reduce Python memory usage</title>
		<link>http://blog.mfabrik.com/2010/08/03/running-32-bit-chroot-on-64-bit-ubuntu-server-to-reduce-python-memory-usage/</link>
		<comments>http://blog.mfabrik.com/2010/08/03/running-32-bit-chroot-on-64-bit-ubuntu-server-to-reduce-python-memory-usage/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 16:15:02 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[plone]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[zope]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[chroot]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[debootstrap]]></category>
		<category><![CDATA[memory usage]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[restart]]></category>
		<category><![CDATA[zodb]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=606</guid>
		<description><![CDATA[Here are documented brief instructions how to run 32-bit chroot&#8217;ed environment on 64-bit Ubuntu server. chroot means that you run re-rooted and jailed system inside another system. What we do here is enabling 32-bit chroot&#8217;ed userland on 64-bit server. 32-bit userland and 32-bit Python environment reduces the memory usage of heavy website applications we are [...]]]></description>
			<content:encoded><![CDATA[<p>Here are documented brief instructions how to run 32-bit chroot&#8217;ed environment on 64-bit Ubuntu server. chroot means that you run re-rooted and jailed system inside another system.</p>
<p>What we do here is enabling 32-bit chroot&#8217;ed userland on 64-bit server. 32-bit userland and 32-bit Python environment reduces the memory usage of heavy website applications we are running (read: Plone/Zope), since 32-bit has only half of the pointer size and object-oriented programming is all about pointers. Zope is especially memory hungry, because it uses ZODB object database. The developer does not need to worry about when doing queries, updates or caches that much  as the persistent site state is transparent to Python (objects are automatically loaded from database or cache when they are referred). Easy persistency means that almost everything is in the database and you need to have big object cache. Plone has huge client-side, in-process, cache for persistent objects. The default setting is for the cache size 5000 objects. (sidenote: since ZODB cache is in-process and Python does not do threading too well, running big Plone sites means that you need run several processes to handle parallel requests &#8211; having multiple processes with big in-process caches means loads of memory consumption)</p>
<p>32-bit userland is especially useful if you need to run Plone on 64-bit VPS (virtual private server) with low amount of available memory (512 MB or 1 GB).</p>
<p>There are some brief measurements about 32-bit vs. 6-bit Python memory usage at the end of this article.</p>
<p>Unless otherwise specified, all command here should be run as the root user of the host system. Commands here are for example only and you <strong>need to know what you are doing</strong>. If you lack advanced UNIX administration skills we <a href="http://mfabrik.com/@@zoho-contact-form">gladly arrange you some commercial training or hosting support</a>.</p>
<h2>Installing</h2>
<p>Basic schroot installation instructions for Ubuntu can be found here <a title="https://help.ubuntu.com/community/DebootstrapChroot" href="https://help.ubuntu.com/community/DebootstrapChroot">https://help.ubuntu.com/community/DebootstrapChroot</a> . We also install ZopeSkel in the chroo&#8217;ed environment for starting creating Plone sites. Note that we are using Ubuntu 8.04 which still ships with Python 2.4 &#8211; <a href="http://blog.mfabrik.com/2010/07/16/easily-install-all-python-versions-under-linux-and-osx-using-collective-buildout-python/">for later Ubuntus you need to compile Python 2.4 from the scratch</a>.</p>
<pre>apt-get install debootstrap
apt-get install schroot

# Old schroot uses global schroot.conf, new versions have
# chroot.d directory

# This is a heredoc, but use what ever editor you like
# to create the configuration
cat &lt;&lt;EOF &gt; /etc/schroot/chroot.d/hardy_i386.conf
[hardy_i386]
description=Ubuntu 8.04 Hardy for i386
location=/srv/chroot/hardy_i386
personality=linux32
root-users=bob
run-setup-scripts=true
run-exec-scripts=true
type=directory
users=bob,john,alice,ploneuser
EOF

mkdir -p /srv/chroot/hardy_i386
debootstrap --variant=buildd --arch i386 hardy /srv/chroot/hardy_i386 \

http://archive.ubuntu.com/ubuntu/

# Check that the chroot is created and working
schroot -l

# Enter the chroot (logged in as bob)
schroot -c hardy_i386 -u root

# Once inside, install python2.4-dev and other needed tools
# Installing PIL with easy_install didn't work for some
# reason, so we use python-imaging package.
apt-get install python2.4-dev python-setuptools python-imaging
easy_install-2.4 ZopeSkel</pre>
<p>And that&#8217;s about it.</p>
<p>Chroot&#8217;ed environment will have</p>
<ul>
<li>It&#8217;s own application binaries (and userland bitness)</li>
</ul>
<p>Chroot&#8217;ed environment will share with the host system</p>
<ul>
<li>Ports</li>
<li>Processes</li>
<li>User accounts</li>
</ul>
<p>Chroot&#8217;ed users</p>
<ul>
<li>Can&#8217;t list filesystem outside chroot</li>
</ul>
<p>&#8230;giving additional safety for shared hosting in the case of chroot&#8217;ed environment is compromised.</p>
<h2>Entering chroot&#8217;ed environment as a specific user</h2>
<p>Try</p>
<pre>schroot -c hardy_i386 -u root</pre>
<p>&#8230;or&#8230;</p>
<pre>schroot -c hardy_i386 -u plone_user # After you have set-uped normal user for chroot'ed environment</pre>
<p><strong>All background processes you leave running in chroot&#8217;ed environment are terminated when you exit this environment</strong>, unless you create sessions as described below.</p>
<h2>Creating chroot sessions</h2>
<p>Sessions enable running commands in chroot without the need to have it constantly open.</p>
<pre># Create a new schroot session
schroot --chroot=hardy_i386 --user=ploneuser \
--session-name=plonesession \
--begin-session

# Run commands in the created session
schroot --chroot=plonesession --user=ploneuser --run-session \
/srv/plone/yourplonesite/bin/instance start

# Ending session
schroot --chroot=plonesession --user=ploneuser --end-session</pre>
<p>Note that -<em>-chroot</em> parameter takes in both actual chroot installations and session ids.</p>
<h2>Doing resets for chrooted environment</h2>
<p>The session processes exist as long as the session exist. Unless you explicitly start a new session with &#8211;begin-session the processes are terminated as soon as you log out from the chroot&#8217;ed environent.<br />
<strong>chroot&#8217;ed environment is temporary unless you explicitly specify it not be</strong><br />
Thus if you want to run daemonized services in chrooted environment you need to take care of session handling manually.<br />
Here is an example how do you construct a session (as a real root user) and then launch a shell script which will take care of launching applications inside the chroot.</p>
<pre># Terminate previous session if any
schroot --chroot=hardy_i386 --user=plone_user --session-name=plone_session --end-session</pre>
<pre>#Start the session (again)
schroot --chroot=hardy_i386 --user=plone_user --session-name=plone_session --begin-session</pre>
<pre># Run a start script inside the chroot'ed environment which will start Plone
# NGINX and other necessary 32-bit services
schroot --chroot=plone_session --user=plone_user --run-session /srv/plone/myplonesite/restart-all.sh</pre>
<h2>Running sessions at startup</h2>
<p>You can add schroot bootstrap in real /etc/rc.local:</p>
<pre>schroot --chroot=hardy_i386 --user=ploneuser \
--session-name=plonesession --begin-session \
&amp;&amp; schroot --chroot=plonesession --run-session \
/srv/plone/inst/bin/instance start</pre>
<p>Remember that the users have to be created outside the chrooted environment. If you set the home directory to something that exists only in the chrooted environment, use something like this</p>
<pre>adduser --no-create-home --home HOMEDIR_IN_CHROOT ploneuser</pre>
<p>Then to create the directory inside the chroot and set its ownership to the newly created user and group.</p>
<h2><strong>32-bit vs 64-bit memory consumption</strong></h2>
<p><strong></strong>Reason why we even tried this is that some python applications, like Zope, use references heavily and moving from 32bit to 64bit references increases memory usage. (<a title="J Stahl 2010" href="http://jstahl.org/archives/2010/01/24/plone-4-uses-29-less-memory-than-plone-3-thanks-python-2-6/">J Stahl 2010</a>)</p>
<p>Memory figures from a development Zope/Plone 3.3.5 server</p>
<table border="1" cellspacing="0" cellpadding="3" bordercolor="#000000">
<tbody>
<tr>
<td width="33.333333333333336%"></td>
<td width="33.333333333333336%" align="left">32-bit</td>
<td width="33.333333333333336%">64-bit</td>
</tr>
<tr>
<td width="33.333333333333336%">After startup</td>
<td width="33.333333333333336%">112 MiB RES<br />
116 MiB VIRT</td>
<td width="33.333333333333336%">175 MiB RES<br />
342 MiB VIRT</td>
</tr>
<tr>
<td width="33.333333333333336%">After normal usage</td>
<td width="33.333333333333336%">159 MiB RES<br />
194 MiB VIRT</td>
<td width="33.333333333333336%">236 MiB RES<br />
487 MiB VIRT</td>
</tr>
</tbody>
</table>
<p>This is far from a complete study, but it would seem that the chroot does pay off even though it has to load 32bit versions of basic libraries along. If running more than one instance on same server memory savings should increase.</p>
<h2>More information</h2>
<ul>
<li><a href="http://manpages.ubuntu.com/manpages/hardy/man1/schroot.1.html">http://manpages.ubuntu.com/manpages/hardy/man1/schroot.1.html</a></li>
<li><a href="http://en.wikipedia.org/wiki/Chroot">http://en.wikipedia.org/wiki/Chroot</a></li>
</ul>
<p>
<a href="http://blog.mfabrik.com"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></img></a> <a href="http://blog.mfabrik.com">Read our blog</a> <a href="http://twitter.com/mfabrik"> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></img></a> <a href="http://twitter.com/mfabrik">Follow us on Twitter</a> <a href="http://www.linkedin.com/in/ohtis"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/linkedin-24.png"></img></a> <a href="http://www.linkedin.com/in/ohtis">Mikko Ohtamaa on LinkedIn</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2010/08/03/running-32-bit-chroot-on-64-bit-ubuntu-server-to-reduce-python-memory-usage/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>.gitignore for Python developers</title>
		<link>http://blog.mfabrik.com/2010/07/23/gitignore-for-python-developers/</link>
		<comments>http://blog.mfabrik.com/2010/07/23/gitignore-for-python-developers/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 08:02:32 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[plone]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[zope]]></category>
		<category><![CDATA[gitignore]]></category>
		<category><![CDATA[ignore]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=595</guid>
		<description><![CDATA[If you are using Git for version control for your Python egg and buildout development below are is a sample which you might want to put into your .gitignore file. *.mo *.egg-info *.egg *.EGG *.EGG-INFO bin build develop-eggs downloads eggs fake-eggs parts dist .installed.cfg .mr.developer.cfg .hg .bzr .svn *.pyc *.pyo *.tmp* Suggestions for new ignores [...]]]></description>
			<content:encoded><![CDATA[<p>If you are using Git for version control for your Python egg and buildout development below are is a sample which you might want to put into your .gitignore file.</p>
<pre>*.mo
*.egg-info
*.egg
*.EGG
*.EGG-INFO
bin
build
develop-eggs
downloads
eggs
fake-eggs
parts
dist
.installed.cfg
.mr.developer.cfg
.hg
.bzr
.svn
*.pyc
*.pyo
*.tmp*
</pre>
<p>Suggestions for new ignores are welcome.
<p>
<a href="http://blog.mfabrik.com"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></img></a> <a href="http://blog.mfabrik.com">Read our blog</a> <a href="http://twitter.com/mfabrik"> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></img></a> <a href="http://twitter.com/mfabrik">Follow us on Twitter</a> <a href="http://www.linkedin.com/in/ohtis"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/linkedin-24.png"></img></a> <a href="http://www.linkedin.com/in/ohtis">Mikko Ohtamaa on LinkedIn</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2010/07/23/gitignore-for-python-developers/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Plone Go Mobile &#8211; preparing a release</title>
		<link>http://blog.mfabrik.com/2010/04/01/plone-go-mobile-preparing-a-release/</link>
		<comments>http://blog.mfabrik.com/2010/04/01/plone-go-mobile-preparing-a-release/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 12:16:13 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[blackberry]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[maemo]]></category>
		<category><![CDATA[n900]]></category>
		<category><![CDATA[plone]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[zope]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=450</guid>
		<description><![CDATA[Enter the mobile world with Plone! Go mobile for Plone add-on is now &#8220;feature complete&#8221; and we are preparing a release. For Easter holidays we bring you a trunk release instructions. Note: you might want to change checkout protocol from &#8220;https&#8221; to &#8220;http&#8221; in the buildout cfg. The most able and most inpatient might want [...]]]></description>
			<content:encoded><![CDATA[<p>Enter the mobile world with Plone! <em>Go mobile for Plone </em>add-on is now &#8220;feature complete&#8221; and we are preparing a release.</p>
<p>For Easter holidays we bring you <a href="http://code.google.com/p/plonegomobile/source/browse/trunk/gomobile/gomobile.mobile/docs/usermanual/installation.txt?spec=svn240&amp;r=240">a trunk release instructions</a>. Note: you might want to change checkout protocol from &#8220;https&#8221; to &#8220;http&#8221; in the buildout cfg. The most able and most inpatient might want to test this now when it is hot.</p>
<p>There exists three production site where you can see the product in action</p>
<ul>
<li><a href="http://mfabrik.com">http://mfabrik.com</a> (try with your web browser and phone and experience the joy of automatic mobile browser detection)</li>
<li> <a href="http://northvillage.mobi">http://saariselka.com</a> and <a href="http://northvillage.mobi">http://northvillage.mobi</a></li>
<li><a href="http://plonecommunity.mobi">http://plonecommunity.mobi</a></li>
</ul>
<p>See the <a href="http://code.google.com/p/plonegomobile/source/browse/trunk/gomobile/gomobile.mobile/docs/usermanual/features.txt?r=240">feature set </a>which will beat crap out of other mobile CMSs.</p>
<p>What&#8217;s missing for the real release is</p>
<ul>
<li>packaging it as a eggs</li>
<li>making microsite</li>
<li>clean up documentation (YES. It has documentation since day 0)</li>
</ul>
<p>It has not been tested on Plone 4.</p>
<p>Thanks <a href="http://plonemetrics.blogspot.com/2010/04/mobile-plone.html">Karl Horak </a>for bringing up the issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2010/04/01/plone-go-mobile-preparing-a-release/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Eclipse plug-in for Plone/Zope/buildout based development</title>
		<link>http://blog.mfabrik.com/2010/03/29/eclipse-plug-in-for-plonezopebuildout-based-development/</link>
		<comments>http://blog.mfabrik.com/2010/03/29/eclipse-plug-in-for-plonezopebuildout-based-development/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 10:01:47 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[buildout]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[plone]]></category>
		<category><![CDATA[pydev]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[zope]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=441</guid>
		<description><![CDATA[Few days ago Fabio announced Django plug-in for Eclipse. There also exists an effort to make Eclipse integrate smoother with Plone / Zope / Buildout world. Please see PyPi page here. It is not nearly as polished as Fabio&#8217;s work, as Fabio being main author of PyDev and started as a collection of company internal [...]]]></description>
			<content:encoded><![CDATA[<p>Few days ago Fabio announced <a href="http://pydev.blogspot.com/2010/03/django-on-pydev.html">Django plug-in for Eclipse</a>. There also exists an effort to make Eclipse integrate smoother with Plone / Zope / Buildout world.</p>
<p>Please see <a href="http://pypi.python.org/pypi/collective.eclipsescripts">PyPi page here</a>.</p>
<p>It is not nearly as polished as Fabio&#8217;s work, as Fabio being main author of PyDev and started as a collection of company internal tools. However if you mare making many buildouts, write code &gt; 5 Python modules at once and don&#8217;t want to start terminal everytime you need to run buildout, this plug-in is for you.</p>
<p>Also, it is not yet a real plug-in. It is a collection of <a href="http://code.google.com/p/jrfonseca/wiki/PythonMonkey">PythonMonkey scripts</a>. This means that to deploy the scripts you simply copy .py files them to <em>scripts</em> folder of any of your Eclipse projects. If you need to work on the codebase, you don&#8217;t need to start a separate Eclipse instance, but you can do it interactively through Eclipse console while you do other development. The script source code is well commented, so if you want to tune them for your own habits it should be easy.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2010/03/29/eclipse-plug-in-for-plonezopebuildout-based-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrating and theming WordPress with your CMS site using XDV</title>
		<link>http://blog.mfabrik.com/2010/03/28/integrating-and-theming-wordpress-with-your-cms-site-using-xdv/</link>
		<comments>http://blog.mfabrik.com/2010/03/28/integrating-and-theming-wordpress-with-your-cms-site-using-xdv/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 12:48:17 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[plone]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[xdv]]></category>
		<category><![CDATA[zope]]></category>
		<category><![CDATA[deliverance]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[locationmatch]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[theming]]></category>
		<category><![CDATA[virtualhost]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xsl]]></category>
		<category><![CDATA[xslt]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=421</guid>
		<description><![CDATA[Introduction XDV is an external HTML theming engine, a.k.a. theming proxy, which allows you to mix and match HTML and CSS from internal and external sites by using simple XML rules. It separates the theme development from the site development, so that people with little HTML and CSS knowledge can create themes without need to [...]]]></description>
			<content:encoded><![CDATA[<div id="xdv-theming">
<div>
<h1><a id="introduction" name="introduction" href="http://www.tele3.cz/jbar/rest/render.py#id1">Introduction</a></h1>
<p>XDV is an external HTML theming engine, a.k.a. theming proxy, which allows you to mix and match HTML and CSS from internal and external sites by using simple XML rules. It separates the theme development from the site development, so that people with little HTML and CSS knowledge can create themes without need to know underlying Python, PHP or whatever. It also enables integration of different services and sites to one, unified, user experience. For example, XDV is used by <cite>plone.org &lt;http://plone.org&gt;</cite> to integrate Plone CMS and Trac issue tracker.  XDV compiles theming rules to XSL templates, which has been a standard XML based templates language since 1999. XSL has good support in every programming language and web server out there. Example backends to perform XSL transformation include</p>
<ul>
<li>Python and lxml library</li>
<li>Apache&#8217;s mod_transform</li>
<li>nginx web server</li>
<li>All XSL capable Java and .NET software out there</li>
</ul>
<p>XDV theming can be used together with Plone where enhanced support is provided by <a href="http://pypi.python.org/pypi/collective.xdv">collective.xdv package</a> package. Technically, collective.xdv adds Plone settings panel and does XSL transformation in Zope&#8217;s post-publication hook using lxml library.  XDV can be used standalone with <a href="http://pypi.python.org/pypi/xdv/0.3a2">XDV package</a> to theme any web site, let it be WordPress, Joomla, Drupal or custom in-house PHP solution from year 2000.  XDV is based on <a href="http://deliverance.openplans.org/">Deliverance specification</a> The difference between XDV and Deliverance reference implementation is that XDV internally compiles themes to XSL templates, when Deliverance relies on processing HTML in Python. Currently XDV approach seems to be working better, as we had many problems trying to apply Deliverance for WordPress site (redirects didn&#8217;t work, HTTP posts didn&#8217;t work, etc.).</p>
</div>
<div>
<h1><a id="tutorials" name="tutorials" href="http://www.tele3.cz/jbar/rest/render.py#id3">Tutorials</a></h1>
<ul>
<li><a href="http://plone.org/products/collective.xdv/documentation/reference-manual/theming">http://plone.org/products/collective.xdv/documentation/reference-manual/theming</a></li>
<li><a href="http://pypi.python.org/pypi/collective.xdv">http://pypi.python.org/pypi/collective.xdv</a></li>
<li><a href="http://pypi.python.org/pypi/xdv">http://pypi.python.org/pypi/xdv</a></li>
<li><a href="http://pypi.python.org/pypi/dv.xdvserver">http://pypi.python.org/pypi/dv.xdvserver</a> (with WSGI)</li>
</ul>
</div>
<div>
<h1><a id="setting-up-xdv-development-tools" name="setting-up-xdv-development-tools" href="http://www.tele3.cz/jbar/rest/render.py#id4">Setting up XDV development tools</a></h1>
<p>XDV tools are deployed as Python eggs. You can use tools like <cite>buildout &lt;http://www.buildout.org/&gt;</cite> configuration and assembly tool or easy_install to get XDV on your development computer and the server.  If you are working with Plone you can integrate XDV to your site existing buildout. If you are not working with Plone, <a href="http://pypi.python.org/pypi/xdv#installation">XDV home page</a> has instructions how to deploy XDV command standalone.</p>
</div>
<div>
<h1><a id="xdv-rules" name="xdv-rules" href="http://www.tele3.cz/jbar/rest/render.py#id5">XDV Rules</a></h1>
<p>Rules (rules.xml) will tell how to fit content from external source to your theme HTML.  It provides straightforward XML based syntax to manipulate HTML easily</p>
<ul>
<li>Append, replace and drop HTML pieces</li>
<li>Insert HTML snippets</li>
<li>CSS or XPath selectors can be used to identify HTML parts</li>
<li>It is possible to mix and match content from more than two sites</li>
<li>etc.</li>
</ul>
<p>Rules XML syntax is documented at <a href="http://pypi.python.org/pypi/xdv">XDV homepage</a>.  Rules will be compiled to XSL template (theme.xsl) by <em>xdvcompiler</em> command. The actual theming is done by one of the XSL backends listed above, by taking HTML as input and applying XSL transformations on it.  Note that currently rules without matching selectors are silently ignored and there is no bullet-proof way to debug what happens inside XSL transformation, except by looking into compiled theme.xsl.</p>
</div>
<div>
<h1><a id="using-xdv-to-theme-and-integrate-a-wordpress-site" name="using-xdv-to-theme-and-integrate-a-wordpress-site" href="http://www.tele3.cz/jbar/rest/render.py#id6">Using XDV to theme and integrate a WordPress site</a></h1>
<p>Below are instructions how to integrate a WordPress site to your CMS. In this example CMS is Plone, but it could be any other system.  We will create XDV theme which will theme WordPress site to match our CMS site in the fly.</p>
<p style="text-align: center;"><a href="http://blog.mfabrik.com/wp-content/uploads/2010/03/xdv_wordpress.png"><img class="size-full wp-image-424 aligncenter" title="xdv_wordpress" src="http://blog.mfabrik.com/wp-content/uploads/2010/03/xdv_wordpress.png" alt="" width="658" height="720" /></a></p>
<p>WordPress theme using built with XDV and using a live Plone web page as a theme template.  This way WordPress theme inherits &#8220;live data&#8221; from Plone site, like top tabs (portal sections), footer, CSS and other stuff which can be changed in-the-fly and reflecting changes to two separaet theming products would be cumbersome.  Benefits using WordPress for blogging instead of main CMS</p>
<ul>
<li>WordPress post and comment management is easy</li>
<li>WordPress does not need to be touched: the old public WordPress instance can keep happily running wherever it is during the whole process</li>
<li>You do not need to migrate legacy WordPress installations to your CMS&#8217;s internal blogging tool</li>
<li>WordPress comes with extensive blog spam filtering tools. We get 11000 spam comments a month.</li>
<li>WordPress is designed for blogging and the user interface is good for that</li>
<li>WordPress integrates well with blog pingback support services</li>
<li>WordPress supports Gravatars and other blogging plug-ins</li>
<li>..and so on&#8230;</li>
</ul>
<p>Benefits of using XDV theming instead of creating native WordPress theme are</p>
<ul>
<li>You need to maintain only one theming add-on product e.g. one for your main CMS and WordPress receives updates to this site and theme automatically</li>
<li>WordPress does not need to be touched</li>
<li>You can host your WordPress on a different server, even wordpress.com, and still integrate it to your main CMS</li>
<li>The theme can be recycled not only for WordPress, but also other external services: Bugzilla, Trac, Webmail, phpBB, you-name-it</li>
<li>Even though WordPress has slick UI, it is a well known fact that it is a can of worms internally. My developers do not like the idea of PHP development and would spit on my face if I ask them to go a develop a WordPress theme for us</li>
</ul>
<div>
<h2><a id="theme-elements" name="theme-elements" href="http://www.tele3.cz/jbar/rest/render.py#id7">Theme elements</a></h2>
<p>The theme will consist of following pieces</p>
<ul>
<li>Deliverance rules XML file which defines how to combine Plone and WordPress HTML (rules.xml)</li>
<li>Additional CSS definitions active only for WordPress (wordpress.css). Dependency to this CSS in injected to the &lt;head&gt; by rules XML</li>
<li>Special Plone page template which will provide slots where WordPress can drop in the content (wordpress_listing.pt)</li>
<li>A helper script which makes it easy for repeatable perform theming actions, like recompiling the theme (xdv.py)</li>
</ul>
<div>
<h3><a id="cms-page-template" name="cms-page-template" href="http://www.tele3.cz/jbar/rest/render.py#id8">CMS page template</a></h3>
<p>This explains how to create a Plone page template where WordPress content will be dropped in. This step is not necessary, as we could do this without touching the Plone. However, it makes things more straightforward and explicit when we known that WordPress theme uses a certain template and we explicitly define slots for WordPress content there.  Example:</p>
<pre>&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
      lang="en"
      metal:use-macro="here/main_template/macros/master"
      i18n:domain="plone"&gt;

&lt;body&gt;

    &lt;div metal:fill-slot="content"&gt;

        &lt;div id="wordpress-content"&gt;
                &lt;!-- Your WordPress "left column" will go there --&gt;
        &lt;/div&gt;

    &lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
</div>
<div>
<h3><a id="theming-rules" name="theming-rules" href="http://www.tele3.cz/jbar/rest/render.py#id9">Theming rules</a></h3>
<p>Following are XDV rules (rules.xml) how we will fit WordPress site to Plone frame.  It will integrate</p>
<ul>
<li>Content from WordPress</li>
<li>Metadata from WordPress</li>
<li>CSS from Plone</li>
<li>Page basic structrure from Plone</li>
</ul>
<p>rules.xml:</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;rules xmlns="http://namespaces.plone.org/xdv"
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
       xmlns:css="http://namespaces.plone.org/xdv+css"&gt;

    &lt;!-- Remove WordPress CSS by filtering out &lt;style&gt; tags--&gt;
    &lt;drop css:content="style" /&gt;

    &lt;!-- Make sure that WordPress metadata is present in &lt;head&gt; section --&gt;
    &lt;append css:content="head link" css:theme="head" /&gt;

    &lt;!-- note: replace does not seem to handle multiple meta tags very well --&gt;
    &lt;drop css:theme="meta" /&gt;
    &lt;append css:content="head meta" css:theme="head" /&gt;

    &lt;!-- Use blog title instead of Plone page title --&gt;
    &lt;replace css:content="title" css:theme="title" /&gt;

    &lt;!-- Put WordPress sidebar to Plone's portlets section --&gt;
    &lt;append css:content="#r_sidebar" css:theme="#portal-column-one .visualPadding" /&gt;

    &lt;!-- Place wordpress content into our theme content area --&gt;
    &lt;copy css:content="#contentleft" css:theme="#wordpress-content" /&gt;

    &lt;!-- This mixes in WordPress specific CSS sheet which is applied for pages
         served from WordPress only and does not concern Plone CMS.
         This stylesheet will theme WordPress specific tags,
         like blog posts and comment fields.
         We keep this file in Plone, but this could be served from elsewhere. --&gt;
    &lt;append css:theme="head"&gt;
        &lt;style type="text/css"&gt;
           @import url(http://mfabrik.com/++resource++plonetheme.mfabrik/wordpress.css);
        &lt;/style&gt;
    &lt;/append&gt;

    &lt;!-- This stylesheet is used by special spam protection plug-in NoSpamNX --&gt;
    &lt;append css:theme="head"&gt;
        &lt;link rel="stylesheet" href="http://blog.mfabrik.com/wp-content/plugins/nospamnx/nospamnx.css" type="text/css" /&gt;
    &lt;/append&gt;

    &lt;!-- Remove Google Analytics script used for CMS site --&gt;
    &lt;drop css:theme="#page-bottom script" /&gt;

    &lt;!-- Rebuild our Google Analytics code, using a different tracker id this time
         which is a specific to our blog.
      --&gt;
    &lt;append css:theme="#page-bottom"&gt;

        &lt;script type="text/javascript"&gt;
                var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
                document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
        &lt;/script&gt;

        &lt;script type="text/javascript"&gt;
                try {
                       var pageTracker = _gat._getTracker("UA-8819100-2");
                       pageTracker._trackPageview();
                } catch(err) {
                }
        &lt;/script&gt;
    &lt;/append&gt;

&lt;/rules&gt;
</pre>
</div>
<div>
<h3><a id="wordpress-specific-css" name="wordpress-specific-css" href="http://www.tele3.cz/jbar/rest/render.py#id10">WordPress specific CSS</a></h3>
<p>This CSS has styles which are applied only to WordPress pages. They are mainly corner case fixes where WordPress and CMS styles must match.  The CSS file is loaded when rules.xml injects it to &lt;head&gt; section.  wordpress.css:</p>
<pre>/* Font and block style fixes */

#wordpress-content h1 {
        border: 0;
}

#wordpress-content .post-end {
        margin-bottom: 60px;
}

#wordpress-content pre {
        width: 600px;
        overflow: auto;
        background: white;
        border: 1px solid #888;
}

#wordpress-content ul {
        margin-left: 20px;
}

#wordpress-content .post-info-date,
#wordpress-content .post-info-categories,
#wordpress-content .post-info-tags {
        font-size: 80%;
        color: #888;
}

/* Make sure that posts and comments look sane in our theme */

#wordpress-content .post {
        margin-top: 15px;
}

#wordpress-content .commentlist li {
        margin: 20px;
        background: white;
        padding: 10px;
}

#wordpress-content .commentlist li img {
        float: left;
        margin-right: 20px;
        margin-bottom: 20px;
}

#wordpress-content #commentform {
        margin: 20px;
}

#wordpress-content {
        margin-left: 20px;
        margin-right: 20px;
}

/* Make WordPress "sidebaar" look like Plone "portlets */

.template-wordpress_listing #portal-column-one ul {
        list-style: none;
        margin-bottom: 40px;
}

.template-wordpress_listing #portal-column-one ul#Recent li {
        margin-bottom: 8px;
}

.template-wordpress_listing #portal-column-one ul#Categories a {
        line-height: 120%;
}

.template-wordpress_listing #portal-column-one h2 {
        background: transparent;
        border: 0;
        font-weight:normal;
        line-height:1.6em;
        padding:0;
        text-transform:none;
        font-size: 16px;
        color: #9b9b9b;
        border-bottom:4px solid #CDCDCD;
}
</pre>
</div>
<div>
<h3><a id="helper-script" name="helper-script" href="http://www.tele3.cz/jbar/rest/render.py#id11">Helper script</a></h3>
<p>The following Python script (xdv.py) makes it easy for us</p>
<ul>
<li>Recompile the theme</li>
<li>Test the theme applied on the site</li>
<li>Preview the theme in our browser</li>
</ul>
<dl>
<dt>It is basically wrapped with default file locations around</dt>
<dd><em>bin/xdvcompiler</em> and <em>bin/xdvrun</em> commands with some webbrowser opening magic.</dd>
</dl>
<p>xdv.py:</p>
<pre>"""

 This command line Python script compiles your rules.xml to XDV XSL

 Modify it for your own needs.

 It assumes your buildout.cfg has xdv section and generated XDV
 commands under bin/

 To compile, execute in the buildout folder::

     python src/plonetheme.mfabrik/xdv.py

 To build test HTML::

     python src/plonetheme.mfabrik/xdv.py --test

 To build test HTML and preview it in browser, execute in buildout folder::

     python src/plonetheme.mfabrik/xdv.py --preview

"""

import getopt, sys
import os
import webbrowser

# rules XML for theming
RULES_XML = "src/plonetheme.mfabrik/deliverance/etc/rules.xml"

# Which XSL file to generate for compiled XDV
OUTPUT_FILE = "theme.xsl"

# Which file to generate applied theme test runs
TEST_HTML_FILE = "test.html"

# Our "theme.html" is a remote template served for each request.
# Because we are doing live integrattion, this is a HTTP resource,
# not a local file.
THEME="http://mfabrik.com/news/wordpress_listing/"

#
# External site you are theming.
# Note: must have ending slash (lxm cannot handle redirects)
#
SITE="http://blog.twinapex.fi/"

try:
    opts, args = getopt.getopt(sys.argv[1:], "pt", ["preview", "test"])
except getopt.GetoptError, err:
    # print help information and exit:
    print str(err) # will print something like "option -a not recognized"

# Convert options to simple list
opts = [ opt for opt, value in opts ]

print "Compiling transformation"
value = os.system("bin/xdvcompiler -o " + OUTPUT_FILE + " " + RULES_XML +" " + THEME)
if value != 0:
    print "Compilation failed"
    sys.exit(1)

if "-p" in opts or "--preview" in opts or "-t" in opts or "--test" in opts:
      print "Generating test HTML page"
      value = os.system("bin/xdvrun -o " + TEST_HTML_FILE + " " + OUTPUT_FILE + " " + SITE)
      if value != 0:
          print "Page transformation failed"
          sys.exit(1)

if "-p" in opts or "--preview" in opts:
    # Preview the result in a browser
    # NOTE: OSX needs Python &gt;= 2.5 to make this work

    # Make sure test run succeeded
    url = "file://" + os.path.abspath(TEST_HTML_FILE)
    print "Opening:" + url

    # We prefer Firefox for preview for its superious
    # Firebug HTML debugger and XPath rule generator
    try:
        browser = webbrowser.get("firefox")
    except webbrowser.Error:
        # No FF on the system, or OSX which can't find its browsers
        browser = webbrowser.get()

    browser.open_new_tab(url)
</pre>
</div>
</div>
<div>
<h2><a id="compiling-the-theme" name="compiling-the-theme" href="http://www.tele3.cz/jbar/rest/render.py#id12">Compiling the theme</a></h2>
<p>This will generate XSL templates to do theming transform. It will compile rules XML with some boilerplate XSL.  Running our compile script:</p>
<pre>python src/plonetheme.mfabrik/xdv.py
</pre>
<p>Since Plone usually does not use any relative paths or relative resources in HTML, we do not give the parameter &#8220;Absolute prefix&#8221; to the compilation stage. In Plone, everything is mapped through a virtual hosting aware resource locator: portal_url and VirtualHostMonster.  For more information see</p>
<ul>
<li><a href="http://pypi.python.org/pypi/xdv/0.3a2#compilation">http://pypi.python.org/pypi/xdv/0.3a2#compilation</a></li>
</ul>
</div>
<div>
<h2><a id="testing-the-theme" name="testing-the-theme" href="http://www.tele3.cz/jbar/rest/render.py#id13">Testing the theme</a></h2>
<p>The following command will apply theme for an example external page:</p>
<pre>bin/xdvrun -o theme.html theme.xsl http://blog.twinapex.fi
firefox theme.xhtml
</pre>
<p>&#8230; or we can use shortcut provided by our script &#8230;</p>
<pre>python src/plonetheme.mfabrik/xdv.py --preview
</pre>
</div>
<div>
<h2><a id="applying-the-theme-in-apache-production-environment" name="applying-the-theme-in-apache-production-environment" href="http://www.tele3.cz/jbar/rest/render.py#id14">Applying the theme in Apache production environment</a></h2>
<p>These steps tell how to apply the integration theme for WordPress when WordPress is running under Apache virtualhost.</p>
<div>
<h3><a id="installing-dependencies" name="installing-dependencies" href="http://www.tele3.cz/jbar/rest/render.py#id15">Installing dependencies</a></h3>
<p>We use Apache and mod_transform. <a href="http://pypi.python.org/pypi/xdv#apache">Instructions how to set up modules for Apache</a> are available on XDV homepage. Some hand-build modules must be used, but instructions to set them up for Ubuntu / Debian are available.  Apache 2 supports <a href="http://httpd.apache.org/docs/2.2/mod/mod_filter.html">filter chains</a> which allow you to perform magic on HTTP response before sending it out. This corresponds Python&#8217;s WSGI middleware.  We&#8217;ll use special built of mod_transform and mod_depends which are known to working. These modules were forked from their orignal creations to make them XDV compatible, as the orignal has not been updated since 2004 (here you can nicely see how open source guarantees &#8220;won&#8217;t run out of support&#8221; freedom).</p>
<ul>
<li><a href="http://code.google.com/p/html-xslt/">XDV mod_transform and mod_depends homepage</a></li>
<li><a href="http://www.outoforder.cc/projects/apache/mod_transform/">Orignal mod_transform and mod_depends homepage</a></li>
</ul>
<p>Example:</p>
<pre>sudo -i
apt-get install libxslt1-dev libapache2-mod-apreq2 libapreq2-dev apache2-threaded-dev
wget http://html-xslt.googlecode.com/files/mod-transform-html-xslt.tgz
wget http://html-xslt.googlecode.com/files/mod-depends-html-xslt.tgz
tar -xzf mod-transform-html-xslt.tgz
tar -xzf mod-depends-html-xslt.tgz
cd mod-depends-html-xslt ; ./configure ; make ; make install ; cd ..
cd mod-transform-html-xslt ; ./configure ; make ; make install ; cd ..
</pre>
<p>Enable built-in Apache modules:</p>
<pre>a2enmod filter
a2enmod ext_filter
</pre>
<p>For modules <em>depends</em> and <em>transform</em> you need to manually add them to the end of Apache configuration, as they do not provide a2enmod stubs for Debian. Edit /etc/apache2/apache.conf:</p>
<pre>LoadModule depends_module /usr/lib/apache2/modules/mod_depends.so
LoadModule transform_module /usr/lib/apache2/modules/mod_transform.so
</pre>
<p>You need to hard reset Apache to make the new modules effective:</p>
<pre>/etc/init.d/apache2 force-reload
</pre>
</div>
<div>
<h3><a id="virtual-host-configuration" name="virtual-host-configuration" href="http://www.tele3.cz/jbar/rest/render.py#id16">Virtual host configuration</a></h3>
<p>Below is our virtualhost configuration which runs WordPress and PHP. Transformation filter chain has been added in.  /etc/apache/sites-enabled/blog.mfabrik.com:</p>
<pre>&lt;VirtualHost *&gt;

    ServerName blog.mfabrik.com
    ServerAdmin info@mfabrik.com

    LogFormat       combined
    TransferLog     /var/log/apache2/blog.mfabrik.com.log

    # Basic WordPress setup

    Options +Indexes FollowSymLinks +ExecCGI

    DocumentRoot /srv/www/wordpress

    &lt;Directory /srv/www/wordpress&gt;
        Options FollowSymlinks
        AllowOverride All
    &lt;/Directory&gt;

    AddType application/x-httpd-php .php .php3 .php4 .php5
    AddType application/x-httpd-php-source .phps

    # Theming set-up

    # This chain is used for public web pages
    FilterDeclare THEME
    FilterProvider THEME XSLT resp=Content-Type $text/html

    TransformOptions +ApacheFS +HTML
    # This is the location of compiled XSL theme transform
    TransformSet /theme.xsl

    # This will make Apache not to reload transformation every time
    # it is performed. Instead, a compiled version is hold in the
    # virtual URL declared above.
    TransformCache /theme.xsl /srv/plone/twinapex.fi/theme.xsl

    # We want to apply theme only for
    # 1. public pages (otherwise WordPress administrative interface stops working)
    &lt;Location "/"&gt;
        FilterChain THEME
    &lt;/Location&gt;

    # 2. Admin interface and feeds should not receive any kind of theming
    &lt;LocationMatch "(wp-login|wp-admin|wp-includes)"&gt;
        # The following resets the filter chain
        # http://httpd.apache.org/docs/2.2/mod/mod_filter.html#filterchain
        FilterChain !
    &lt;/LocationMatch&gt;

&lt;/VirtualHost&gt;
</pre>
</div>
<div>
<h3><a id="running-it" name="running-it" href="http://www.tele3.cz/jbar/rest/render.py#id17">Running it</a></h3>
<p>After Apache has all modules enabled and your virtualhost configuration is ok, you should see WordPress through your new theme by visiting at the site served through Apache:</p>
<ul>
<li><a href="../">http://blog.mfabrik.com</a></li>
</ul>
</div>
<div>
<h3><a id="automatically-reflecting-cms-changes-back-to-xdv-theme" name="automatically-reflecting-cms-changes-back-to-xdv-theme" href="http://www.tele3.cz/jbar/rest/render.py#id18">Automatically reflecting CMS changes back to XDV theme</a></h3>
<p>The theme should be recompiled every time</p>
<ul>
<li>Plone is restarted: CSS references change in &lt;head&gt; as CSS cache is rebuilt</li>
<li>CSS is modified: CSS references change in &lt;head&gt; as CSS cache is rebuilt</li>
<li>Plone content is changed and changes reflect back to WordPress theme (e.g. a new top level site section is being added)</li>
</ul>
<p>This is because the compilation will hard-link resources and template snippets to resulting the theme.xsl file. If hard-linked resources change on the Plone site, the transformation XSL file does not automatically reflect back the changes.  It could be possible to use Plone events automatically to rerun theme compilation when concerned resources change. However, the would be quite complex.  For now, we are satisfied with a scheduled task which will recompile the theme now and then.  Alternatively, mod_transforms could be run in non-cached mode with some performance implications.  Here is a shell script, update-wordpress-theme.sh, which will perform the recompilation and make Apache&#8217;s transformation cache aware of changes:</p>
<pre>#!/bin/sh
#
# Periodically update WordPress theme to reflect changes on CMS site
#

# Recompile theme
sudo -H -u twinapex /bin/sh -c cd /srv/plone/twinapex.fi ; python src/plonetheme.mfabrik/xdv.py

# Make Apache aware of theme changes
sudo apache2ctl graceful
</pre>
<p>Then we call it periodically in cron job, every 15 minutes in /etc/cron.d/update-wordpress:</p>
<pre># Make WordPress XDV theme to reflect changes on CMS
0,15,30,45 * * * * /srv/plone/twinapex.fi/update-wordpress-theme.sh
</pre>
</div>
</div>
<div>
<h2><a id="updating-wordpress-settings" name="updating-wordpress-settings" href="http://www.tele3.cz/jbar/rest/render.py#id19">Updating WordPress settings</a></h2>
<p>No changes on WordPress needed if the domain name is not changed in the theme transformation process.</p>
<div>
<h3><a id="site-url" name="site-url" href="http://www.tele3.cz/jbar/rest/render.py#id20">Site URL</a></h3>
<p>Unlike Plone, WordPress does not have decent virtual hosting machinery. It knowns only one URL which is uses to refer to the site in the external context (e.g. RSS feeds).  This setting can be overridden in</p>
<ul>
<li>WordPress administrative interface</li>
<li>wp-config.php</li>
</ul>
<p>Here is an example how we override this in our wp-config.php:</p>
<pre>// http://codex.wordpress.org/Editing_wp-config.php#WordPress_address_.28URL.29
define('WP_HOME','http://blog.mfabrik.com');
define('WP_SITEURL','http://blog.mfabrik.com');
</pre>
</div>
</div>
<div>
<h2><a href="http://www.tele3.cz/jbar/rest/render.py#id21">HTTP 404 Not Found special case</a></h2>
<p>Http 404 Not Found responses are not themed by Apache filter chain. This is not possible due to order of pipeline in Apache.  As a workaround you can set up a custom HTTP 404 page in WordPress which does not expose the old theme.</p>
<ul>
<li>Go to WordPress admin interface, Theme editor</li>
<li>Edit 404.php and modify it so that it does not pull in the WordPress theme:
<pre>&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Not found&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

        &lt;h1&gt;Not Found, Error 404&lt;/h1&gt;
        &lt;p&gt;Aaaaw, snap! The page you are looking for no longer exists. It must be our hamster who ate it.&lt;/p&gt;

        &lt;a href="&lt;?php bloginfo('url'); ?&gt;"&gt;Go to blog homepage&lt;/a&gt;

        &lt;a href="http://mfabrik.com"&gt;mFabrik business site&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
</li>
</ul>
<p>For more information see</p>
<ul>
<li><a href="http://codex.wordpress.org/Creating_an_Error_404_Page">http://codex.wordpress.org/Creating_an_Error_404_Page</a></li>
</ul>
</div>
<div>
<h2><a id="roll-out-checklist" name="roll-out-checklist" href="http://www.tele3.cz/jbar/rest/render.py#id22">Roll-out checklist</a></h2>
<p>Below is a checklist you need to go to through to confirm that the theme integration works on your production site</p>
<ul>
<li>WordPress public pages are loaded with the new theme</li>
<li>WordPress login works</li>
<li>WordPress administrative interface works</li>
<li>RSS feed from WordPress works and contain correct URLs</li>
<li>HTTP 404 not found is handled correctly</li>
<li>HTTP 302 redirect is handled correctly (i.e. missing / at the end of blog post URL)</li>
<li>Changes on CMS site are reflected to WordPress theme within the update delay</li>
<li>Old blog site is redirected to new site using HTTP 301 (if applies)</li>
</ul>
</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2010/03/28/integrating-and-theming-wordpress-with-your-cms-site-using-xdv/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Userland templates for Plone &#8211; template engine abstraction layer for Python</title>
		<link>http://blog.mfabrik.com/2008/11/09/userland-templates-for-plone-template-engine-abstraction-layer-for-python/</link>
		<comments>http://blog.mfabrik.com/2008/11/09/userland-templates-for-plone-template-engine-abstraction-layer-for-python/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 20:50:13 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[Plone (old)]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[zope]]></category>
		<category><![CDATA[cheetah]]></category>
		<category><![CDATA[content rules]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[engine]]></category>
		<category><![CDATA[kupu]]></category>
		<category><![CDATA[metal]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[tal]]></category>
		<category><![CDATA[tales]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://blog.redinnovation.com/?p=146</guid>
		<description><![CDATA[I have been working with collective.easytemplate product which allows users to use template tags on various places on Plone site. Currently supporting Kupu Outgoing email actions (Content rules ones) The users can place ${title}, ${object_url} and other template in the edit mode. These variables which are directly mapped from Archetypes fields when the content is [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working with <a href="http://plone.org/products/easy-template">collective.easytemplate</a> product which allows users to use template tags on various places on Plone site. Currently supporting</p>
<ul>
<li>Kupu</li>
<li>Outgoing email actions (Content rules ones)</li>
</ul>
<p>The users can place ${title}, ${object_url} and other template in the edit mode. These variables which are directly mapped from Archetypes fields when the content is viewed/sent. Also, one can register custom snippet generators like $list_folder_content.</p>
<p>I hope Easy Template to cover some more actions in the future. I have noted PloneFormGen and Singing &amp; Dancing product authors that we could add some mixed in functionality together.</p>
<p>Currently Easy Template uses Cheetah template backend. Cheetah is not Zope security friendly and exposing templated actions should be allowed only to trusted members. I am not huge fan of Plone&#8217;s TAL template language which is based on XML attributes and thus suitable only be used in XML context &#8211; this language is aimed only for hardcore hackers and software designers and ordinary folk really cannot wrap their minds around it.</p>
<p>Because I am not sure which will be the chosen template backend in the future I chose to abstract the template engine layer away. I created <a href="http://pypi.python.org/pypi/collective.templateengines/0.1">collective.templateengines</a> product. It is a bunch of Zope interfaces and utility functions to abstract away common template actions like</p>
<ul>
<li>Applying a template</li>
<li>Adding a template context variables</li>
<li>Registering custom template tags</li>
</ul>
<p>Currently collective.templateengines supports Cheetah and Django templates.</p>
<p>So, dear audience, what do you think of all this? What template engine would you suggest which would be Kupu friendly &#8211; you can edit the template language in WYSIWYG editor? Do you see any other usages for collective.templateengines? Which other projects could adopt template engine abstraction layer?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2008/11/09/userland-templates-for-plone-template-engine-abstraction-layer-for-python/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Python code management &amp; deployment &#8211; a glance at zc.buildout and few others</title>
		<link>http://blog.mfabrik.com/2008/09/02/python-code-management-deployment-a-glance-at-zcbuildout-and-few-others/</link>
		<comments>http://blog.mfabrik.com/2008/09/02/python-code-management-deployment-a-glance-at-zcbuildout-and-few-others/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 08:24:47 +0000</pubDate>
		<dc:creator>Tuukka Mustonen</dc:creator>
				<category><![CDATA[development tools]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[zope]]></category>
		<category><![CDATA[buildout]]></category>
		<category><![CDATA[code management]]></category>
		<category><![CDATA[paver]]></category>
		<category><![CDATA[virtualenv]]></category>
		<category><![CDATA[zc.buildout]]></category>

		<guid isPermaLink="false">http://blog.redinnovation.com/?p=104</guid>
		<description><![CDATA[We&#8217;ve been using zc.buildout for Plone deployment and it&#8217;s working out great. A few days ago implemented a buildout recipe for Django project deployment, automatic web configuration, symlinking, media-folder structuring etc. and while I got it working, I came up with twisted feelings. Buildout is from the creators of Zope (I suppose) so you can [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been using <a href="http://pypi.python.org/pypi/zc.buildout/1.1.1">zc.buildout</a> for <a href="http://www.plone.org">Plone</a> deployment and it&#8217;s working out great. A few days ago implemented a buildout recipe for <a href="http://www.djangoproject.org">Django</a> project deployment, automatic web configuration, symlinking, media-folder structuring etc. and while I got it working, I came up with twisted feelings.</p>
<p>Buildout is from the creators of <a href="http://www.zope.org/">Zope</a> (I suppose) so you can expect a powerful project code management tool. The question is, however, whether or not it suits your needs. In my case I found out it too heavy. I mean, to add even a simple task you have to create a new &#8220;recipe&#8221; (a package) that does the tricks. Of course some recipes are generic (found from <a href="http://pypi.python.org">PyPi</a>) and you can just run them with your own INI options, but in my case I had to do some custom implementation. Creating a new python package isn&#8217;t that hard for sure <img src='http://blog.mfabrik.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  but there&#8217;s of course some learning curve, so the <em>real</em> question is should you spend time to learn it or not?</p>
<p>I found out that zc.buildout has some nice features like:</p>
<ul>
<li> Automatic requirements processing through setuptools</li>
<li>Automatic (yet simple) removal of directories during recipe uninstall</li>
<li>Clear structure (install(), update() &amp; uninstall() methods)</li>
<li>INI-syntax, python does have a clear syntax but INI is always clearer for a newbie</li>
<li>Easy script creation (adjust python paths somewhat automatically)</li>
<li>Easily repeatable</li>
<li>Passing of arguments from one recipe to another</li>
<li>etc.</li>
</ul>
<p>The problems?</p>
<ul>
<li>It takes a while to learn zc.buildout</li>
<li>It takes &#8216;another while&#8217; to learn to write recipes</li>
<li>Too much hassle for little things</li>
<li>INI-syntax is very limited in features</li>
<li>Buildout easily updates all your packages (that means also the ones you didn&#8217;t want to!)</li>
<li>Lack of documentation (it has good docs to get you going.. but after a while it leaves you with open questions)</li>
<li>Unnecessary overhead (for each script you launch, you&#8217;ll need a launcher script created via buildout)</li>
</ul>
<p>There&#8217;s no denying zc.buildout is powerful, but I wouldn&#8217;t use it for projects which need reasonable amount of customization. It&#8217;s just plain easier and quicker to write shell scripts and while those won&#8217;t provide you with any sort of ready tools you won&#8217;t propably need them. For bringing up somewhat static environment, where you don&#8217;t need to hack things (like that for Plone) it&#8217;s quite a decent option, however.</p>
<p>I also explored alternatives to zc.buildout. I&#8217;ve been reading about earlier virtualenv but haven&#8217;t really tried it out until now. It looks very promising and creates a more flexible environment compared to zc.buildout. Of course their goals are not exactly the same. Also, there are a few other alternatives out there, among them a new Python code management tool called <a href="http://www.blueskyonmars.com/projects/paver/">Paver</a> (just look at that cool logo.. it does remind you of Indiana Jones, does it not?). I glanced through the Paver docs and it looks like it <em>might</em> be the way to go (Paver also supports virtualenv), but didn&#8217;t quite get the grasp of the benefits just yet. Anyway, if you are still interested in code management and deployment, I&#8217;d recommend you to read the <a href="http://www.blueskyonmars.com/2008/04/22/paver-and-the-building-distribution-deployment-etc-of-python-projects/">Paver release announcement</a> and also <a href="http://www.blueskyonmars.com/projects/paver/foreword.html">Paver forewords</a>. They should clear things up.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2008/09/02/python-code-management-deployment-a-glance-at-zcbuildout-and-few-others/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Zope Zeo vs. standalone setups</title>
		<link>http://blog.mfabrik.com/2008/07/07/zope-zeo-setupconversion-and-zeo-vs-standalone-performance-review/</link>
		<comments>http://blog.mfabrik.com/2008/07/07/zope-zeo-setupconversion-and-zeo-vs-standalone-performance-review/#comments</comments>
		<pubDate>Mon, 07 Jul 2008 12:21:38 +0000</pubDate>
		<dc:creator>Tuukka Mustonen</dc:creator>
				<category><![CDATA[Plone (old)]]></category>
		<category><![CDATA[Red innovation]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[zope]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[comparison]]></category>
		<category><![CDATA[load balancer]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://blog.redinnovation.com/?p=51</guid>
		<description><![CDATA[A review of Zope standalone &#038; Zeo setups, performance review, setup examples, guide to deployment, conclusions]]></description>
			<content:encoded><![CDATA[<p>We do some Plone development here at Redi. As known, Plone is a powerful, but unfortunately quite a heavy CMS which is best suited for Intranets. Thus, we are always looking for speed increase.</p>
<p>Enter <strong>Zeo cluster</strong> &#8211; a feature that nowadays comes bundled with Zope and allows one database (practically Data.fs) to be used by multiple Zope instances, or more accurately <strong>Zeo clients</strong>. In standalone installation only one CPU / CPU core can be used for processing requests (as Zope / Python implementation is single-threaded AFAIK). So if there are any concurrent requests the database (ZODB, the Zope Object Database) usually has to wait for the request processing before it is asked for the data and only part of the processing power is used as requests are queued. Using Zeo server-client architecture however, each Zeo client can do the processing on their own CPU/core (thus efficiently using the whole CPU prosessing power available) and also minimize the hard disk idle time by asking for data in an ~asynchronous manner (in separate queues). Actually ZODB even serves the same object simultaneously to different client processes for performance reasons. This might raise database ConflictErrors, which are nothing to fear of, however, as noted some paragraphs below.</p>
<p>Similarly, you could also deploy Zeo clients on different computers in local network (or wherever you want), but that&#8217;s not the scope of this article. Having clients running on different machines is a similar case with the same performance basis, but there are connection lags, bandwith limits and such that decrease performance.</p>
<h1>Theory vs. practice</h1>
<p>Deploying a Zeo cluster instead of standalone Zope instance should theoretically increase the performance by factor of extra available CPUs / CPU cores. There might be some overheads from this setup though, so we tested it out using ApacheBenchmark &#8211; the benchmarking module that comes bundled with Apache nowadays. But first something about&#8230;</p>
<h1>Setting up Zeo &amp; converting from standalone mode</h1>
<p>In the easiest scenario, setting Zeo up is rather easy: the unified installer supports Zeo-server setup out of the box (=there is a recipe for it). Just run the unified installer like:</p>
<pre>$ ./install.sh zeo</pre>
<p>Luckily, the unified installer uses buildout from Plone 3.1 onwards. Thus, converting your current  buildout instances to Zeo cluster is nothing but change of buildout configuration. Where you would normally need &#8216;instance&#8217; section in your buildout.cfg you will now need the following:</p>
<pre>[zeoserver]
recipe = plone.recipe.zope2zeoserver
zope2-location = ${zope2:location}
zeo-address = 127.0.0.1:12000
#effective-user = __EFFECTIVE_USER__</pre>
<pre>[client1]
recipe = plone.recipe.zope2instance
zope2-location = ${zope2:location}
zeo-client = true
zeo-address = ${zeoserver:zeo-address}
# The line below sets only the initial password. It will not change an
# existing password.
user = admin:mysecretpassword
http-address = 12001
#effective-user = __EFFECTIVE_USER__
#debug-mode = on
#verbose-security = on

# If you want Zope to know about any additional eggs, list them here.
# This should include any development eggs you listed in develop-eggs above,
# e.g. eggs = ${buildout:eggs} ${plone:eggs} my.package
eggs =
    ${buildout:eggs}
    ${plone:eggs}

# If you want to register ZCML slugs for any packages, list them here.
# e.g. zcml = my.package my.other.package
zcml =

products =
    ${buildout:directory}/products
    ${productdistros:location}
    ${plone:products}</pre>
<p>To add more clients (which is quite the point here), append as many times the extra client sections like this:</p>
<pre>[client2]
recipe = plone.recipe.zope2instance
zope2-location = ${zope2:location}
zeo-client = true
zeo-address = ${zeoserver:zeo-address}
user = ${client1:user}
http-address = 12002
#effective-user = __EFFECTIVE_USER__
#debug-mode = on
#verbose-security = on
eggs = ${client1:eggs}
zcml = ${client1:zcml}
products = ${client1:products}</pre>
<p>That minimizes the need for retyping user names, password etc. These examples were taken from Plone unified installer buildout.cfg with ports changed.</p>
<h1>Starting, stopping &amp; restarting</h1>
<p>Now, to start your Zeo-powered Plon clients you could type:</p>
<pre>bin/zeoserver start
bin/client1 start
bin/client2 start
...same for all the clients...</pre>
<p>However, the unified installer has a recipe which automatically generates nice and simple shell scripts to control your cluster. In the end of your buildout.cfg, add:</p>
<pre>[unifiedinstaller]
recipe = plone.recipe.unifiedinstaller
user = ${client1:user}
primary-port = ${client1:http-address}</pre>
<p>That should generate the scripts. In fact, it propably does also something else, something which I&#8217;m not aware of. However, I didn&#8217;t bump into any problems, yet <img src='http://blog.mfabrik.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Anyway, to start the whole cluster (server &amp; clients), type:</p>
<pre>bin/startcluster.sh</pre>
<p>And that does it (it start server and the clients). Shut it down via:</p>
<pre>bin/shutdowncluster.sh</pre>
<p>And restart:</p>
<pre>bin/restartcluster.sh</pre>
<h1>ConflictErrors &#8211; not that errerous</h1>
<p>As noted before, in Zeo mode the ZODB might serve the same objects to two more clients at the same time. If one client manipulates the object before others (ie. edits values and saves changes) the other requests will propably fail. This raises ConflicError which looks like this:</p>
<pre>ConflictError: database conflict error (oid 0x0f39, class HelpSys.HelpSys.ProductHelp)</pre>
<p>In this case ZODB tries to reprocess the failed requests. This should be common database approach and thus a feature, not a bug (although Zope might want to tell that in error message!). For more accurate explanation see <a href="http://n2.nabble.com/ZPublisher.Conflict-ConflictError-td339922.html">Plone discussion</a>.</p>
<h1>Parsing it together with web server</h1>
<p>The Zeo components (server and clients) talk to each other via standard Internet protocols (TCP or UDP, not sure). In the default setup, the Zeo server listens to port 8100 and Zeo clients to 8080, 8081, etc. Thus, to access the separate clients as &#8216;one site&#8217; we need to serve the requests to multiple clients. This can be achieved with load balancers. Apache has at least one: <a href="http://www.google.fi/search?q=apache+load+balancer&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=com.ubuntu:en-US:official&amp;client=firefox-a">mod_proxy_balancer</a> which should do exactly what we need. Apache isn&#8217;t the best choice for achieving high requests per second values, but it will do for our tests (compare to more lightweight but also more limited lighttpd). Just remember that there are other alternatives/methods available, like using <a href="http://www.thefraggle.com/2007/04/09/http-load-balancing-with-squid/">squid</a> as load balancer.</p>
<p>Our configuration is as follows (inside VirtualHost-directive):</p>
<pre>  &lt;Proxy balancer://lb&gt;
    BalancerMember http://127.0.0.1:12001/
    BalancerMember http://127.0.0.1:12002/
    BalancerMember http://127.0.0.1:12003/
    BalancerMember http://127.0.0.1:12004/
  &lt;/Proxy&gt;

  &lt;Location /balancer-manager&gt;
    SetHandler balancer-manager
    Order Deny,Allow
    Allow from all
  &lt;/Location&gt;

  ProxyPass /balancer-manager !
  ProxyPass             / balancer://lb/http://localhost/VirtualHostBase/http/www.mydomain.com:80/plonesite/VirtualHostRoot/
  ProxyPassReverse      / balancer://lb/http://localhost/VirtualHostBase/http/www.mydomain.com:80/plonesite/VirtualHostRoot/</pre>
<p>This setup also allows us to use the balancer-manager (accessible at /balancer-manager) that comes with mod_proxy_balancer. It&#8217;s useful for checking if the configuration is working and balancer is dividing the requests equally. In my setup the balancer is using the default Request Counting -algorithm which divides the requests numerically equally between the instances, but you might want to also try Weighted Traffic Counting, which should be for actual use. In our test only the frontpage is accessed however, so each request&#8217;s data transfer is equal and the weighted traffic counting isn&#8217;t of use.</p>
<h1>The test</h1>
<h3>The server machine</h3>
<ul>
<li>Ubuntu 8.04 virtual server</li>
<li>Intel Xeon 2.0Ghz (4 cores)</li>
<li>2 GB of RAM</li>
<li>Hard disk drive (7200rpm?)</li>
</ul>
<h3>The setup</h3>
<ul>
<li>Standalone Plone instance</li>
<li>Plone via Zeo server with 4 clients (as many clients as cores in processor)</li>
<li>Plone via Zeo server with 6 clients (for curiosity)</li>
</ul>
<p>The tests where run locally in development environment to minimize the network lag (was 0-1ms).</p>
<h3>The test commands</h3>
<p>ApacheBenchmark commands:</p>
<pre>$ ab -n N -c C myurl</pre>
<p>where N was either 1000 or 9000 (requests) and C 1, 10, 100 or 1000 (concurrent requests).</p>
<h3>The results</h3>
<p>You can download the more in-depth test sheet <a href="http://blog.redinnovation.com/wp-content/uploads/2008/07/plonezope_standalone_vs_zeo.pdf">Plone Standalone vs. Zeo installation</a> (PDF).</p>
<p>To put it simple: theory and practise meet well &#8211; Zeo server is a lot more powerful with concurrent requests. On non-concurrent requests the results are about the same.</p>
<p>Having as many Zeo clients as CPUs / CPU cores can boost the performance up to number of extra CPUs/cores. For example, in our quad-core server with Zeo setup we gained nearly <strong>4 times the requests per second</strong> of standalone installation (~370% to be accurate). <strong>Increasing Zeo clients to 6 didn&#8217;t help</strong> any as there&#8217;s no processing power left from 4 heavily stressed client processes. Also to be noted is that the <strong>waiting times for clients nearly tripled </strong>(median jumped from 126 to 305 ms) <strong>when raising concurrency from 1 to 10</strong>. This isn&#8217;t bad though &#8211; those are still low figures compared to <strong>standalone&#8217;s median of 1215 ms!</strong> Only when raising concurrency to 100 we began to see some 3,6 seconds waiting times (6 seconds for standalone). <strong>Increasing concurrency didn&#8217;t bring down the requests/second rates</strong> much (less than 5%) as expected.</p>
<p>Overall, the results were expected, but now we have evidence of it: under <em>concurrent</em> request load Zeo server is a good option to multiply the performance of your site. With very low traffic sites which rarely get more than 1 request at time this doesn&#8217;t matter.</p>
<p>One bad word about the resource requirements though: The used <strong>RAM increase for 6 client Zeo setup</strong> (standard Plone 3.1.2 + 12 additional Products) <strong>was whopping 621 MB</strong> (1132 MB -&gt; 1753 MB). That means about <strong>100 MB per Zeo client</strong> as the Zeo server memory intake was only about 12-15 MB. Thus, only use as many Zeo clients as absolutely necessary or you might find your beloved server machine under very serious Zope flu!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2008/07/07/zope-zeo-setupconversion-and-zeo-vs-standalone-performance-review/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The good, the bad and the Zope</title>
		<link>http://blog.mfabrik.com/2008/04/18/the-good-the-bad-and-the-zope/</link>
		<comments>http://blog.mfabrik.com/2008/04/18/the-good-the-bad-and-the-zope/#comments</comments>
		<pubDate>Fri, 18 Apr 2008 10:26:57 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[zope]]></category>
		<category><![CDATA[]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[components]]></category>
		<category><![CDATA[failure]]></category>
		<category><![CDATA[headache]]></category>
		<category><![CDATA[mindshare]]></category>
		<category><![CDATA[plug in]]></category>

		<guid isPermaLink="false">http://blog.redinnovation.com/2008/04/18/the-good-the-bad-and-the-zope/</guid>
		<description><![CDATA[I want to use Zope 3 interface package to write component architecture i.e. have a plug-ins easily in Python. Zope 3 interfaces are very handy and, which cannot be conducted from the name, are available outside Zope too. From my prior experiences I know that Zope 3 interfaces package is one of the best and [...]]]></description>
			<content:encoded><![CDATA[<p>I want to use Zope 3 interface package to write component architecture i.e. have a plug-ins easily in Python. Zope 3 interfaces are very handy and, which cannot be conducted from the name, <em>are available outside Zope</em> <em>too</em>. From my prior experiences I know that Zope 3 interfaces package is one of the best and most underrated Python packages out there. It even influenced to the new design of Python 3k.</p>
<p>Well then&#8230; I haven&#8217;t used Zope 3 interfaces standalone before, so the first thing what I do is writing &#8220;zope 3 interfaces&#8221; into my Google search this.</p>
<p><a href="http://wiki.zope.org/Interfaces/FrontPage">This page comes up</a>.</p>
<p>It&#8217;s horrible &#8211; the very reason I write this quick blog entry. Some notes below  (I have written things from the point of external visitor &#8211; I have hands deep in Zope myself, so you don&#8217;t need to clarify these things for me or teach anything)</p>
<ul>
<li>The information is tangled mess: please use subtitles and images</li>
<li>You could mention that the package can be used outside Zope</li>
<li>You could mention tat the package is a generic Python package</li>
<li>The list of CamelCaseWordsWhichGoesOnAndOnUnexplained made me puke. Please use proper English and explain the meaning of the links.</li>
<li>It has a comment box: I tried to comment the page but I will get permission error. Please do not show the comment box if the commenting is not actually possbile.</li>
<li>Then I tried to register to Zope.org to comment or fix the basic things on the page. You have a join link in zope.org, but there is no registration form. Manual email conversation seem to be prerequisite for the registration. Is Zope a secret society or something&#8230;? The contribution barrier just rise too high.</li>
<li>In this point, I give up. Even if you had  the best interface package out there,  I don&#8217;t care anymore. Looks like getting involved to fixing thing takes too much of my time. You had your 10 minutes of time to impress me and you failed. Not only that, but I got so frustrated that I want to learn smoking, fast.</li>
</ul>
<p>In the post <a href="http://faassen.n--tree.net/blog/view/weblog/2008/04/05/0">&#8220;No, you are not smart enough for Zope</a>&#8221; Martjin Faassen highlights some problems of Zope community. <span class="entryText"> &#8220;It&#8217;s <em>hard</em> to get good content written&#8221; Martjin claims. I disagree. Whoever created the page originally could <em>have</em> <em>thought </em>what people coming to the page want. They don&#8217;t want to decrypt the brain core dump of  hardcore Zope developer. They want to know <em>what is this thing, how this thing is beneficial for them</em>, <em>how do I get started with it</em> and <em>how do I use it</em>.  </span></p>
<p><span class="entryText">You all know how Internet works. You all have visit on web pages. You all are customers for the same thing you also produce. So writing a basic web page is not something you couldn&#8217;t do.</span></p>
<p>Hints:</p>
<ul>
<li> apt-get install python-zopeinterface</li>
<li><a href="http://svn.zope.org/zope.interface/trunk/src/zope/interface/README.txt?view=markup">README.TXT</a></li>
</ul>
<p>Pardon me the tone of this post. Zope is the 23th best thing out there, but the Zope community has stagnated badly in some aspects. Some things were acceptable ten years ago when web was still young and Python developers hardcore, but <a href="http://www.google.com/trends?q=zope">if you don&#8217;t keep with the pace you lose all the mindshare</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2008/04/18/the-good-the-bad-and-the-zope/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Tuning file system performance for Plone development</title>
		<link>http://blog.mfabrik.com/2007/10/24/tuning-file-system-performance-for-plone-development/</link>
		<comments>http://blog.mfabrik.com/2007/10/24/tuning-file-system-performance-for-plone-development/#comments</comments>
		<pubDate>Wed, 24 Oct 2007 01:44:57 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[Plone (old)]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[zope]]></category>
		<category><![CDATA[atime]]></category>
		<category><![CDATA[ext3]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[tune2fs]]></category>

		<guid isPermaLink="false">http://blog.redinnovation.com/2007/10/24/tuning-file-system-performance-for-plone-development/</guid>
		<description><![CDATA[I recently read this article about tuning Ext3 file system for better performance. I was doing a fresh Ubuntu 7.10 install on my laptop, so I decided to see how much this would affect to my every day Plone development. On Linux, every time a file is read, its access time attribute is rewritten. This [...]]]></description>
			<content:encoded><![CDATA[<p><gravatar mikko@redinnovation.com> </p>
<p>I recently read <a href="http://http://www.goitexpert.com/entry.cfm?entry=ubuntuguide">this article </a>about tuning Ext3 file system for better performance. I was doing a fresh Ubuntu 7.10 install on my laptop, so I decided to see how much this would affect to my every day Plone development.</p>
<p>On Linux, every time a file is read, its access time attribute is rewritten. This causes a lot of unnecessary writes to file system. Since there are only few rare application needing this feature, turning of the feature can give a nice performance boost on systems dealing with large amount of files.</p>
<p>Plone 3.0 has 10000 files. A lot of them are read during the start-up. Maybe I am getting somewhere here&#8230;</p>
<p>When you are doing Plone development, you need to restart Plone often. I used <a href="http://http://www.pixelbeat.org/scripts/stopwatch/">this highly scientific method</a> to measure Plone start-up time from issuing <strong>zopectl fg</strong> to getting the front page load completed in Firefox. I warmed the file system cache beforehand by doing two dry runs.</p>
<p>I also did some simple front page bombing with ab tool.</p>
<p><strong>System setup</strong></p>
<ul>
<li>HP nx9420 laptop (5400 RPM hard disk)</li>
<li>Plone 3.0.2/Zope 2.10.4</li>
<li>Intel Core 2 Duo, 2 Ghz</li>
<li>Ubuntu 7.10</li>
<li>Applied following Ext3 options: noatime, data=writeback</li>
</ul>
<p><strong>Out-of-the-box filesystem</strong></p>
<p>Lap 1: 23s</p>
<p>Lap 2: 22s</p>
<p>Lap 3: 22s</p>
<p>ab stats:</p>
<p>Concurrency Level:      10<br />
Time taken for tests:   11.805239 seconds<br />
Complete requests:      100<br />
Failed requests:        0<br />
Write errors:           0<br />
Total transferred:      2058700 bytes<br />
HTML transferred:       2030600 bytes<br />
Requests per second:    8.47 [#/sec] (mean)</p>
<p><strong>Tuned file system </strong></p>
<p>Lap 1: 21s</p>
<p>Lap 2: 22s</p>
<p>Lap 3: Didn&#8217;t bother to do it&#8230;</p>
<p>ab stats:</p>
<p>Concurrency Level:      10<br />
Time taken for tests:   12.102054 seconds<br />
Complete requests:      100<br />
Failed requests:        0<br />
Write errors:           0<br />
Total transferred:      2058700 bytes<br />
HTML transferred:       2030600 bytes<br />
Requests per second:    8.26 [#/sec] (mean)</p>
<p><strong>Conclusion </strong></p>
<p>&#8220;Hooray.&#8221;</p>
<p>Though Plone/Zope crawls through of thousands of files during the start up  (and thus touches their access times), the slow start-up process seem to be CPU bound. Magic file system tricks won&#8217;t make your everyday Plone development more effective.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2007/10/24/tuning-file-system-performance-for-plone-development/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
