Python wrapper to take the pain out of the units command

17:04, Sunday August 22nd, 2004 • feeling relaxed • 2 comments

#!/usr/bin/python

"""Wrap the standard Unix units command but do the calculation as well.
Arguments are the amount, the from-unit and the to-unit"""

import os, sys

a = sys.argv
if (len(a) < 4):
    print "usage: convert.py quantity from-units to-units"
    sys.exit()

cmd = "/usr/bin/units"
pipe = os.popen("%s -q %s %s" % (cmd, a[2], a[3]))

try:
    numberpart = lambda x: float(x.readline().strip()[2:])
    mult, div = numberpart(pipe), numberpart(pipe)
    print "%0.3f %s = %0.3f %s" % \
            (float(a[1]), a[2], float(a[1]) * mult, a[3])

except ValueError, e:
    message = str(e).split(":")
    unit = message[len(message) - 1].split(" ")
    print "Unknown unit: \"%s\"" % unit[len(unit) - 1].strip()[1:-1]

Ahhhh ha hahaha!

5:00, Friday August 13th, 2004 • feeling webmasterly • no comments

I've been hacking heavily on InfoCMS and I'm really starting to create cool stuff now:

I'm feeling pretty chuffed now.

ISP fun

2:47, Wednesday August 4th, 2004 • feeling resigned • no comments

Had an interesting couple of hours today when Gradwell installed PHP 5 on a box they thought wasn't in the web cluster, but was. Hypothetical2 and InfoCMS emulate exceptions, so they have throw and catch functions and an Exception class. PHP 5 has real exceptions, so these words are sacred, the former being keywords and the latter being a built-in class. Needless to say some amount of chaos ensued. I rapidly updated all my live sites but in such way that I can be pretty sure I've introduced bugs.

Then later on this evening I was trying to do some stuff with the smtplib Python module and couldn't get any mail to come through. After poking about for a bit I found that it was all jamming up in my MTA queue because my Mum's ISP, Tiscali, wouldn't return anything in reponse to an MX query. I guess this is their clever way of stopping worms from running riot, but it pissed me off, so now I'm using Zen's servers instead :-).

Chocks in no way away

15:41, Monday July 26th, 2004 • feeling relaxed • no comments

We've been trying to set up a company for months now. We chose our name, Cohack, got our domain, email and web site all set up in a matter of moments. We got some leads and we're beginning to get towards making some sales. But to do this we need a company. We'd filed our forms as soon as we could, but there was a mistake. They got sent back to us, but unbeknown to us they went to our accountant, so we waited for two weeks hearing nothing. We finally ring them and they're all shirty and treat us like morons.

OK, we'll reapply. We're three people based in two cities, so getting the necessary signatures and witnessing done is a bit of effort, getting us all into one place and then seeing a solicitor so we can swear we're honest. We send the forms off again and don't hear anything for another two weeks. I ring Companies House and they tell me they haven't received the letter. We sent it special delivery on the 16th. I ring the Royal Mail. They didn't deliver it until the 24th! We paid good money for that delivery, we should really demand a refund. I ring Companies House again and they say, well, if we received it on the 24th it will take four to five days until the company is set up. Fair enough, but they can't even confirm that they did receive it!

So now we wait again. This is just shit though. Here we are trying to do our bit for the nation's economy by being all entrepreneurial and these two massive agencies basically don't have time for us, despite our paying hard cash to both of them for their services.

The postal service in this country has fallen apart, they regular fail to deliver letters for weeks at a time. This used to be something you heard about, now it happens to everybody. They can't even get special delivery right when you produce four quid hard cash. This is at a time when the workers in the service are being pushed so hard that strikes are a constant threat. It's a management catastrophe. They've completely destroyed the trust relationship they had with the nation. It stinks.

Reason Max

14:28, Thursday July 22nd, 2004 • feeling relaxed • 1 comment

With Reason, you have a virtual rack on synth and production gear. Flip it around and you can change how the rack is connected together.

With Max you build sound processes from the ground up.

What if in Reason you could not just flip the rack around but could also crack each box open and resolder it's internals, Max-style.

That would be coool.

Page 24 of 113

← previous page, next page →

Choose another page: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113 or return to the most recent entries.

Last updated at 11:32, Wednesday June 18th, 2008. All times are shown in 24-hour clock format and are BST.

Rate my journal on bloghop.com: the best pretty good ok pretty bad the worst

aftnn.orgafternoon's journal → page 24