Skip to main content

Posts

Showing posts from 2009

The names behind the languages

If we're going to continue to spill blood in these language wars, it's important that we all know who our generals are (and who our enemy generals are). Feel free to offer corrections or extensions to the list.

C - Dennis Ritchie

C++ - Bjarne Stroustrup

Forth - Charles H. Moore

Lisp - John McCarthy

Perl - Larry Wall
PHP - Rasmus Lerdorf

Python - Guido van Rossum

Ruby - Yukihiro Matsumoto

Tcl - John K. Ousterhout

Venn Diagrams with google charts

I recently had the need to view some data sets as venn diagrams, so I found google's chart api and hacked out a little AJAX application to do so, you can try it out here. And, for the fun of it, a VERY simple Python implementation:



import urllib
from PIL import Image
import StringIO

def venn_diagram_url(a, b, c, width=400, height=200):
values = [width, height, len(a), len(b), len(c)]
values.append(len(a & b))
values.append(len(a & c))
values.append(len(c & b))
values.append(len(a & b & c))
base_str = 'http://chart.apis.google.com/chart?'
args_str = 'cht=v&chs=%sx%s&chd=t:%s,%s,%s,%s,%s,%s,%s'
return base_str + (args_str % tuple(values))

a = set((1, 2, 3))
b = set((2, 4))
c = set((3, 4, 5))

data = StringIO.StringIO(urllib.urlopen(venn_diagram_url(a, b, c)).read())
Image.open(data).show()


Not much to it... But maybe someone will find it useful.