Archive for July, 2008

Easy examples of redundancy

2008-07-29-Tue

The following are some examples of simple redundancies in procedural programming. They are given in Python. I typically run into these when I simplify my code after writing it for the first time or after making edits.
Using if-else to assign a Boolean:
if condition:
x = True
else:
x = False
Simplified:
x [...]

Department of redundancy department: Python lambdas

2008-07-29-Tue

A coworker recently pointed out the lambda (anonymous function) in this piece of code that I wrote was redundant:
project_key_regex = re.compile(r”^project(\d+)$”)
for key in filter(lambda k: project_key_regex.match(k), req.args.keys()):

It would be improved like this:
project_key_regex = re.compile(r”^project(\d+)$”)
for key in filter(project_key_regex.match, req.args.keys()):

Apparently, methods of an object can be thought of as [...]

The revised create users and create projects doublet

2008-07-28-Mon

A picture is worth a few hundred thousand bytes, so without further ado, this is what’s new:

Although it isn’t apparent from the screenshot, a new memberships row (with “select a user/project” and “select a role”) is added whenever the final row is filled.
Compare these to the interfaces that we had before:

Create Multiple Users: Error handling

2008-07-23-Wed

The new Create Multiple Users page has a back-end that gives information on all sorts of errors:

Great bug writers think alike

2008-07-10-Thu

a.k.a. “A subtle bug from a perfect storm of HTTP, HTML, JavaScript, and DOM“
My current work
I’m currently in the midst of implementing a new interface for creating new users. This is how it currently looks like:

The project membership table is created on the client side using JavaScript. The administrator adds and removes memberships (rows) without [...]

Final role editor (for now)

2008-07-09-Wed

This is the current state of the role editor. Development on it has wrapped up a few days ago. It is available at (SVN) https://drproject.org/svn/drproject/DrProject/branches/newadmin.
Initial screen:

Adding a role:

Role added:

Editing a role (click on pencil and paper icon):

Done editing a role:

Removing a role that is still in use (click red X, get redirected to this page):

Note [...]