30 January 2010
February VanPyZ meeting at ActiveState on Tuesday
The February VanPyZ meeting will be hosted at ActiveState this coming Tuesday evening. I posted details on my work blog. Myself and Michael Grünewald will be speaking on recent ActiveState Code work and Brett Cannon will be speaking on his importers project. See you there.
"VanPyZ" is the Vancouver Python user group.
tags: activestate, code.activestate.com, python, vanpyz
0 comments14 January 2010
nice I ♥ Komodo blog post
Nice post on Komodo (comparing to other editors): Sayonara TextPad, Hello Komodo EditSo, who makes an FOSS-friendly editor for Windows with the best UI that leverages Scintilla?
In the end, I settled on Komodo Edit.
...
What clinched the deal was (a) the tour of the UI that really appeared to be thoughtfully considered by its designers, and (b) the design team which has its roots in support of Perl and other FOSS initiatives for the Windows platform. What was clear to me was that the guys at ActiveState punched away in the same languages as I did, and clearly understood what would make a best of breed coding editor, then they just went ahead and built one!
tags: activestate, komodo
0 comments30 November 2009
VanPyZ meeting at ActiveState tomorrow (Tues)
We are hosting the December VanPyZ meeting at my work (ActiveState) tomorrow night. Details:
What
Jamu Kakar: How to use Storm with a focus on some common patterns to common problems.
Doug Latornell: PyYAML, flickrapi, and TkInter in a Desktop Image Display App.
Where
ActiveState
1700 - 409 Granville Street
(SW corner of Granville and Hastings, map)
Buzzer# 1700
When
Tuesday, December 1st, at 7PM
"VanPyZ" is the Vancouver Python user group.
tags: activestate, python
0 comments17 November 2009
Small Django patch to add full traceback for wrapper exception during template rendering
Here is a patch that I'm tending to apply to my Django (currently v1.1.1) trees to give me a full traceback on the wrapped exception when getting an exception during template processing. Without this patch you only get the string summary of the underlying exception -- often far from enough info to track down the actual bug. With this patch the result isn't that pretty (a full Python traceback as the string summary of the TemplateSyntaxError), but the info sure is helpful.
Read more »tags: django, patch, programming
1 comments11 November 2009
using gmail for outbound email on Mac OS X
Why?
At work I run a number of cron jobs: web log analysis scripts, metrics
gathering, db migration for beta versions of some sites, etc. However, one
thing I've been unable to use effectively on my Mac machines 1 is
the MAILTO facility of cron. Given a foo.cron script like this:
#!/bin/sh
export MAILTO=me@example.com
export SUBJECT="do some daily stuff"
...
that is run like this:
0 0 * * * $HOME/.../foo.cron > $HOME/var/log/do-some-daily-stuff.log
any output to stderr with be mailed to "me@example.com". That is, it would if outgoing email was setup for the currently running MTA (mail transfer agent) on that machine.
How?
On Mac OS X (since Leopard, I think) the default MTA is Postfix, and Postfix's terminology for "handle outbound email" is to set the "relayhost". This post explains how to configure Postfix on Mac OS X 10.5 (Tiger). What follows is my summary of the commands -- slightly different than the other post for clarity -- plus a few thoughts. Please read the other post for extra details.
# Create `/etc/postfix/relay_password` with auth information like this:
# smtp.gmail.com YOURNAME@gmail.com:YOURPASSWORD
$ sudo vi /etc/postfix/relay_password
$ cat /etc/postfix/relay_password
smtp.gmail.com YOURNAME@gmail.com:YOURPASSWORD
# Compile this to a Postfix lookup table...
$ sudo postmap /etc/postfix/relay_password
# ... and test it.
$ sudo postmap -q smtp.gmail.com /etc/postfix/relay_password
YOURNAME@gmail.com:YOURPASSWORD
# Download the Thawte root certificates from
# <https://www.verisign.com/support/roots.html> and setup
# a certificate for Postfix.
$ firefox https://www.verisign.com/support/roots.html
$ cd ~/Downloads
$ unzip -q roots.zip
$ sudo mkdir /etc/postfix/certs
$ sudo cp ~/Downloads/Thawte\ Root\ Certificates/Thawte\ Root\ Certificates/thawte\ Premium\ Server\ CA/Thawte\ Premium\ Server\ CA.pem /etc/postfix/certs
$ sudo c_rehash /etc/postfix/certs/
Doing /etc/postfix/certs/
Thawte Premium Server CA.pem => d44d72e8.0
# Add the following lines to `/etc/postfix/main.cf`:
relayhost = smtp.gmail.com:587
# auth
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/relay_password
smtp_sasl_security_options = noanonymous
# tls
smtp_tls_security_level = may
smtp_tls_CApath = /etc/postfix/certs
smtp_tls_session_cache_database = btree:/etc/postfix/smtp_scache
smtp_tls_session_cache_timeout = 3600s
smtp_tls_loglevel = 1
tls_random_source = dev:/dev/urandom
# Re-start the Postfix service. (Note: You can also do the re-starting via
# `launchctl`.)
sudo postfix stop
sudo postfix start
# Now test this by sending email with `mail`:
$ /usr/bin/mail -s "testing 1 2 3" recipient@example.com
Howdy, from Postfix on your Mac!
.
EOT
Now recipient@example.com should have received your test email. If not
check "/var/log/mail.log". Here is a successful log message:
Nov 10 23:33:26 mower postfix/smtp[56627]: ED1265BBA2A: to=<recipient@example.com>, relay=smtp.gmail.com[74.125.155.109]:587, delay=2.9, delays=0.44/0.94/0.56/0.96, dsn=2.0.0, status=sent (250 2.0.0 OK 1257924806 20sm930503pxi.15)
Here is a failing log message (in this case because I'd incorrectly mixed using "smtp.googlemail.com" instead of "smtp.gmail.com"):
Nov 10 21:32:14 mower postfix/smtp[55593]: C028D5BB6F8: to=<recipient@example.com>, relay=smtp.googlemail.com[74.125.155.16]:587, delay=0.33, delays=0.05/0.02/0.24/0.02, dsn=5.5.1, status=bounced (host smtp.googlemail.com[74.125.155.16] said: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://mail.google.com/support/bin/answer.py?answer=14257 20sm817933pxi.3 (in reply to MAIL FROM command))
A couple thoughts
This setup requires putting your Gmail password in plaintext in
/etc/postfix/relay_password, which I'm not too happy about. So I've created a
separate Gmail account with a different password to use for this.
One of the beauties of this setup is that there is a record of all the emails that have been sent this way in that Gmail account's "Sent mail".
Update (23 Nov 2009)
Note that while I've gotten this working on my 10.5 laptop, I've been *unable* to get this working on a 10.4 Mac Pro. Initially I was getting this error (in /var/log/mail.log):
Nov 22 21:54:34 kungfu postfix/smtp[8329]: 9756661DC9F5: to=<recipient@example.com>, relay=gmail-smtp-msa.l.google.com[74.125.127.109], delay=1, status=bounced (host gmail-smtp-msa.l.google.com[74.125.127.109] said: 530 5.7.0 Must issue a STARTTLS command first. 21sm2865586pzk.7 (in reply to MAIL FROM command))
The fix for that was to add the following line to "/etc/postfix/main.cf" (and re-start postfix):
smtp_use_tls = yes
However, now I am stuck (and currenting giving up) on this error (in "/var/log/mail.log"):
Nov 22 21:56:53 kungfu postfix/smtp[8519]: warning: Only sdbm: type allowed for btree:/etc/postfix/smtp_scache
Nov 22 21:56:53 kungfu postfix/smtp[8519]: warning: Could not open session cache btree:/etc/postfix/smtp_scache
Nov 22 21:56:54 kungfu postfix/smtp[8519]: Peer verification: CommonName in certificate does not match: smtp.gmail.com != gmail-smtp-msa.l.google.com
Nov 22 21:56:54 kungfu postfix/qmgr[8516]: warning: premature end-of-input on private/smtp socket while reading input attribute name
Nov 22 21:56:54 kungfu postfix/qmgr[8516]: warning: private/smtp socket: malformed response
Nov 22 21:56:54 kungfu postfix/qmgr[8516]: warning: transport smtp failure -- see a previous warning/fatal/panic logfile record for the problem description
Note that the naively setting "smtp_tls_enforce_peername = no" in "/etc/postfix/main.cf" did not work.
-
I have a Macbook that is my main machine and a Mac Pro that is used for running most of our Komodo builds and some of the heavy log analysis scripts that I run. ↩
tags: macosx
1 comments22 October 2009
moving this blog to blogger
Meta note: I'm moving this blog to blogger (http://trentmick.blogspot.com/). Just test content there now. Hope to have that done in the next few days. If everything goes well, redirects should just make everything work.
Update: Mostly moved. Just working on redirects now.
tags: General
0 comments27 July 2009
Hannah Catherine Mick
Originally uploaded by trento.
I've been remiss in not blogging about my new daughter until now... tada! A lovely little girl. 7lb 4oz. Born on July 4th. All the appropriate bits. Everyone healthy. At times ominous hospital experience, but all good in the end. Ewan's (her almost 2 year old brother) latest thing is to kiss her on the forehead repeatedly. Big wet ones.
tags: General
3 comments