How to add collectors to a device class

November 27th, 2008

In the device class, go More>Collector Plugins; or go to the zProperties screen, then click the edit button next to the zCollectorPlugins field.

To add a new collector, click the very faint “Add Fields” link and a box will pop up with all the available ones.

How to convert a PKCS#12 cert into PEM

November 19th, 2008

openssl pkcs12 -in .p12 -out .pem

And if you want to take the password off, add -nodes

How to burn a CD from an ISO in OSX

October 29th, 2008

Open Disk Utility. Open Finder. Drag the ISO from the Finder window into the Disk Utility window. Select ISO in Disk Utility and click Burn.

How to undelete a file in svn

October 16th, 2008

Look in the .svn/entries file for the URL of the repo.

Get the number of the last revision the file was in before you deleted (or if you don’t know, start from the current one and work backwards)

svn cp -r <rev> <repourl>/<filename> ./<filename>

Then commit.

Asus Eee 900 won’t boot from USB drive

September 4th, 2008

Make sure the USB drive is listed as the first drive in the hard drive list, as well as being first in the list of devices to boot from.

Migrating sequences to Postgres

August 17th, 2008

When moving a database from mysql to postgres, it’s often necessary to reset the sequences (.i.e. autoupdated row ids)

Find out what the largest one is with select max (id) from mytable;

Set the sequence with select setval('mytable_id_seq',x+1) ;

UnicodeDecodeError using BeautifulSoup

August 1st, 2008

UnicodeDecodeError: 'ascii' codec can't decode byte 0xa3 in position 0: ordinal not in range(128)

There’s a rather annoying bug in python 2.5′s sgmllib.py which is the cause.

The function convert_charref assumes that ascii characters have values up to 255; the correct limit is 127.

login in testing – must call GET before doing POST

July 25th, 2008

In 0.96, if you dive straight in with a POST to your login page with username/password, you’ll get a login error, saying “Your Web browser doesn’t appear to have cookies enabled. Cookies are required for logging in.”.

This is because the test cookie only gets set when you do a GET.

So doing this works:


response=client.get(login_page)
response=client.post(login_page, {'username': username, 'password': password, 'next': home_page})

But just doing the post doesn’t.

test.Client problems logging in (now fixed)

July 24th, 2008

If you’re creating a test user for a unit test, do it this way:


newuser=User.objects.create_user('john', 'lennon@thebeatles.com', 'johnpassword')

rather than this:


newuser=User(username="john",email="lennon@thebeatles.com",password="johnpassword")

The latter looks correct, but you’ll get problems logging in since Django stores the *hash* of the password in the db, not the clear text.

Another gotcha is that the client.login() function only works with pages where you can’t get at them until you have logged in – if the page is available to AnonymousUser, then login() will always fail.

‘module’ object has no attribute ‘day_abbr’

July 4th, 2008

This means you have a naming conflict between the core python module calendar and another one which is taking precendence.

If you’ve got your own module called calendar, rename it…