WordPress hooks

I wanted to configure the “From” email address that WordPress uses when emailing password resets. The way to do this is with a WordPress hook, specifically a filter hook in this case. So, in wp-config.php I added the following code:

add_filter( 'wp_mail_from', 'pcblog_mail_from' );
add_filter( 'wp_mail_from_name', 'pcblog_mail_from_name' );

function pcblog_mail_from() {
  return 'pcblog@progclub.org';
}
function pcblog_mail_from_name() {
  return 'ProgClub blog';
}

Empowerment

This theme has sprung into my head a little over the past few weeks, as I’ve just started a club with a view to “empowering” programmers, and it’s apt that I reflect on what that means. So, while I smoke my cigarettes, it’s one of the things I think about. And, as I’ve been thinking about it, I’ve had a few thoughts! Go figure.

Anyway, this is still all a little rough, and this post is only my first step in solidifying these thoughts, but here they are.

Traditionally I’m a “Microsoft” programmer. The other kids used to tease me about it. Actually, I copped it at each end, because all the other Microsoft programmers used to tease me and call me a bleeding heart open-source sympathising commie. There’s no winning. Especially if you’re a “Microsoft” programmer.

Over the past few months I’ve been doing a fair bit with PHP. I figure there are so many great PHP web-apps that PHP can’t be all bad, despite its reputation for being shoddy and insecure. I mean, they teased me for being a “Microsoft” programmer, so they can tease me for being a PHP programmer too if they want. I’ve got pretty thick skin by now. And besides, we all know who the world’s leading authority on programmer fashion is: me. So, I’m clearly authoritative enough that I can roll my own way and set my own trends.

I’ve digressed. I do that. What was I talking about again? Oh, yeah. Empowerment. So, here’s the thing about coming to Linux, and PHP, and open-source in general: it makes you feel powerful. And that’s thought number one: where commercial software vendors like Microsoft and Apple hoard power, open-source programmers give it away. And, they give it to *you*. It makes sense when you think about it. Commercial entities survive on commerce, and there’s only commerce when there are goods and services that customers “depend” on. A commercial software vendor might pay lip-service to “empowering” you, but what they really want is for you to become “dependant” on them, which is the opposite of being empowered.

I’ll give you an example. The other day I wanted to package my new library into a download file. So I decided to go with a .tar.gz and use the tar command to create the file. I scripted my packaging process, and everything was functional in a matter of minutes. A lovely experience of empowerment. Compare this to my every day experience using WinZip. I used to own a copy, but I haven’t bothered to get a new license, and the copy I’m running on my Windows machine at the moment is an evaluation version. Consequently, every time I need to unzip a file, I need to click the button that says “Use evaluation version”, and as if to insult me, the developers thought it would be a good idea to move that button around at random and play a game with me every time I try to get something done. Of course I have WinZip because the default decompression software built into Windows doesn’t handle .tar.gz files. My point here is that in Windows, I’m not very empowered at all. The only way I’ll get a little bit of power is to part with some more money, and then maybe WinZip will start working for me rather than against me. But, even after spending my money, I still wouldn’t have a command-line tool that allowed me to script the compression of my package in a matter of seconds (well, minutes, I’m still new so I had to lookup how to use the tar command, and then trial-and-error my way into getting the right directory structure inside the tarball). This is just one example. I have many more. But I suspect you get the idea, so I won’t elaborate. In case you didn’t get the idea, here it is again: commercial programmers hoard power, and open-source programmers give it away.

This “giving power away” thing is a pretty big cultural change. There’s almost something scary about it. Sometimes I worry that maybe I’m naive, and that maybe other people shouldn’t be empowered. Maybe if they’re empowered then they’ll come after *me* with their new power. Maybe it would be better if I made people need me. I’m pretty sure that’s how *they* think. But… after giving it some thought, I still come down on the side of giving power away. I just think that not only is it the more noble thing to do, it’s also the more practical thing to do. I worry about safety and security too, I just figure I’m likely to be safer and more secure if the people around me are more, rather than less, powerful. I figure that for every more powerful evil person there will be two more powerful good people, and the good will outweigh the bad. There might be a little conflict and a few casualties on the path, but wasn’t there always? So, that’s thought number two: it is better to give power away.

To recap:

  1. Commercial programmers don’t give power away
  2. Open-source programmers do give power away
  3. It’s better to give power away

And those are my thoughts so far. Thanks for reading!

Credit card buckets spec

Steve Yegge had a few questions, so here are the answers. This shit is so obvious. It’s not hard to be a programmer at all.

Can customers control the buckets, or are they fixed?
Customers can control the buckets.
If fixed, how many are there? What are their names?
They’re not fixed.
Let’s assume for the remaining questions that they are NOT fixed, since a predefined set of buckets would be “insanely stupid” and rejected by customers. So, how many buckets can a customer make? Min and max?
Min: 0; Max: 2,147,483,647.
Can customers give the buckets names?
Yes.
If not, do they have to use numbers?
They can.
What characters can they use in the name?
[a-zA-Z0-9_\’\@\#\$\%\&\*\(\)\:\;\/\\\-\+ ]
What’s the maximum length?
64.
If we need to truncate the name in a printed statement, how do we truncate it?
Truncate to MAX_LEN-3 characters long and append ‘…’.
Can a customer change their buckets mid-month?
Yes.
Can a customer change their buckets between months?
Yes.
What if their balance is nonzero?
Balances are usually nonzero.
Can they transfer balance between buckets?
Yes.
Can a customer change the name of a bucket?
Yes.
Do names have to be unique?
No.
Exactly how does a customer name a bucket?
They nominate a name for buckets they have created on the web-site.
Online?
Yes.
Over the phone?
No.
By snail mail forms?
No.
Talking to bank teller?
No.
All of the above?
Online only, to save on administration overhead.
Same question for all other configuration settings. How? Where?
Online only.
Do credit-card customer service reps have to know about the buckets?
No.
How much do they have to know? (hint: everything)
They have to know that the policy is that this feature is supported online only.
Is there training involved? (hint: yes)
Yes, we need to inform them that there’s a new online service.
Do the customer-service tools have to be redesigned to take into account this bucketization?
No.
What about the bank’s customer self-service website?
We’re integrated as a part of that.
What about the phone interactive voice-response tree?
It’s not relevant to this feature.
What about the software that sends email updates to the customer?
It doesn’t need to know about buckets.
What about the software that generates printed billing statements?
It should incorporate bucket information.
How exactly does it represent the buckets, the individual spending limits and balances, the carry-overs from month to month, the transfers, the charge-backs, the individual per-bucket fees?
Buckets are named per the customer’s setting. The individual spending limits and balances are reported. There are no carry-overs from month to month. Transfers are allocated in a bucket. What are charge-backs? There are no fees for this service.
What about the help text on the website?
It should be in UTF-8 format, and contain useful descriptive information about the service.
What about the terms and conditions?
This is a “best efforts” under-taking of the bank that is fraught with peril and not guaranteed (though maybe useful).
What about the little marketing pamphlets?
They should advertise the availability of the new service.
Should they try to explain all this shit, or just do some hand-waving?
Just do some hand-waving.
Can a customer insert a new bucket into the list?
Yes.
How are the credit limits of the remaining buckets re-allocated?
They’re not. If the customer adds a new bucket they increase their monthly spending unless they modify another bucket to account.
What if adding a new bucket puts one or more of the older buckets over the limit?
Adding a new bucket can’t do that.
Do we charge fees?
No. The service is free as a point of difference from other banks.
Do we tell the customer they’re about to be charged a fee right before they create the bucket?
There is no fee.
Is it, like, OK/Cancel?
It’s not relevant, there’s no fee.
Do we send them a follow-up email telling them they just fucked themselves over?
No, that would be a bad idea.
What exact wording do we use?
We don’t send such and email.
Can a customer delete a bucket?
Yes.
What if there’s money in it?
We ask them which bucket they’d like to transfer it too, or if they’d like it in ‘unallocated’.
What if it’s overdrawn?
It can still be deleted if it’s overdrawn.
How do we represent the overdraft fee in the database?
There is no fee.
How do we show the deletion event in their bill?
By omitting that bucket from their list.
Can a customer merge or consolidate buckets?
Yes.
What if a customer has an emergency situation, plenty of limit in other buckets, and they really really need to charge to a couple of buckets, but they want to avoid an overdraft fee? What do they do? Are the buckets mandatory or discretionary?
Buckets are discretionary, overall account balance attracts overdraft fee.
How the hell do we even tell if they’re buying “chocolate”, anyway?
We provide a facility for them to nominate the bucket of a transaction after it has been processed. There is a bucket for unallocated spending.
The vendor doesn’t tell us the purchase type. How do we know how to charge the right bucket?
We can’t, it’s up to the customer to allocate their spending.
What if it’s ambiguous?
It will always be ambiguous.
What if the buckets overlap?
The customer picks a bucket.
Does the customer need a point-of-sale interface for deciding which bucket to put the charge in?
No, it can be done after the purchase.
Can they do “separate checks” and split the charge into several buckets?
Yes.
Where are you going? Answer me!
I’m still here, baby.
WHAT THE EVER-LOVING *FUCK* ARE YOU PEOPLE SMOKING? HUH? HAVE YOU EVEN THOUGHT ABOUT THIS PROJECT FOR MORE THAN A MILLISECOND? THE SPEC FOR THIS PROJECT WILL BE 5,000 PAGES! IT WILL TAKE THOUSANDS OF MAN-YEARS TO IMPLEMENT, AND *NOBODY* WILL UNDERSTAND HOW IT WORKS OR HOW TO USE IT, EVEN IF WE SOMEHOW MANAGE TO LAUNCH IT! IT’S FRIGGING IMPOSSIBLE! IT’S INSANE! __YOU__ ARE INSANE! I QUIT! NO, WAIT, YOU’RE FIRED! ALL OF YOU! AAAAAAAAAUUUGH!
Having a rough day, Stevey? This programming gig isn’t for the meek, you know.