A great idea from Mitchell Joachim. Not sure meat houses are ready for the public, but growing wooden houses from vegetation is a radical and brilliant solution to ecologically-friendly communities.
Latest Entries »
Alice did it, and from there I’ve found some more interesting people doing it. So to throw myself aboard a bandwagon (and break a long dry spell without posting), here are 5 things I’m thinking about right now:
- Apps (especially games) targeting a specific device could be coming to an end soon. Google’s announcement of Chrome being able to run native code in a sandbox (caution: really dry technical presentation) is a game-changer. Bye-bye OS-specific applications that you buy on (ugh) physical media. Hello things that you open in a browser, which have full web connectivity and presence, and which will run on any platform supporting it. Yes, I’m well aware of the less-than-illustrious history of thin-client network computing. What I think makes this different is that Google have already got the platform in the hands of tens (if not hundreds) of millions of customers. For free. All they need to do to enable it is flip a switch. Oh, and they’re about to release an operating system based on this technology.
- Games are about to get big. By this, I don’t mean that people will buy more copies of games, nor that mainstream game devices will become more popular (though both are a given in the short term). No, I mean that more people are about to start making games. There are a couple of things that are bringing this about. The first is the massive ubiquity of platforms that can play games, and the second is the emergence of content-creation tools that don’t require computer-science or art degrees to use. Unity3D, which coincidentally was announced as an early launch platform for creating content which runs under Google’s Native Code system, is just such a platform, but there are many more with similar aims, such as MIT’s Scratch.
- Which brings me to: the next big software revolution will be in the creation of interpreted content. What I mean by interpreted content is content that the user does not have to create in painstaking detail. Instead, the user sets guidelines and parameters for what they want, and the software interprets the user’s intention and generates content. Procedural content has gotten us most of the way there, and there are some fantastic (though limited) examples such as Spore’s creature creator, the MakeHuman project, and LaDiDa available right now. However, the next wave will seamlessly intermediate between clumsy, inexact humans and the rigorous demands of content creation. I’d really like it if the interface to such software sounded like Jarvis from the Iron Man movies.
- Driving is an under-utilised platform for gaming, and could make roads much, much safer. Think networked vehicles with sensors that score your driving according to how safe and green it is, with high-score tables, local and national leagues, full social media connectivity, etc. Quite why the full extent of car manufacturers’ use of game mechanics so far is a tree that lights up green in one eco-friendly Honda remains an utter mystery to me.
- Talking of people that don’t get it… copyright reform has got to happen now. When everyone can make content, and content can go everywhere, people will be remixing and creating on a scale that utterly dwarfs the current Big Content industries. We need to ensure a strong creative commons and a legal framework that enables people to draw from the rich tapestry of our collective culture without fear of prosecution.
So that took a lot longer than expected, mostly due it turning into a stream of consciousness that I had to edit down from about 11 different ideas that suddenly occurred to me. More on points 2 and 3 coming soon.
Dear Meg Hillier,
As a constituent whose career and majority of personal communications are conducted across the internet, I’m very worried that the Government is planning to rush the Digital Economy Bill into law without a full Parliamentary debate.
The Bill contains measures that favour the protection of commercial interests at the expense of an individual citizen’s rights — specifically measures that allow copyright holders to issue requests to limit or even terminate the internet connections of private individuals based only on the belief of the copyright holder that the individual has infringed their copyright. In effect, this creates a situation outside the bounds of a fair and just society where a person can be punished by the withdrawal of a service that the UN is proposing be considered a basic human right.
In the digital age it’s only fair that copyright holders have greater recourse when their rights are infringed — but the measures in the Bill are a step too far. Millions of UK citizens depend on the internet for the ability to conduct their daily lives, their jobs, and for access to essential services. Restricting or withdrawing access to internet services is a disproportionate response, especially without the safeguard of a fair legal process.
Whereas a rights holder can impose penalties on an individual without the burden of proof and with almost no impediment of cost, the only recourse for an individual so restricted is through the courts — a massive, and clearly asymmetrical burden. The EU has adopted the position that any punitive measures affecting internet access by member states “must respect the fundamental rights and freedoms of citizens”. In particular, it the EU requires that citizens are entitled to a “fair and impartial procedure” before any measures can be taken to limit their internet access.
Industry experts, internet service providers (like Talk Talk and BT) and huge internet companies like Google and Yahoo are all opposing the bill — yet the Government seems intent on forcing it through without a real debate.
As a constituent I am writing to you today to ask you to do all you can to ensure the Government doesn’t just rush the bill through and deny us our democratic right to scrutiny and debate. As a life-long labour supporter whose career would be ended without internet access, I see no way that I can continute to vote Labour if the Bill passes unaltered.
Yours faithfully,
Sebastian Potter
PyPlants has come on in leaps and bounds over the past few days (well, evenings), and now from its new home as PyPlants on bitbucket sports a completely rewritten rendering backend which is more modular, should be really easy to plug into, and now supports POV-Ray out of the box.
What’s that you say? A 3-D ray-tracer? Yes indeed, as promised in the second part of this series of development diaries, I’ve now finished work on an update that turns this:
("A", "I+[A+O]-->>[--L]I[++L]-[AO]++AO")
("I", "FS[>>&&L][>>^^L]FS")
("S", "SFS")
("L", "['{+f-ff-f+|+f-ff-f}]")
("O", "[&&&C`>W>>>>W>>>>W>>>>W>>>>W]")
("C", "FF")
("W", "[`^F][{&&&&-f+f|-f+f}]")
Into this:

Rendering of an olive bush from pyplants povray renderer
Unfortunately it’s now 2am, so the write-up will have to wait for the weekend. Do feel free to grab the code and have a poke around. You’ll obviously need povray, pygame, and pycairo installed, but everything else should work with python’s included batteries.
In the previous part of this article we looked at the background to L-Systems, and how they could be used for describing self-similar biological systems. In this part we’ll look at a sample implementation of a very basic 2D L-System in Python, together with a basic PNG renderer using PyCairo.
This is an implementation of a deterministic, context-less L-System, which given the same initial conditions will always produce the same results. Whilst this won’t produce very naturalistic results for our plant system, it’s a useful first step to produce results like this:

First, we’ll define some 2D operations:
- F: Move forward LINE_LENGTH, drawing a line.
- +: Rotate clockwise THETA degrees.
- -: Rotate anti-clockwise THETA degrees.
- [: Push the current position and rotation onto a stack
- ]: Pop the current position and rotation off the stack
PyCairo is a great library for vector drawing operations and very well suited to the drawing operations we’ll be using. To use PyCairo, you simply declare a drawing surface (in this case a cairo.ImageSurface), and pass that to a context. All drawing operations will then happen on this context.
This sample implementation is also available on pastebin.
# this code is an improved version of the l-system
# sample code originally distributed with pycairo.
# originally Copyright 2003 Jesse Andrews (jdandr2 at uky.edu)
# this version Copyright 2009 Seb Potter (iamseb at iamseb.com)
# licensed under GPL
import logging
import cairo
# setup logging to just print to stdout.
# python's logging module is significantly
# better than using print for debugging
LOG_FILENAME = '/dev/stdout'
logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)
class Lindenmayer:
"""
A class to represent L-Systems and render them using cairo
"""
def __init__( self ):
self.width = self.height = 500 # use a 500 pixel square image
self.prod = {'[':'[','F':'F',']':']','+':'+','-':'-'} # the identity products
self.start_pos = (self.width*0.5, self.height) # we translate to the middle bottom of the image to start
self.start_angle = 180 # we rotate through 180 degrees to draw upwards - cairo's origin is top-left
self.theta = 90 # the rotation angle in degrees
self.stack = [] # this will be the stack for storing translation and orientation tuples
self.str = 'f' # the starting string, or 'axiom'
self.line_length = 5 # how far we move forward on each step
self.line_width = 2 # just controls the rendered width of the line
self.logger = logging.getLogger("flower.draw.lindenmayer") # use logging to print debugging
self.logger.setLevel(logging.DEBUG)
def addProd(self, let, prod):
"""
Add a production to the ordered list of productions to apply to the current string.
"""
self.prod[let]=prod
def iterate(self, iterations=1):
"""
Iterate over the list of productions and apply them to the string, in a loop.
The end result is the final transformed string.
"""
for i in xrange(iterations):
self.str = ''.join([ self.prod[l] for l in self.str])
self.logger.info("String is: %s" % self.str)
def line(self, ctx, len):
ctx.rel_line_to( 0, len )
def rotate(self, ctx, deg):
ctx.rotate( 2*3.141592653589793*deg/360.0 )
def draw(self, colour):
"""Render the string representation of the L-System"""
self.logger.info(colour)
# create a cairo drawing context from the provided surface.
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, self.width, self.height)
ctx = cairo.Context(surface)
# first we'll create a nice white rectangle as our background
ctx.rectangle(0, 0, self.width, self.height)
ctx.set_source_rgb(1, 1, 1)
ctx.fill()
# set the line colour, width, and make sure that cairo knows how close
# lines should be to join them
ctx.set_source_rgb(*colour)
ctx.set_line_width(self.line_width)
ctx.set_tolerance(0.1)
ctx.set_line_join(cairo.LINE_JOIN_BEVEL)
# start drawing a path, move to our start point, and rotate to
# the starting angle
ctx.new_path()
ctx.move_to(*self.start_pos)
self.logger.debug("Initial position: %s, %s" % ctx.get_current_point())
self.rotate(ctx, self.start_angle)
# this is the very simple way we iterate over the final string
# and perform a drawing operation for each symbol in the string
for c in self.str:
if c == 'F':
# move forward
self.logger.debug("f: draw a line of %s" % self.line_length)
self.line(ctx, self.line_length)
if c == '+':
# rotate clockwise
self.logger.debug("+: rotate %s" % self.theta)
self.rotate(ctx, self.theta)
if c == '-':
# rotate anti-clockwise
self.logger.debug("-: rotate -%s" % self.theta)
self.rotate(ctx, -self.theta)
if c == '[':
# push the transform and orientation onto the stack
m = ctx.get_matrix()
p = ctx.get_current_point()
self.logger.debug("[: push the matrix %s onto the stack" % m)
self.stack.append((p, m))
if c == ']':
# restore the transform and orientation from the stack
p, m = self.stack.pop()
self.logger.debug("]: pop the matrix %s off the stack" % m)
ctx.set_matrix(m)
ctx.move_to(*p)
# now draw the path created as a stroke on the context
ctx.stroke()
# write this to a png
surface.write_to_png("test.png")
self.logger.info("Wrote test.png")
def main():
colour = (0, 0.3, 0)
# setup the initial parameters for this l-system
lin = Lindenmayer()
lin.start_angle = 205
lin.start_pos = (lin.width*0.25, lin.height)
lin.str = 'X'
lin.addProd('X', 'F[+X]F[-X]+X')
lin.addProd('F', 'FF')
lin.theta = 20
# generate the final string
lin.iterate(iterations=5)
# render the string using pycairo
lin.draw(colour)
if __name__ == '__main__':
main()
In the third part of this series we’ll look at more realistic approaches to describing plant systems, including introduction of randomness through Stochastic L-Systems, and ways to create more plant-like features including leaves and flowers.
For a fledgling project idea, I’ve recently needed to work out how to draw plants procedurally, and of course Python is my language of choice for some rapid prototyping. Whilst some richly-featured professional applications exist for generating flora in a procedural fashion for high-end rendering, there are precious few systems available for the kind of bulk task that I require.
At first the task of generating plants might seem like a massive endeavour. The various permutations of stem widths, lengths, branch frequency, colour variation, leaf size, shape, frequency and mind-boggling. And that’s not even considering the problem space represented by flowers.
Fortunately, the problem of representing self-similar biological development is one that attracted Aristid Lindenmayer, who in 1968 introduced L-Systems:
… as a theoretical framework for studying the development of simple multicellular organisms, and subsequently applied to investigate higher plants and plant organs. After the incorporation of geometric features, plant models expressed using L-systems became detailed enough to allow the use of computer graphics for realistic visualization of plant structures and developmental processes.
(Lindenmayer’s book The Algorithmic Beauty of Plants is no longer in print, but is available for free in PDF.)
L-Systems are remarkably powerful, simple systems that express the development of a formal grammar through a parallel rewriting process. In effect, you start with a string that represents certain graphical operations, and a set of rules for rewriting the string. You iterate over the string a certain number of times, and are left with a final product.
For example in a 2D system, the symbol F represents drawing a straight line in a forward direction, the symbol + represents rotating left, and — represents rotating right. If you start with the string “F”, and a rule that says “(F → F+F−F−F+F)”, then you’d see the following iterations:
- F+F-F-F+F
- F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F
- F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F+ F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F– F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F– F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F+ F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F
If you then plot those rules using a unit vector length and an angle of 90 degrees, you end up with the following iterations:
There are several more symbols that can be applied to the graphical operations, including pushing the current position and orientation onto a stack and popping it off again, rotations in 3D, and operations to define closed polygons and moving through colour and size lookup tables.
The most basic type of L-System is the deterministic context-less system, D0L, where each operation is independent and will always produce the same output. The Koch Square above is one of the most simplistic examples, but with a couple of variations much more complex patterns arise:
- Start: “X”
- Rule 1: “(X → F-[[X]+X]+F[+FX]-X)”
- Rule 2: “(F → FF)”
- Angle: 25 degrees
- Iterations: 5

In Part 2 we’ll look at a first approach to implementing L-Systems in Python, and a rudimentary renderer for 2D systems using PyCairo.
Ten things I’ve learned as a developer at WooMe:
- Be clear what your direction is. Identify your key proposition and focus on it. Don’t get distracted by unrelated features — somebody else is probably already doing those better than you.
- Be merciless with features that don’t cut it. No matter how much you like it, if your audience doesn’t like it, either change it or kill it fast. Wasting time on your personal pet project when there’s no clear demand for it is time you should be spending on features users want.
- Use what’s already there rather than inventing your own. Need a message queue? Video processing? Load balancer? Email distribution? Payment system? Use something that already exists rather than waste time you should be spending on feature development.
- Quick and dirty is better than late to market. At the rate this industry moves, capturing your audience’s attention first is more important than having a well-engineered solution. For the most part, users don’t care about your code quality, as long as it works.
- Don’t optimise until you need to. Sure, you may end up chasing your tail for a bit when you need to scale, but until you hit that point you’re wasting valuable time that should be spent on feature development.
- Scaling is most often a data problem. When you do need to optimise, scaling won’t be about the performance of your application. Scaling web applications horizontally is easy. Scaling databases vertically is expensive. Scaling databases horizontally is very, very hard. Don’t worry about what web application framework you use, worry about what database you put behind it.
- Abstraction is great, as long as you understand what you’re abstracting. This has been a constant pain with Django’s ORM. Yes, it’s a powerful and useful abstraction, but without a solid understanding of what the database is doing behind it, it’s easy to get into very deep trouble, very quickly.
- Log everything. Nothing is harder than trying to find problems on a live environment without detailed logging.
- Storage is cheap. It’s better to store everything than to throw away data. You never know when you might need something.
- Communication is critical. Not just outside your organisation, but within it. Tell people what you’re doing, frequently. Ask them what they’re doing just as often. Not only do ideas percolate through this process much more effectively, but when things go wrong, clear and frequent communication will stop them from getting worse.
In a move that’s in direct conflict with the 1688 BIll of Rights guaranteeing the unrestricted reporting of parliament (“[t]hat the Freedome of Speech and Debates or Proceedings in Parlyament ought not to be impeached or questioned in any Court or Place out of Parlyament”), the Guardian today was gagged by a high court injunction from reporting parliamentary proceedings.
Fortunately, the Guardian is able to tell us who the lawyers for the plaintif were. They’re Carter-Ruck, who just so happen to be mentioned in the list of Parliamentary Questions for Wednesday 14th October.
61
NPaul Farrelly (Newcastle-under-Lyme): To ask the Secretary of State for Justice, what assessment he has made of the effectiveness of legislation to protect (a) whistleblowers and (b) press freedom following the injunctions obtained in the High Court by (i) Barclays and Freshfields solicitors on 19 March 2009 on the publication of internal Barclays reports documenting alleged tax avoidance schemes and (ii) Trafigura and Carter-Ruck solicitors on 11 September 2009 on the publication of the Minton report on the alleged dumping of toxic waste in the Ivory Coast, commissioned by Trafigura. (293006)
Thanks to @handelaar, and Richard Wilson for pointing this out.
In a mere fortnight the final episode of Galactica hits the air, and we will finally find out how it all ends. After nearly five years of watching, I can’t frakking wait.
I won’t offer any spoilers here (for those people I know who are only still watching the earlier seasons), but Topless Robot offers 20 alternative endings for Galatica. For some reason none of them involve Roslin airlocking every last living person. Possibly too close to the truth?
My personal favourite:
The ship runs out of algae. Order breaks down as the remaining humans turn to cannibalism to survive. Adama is forced to eat Roslin, and cries while eating her. It is revealed that the only difference between humans and humanoid Cylons is that the Cylons have a delicious “ranch” flavor.

