Deadly Bloody Serious


Default arguments in Python: two easy blunders

Posted in Django, Misc, Python by garth on the May 9th, 2008

I’m glad I stumbled across Patrick Altman’s tweet about a “default bug in Django“. I’d never have guessed you can pass a callable to a field’s default= argument, otherwise. That’s quite a powerful idiom, and I think I’ll use it a lot.

To balance the karma, I’d like to post a quick reminder to everyone else that expressions in default arguments are calculated when the function is defined, not when it’s called. In Patrick’s code, for example, all objects created in the same running session got the same timestamp. Try this in the Python interactive prompt:

>>>import time
>>> def report(when=time.time()):
…     print when
…
>>> report()
1210294387.19
>>> time.sleep(5)
>>> report()
1210294387.19

Until the interpreter quits, you’ll always get the same timestamp. The correct way to go about this is to default to None or some other sentinel, then replace it inside the function:

>>> def report(when=None):
…     if when is None:when = time.time()
…     print when
…
>>> report()
1210294762.29
>>> time.sleep(5)
>>> report()
1210294772.23

Now that you know about that blunder, you should be able to figure out what’s going on with this second classic blunder when using default arguments in Python:

>>> def spam(eggs=[]):
…     eggs.append(”spam”)
…     return eggs
…
>>> spam()
['spam']
>>> spam()
['spam', 'spam']
>>> spam()
['spam', 'spam', 'spam']
>>> spam()
['spam', 'spam', 'spam', 'spam']

Twitter’s Famous Last Words?

Posted in Misc by garth on the May 2nd, 2008

Just before Twitter went completely dark, I saw this:

last words

I’m sure it’ll be back up soon, but ’twas nice to have a laugh before hitting the sack.

(Speaking of irony: I have 666 unread items in my feed reader’s Productivity folder…)

Admiral Sir Reginald Aylmer Ranfurly Plunkett-Ernle-Erle-Drax

Posted in Misc by garth on the September 4th, 2007

Yep. Quadruple-barrelled.

I always wondered what'd happen if one double-barrelled person married another double-barrelled person. Reg Drax here seems to be Exhibit A. 

Our kids are double-barrelled. To save them from Reg' fate, we carefuly chose their middle names so they could ditch the two surnames entirely if necessary. 

Thanks, Merlin! 

0wn3d

Posted in Misc, Wordpress by garth on the August 2nd, 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. 

In search of the perfect computer desk

Posted in Geek, Misc by garth on the January 4th, 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.

Nine Ways to Improve the Diskeeper Download and Support Experience

Posted in Misc by garth on the December 7th, 2006

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 webmaster@diskeeper.com. The second links to the technical support form. The third, which I clicked, sends email to service@diskeeper.com.

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.)

How noisy are Australian bloggers, anyway?

Posted in Misc by garth on the November 22nd, 2006

According to buggerall, I’m the 85th most noisy blogger in Australia (but less than 3% as noisy as Darren “ProBlogger” Rowse). Extracting the top 100…

Australian Blogger Rankings: Noise vs Rank (Top 100)

That’s me, at the right. Here’s the graph of all 923 entries, though:

Australian Blogger Rankings: Noise vs Rank (Top 923)

There’s your classic power law, as you no doubt expected.

For the time being, I can bask in the knowledge that there are at least 84 Australian bloggers noisier than I am. With luck, I’ll slide even further once the rest of the Australian bloggers rush to secure their ranking by registering at buggerall.

(Nice buzz generation exercise, fellas. Onya.)

PayPal Spring Fling: Surprise!

Posted in Misc by garth on the October 21st, 2006

I’m still shaking my head at this one: Zoe got mail from PayPal telling her she’d won $50 in their Spring Fling competition, and as near as we can make out it wasn’t a phishing attempt.

Good signs include:

  • The link from the mail is to https://www.paypal.com/, not some random IP address;
  • IE verified the certificate; and
  • Zoe subsequently logged into her PayPal account from a fresh browser and saw the $50.

On the other hand:

  • There’s no mention of the competition anywhere on PayPal’s site; and
  • There’s no result in Google.

Whilst I’m delighted that Zoe apparently won some cash, I’ve still got an odd itch between the shoulder blades…

Del.icio.us 1, FeedBurner 0

Posted in Misc by garth on the October 4th, 2006

(If you actually browsed to my site to read this, you don’t need to read this. Oh, the irony!)
I was hoping to post to let my feed subscribers know that I’ve taken my del.ico.us bookmarks out of my feed, but the poor lads at FeedBurner are having trouble again:

java.lang.OutOfMemoryError: unable to create new native thread

Aah, well. I’ll do it soon enough. In any case: if you want my bookmarks to keep rocking up, you’ll need to subscribe to their feed directly.

Rebooting…

Posted in Misc by garth on the September 13th, 2006

I’m rebooting my blog on new software. I’ll explain more later….


Bad Behavior has blocked 2370 access attempts in the last 7 days.