Archive for July, 2008

First Beijing Aesthetic Marathon calling for Runners

Monday, July 14th, 2008

I have participated in the First Beijing City Aesthetic Marathon today, running for about 20 minutes through the hutongs and markets around Tianshuiyuan. The Beijing City Aesthetic Marathon is an art project initiated by HOIO (Samuel Herzog). It’s a sportive challenge and a way to discover Beijing at the same time. The 42.195 kilometres of the Marathon are run in sections by different persons. Every runner is asked to take HOIO into the part of Beijing they consider the most beautiful and exciting route through the city. Sections can be as short as one kilometre and as long as what can be done by a person in one hour (that’s the maximum battery lifetime of the camera). Each run is filmed by Samuel Herzog. You can see an overview of the previous runs here.

Samuel Herzog will be in Beijing until Saturday July 19th, if you are interested in taking him through your favorite part of Beijing, you can contact him at hoio[at]bluewin.ch.

Free Open Source Software

Wednesday, July 9th, 2008

Despite the fact that nobody is willing to pay for software and that proprietary software is free as in free beer, there are some points to be considered:

  • FOSS is legal to use, copy, modify, and distribute. Especially in China, where new laws can be enforced within little time, this can be a considerable advantage. However, it doesn’t seem that anti-piracy laws will be enforced anytime soon.
  • FOSS can be modified to meet the exact needs of the users. This is impossible with proprietary software.
  • FOSS has always been free, and FOSS-based companies have always been forced to come up with different business models. Hence the Chinese situation is not that different from other countries.

The question is: If people don’t pay for software, will they pay for customisation of open source code? Are they willing to pay for services and support related to the software?

Random Thoughts

Tuesday, July 8th, 2008

I have been in China for almost three months now. I have attended quite a number of FOSS-related events, have spoken to many people, and observed everyday programming at Exoweb. I have taken notes, asked questions, actively participated, and helped organising events. I now have a large pile of important-looking business cards, some new contacts on GTalk, Twitter, Facebook, and a wiki full of words describing what I have experienced, but I am still struggling to describe open source in China.

So far it seems that FOSS in China is mainly about talks, about promotion, about words, not that much about code. When it comes to software, China and Thailand are special cases: Software is generally available for free or little money, independent of it being open source or not. Piracy is omnipresent, licenses don’t exist. It seems almost impossible to make money with software development in China. People just don’t want to pay for it.

Questions

How does this influence software development in China? Are there new business models emerging from this? Is there a need for China to have a software industry at all? How does it influence innovation and creativity? How do existing software development companies survive? What about web (2.0) development?

BeijingOpenParty July: Summer Daydreams (仲夏梦舞)

Sunday, July 6th, 2008

The next Beijing Open Party will take place on July 19th at the Thoughtworks offices in Beijing. If you want to give a talk, you can propose it on the Beijing Open Party google group. Alternatively you can also just show up at the party and propose your topic. The party’s original announcement can be found here.

Event:  BeijingOpenParty July: Summer Daydreams (仲夏梦舞)
Date: July 19th
Time:  13.30 - 17.30
Address:  Room 1105, 11th Floor GuoHua Plaza, No.3 Dongzhimen South Street, Dongcheng District, Beijing, China, 100007, see map.

Accessible Captchas in Django

Sunday, July 6th, 2008

While we were implementing the GNOME.Asia summit website (will be available on www.gnome.asia soon), we were confronted with the problem of captcha accessibility. Despite Recaptcha’s claim of being accessible by providing sound captchas, the sound quality turned out to be rather poor and I actually did not succeed in using it even after listening to it four times. Based on this solution implemented in Rails, I reimpleted a similar idea for question captchas in Django. The code is fairly simple, based on a model which contains questions and the corresponding answers, and an implementation of a Django newforms field which can be used in the form. Some example questions can be found here.

models.py

from django.db import models
from django.utils.translation import ugettext_lazy as _
 
class AccessibleCaptcha(models.Model):
    question = models.CharField( max_length=255)
    answer = models.CharField(max_length=255)
 
    question.verbose_name = _(u'Question')
    answer.verbose_name = _(u'Answer')
 
    def __unicode__(self):
        return self.question

fields.py

from random import randint
from django.newforms import *
from django.utils.translation import ugettext_lazy as _
from django.utils.safestring import mark_safe
from captcha.models import AccessibleCaptcha
 
class AccessibleCaptchaWidget(Widget):
 
    def __init__(self, options={}, *args, **kwargs):
        super(AccessibleCaptchaWidget, self).__init__(*args, **kwargs)
 
    def render(self, name, value, attrs=None):
        index = randint(0, AccessibleCaptcha.objects.count()-1)
        accessible_captcha = AccessibleCaptcha.objects.all()[index]
        question = accessible_captcha.question
        return mark_safe(u'''<strong>%(question)s</strong> 
<input name="%(name)s" value="%(index)d" type="hidden" />
<input name="%(name)s" id="id_%(name)s" type="text" />'''
                % {'name':'captcha', 'index':index, 'question':question})
 
    def value_from_datadict(self, data, name, prefix):
        return data.getlist(prefix)
 
class AccessibleCaptchaField(Field):
    def __init__(self, required=True, label=None, help_text=None,
            options={}, *args, **kwargs):
        super(AccessibleCaptchaField, self).__init__(required=required,
            widget=AccessibleCaptchaWidget(options=options),
            label=label, help_text=help_text, *args, **kwargs
            )
 
    def clean(self, value):
        errormsg = gettext(u'You did not enter the correct answer. Please try again.')
        if not isinstance(value, (list, tuple)):
            raise ValidationError(errormsg)
        #get the right answer from the database
        #value[0] contains the id of the hidden field, value[1] contains the user input
        index = int(value[0])
        answer = AccessibleCaptcha.objects.all()[index].answer
        if not value[1].lower() ==  answer.lower():
            raise ValidationError(errormsg)
        return True

Usage

captcha = AccessibleCaptchaField(label=_(u'Are you human?'))