Pirnat.com

On second thought, let’s not go to Camelot; it is a silly place

Pirnat.com header image 4

Reconciling Leopard and the Brother 5070N Laser Printer

May 8th, 2008 by Mike
RespondGravatar

Once upon a time, I upgraded to Leopard on my Mac Pro, and, though I did not mention it at the time, something in upgrade land totally pissed off my Brother 5070N laser printer.

I’d bought the printer in the first place because it was one of the first to support Bonjour (née Rendezvous, née Zeroconf) networking. With good ol’ Tiger, it Just WorkedTM, and all was milk and honey as far as printing went in my home. But noooo, it didn’t like the hoity-toity, super-duper-greatest-thing-since-sliced-bread Leopard attitude, and just spat out endless reams of cryptic stack dumps instead of, say, directions to wherever I was in a hurry to leave for. I poked around a little, checking for new drivers and all that sort of common sense stuff, and found that even Brother’s website claimed that the drivers were bundled with Leopard and that there was nothing for me to download.

I never did get around to figuring out the problem at the time, and being a sleep-deprived and very busy new dad it unfortunately hasn’t been much of a priority. Somehow I’ve learned to live with six months (!!!) of not being able to print a damn thing. And worse, I’ve had to hold off on upgrading my wife’s machine, which has kept her from being able to enjoy the goodness of automated Time Machine backups.

I finally got fed up with it today and decided to finally sort things out once and for all. I even indulged my inner noob and followed Brother’s directions, even though it meant assigning a static IP to my printer and dropping it back from the awesomeness of Bonjour to the semi-awesomeness of old-school IP printing. It turns out that, even though no one says it anywhere, that was the key. So, here’s a bit of advice for future Googlers: the 5070N will not print correctly using Bonjour under 10.5. You want the CUPS driver and the “HP Jetdirect - Socket” protocol. Then poof! It’s all happy again.

Now to go about breaking upgrading Liz’s laptop…

Tags: computers  geekery  macintoshLeave a Comment Print This Post

links for 2008-05-07

May 7th, 2008 by Mike
RespondGravatar

Tags: UncategorizedLeave a Comment Print This Post

links for 2008-04-26

April 26th, 2008 by Mike
RespondGravatar

Tags: UncategorizedLeave a Comment Print This Post

Hopefully Minimizing Wheel Reinvention

April 23rd, 2008 by Mike
RespondGravatar

Dear Lazyweb:

I have a number of programming itches that I’d like to scratch that are just slightly large enough that I’d really love to just use something that already exists (if available). I’d spend a while digging around, but, well… I’m lazy, and I’m busy. So hopefully some of you have suggestions. I am looking for:

  • an MSN Messenger client library (preferably in Python)
  • a Twitter client library (preferably in Python)
  • a solution for cross-posting between LiveJournal and Wordpress (either direction) that supports (or could be made to support with a minimum of pain) multiple LJ blogs on one end and multiple WP users on a shared blog (not that my wife really posts that much any more) on the other
  • a hosting provider that’s friendly to IM bots and is affordable (for some value of “affordable” that I have yet to precisely define, but which in all likelihood simply means that it won’t cause marital unrest)

I may award bonus points if the MSN and Twitter suggestions are both written against Twisted. I know Twisted’s got some MSN support, but I’ve not looked into it too closely and was a little disappointed by the state of the official docs and examples.

I currently host with WebFaction and though I’m normally entirely satisfied with them, I seem to recall that at one point they frowned on running IM bots on their shared hosting platforms, although I can’t immediately find anything expressly prohibiting it in their terms of service, AUP, knowledgebase, and support forums.

Thanks in advance!

Tags: geekery  python2 Comments Print This Post

Wait, How Old Is My Kid Again?

April 22nd, 2008 by Mike
RespondGravatar

The thing about being a relatively new parent is that life very quickly becomes a complete blur, and after a certain point you’ve no sense of what day it is, let alone how many weeks old your little bundle of joy is. This makes life tricky, since there are certain milestone weeks that are usually the harbingers of sudden shifts into higher levels of fussiness and sleep regression.

So what’s a frazzled dad to do?

Well, I do have Python, and I seem to have Google Reader open an awful lot, and cron jobs are a lot better at remembering to do things than I am… So here’s my fifteen-minute solution that I whipped up the other week in between putting Claire down for her morning nap and getting ready for work. (File names and URLs have been changed to protect the innocent.)

#!/usr/bin/env python
 
import datetime
from dateutil.rrule import rrule, DAILY, WEEKLY, MONTHLY
import PyRSS2Gen as RSS2
 
# You'll want to change all of these values, obviously...
KID_NAME = u'Claire'
BIRTHDAY = datetime.datetime(2007, 9, 10, 21, 57)
FEED_URL = 'http://yoursite/kids_age.xml'
FILENAME = 'your_path/kids_age.xml'
 
def periods_between(freq, start_date, end_date):
    rr = rrule(freq, dtstart=start_date)
    periods = len(rr.between(start_date, end_date))
    return periods
 
def format_entry_body(months, weeks, days):
    body = """<h1>Today, %(kid_name)s Is...</h1>
    <ul>
        <li>%(months)s months</li>
        <li>%(weeks)s weeks</li>
        <li>%(days)s days</li>;
    </ul>
    <p>They grow up so fast!</p>"""
    kid_name = KID_NAME    # so we can cheat with locals()
    return body % locals()
 
def make_rss(body):
    now = datetime.datetime.now()
    # Add a hash component to the item link so that the RSS reader
    # will recognize this as today's new entry...
    item_url = FEED_URL+'#'+now.strftime('%Y%m%d')
    rss = RSS2.RSS2(
        title=u"How Old Is %s?" % KID_NAME,
        link=FEED_URL,
        description=u"How old is %s in months, weeks, and days" \
            % KID_NAME,
        lastBuildDate=now,
 
        items = [
            RSS2.RSSItem(
                title=u"How old is %s today?" % KID_NAME,
                link=item_url,
                description=body,
                guid=RSS2.Guid(item_url),
                pubDate=now,
            )
        ]
    )
    return rss
 
def to_xml(rss):
    xml = rss.to_xml()
    # Make our xml at least a tiny bit human-readable
    xml = xml.replace('><', '>\n<')
    return xml
 
def main():
    now = datetime.datetime.now()
    months = periods_between(MONTHLY, BIRTHDAY, now)
    weeks = periods_between(WEEKLY, BIRTHDAY, now)
    days = periods_between(DAILY, BIRTHDAY, now)
    body = format_entry_body(months, weeks, days)
    rss = make_rss(body)
    xml = to_xml(rss)
    f = open(FILENAME, 'w')
    f.write(xml)
    f.close()
 
if __name__ == '__main__':
    main()

You will, of course, have to install dateutil (via easy_install) and PyRSS2Gen (the old-school tarball way) so that they can do the heavy lifting for you.

Then all that’s left is to cron it to run daily, and point your favorite RSS reader at the feed. Voila! You’re on top of exactly how old your kid is, and quickly on your way to becoming Parent of the Year.

Tags: children  claire  geekery  python6 Comments Print This Post

links for 2008-04-18

April 18th, 2008 by Mike
RespondGravatar

Tags: UncategorizedLeave a Comment Print This Post