Jonathan Riboux – Technical Blog Python, Zope, Plone and more

25Aug/090

Drastically improve Intel graphics performance under Ubuntu Jackalope 9.04

The new Ubuntu Jackalope 9.04 has some performance issues with the EXA acceleration method of Intel graphic cards due to actual Kernel. This causes poor 2D performance (eg in Compiz).

There is no available fixes atm in Ubuntu Jackalope repositories but you can update to kernel 2.6.30.3 and configure your Intel graphic device following instructions on this page : HOWTO: Jaunty Intel Graphics Performance Guide.

I used "Optimal configuration" on a Dell Vostro 220s and noticed a drastic performance improvement, especially in Compiz (even in normal mode).

5Aug/090

Generate pot files for all development eggs

With the following script, you can generate pot files for each egg in development in your Zope/Plone project.

It creates three pot files per egg

  • [EGG_NAME]-generated.pot : generated from the egg sources using i18ndude
  • [EGG_NAME]-extra.pot : empty pot generated if it doesn't exist, you can put your extra msgid/msgstr
  • [EGG_NAME].pot : merged from generated and extra

Requirements

  • egg must have a locales subdirectory
  • i18n domain used in the egg must have the same name as the egg
  • i18ndude must be installed

generate_i18n.sh

#!/bin/sh
 
# Change this to the path containing your
SRC="src"
 
for EGG_NAME in `ls $SRC`
do
  EGG_SUBDIR=`echo $EGG_NAME|sed "s/\./\//g"`
  EGG_DIR=`echo $SRC/$EGG_NAME/$EGG_SUBDIR`
  LOC_DIR=`echo $EGG_DIR/locales`
 
  if [ -d $LOC_DIR ]; then
    echo "========================================"
    echo "Found locales in $EGG_DIR"
    echo "Generating pot..."
    # Make sure pot files exist, create them if not
    touch $LOC_DIR/$EGG_NAME-generated.pot
    touch $LOC_DIR/$EGG_NAME-extra.pot
    # Create pot generated from sources
    i18ndude rebuild-pot --pot $LOC_DIR/$EGG_NAME-generated.pot --create $EGG_NAME $SRC/$EGG_NAME
    # Merge it with the extra pot (manual one) and create the final pot
    cp $LOC_DIR/$EGG_NAME-generated.pot $LOC_DIR/$EGG_NAME.pot
    i18ndude merge --pot $LOC_DIR/$EGG_NAME.pot --merge $LOC_DIR/$EGG_NAME-extra.pot
  fi
done
5Aug/090

Get all versions of your development eggs

On a big Zope/Plone project with a long list of eggs in development, you must know each version of each egg when you want to release them and configure production / pre-production buildout.

Instead of looking into each egg's VERSION.txt or setup.py, here's a script to list them all. The result can be copy/past in your buildout's version.cfg .

list_versions.py

import stat, os, re
 
re_version = re.compile(r"""^version\s*=\s*(?:"|')(.*?)(?:"|')""", re.MULTILINE|re.DOTALL)
re_name = re.compile(r"""name\s*=\s*(?:"|')(.*?)(?:"|')""", re.MULTILINE|re.DOTALL)
 
def _get_setup(base):
    """returns setup content"""
    setup_py = os.path.join(os.getcwd(), base, 'setup.py')
    return open(setup_py).read()
 
if __name__ == '__main__':
    print 'src versions :\n==============\n\n'
 
    files=os.listdir(".")
    files=[filename for filename in files if filename[0] != '.']
 
    for egg in files:
        if egg[0]=='.':
            continue # ignore hidden files
        try:
            stat_info=os.lstat(egg)
        except:
            continue # bad file
        if not stat.S_ISDIR(stat_info.st_mode):
            continue # ignore files
 
        try:
            setup = _get_setup(egg)
            print '%s = %s'%(re_name.search(setup).group(1), re_version.search(setup).group(1), )
        except:
            continue # prevent crash when setup.py doesn't exist
Tagged as: , , No Comments
5Aug/093

Using Microsoft’s Browser Test VMs in Virtual Box

Edit : this solution no longer works with latest Microsoft's vm :( .

If you are a web developer, you may have noticed that Microsoft's browser test virtual machines don't work out of the box in Sun VirtualBox.

Here's a step-by-step how-to you can follow to make them work like a charm : Using Microsoft's Browser Test VMs in Virtual Box