E-Scribe : a programmer’s blog

About Me

PBX I'm Paul Bissex. I build web applications using open source software, especially Django. Started my career doing graphic design for newspapers and magazines in the '90s. Then wrote tech commentary and reviews for Wired, Salon, Chicago Tribune, and others you never heard of. Then I built operations software at a photography school. Then I helped big media serve 40 million pages a day. Then I worked on a translation services API doing millions of dollars of business. Now I'm building the core platform of a global startup accelerator. Feel free to email me.

Book

I co-wrote "Python Web Development with Django". It was the first book to cover the long-awaited Django 1.0. Published by Addison-Wesley and still in print!

Colophon

Built using Django, served with gunicorn and nginx. The database is SQLite. Hosted on a FreeBSD VPS at Johncompanies.com. Comment-spam protection by Akismet.

Pile o'Tags

Stuff I Use

bitbucket, Django, Emacs, FreeBSD, Git, jQuery, LaunchBar, Markdown, Mercurial, OS X, Python, Review Board, S3, SQLite, Sublime Text, Ubuntu Linux

Spam Report

At least 236428 pieces of comment spam killed since 2008, mostly via Akismet.

OSCON 2007, Day 4

Keynote speakers

Ben Fry talked about Processing (I missed this part, but fellow attendees who hadn't heard of the language before we very excited and impressed.)

Bill Hilf from Microsoft notes that they're moving to some OSI-approved licenses.

Rickard Falkvinge from Sweden's Pirate Party spoke about their attempt to reform intellectual property law. In their first election, they got only 0.63% of the vote, buy this placed them in the top 10 parties in their first election -- a record for a first-year political party. I don't think that intellectual property regulation is a broad enough base for a political party, but the fact that they're getting so much interest is very telling. After Falkvinge noted that political contributions are not regulated in his country, one audience member ran up and handed him cash!

Steve Yegge had some serious problems with his slides (in fact, I started feeling physically queasy after 10 minutes of mad flashing from the big screens as the tech guys ran around trying to get it to work). His essential message, delivered in the usual funny, acerbic, and rambling Yegge style, was: "open source" has a branding problem.

Session: How dtrace helped Twitter

When Twitter started getting popular, they were have serious scaling problems. Luckily they were running Solaris 10, which includes dtrace.

(It's also in OS X 10.5 and probably going into FreeBSD as well.)

dtrace provides "concise answers to arbitrary questions."

It's designed for production systems: safe operation, and no overhead when not in use. But also obviously very good for development.

dtrace -l shows you all the "points of instrumentation", i.e. hooks. About 50,000 of them in the quickie example they just ran.

dtrace has its own scripting language, the extension is .d.

dtrace -n 'syscall:::entry { @[execname] = count(); }

This runs and gathers data, then when you hit ctrl-c you get a summary table.

A dtrace script can run something else; their example was a rubyfollow.d script that was passed a Ruby script (a simple "hello, world") as an argument.

There seems to have been some work on a dtrace-enabled Python, but as far as I can tell it's Solaris-only.

Session: Justin Gallardo, How to Write A Killer Sugar Activity

The word "activity" more or less means "Application". "Sugar" is the user environment for the OLPC project. All Sugar apps/activities are written in Python and GTK+, except for eToys (which is written in Squeak).

Justin got involved with the project by finishing the port of Abiword, now he manages the media player.

The HIG (human interface guidelines, remember those?) for the Sugar project are very different from those that most people are familiar with.

They're using git for version control.

Installing is hard and slow, he's making no bones about that. The build is called "sugar-jhbuild" if you're Googling.

Looks like the easiest way is to install qemu and download an image (100MB to 300MB). It will run a bit slower than a native build but likely faster than the XO (the OLPC machine). Honestly, this looks like the only reasonable way to do it unless you're interested in working on the build/install process itself.

The OLPC has a Tetris Clone called "Block Party" that was written by the same guy who wrote the original Tetris!

Alt-= gets you into the developer console.

Any time you print from a Python program, and any time you have an exception, it shows up in the log -- one log per application.

Activities (applications) in the background are throttled to about 5% CPU.

All icons are SVG.

Developer tips

There are special GTK widgets for Sugar.

Online resources:

Session: Open Source RIAs

JavaFX Script: I really have a hard time getting past the awful, awful name. It used to be called "F3" -- which, though opaque, is really a better name.

Apparently it uses a declarative syntax in places.

Adobe Flex: a beta word processor called "buzzword" is using Flex 2. . AIR will not be open source. Uses WebKit and SQLite, though.

(I had to leave this session right after the Q&A segment began, in order to make it to Guido van Rossum's Python 3000 talk. The first questioners dove right into the license restrictions on the Flash player though!)

Session: Guido van Rossum, Python 3000

(If you've seen or heard Guido talk about Py3K in the past year this is going to be very familiar. I wonder if he would consider creating a "just the diffs" version of the talk.)

Update: Guido has posted a short Python 3000 FAQ on artima.com. And a second one.

Current timeline:

He makes a good point that without full unit test coverage you're not going to exercise your code enough to get the Py3K warnings, which you need to see in order to know what to fix.

  1. start with unit tests, full coverage
  2. port to 2.6
  3. test with py3K warnings mode on
  4. fix all warnings
  5. use 2to3 utility to convert to 3.0 (no hand-editing of output allowed!)
  6. test converted source code under 3.0 (of course you have ported your test suite)
  7. fix stuff in 2.6 source and goto "test with py3k warnings" step
  8. release separate 2.6 and 3.0 versions

Tips

Unicode: Default source encoding is UTF-8; unicode letters are allowed in identifiers; some issues remain (e.g. normalization); stdlib remains ASCII.

An abstract base class in Py3K is defined as a class with at least one abstract method. There's an @abstractmethod decorator. There will be "voluntary" base classes for standard APIs: Iterable, Iterator, MutableMapping, Real, RawIOBase, Hashable, Sized, Container, etc.

Continuing the move toward iterators and lazy evaluation: zip(), map(), and filter() will all return iterators. As will dict.keys(), .items(), and .values() -- these three will return something new called a "dict view", which are iterables (but not iterators).

New super() call: When called without args, it figures out the current class and self. This is the way I've always wanted it to work!

Set literals: {1, 2, 3} -- this is very nice. (An empty {} will still produce an empty dict. Fair enough.)

Set comprehensions and dict comprehensions. Also very nice.

lambda lives -- reduce dies.

Thursday, July 26th, 2007
+ + +
2 comments

Comment from John Levon , 5 days later

There's nothing Solaris-specific in the DTrace Python support. In theory, any OS with DTrace ported will be able to use the new support I added.

Comment from Paul , 1 week later

That's good to hear, John, thanks for taking the time to comment.

Bring on OS X 10.5!

Comments are closed for this post. But I welcome questions/comments via email or Twitter.