First ride of the year (yes, #lazy #fatbastard #slacker)

Part of my recovery from the meniscus op has been to go riding. It’s the part which I’ve been least successful at so far, but which I am determined to do more of. For starters, I need to lose at least 7kg, and I want to lose 15kg, to get me down to the 74-75kg range. When I get back to 80kg I’ll be able to fit into my suit, and more importantly, be able to wear some really awesome tailored Italian shirts I got in Firenze during our trip in 2005. There’s also a nice tailored jumper from Paris that I want to get back into come winter..

Then there’s the small matter of the Bicycle Queensland annual Coottha Challenge. I missed out last year because I was playing safe just before the arrival of A. This year, however, I will be doing that ride.

So yes, I’ve got motivation to get on the bike.

I was going to head off for a city ride via Dewar Tce at 7am, but A’s teething meant we were awake at 11pm and from 2-3, a rather rotten night. Managed to get out the door by 0830 when the temp was starting to rise, and rather than add the extra 10km of going via Sinnamon Park and Seventeen Mile Rocks Rd, I went along Ashridge Rd in Oxley.

While I appreciate the reasoning, I was mightily annoyed to see the traffic calming stuff at the intersection of Dewar Tce and Hilda St. Prior to today I’ve been able to get up to about 60km/h, but today … a mere 31.7km/h. Booooo.

I managed to get to my favourite cafe, Cup by about 10 – it was packed. It’s a small business which has been going for just on 3 years, and while I don’t like that sometimes I have to wait for my coffee I remind myself of the bigger picture – more customers points to operational longevity which points to it being there when I want a single origin expertly poured coffee.

From Cup I went through the Southbank Parklands where the artificial beach was packed full of screaming littlies, across the Goodwill Bridge and back home via the Bicentennial Bikeway. The work that Brisbane City Council has done on the Hale St East upgrade is tremendous, and it was a delight to ride back home. (Next time I’m going along that way I’ll try to get some pics to post).

It was also a delight to be able to hop in the pool with the family when I got back. And since today is proving to be so hot, we might have another dip before dinner, too.

Summary, via my Garmin 705:

  • Distance 51.97 km

  • Time 2:30:56

  • Average Speed 20.7 kph

  • Calories 2,363 C




Multiple recipients with Python’s smtplib sendmail method

I’m currently the defacto maintainer for the Solaris 11++ gate tools, and recently found a need to add support to our mail utility for sending to multiple recipients. We use the mail utility from most of our Mercurial gatehooks so we can notify Relevant People(tm) when things happen.

TL;DR – skip to the Summary

Anyway, my first cut of the change didn’t work, even though the debug log seemed to show the right stuff:

lib $ ./mail.py -n -s "This is a test, please to be ignoring" -x "nofilter" -r jmcp -T alan@domain,valerie@domain,bart@domain
This is yet another test, this time with text in the body.
jmcp
.
send: 'ehlo localhostname\r\n'
reply: '250-localhostname Hello localhostname [myIPaddr], pleased to meet you\r\n'
reply: '250-ENHANCEDSTATUSCODES\r\n'
reply: '250-PIPELINING\r\n'
reply: '250-EXPN\r\n'
reply: '250-VERB\r\n'
reply: '250-8BITMIME\r\n'
reply: '250-SIZE\r\n'
reply: '250-DSN\r\n'
reply: '250-ETRN\r\n'
reply: '250-DELIVERBY\r\n'
reply: '250 HELP\r\n'
reply: retcode (250); Msg: localhostname Hello localhostname [myIPaddr], pleased to meet you
ENHANCEDSTATUSCODES
PIPELINING
EXPN
VERB
8BITMIME
SIZE
DSN
ETRN
DELIVERBY
HELP
send: 'mail FROM:<jmcp> size=264\r\n'
reply: '250 2.1.0 <jmcp>... Sender ok\r\n'
reply: retcode (250); Msg: 2.1.0 <jmcp>... Sender ok
send: 'rcpt TO:<alan@domain>\r\n'
reply: '250 2.1.5 <alan@domain>... Recipient ok\r\n'
reply: retcode (250); Msg: 2.1.5 <alan@domain>... Recipient ok
send: 'data\r\n'
reply: '354 Enter mail, end with "." on a line by itself\r\n'
reply: retcode (354); Msg: Enter mail, end with "." on a line by itself
data: (354, 'Enter mail, end with "." on a line by itself')
send: 'From: jmcp\r\nTo: alan@domain, valerie@domain,\r\n\tbart@domain\r\nSubject: This is a test, please to be ignoring\r\nX-gate-filter: nofilter\r\nX-gate-script: ./mail.py\r\n\r\n\r\nThis is yet another test, this time with text in the body.\r\n\r\njmcp\r\n..\r\n.\r\n'
reply: '250 2.0.0 q050HwfD015209 Message accepted for delivery\r\n'
reply: retcode (250); Msg: 2.0.0 q050HwfD015209 Message accepted for delivery
data: (250, '2.0.0 q050HwfD015209 Message accepted for delivery')
send: 'quit\r\n'
reply: '221 2.0.0 localhostname closing connection\r\n'
reply: retcode (221); Msg: 2.0.0 localhostname closing connection

There’s only one rcpt in that output, which isn’t what I wanted at all.

After much re-reading of the python library pdf I realised that I needed to add the recipients as a list, rather than a string. One quick mod later and I was adding elements correctly – or so I thought. Having an actual list in the email headers made the email.Message.as_string() method die horribly. Back to the drawing board.

I eventually realised that I should use the email.Message.add_header() method instead of the lazy shorthand of just appending to msg['To']. That got the right headers added and email.Message.as_string() didn’t die any more. However, calling

connection.sendmail(self.msg['From'], self.msg.get('To'), self.msg.as_string())

still only gave me one recipient. Fortunately, there’s email.Message.get_all(), which does what I want.

Summary

So the summary is this: If you want to use smtplib to send email to multiple recipients, use email.Message.add_header('To', eachRecipientAsString) to add them, and then when you invoke the sendmail method, use email.Message.get_all('To') send the message to all of them. Ditto for Cc and Bcc recipients.

For the curious, here’s a link to the diff of the lib/mail.py changes




A few blog posts I’ve found interesting in the last few days

Before I forget, I’d like to mention a few blog posts that I’ve come across recently which I think deserve a wider audience:

One teachers approach to preventing gender bullying in a classroom.What this teacher did for her students is truly inspiring.

Why I flipped off “Kiss Cam” at the Boxing Day TestFor a long time now the game of Cricket as managed by Cricket Australia and the ICB has made me despair for the future of the game. Placing advertising on everything that moves is bad enough, but Twenty-20? Can’t Stand It(tm). Add to that the arrogance displayed by the Australian team and you’ve got a real turn off. Reading Megan’s post about the “kiss cam” made me wonder WTF Cricket Australia and their sponsors were thinking. Were they thinking at all? With their small heads? Sadly, but unsurprisingly, about half of the comments attached to Megan’s post display a lack of understanding about why the “kiss cam” is a bad thing for Cricket, and sport in general.

The insecure, unfulfilled life of the true scepticTeaching children to think for themselves, and to nurture their critical faculties while doing so, is one of the best things a teacher can do for a student. I’ve always had teachers who insisted that I think for myself, and showed me how to winnow the chaff. If your child’s teachers aren’t doing that, then your child is missing out on essential life skills which are even more important now (with digital natives, like my kids) than they were when I was at school and could still find an encyclopedia on the library shelves.




Apologies for all the duplicate posts

Firstly – sorry about all these duplicate posts, it seems to be a necessary evil from the RSS reader point of view, since my feed url has changed. The good news is that there shouldn’t be too many more of them….

I’ve been pulling in my old Roller posts using http://codex.wordpress.org/Importing_From_Roller and the Movable Type importer (http://codex.wordpress.org/Importing_from_Movable_Type_to_WordPress), but I noticed that while everything imported “ok” nothing was showing up in my list of published posts.

Most annoying. After approving all the comments that were associated with those posts, ~30 posts were then publishable, but that still left around 250 to finagle.

15 minutes ago I got sufficiently annoyed (after reading this forum post) that I decided to update the db by hand. Ha!

So after a quick mysqldump of the wordpress tables + content, I ran this sequence:

mysql@mailzone:~$ /usr/bin/mysql -u $myWPusername -p
[enter passwd]
mysql> select ID,post_type,post_status from wordpress.wp_posts where post_type="post";
+-----+-----------+-------------+
| ID  | post_type | post_status |
+-----+-----------+-------------+
| 310 | post      | 1           |
| 311 | post      | 1           |
| 312 | post      | 1           |
|  28 | post      | 1           |
|  29 | post      | 1           |
|  30 | post      | 1           |
...
|   3 | post      | auto-draft  |
|  21 | post      | auto-draft  |
| 457 | post      | auto-draft  |
|  35 | post      | publish     |
|  59 | post      | publish     |
|  71 | post      | publish     |
|  96 | post      | publish     |
...
|   1 | post      | trash       |
+-----+-----------+-------------+
291 rows in set (0.00 sec)

Checking my roller database dump, I noticed it had “STATUS: 1″ for each post, which the MT importer clearly plonked verbatim into the mysql table. Now it was time for the surgical strike:

mysql> update wordpress.wp_posts SET post_status="publish" where post_type="post" and post_status=1;
Query OK, 256 rows affected (0.10 sec)
Rows matched: 256  Changed: 256  Warnings: 0

mysql> commit;Query OK, 0 rows affected (0.00 sec)




I’m not Arthur “Two Sheds” Jackson

..... although like Arthur[1], I do now have a shed.

J ordered a garden shed from cheapsheds.com.au in November; it arrived after my fortnight off in November so I didn’t get it constructed and installed until today. I managed to get the paving done during my holiday (paver 2nds from Centenary Landscaping just up the road were $18/sqm, rather than Bunnings’ $4 per paver, and sand at $4/40kg), then it was just a matter of finding a few spare hours when we didn’t have pre-Christmas stuff. That turned out to be today

:-)

My mate Leighton was able to come over and help, so from start to finish the shed assembly took a little under 4 hours. Definitely a two-man operation, especially when putting the panels together, there were a few tiny holes to line up in sheet metal when screwing the corners together. His extra height (10cm) helped with the screws from the roof into the top of the sides, too. I would have needed a ladder.

This is the back panel:

Shed back panel assembled






Up and running with Roller v5

It’s been bugging that I haven’t updated my Roller Weblogger instance from 4.0.1 to 5.0 – the “new” version is now a year or so old. Bit the bullet this evening and ran through the steps needed:

  • unzip archive and unjar the war file

  • create webapp/WEB-INF/classes/roller-custom.properties

  • edit relevant parts of the roller-custom.properties file

  • add postgresql.jar and the Javaxmail.jar to webapp/WEB-INF/lib




We’re in a holding pattern

Today we went to see a neurosurgeon about J’s tumour. He was quite pessimistic about the side effects of the possible surgical approaches, which is a complete contrast to the ENT surgeon we saw a few weeks back. He told us to come back in 6 months after another MRI and just wait it out. We’ll go and see a radiosurgeon in mid January to get his opinion about whether that would be a better option than cutting open her skull, however it’s all very very draining. J’s spent all of the afternoon in tears – she was mentally better prepared for the neuro to say “I can fit you in tomorrow, see you at 7am” instead of “come back later.” So we’ll wait and see. We were hoping to get surgery done in April anyway, so another 2-3 months isn’t too long a wait. It does, however, mean that she’ll have to put up with the symptoms for longer. The benefit, though, is that we’ll get more time to evaluate the risks of the possible options.




Marriage Equality: the scurrilous backlash has started

I live in the Queensland electorate of Mt Ommaney (pdf map). Our local member is Julie Attwood. In today’s junkmail delivery was this flyer:

Marriage flyer (front)Marriage flyer (back)

I sent a submission in to the recent Civil Unions bill expressing my support for that bill. I am delighted to see that my local MP’s vote on both Civil Unions and Surrogacy was enough to pull the knuckle-dragging homophobes out of the woodwork. The flyer comes from the Australian Marriage Forum, which describes itself with these words:

We are people and organisations who are concerned at how advocates are pushing for same-sex marriage without really presenting the reality of what this means for our nation. Two of the founding organisations are the Australian Christian Lobby and the Australian Family Association.It’s important to note that legislation to support same-sex marriage may have enormous consequences on our culture and we want to bring those concerns to the fore so we can be open and honest about what we really need and want when it comes to defining marriage in our nation.

One thing that I am certain of is that neither the ACL or AFA actually want to have an “open and honest” discussion about marriage, because that would mean accepting that a sizeable majority of the voting population of Australia believe same sex marriage is a good, necessary, compassionate and loving idea.

One other thing of note: the flyer mentions a .org.au website, but redirects you to a plain .org instead. I’m not certain that they’d be allowed to use a legitimate .org.au domain under current AuDA rules.