Django vs feedparser on dates

by garth on September 1, 2007

I'm having trouble storing feedparser results in a Django model.

It's all about timestamps. Feedparser returns timestamps in a standard time nine-tuple, asserting UTC. Django wants datetime objects. So, I'm trying to translate:

django_timestamp = datetime.datetime.fromtimestamp(time.mktime(feedparser_timestamp))

feedparser_timestamp = django_timestamp.utctimetuple()

This works fine for the majority of timestamps, but sometimes translating to datetime and back mutates the timestamp. In turn, that makes get-if-modified-since somewhat unreliable. Here are some examples, from my log file:

WARNING: (2004, 11, 19, 5, 13, 31, 4, 324, 0) => datetime.datetime(2004, 11, 19, 6, 13, 31) => (2004, 11, 19, 6, 13, 31, 4, 324, 0)

WARNING: (2005, 11, 2, 2, 17, 55, 2, 306, 0) => datetime.datetime(2005, 11, 2, 3, 17, 55) => (2005, 11, 2, 3, 17, 55, 2, 306, 0)

WARNING: (2006, 12, 13, 0, 21, 25, 2, 347, 0) => datetime.datetime(2006, 12, 13, 1, 21, 25) => (2006, 12, 13, 1, 21, 25, 2, 347, 0)

WARNING: (2004, 11, 14, 23, 55, 31, 6, 319, 0) => datetime.datetime(2004, 11, 15, 0, 55, 31) => (2004, 11, 15, 0, 55, 31, 0, 320, 0) 

I'm off by an hour. I smell a problem with daylight savings. I just wish I knew what to do about it. 

I've waved a dead chicken at this one all the ways I know how. Every change I make breaks the conversion entirely. So, I'm throwing this out to the community in the hope that someone can help me. 


Push the tempo?

by garth on August 27, 2007

I'm much more likely to post to Twitter, Tumblr and Facebook than here. The environments are pleasantly slack: I don't feel like I have to write masses of highly insightful prose. 

Today, I noticed another key factor: their tools are optimised for speed of posting. You can tweet or tumble as fast as you can send an instant message. For whatever reason, I feel a lot more drag than that when trying to post in WordPress. 

I've installed TIQPWP to see if it helps. Already, I've noticed one thing I like: when I hit Enter, I get a new paragraph rather than a line break. 

Result so far: first post in a billion years. Well, a month. Whatever.  

[Django Community Blog subscribers: if you see this, the administrator hasn't yet updated my feed. Sorry about that.]


by garth on August 2, 2007

My web host just rang me to ask me to upgrade WordPress. Some benefactor of humanity had used a hole in WordPress to turn his web server into a spam-bot, and he was going to get black-holed any minute. Rather than turn me off entirely, he rang me. How's that for customer service? I sincerely doubt I'd get that from, say, GoDaddy. 


Rules of H

by garth on May 11, 2007

  1. Put all the cards on the book brochure, lining them up with pictures of books.

  2. Willow picks two cards.

  3. Dad picks the other two.

  4. Each player takes turns. Willow goes first.

  5. In each turn:

    a) Put down a card on a picture of a book.

    b) Say "H" if it's a big book, or "Chok" if it's a small book.

  6. When everybody has put down their cards, everyone sticks their hands in the air and says "Jor! I won!"

    ("Jor" means "I'm first!")

  7. Every day, we like to play H.

{ 1 comment }

Fix: Python Script Arguments Not Passed

by garth on May 4, 2007

On Windows, you can run a Python script on the PATH simply with its name. These should be equivalent: 

c:>congeal blood

c:> blood

c:>python blood

If it's not working that way, fixing PATHEXT and correcting the file type associations with ASSOC and FTYPE will usually do the trick: 


c:>ftype Python.File="C:Python25python25.exe" "%1" %*

c:>assoc .py=Python.File

If that still isn't working, try deleting the following registry key:


There's plenty of advice about PATHEXT, FTYPE, and ASSOC, but none of the search terms I tried dug up the registry key. I knew there had to be one, because giving FTYPE silly arguments didn't stop the script from being executed. I found the registry key by brute-force searching the registry for .PY. I'm posting this so that someone else can save that hour of hassle.


Apple TV: good luck plugging it in!

by garth on March 31, 2007

If only I'd been following The Register: my shiny new Apple TV lacks any outputs compatible with older televisions. It outputs HDMI or component video; my Grundig takes RGB or composite over SCART.

If Apple TV had an S-Video port, I'd be fine. It doesn't. I'm not.  

For only an extra AUD$150-250 depending on model, I can buy a converter and have it shipped from the UK. Or, I can spend AUD$2,200 on an A/V receiver that can do the trick. Or, I can spend thousands replacing my fantastic looking cathode-ray tube TV with an expensive flat panel that still won't look as good for standard definition television.

Or, I could just return the bastard.

* * *

Keene Electronics have an Australian stockist. Hope hope. 


Idolising Children

by garth on March 21, 2007

Daniel Donahoo is a top bloke. He's just written a book called Idolising Children (that'd be Idolizing Children to you in the USA), in which he calls us to end "frantic over-parenting". We're trying to hold ourselves or others to insane standards of perfection in parenting. That's as silly as being dissatisfied looking in the mirror if we don't match the airbrushed models on the covers of magazines.

(More insidious, to me: the stress we're putting ourselves under is probably leading to health and mental health impacts well capable of undoing any extra effort we manage to put in. Those effects are probably as much on the kids as on us. Oops!)

I'll leave more ranting until I've finished reading the book. 


GTD, the half-life, and the fire-hose

by garth on February 19, 2007

I had the good fortune to attend GTD | The Roadmap in San Francisco the other week. If you're still not Getting Things Done after reading the book, join Connect and get the Roadmap discount. Or, attend Roadmap and get the Connect discount. Either way, you spend a day with David Allen and gain access to some fantastic audio and printed content. 

David warned that when we left, the Half-Life of Seminar Enthusiasm would confront the Fire-Hose of Reality. After two or three weeks of the fire hose, I'm happy to report that I'm still better off for having attended Roadmap. I still haven't made it all the way through a review without being interrupted, but the rest of my system is working better than ever.  

First of all, I've abandoned ResultsManager. I paid full price for it, but after a year of thrashing it still wasn't working for me. Its ability to gather tasks from a billion and one MindManager maps is nothing short of miraculous. If you haven't got GTD down pat, though, I predict you'll get lost in ResultsManager's twisty, turny maze of passages, all alike. Spend that USD$285 on half of Roadmap, instead.

Instead, I manage everything in Outlook tasks. One task per next action, one task per project. Not all actions have a project, but all projects have one to many actions. I copy the action description back to the project note to help me keep track. In a prior life, I'd have ranted and wailed and gnashed my teeth at the sheer inefficiency of it all. Compared to the effort of managing purpose-built task management software, however, this is a cake and it's working.

If I forget the double-entry, I pick it up later. Sometimes, I don't bother: the linkage is entirely optional. Many GTD practitioners report that they simply remember the linkage if they're doing their weekly reviews often enough. Say, weekly. 

Everything is mirrored from my PC to KeySuite on my Treo. One or both are always a little out of date. If that itches, I simply HotSync. I've dropped from several times a day to once or twice, which brings most things within range of memory. 

Best of all since Roadmap, I've experienced inbox zero. I got it that way by dragging my old not-entirely-processed mail into an Old Mail folder. You might think that's cheating, but it's still zero. The paradox is: you have to experience it before you want it hard enough to get there. So, cheat! If the thousands of stale messages bother you, schedule some processing stints for later. 

There's nothing quite like surrounding yourself with people who're better at something than you are. I soaked up more tips and tricks in the breaks during Roadmap than in a year of hunting for them on the 'net. All told, I'm bloody happy I attended.

{ 1 comment }

In search of the perfect computer desk

by garth on January 4, 2007

I need a desk with:

  • A gutter up the back for cables;

  • Enough width for my two monitors;

  • Enough room underneath for two computers and a subwoofer; and

  • Hopefully some magic shelfy thing for the printers, etc.

I'm about to head to Ikea.

I dread Ikea.

If anyone has any better ideas, I'd love to hear them.


Diskeeper Corporation’s philosophy in regards to Technical Support is to service you as near-instantly as possible.

For four days, I've been trying to get the product I paid for. I still don't have it. Diskeeper's karma has, I'm afraid, run over its dogma.

When you buy Diskeeper online, you don't get a link to the product. Rather, you get a link to a download application. The application is supposed to download Diskeeper for you. Unfortunately, for me, it doesn't work: it complains that there's no connection to the Internet, then crashes. Every time.

The receipt email links to a FAQ entry titled "I am having trouble downloading; What should I do?", which tells you how to avoid problems downloading the little downloader application. It doesn't solve problems with the downloader itself. The fall-back advice at the end reads:

If you continue experiencing problems with the download, please respond by including a screenshot of the problem is possible. This will help us assist you to get your product.

There are three identical looking "This didn't help" buttons on the page, each after different re-writes of the same advice (disable firewalls; delete your IE cache; fix your security settings; and make sure you got your link right). The first sends email to [email protected] The second links to the technical support form. The third, which I clicked, sends email to [email protected]

I sent the mail my Monday afternoon, ready for the USA's Monday morning. Diskeeper's "near-instant" response turned up their Wednesday morning. Sadly, they'd ignored the screenshots they'd asked for. Instead, I was directed to the technical support form. I filled in the form at noon PST, three hours ago.

Whilst I wait for Diskeeper's "near-instant" response, I'd like to offer them some advice based on the best practice I've experienced buying other software online:

  1. Get the downloader right. You're trying to improve your customer experience. The downloader had better be good.

  2. Give a direct download link in the receipt email. Every other downloader I've encountered has been accompanied by a direct download link in case the downloader failed. Oddly enough, all those downloaders worked fine.

  3. Include the product key in the mail, so customers can activate their trial version if they can't download the full version. The trial download used a direct download link and worked first try. If I knew my key, I'd be up and running now.

  4. Link to the trial version download page from the "I can't download!" FAQ entry, just in case.

  5. Make those identical buttons behave identically. It was only when I went back and studied the FAQ entry that I realised that the three buttons had different functions. Re-reading the content, I still can't figure out why they're different. I understand the need for different "that worked!" buttons so you can track the results. There should be only one "I still can't do it" button, though.

  6. State realistic support response times on the support form. If you're not staffed for "near-instant", don't claim it. You're better off to tell people it'll take four days and be right than claim it's instant and then have them wait that long.

  7. Raise the support case yourself if someone emails you all the details you need. I had to fill in my details once to buy the product. As you asked in their web page, I sent you all the problem details with screen shots. Instead of connecting the dots, you asked me to go to another form and repeat both sets of information.

  8. Register support accounts at the time of sale. You have the information, Diskeeper. Use it.

  9. Send an email to confirm that a case was raised. I'm still waiting for such a mail. Every other company sends one. Maybe there's a technical problem holding the mail up, but given the rest of the situation I'm not going to hold my breath waiting for it.

  10. (bonus!) When you send a license file, include instructions. More detail on that one below, in the updates. 

  11. (bonus #2!) If Diskeeper is happily licensed, disable the Registration menu item. With the license file in the same directory as the installer, Diskeeper will be properly licensed but won't give you much of an indication that you can stop worrying. Why leave customers to worry?

I think I'll give Diskeeper another week, then ring Visa and cancel the transaction.

Two days later: Diskeeper's webmaster reacted faster than Diskeeper's support department, despite having to spot a random blog post rather than check the queue on the official support form. He or she knows how to apologise, and asked for my purchase order number so s/he could fix the situation.

I'll let you know if Diskeeper's actual support personnel ever get back to me. Y'know, the people paid to do it. 

Another four days later: Diskeeper's webmaster wrote to inform me that "[the] download issue that you are experiencing is one we are aware of and are currently working on correcting", and attached a license file. The download trouble FAQ still doesn't mention the problem, though. 

What to do with the license file isn't entirely clear. Webmaster said to download both files to the desktop and then run the installer, so I did that. I poked around trying to get the license key, and ended up forcing an activation of some sort online. The "Enter License Key" menu option is still present and live. 

If it turns out Diskeeper is still in trial mode and expires, I'll certainly mention it. If not, I guess this gets me up and running. That's nice enough for me, but I sincerely hope for Diskeeper's employees and shareholders' sakes that they fix the problems before they affect more customers. 

Later still: Webmaster tells me the license file will have worked. I've added another bonus item.

Yet later still: I'm online for the first time in days. Other Diskeeper personnel have been in touch to check that everything's OK. One even found my mobile number somewhere. I'm delighted to see some professional fire-fighting in action. I also hope they can make some simple changes to prevent the need for fire-fighting in the future.

(I posted those last two items at the same time. I made them separately because Diskeeper's anonymous Webmaster deserves credit for yet another rapid response.)