Dec 12, 2008
Bristol Plone Performance Sprint Day #1
Make Plone go faster
The sprint started with a brainstorming session where we collected all the ideas and areas the participants brought into three core areas. They have been tentatively named Cataloging and Indexing, Instrumentation and Benchmarking. We then proceeded to collect input on these three areas by having everybody write down whatever came to mind on post-its and we just stuck them together on the wall.
After lunch we split up into three groups where all the input for each topic was processed. The group session was limited to just over an hour, as the goal was not to jump into (anf get lost in) an exhaustive discussion of all aspects and details but rather to come up with specific, actionable proposals which would then be put to the entire sprint in a short presentation, where we collectively decided on what (partially already how) we were going to work on for the remainder of the sprint.
This approach turned out to be a really good idea for multiple reasons. For one, we collectively decided on what we would concentrate on. Nobody had to feel left out. By limiting the first session to an hour and demanding a short presentation from each group to the entire sprint, we avoid rushing into dead ends. And lastly, everybody was on the same picture from the very start.
The three presentations then provided each group with further feedback and by the time they were over everybody was ready to get some actual work done.
We ended day one by rewarding ourselves with a big dinner of real authentic English food (i.e. Indian curry) in an old converted bank.
Oct 18, 2008
Windmill for Browser testing
A promising Chandler originated Selenium competitor
While cleaning up on the remoteinclude sprinting we did last week at the post-conference sprint, I came across Windmill. Windmill looks like a really promising candidate for anyone wishing to do some non-trivial browser based testing of their web applications:
Windmill implements cross browser testing, in-browser recording and playback, and functionality for fast accurate debugging and test environment integration.
I'd be curious to know if any members of the Plone/Zope community have had any experiences with it. Also, if you've simply become curious and would like to try it out for yourself (and then report back) but are intimidated (or simply put off) by the lengthy installation instruction, here's a one-stop buildout including the particular python that windmill needs, that will get you going:
[buildout]
python = python
parts =
python
pythonbin
windmill
[windmill]
recipe=zc.recipe.egg
eggs =
simplejson==1.9.1
windmill
[python]
recipe = zc.recipe.cmmi
url = http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tgz
executable = ${buildout:directory}/parts/python/bin/python2.5
extra_options=
--enable-unicode=ucs4
--with-threads
--with-readline
MACOSX_DEPLOYMENT_TARGET=10.5 # uncomment this, if your're not on MAC OS X
[pythonbin]
recipe = plone.recipe.command
command = ln -s ${python:executable} ${buildout:bin-directory}/python
Update: Martijn Peters points out, that you can use newer versions of simplejson, you just need to stick to the 1.9 branch for the time being:
"because I assume it's the 2.0.0 API change that makes them use 1.9.x on their instruction pages. It works just fine with 1.9.3 anyway, haven't tried 2.0.3 at all."
I've updated the buildout above accordingly. Also, if you already have a working python2.5 on your system (unlike yours truly who hosed his Mac OS X 10.5 python2.5 ages ago) you can reduce the buildout to this snippet:
[buildout]
parts =
windmill
[windmill]
recipe=zc.recipe.egg
eggs =
simplejson <=2.0.0dev
windmill
Sep 25, 2008
lxml on Mac OS X
Now with even less seg-faulting!
For a current project I needed to include (the most excellent Python XML library) lxml. Getting the right version to run on Mac OS X has been notoriously difficult, though. Easy-installing it was broken (and currently is, for me, as well) and while I have found multiple how-tos, they all dealt with the problem by installing it manually from sources and patching the configure process etc. pp. That would, of course, defeat the whole purpose of using buildout in the first place.
Cheeseshop to the rescue: there is a recipe for installing lxml along with the proper versions of libxml and libxslt, however, its default values didn't work for me. So for the record: the following buildout snippet will get you non-segfaulting lxml on (at least) Mac OS X 10.5.x and Ubuntu linux. YMMV.
parts =
[...]
lxml
eggs =
[...]
lxml==2.1.2
[lxml]
recipe=plone.recipe.lxml
egg =
lxml==2.1.2
libxml2_url =
http://xmlsoft.org/sources/libxml2-2.7.1.tar.gz
libxslt_url =
http://xmlsoft.org/sources/libxslt-1.1.24.tar.gz
p.s. this should be good news for all folks working with Deliverance. Perhaps now I could revisit that...
Jun 02, 2008
Netboot installing Ubuntu on a SunFire X2200
Because installing from CD is soooo nineties ;-)
After receiving my new toy at work three days ago, a SunFire X2200 with 16Gb RAM, today I finally got around to set it up.
Now, while my server OS of choice is definitely FreeBSD this particular machine is going to be used as a development machine for a Plone project which will eventually be hosted at a provider who doesn't support FreeBSD but instead Ubuntu. Also, the machine came without an optical drive. So after a few fruitless attempts to boot from an USB stick, I simply stuck to what I already know and chose a TFTP based route using Mac OS X's built-in tftp server.
Basically, I just followed my previous how-to on how to install FreeBSD on a (headless, keyboardless) soekris machine. Only, this time, I installed the dhcp server from mac ports, instead of compiling it manually:
sudo port install dhcp
Then I downloaded the Ubuntu Server ISO image and mounted it.
In my dhcpd.conf I modified the root-path and filename options thus:
option root-path "/Volumes/Ubuntu-Server 8./install/netboot/";
filename "pxelinux.0";
Next modified the (existing) /System/Library/LaunchDaemons/tftp.plist so that it looked like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>InitGroups</key>
<true/>
<key>Label</key>
<string>com.apple.tftpd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/libexec/tftpd</string>
<string>-i</string>
<string>/Volumes/Ubuntu-Server 8./install/netboot</string>
<string>-u</string>
<string>root</string>
<string>-s</string>
<string>/Volumes/Ubuntu-Server 8./install/netboot</string>
<string>-l</string>
</array>
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockServiceName</key>
<string>tftp</string>
<key>SockType</key>
<string>dgram</string>
</dict>
</dict>
<key>inetdCompatibility</key>
<dict>
<key>Wait</key>
<true/>
</dict>
</dict>
</plist>
Now all I needed to do was to start both daemons...
sudo /opt/local/sbin/dhcpd
sudo service tftp start
...finally fire up the machine and press F12 at the boot prompt and Bob was my proverbial uncle.
Apr 26, 2008
blueprint css + jquery
I'm using the blueprint CSS framework for a new site that I'm working on and am rather enjoying the process (as far as that is humanly possible, given that it by definition involves working with CSS... cough).
One of the neat features of blueprint is a compressor script that not only renders all the various CSS bits that you want according to the given column numbers and sizes for each project into one neat (and compact) CSS file, but it also lets you define semantic classes and ids, so you can use something like class="navigation" instead of class="span-6 last". And on top of that, the compressor script will also generate a PNG image that conforms to the column size and padding you've selected. This proved to be really helpful in debugging the pages. Simply add the class showgrid to your outer most container div and presto!
When demonstrating the layout to the client, though, I wanted a less obtrusive way of switching the grid on and off and I thus came up with little jQuery script to generate a toggle switch for each page. And since jQuery will be the standard javascript library for Plone from version 3.1 onward, anyway I thought I might as well share the following snippet:
$(document).ready(function() {
$("body").append("<div id='debug'>turn grid: <a href='' id='togglegrid'>"
+ gridstate() + "</a></div>";);
$("#debug").css("position", "absolute");
$("#debug").css("bottom", "0");
$("#togglegrid").click(toggle_grid);
});
function toggle_grid () {
$(".container").toggleClass("showgrid");
$("#togglegrid").text(gridstate());
return false;
}
function gridstate () {
if ($(".container").hasClass("showgrid")) {
return 'off';
} else {
return 'on';
};
}
P.S. I'm not exactly a fan of the Javascript language but I do appreciate jQuery a lot and for the sanity that it partially restores when working with Javascript. The snippet above is a good example of that in my opinion. Javascript can't get any more "pythonic" than that IMHO ;-) (But please prove me wrong!)

