Ian Ward

Boxkite Inc.
CKAN contributor/tech lead
PyRF primary contributor
Urwid author
Speedometer author

Contributing to Open Source
IASA E-Summit, 2014-05-16
Urwid Applications
Urwid Intro
Unfortunate Python
Django 1.1

Moving to Python 3
Article Tags


Ian Ward's email:
first name at this domain

wardi on OFTC, freenode and github

Locations of visitors to this page

News rss icon

Django Hides (some) Widget Exceptions link
Posted on 2010-12-13.

If you write any custom Django widgets or admin list_display callable functions you have probably run into this: Everything looks ok, except the place where your widget should be is just blank. Nothing. No traceback or any clue as to what went wrong.

It seems that Django suppresses all the exceptions sent by widgets rendering except for AssertionError and TypeError. Debugging under those conditions is tricky, so I wrote a function decorator to help. Just import this and put @assert_on_exception before your render method or admin list_display callable function:

def assert_on_exception(fn):
    import sys
    def wrap(*args, **kwargs):
            return fn(*args, **kwargs)
        except (AssertionError, TypeError):
            raise AssertionError(sys.exc_info()[0].__name__ + ": " + str(sys.exc_info()[1]))
    wrap.__name__ = fn.__name__
    wrap.__doc__ = fn.__doc__
    wrap.__module__ = fn.__module__
    return wrap

Tags: Django Software Python

Manufactoria:Reverse the input
Manufactoria Distils the Awesome of Programming link
Posted on 2010-12-12.

Just adding my voice to the chorus of people praising Manufactoria.

I played through a earlier version months ago, but had to come back and try it again. The latest versions let you flip parts and easily move and rotate sections of your machines. And the new "Malevolance engine" jumps straight to your flaws or validates your designs almost instantly. If you like writing software, you must try this little game.

Tags: Software Games

Posted on 2010-11-29.

Many hard drives available today have 4K physical sectors instead of the old standard 512-byte sectors. The larger sectors allow the manufacturers to save space required for error correction, so they can save money, and in turn we get cheaper hard drives. Which is great, except that if a drive is using 4K sectors the drive must report it to the operating system or performance may suffer.

I recently purchased two WD HDDs: one 1.5TB and one 2TB, both "EARS" models. The 1.5TB drive happily reports that it has 4K physical sectors:

fdisk -l /dev/sdc
Disk /dev/sdc: 1500.3 GB, 1500301910016 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

But the 2TB drive claimed to have 512 byte sectors.

fdisk -l /dev/sdd
Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

"That's strange", I thought. So I ran a quick test to see if the 2TB drive was lying.

Read More …

Tags: Hardware Linux

Speedometer 2.7 Screenshot
Speedometer 2.7 Released link
Posted on 2010-11-08.

I've updated my Speedometer project to use some of the latest Urwid features.

This release works well with light, dark or transparent backgrounds. It can display in monochrome mode and now has 88/256-color mode support (with a solid background color). There is also a new option to exit once a monitored file download completes.

Speedometer 2.7 requires Urwid (Speedometer 2.6 was compatible with ancient versions of Urwid) it now uses raw_display, MainLoop and the updated Pile widget. Otherwise the features and code structure are largely unchanged.

Tags: Urwid Software Speedometer Python

Good Linux Games link
Posted on 2010-10-07.

LWN.net just published an article listing some good Linux games (comments possibly even better than the article). I'm posting this here so I can find it again when I have the time to waste.

Tags: Software Linux LWN.net Games

Sphinx logo
Sphinx Presentation at OPAG link
Posted on 2010-08-29.

I will be giving a talk at the September meeting of the Ottawa Python Authors Group covering some documentation work I have done recently using Sphinx domains and a custom Pygments lexer.

I am working on an embedded device for a client that includes a proprietary text command language. Sphinx supports documenting many common languages like C, Python and Ruby, but with the 1.0 release it now allows adding "domains" for new languages. I have used this feature to create a domain for this command language.

Sphinx uses Pygments to provide syntax hilighting for source code examples. None of the available options fit this command language so I also created a custom lexer for this command language in just a few lines of code.

My talk will cover creating these extensions for Sphinx and Pygments.

Tags: Ottawa Software Python OPAG

Non-trivial Django Forms slide
Posted on 2010-04-16.

This is the text from the Nontrivial Django Forms talk I gave last Tuesday at the April meeting of the Ottawa Python Authors Group.

This talk starts where the Django forms documentation leaves off.

Read More …

Tags: Django Ottawa Software Python OPAG

Urwid at OSCON and LinuxFest Northwest link
Posted on 2010-04-04.

Rob Lanphier will be giving talks relating to Urwid at OSCON and LinuxFest Northwest:

LinuxFest Northwest
Bellingham, WA, April 24-25 (Exact time TBD)
Using Urwid and Python Console Applications

O'Reilly's Open Source Convention (OSCON)
Portland, OR, July 22 (Thursday, 1:40pm)
Great User Interfaces in the Terminal Window

Tags: Urwid Software Linux Python

Crystalfontz preview
Posted on 2010-03-14.

The development version of Urwid now has support for display and input on a Crystalfontz 635 LCD panel. These are small LCD screens that fit in a PC's 5ΒΌ" drive bay. They have six buttons, four red/green LEDs and a 20x4 character display with an adjustable backlight.

Read More …

Tags: Urwid Hardware Software Linux Python

Posted on 2009-12-27, last modified 2010-01-21.

Something that has annoyed me for some time now (but not enough to google it, apparently) is Thunderbird's reply header. The default reply header has no date and time. Turning it on turns out to be pretty simple, it just hasn't been added to the configuration dialogs it seems. I need to do this on all the systems I check mail from so I'm documenting it here.

Read More …

Tags: Software Linux

« page 1 2 3 4 5 6 7 8 910 11 12 page »