Calculating surcharges

Let’s say a credit card processor charges a variable rate plus a fixed fee on any credit card transactions. For example, Stripe’s current merchant fee in the US is 2.9% + $0.30. This means that, for a $100 amount charged, the seller is getting only $100 − ($100 × 2.9% + $0.30) = $96.80 after the fee is deducted. In some contexts, sellers will want to make up for the difference by passing the fee on to the customer.

What if the seller wants to add a surcharge to recoup the amount of the processing fee? They can’t just tack on 2.9% + $0.30 to the subtotal, because that surcharge itself will incur the processing fee, and the seller will still lose money.

So the formula instead is:

\begin{aligned}
p_v &=\text{the variable portion of the processing fee (e.g., 0.029)} \\
p_f &=\text{the fixed portion of the processing fee (e.g., 0.30)} \\
x &=\text{the subtotal} \\
f &=\text{the surcharge needed to recoup the processing fee} \\
\end{aligned} \\
f=\frac{x+p_f}{1-p_v}-x

This follows from a simple derivation. The amount on which the processing fees will be charged is x+f. This means the processing fees are

(x+f)p_v+p_f

What the seller earns after processing fees, then, is the total minus the above fee:

(x+f)-((x+f)p_v+p_f) \\
=(1-p_v)(x+f)-p_f

Our goal is for the expression above (what the seller earns after processing fees are deducted) to end up equal to the subtotal. Now solve for f that makes that true:

\begin{equation*}
\begin{aligned}
x &= (1-p_v)(x+f) - p_f \\
x+p_f &= (1-p_v)(x+f) \\
\frac{x+p_f}{1-p_v} &= x+f \\
f &=\frac{x+p_f}{1-p_v}-x \\
\end{aligned}
\end{equation*}

Combining tar with logging and mbuffer

As a supplement to my last blog post on archiving to an LTO tape drive using conventional open source utilities like tar, this is how you can save a filelist of the tar output (same as would be outputted by tar -tvf /dev/nst0) to a text file, while also redirecting tar through mbuffer to the tape drive.

tar --label="backup-20230101-volume2" -b512 -cvf - --exclude='.DS_Store' --files-from=/tmp/directories-list.txt 2> >(tee /tmp/tar-filelist.txt >&2) | mbuffer -m 4G -P 80 -s 262144 -o /dev/nst0

It’s critical that the output of tee is again redirected to stderr using >&2 — if you don’t do this, the text from the log will end up in the stdout that gets piped to the mbuffer, which will get written to tape. In that circumstance, tar will not be able to understand the archive when reading it back, since there will be spurious text data.

If you aren’t piping tar’s stdout through mbuffer, you can avoid the redirection problem because tar won’t be outputting to stdout at all. For example:

tar --label="backup-20230101-volume2" -b512 -cvf /dev/nst0 --exclude='.DS_Store' --files-from=/tmp/directories-list.txt 2> tee /tmp/tar-filelist.txt

A new blog series?

Over dinner this week, I was revealed as one of those weirdos who actually read the fine print. Yep, once in a while—embarrassingly often—I’ll actually dig right into those long documents that come with the health insurance, the credit card offer, or the website signup.

Forced arbitration clause in Amex Premier Rewards Gold cardmember agreement.
When was the last time you actually read something like this?

Why? Because the purpose of these “Terms and Conditions,” or “Cardmember Agreements,” or whatever else they’re calling these lengthy, prewritten, one-sided contracts, is to modify default legal rules/rights in such a way that benefits the parties that wrote them. So, even if I don’t have any practical choice in whether or not to use Facebook, even if I can’t really negotiate with American Express and rewrite the terms of the extended warranty, at the very least it’s useful to know what my rights are—and what hidden benefits there might be that most people don’t know about.

So a friend thought it might be fun if I just occasionally write about these things. Perhaps a sort of Bad Terms & Conditions section on my blog, or … Digging through the Fine Print

Still working on the name.

I’ll try not to fall into the bad habit of labelling companies “fascists” or something similarly colourful, which other blogs highlighting these issues inevitably find themselves doing. (I mean, literally every company that deserves any business does it, so what’s a conscientious consumer to do?) For what it’s worth, Consumerist already writes about this and does a pretty good job of it.

Continue reading “A new blog series?”

Let me vote, dammit

In Frank v. Canada (Attorney General), 2015 ONCA 536, the Court of Appeal for Ontario decided that Canadian expatriates could be denied the ability to vote after 5 years of residency abroad, in spite of the Charter clause guaranteeing citizens the right to vote, reversing an earlier court ruling that had vacated the temporal limit. Letting all citizens vote would be “unfair” to Canadians who live in Canada, apparently.

As a Canadian expat (US green card holder), I sincerely hope this case is overturned on appeal to the Supreme Court of Canada.

Like the respondents, who “attended university in the U.S. and remained there to pursue careers in their chosen professions”, my choice to be in the United States to advance my studies and career in the law is a matter of circumstance. Acquiring a green card did not signal the surrender of my citizenship and all its rights, responsibilities, and privileges.

It’s already annoying enough when the tax agencies of the two countries—CRA and IRS—use different definitions of residency for tax purposes… which differ from the governments’ definitions of residency for immigration purposes… which apparently differ from some U.S. states’ definitions of residency for driver’s licences…

… but now to convolute the meaning of a citizen’s right with a resident’s right?

I remain invested in the direction of the Canadian government and try to stay informed about Canadian politics. I still receive communications from multiple Canadian parties, am a supporter of two activist groups involved in IP and media law, and continue to engage in discourse with resident Canadians about the state of the nation.

As an individual with only one citizenship—Canadian—being disenfranchised at the end of five years from voting in Canadian federal elections would leave me with no democratic representation in any jurisdiction, since noncitizens in America are forbidden from participating in the U.S. electoral system even as a donor to any campaign. Even Canadian felons would have more political representation than I would have. This untenable situation would reasonably drive an expat to pursue foreign citizenship, if only to regain those rights and privileges that one would have expected Canadian citizenship to guarantee.[1]

The Charter doesn’t define the right to vote by residency, but by citizenship. Section 3 provides:

Every citizen of Canada has the right to vote in an election of the members of the House of Commons or of a legislative assembly and to be qualified for membership therein.

The majority opinion contends that residency has been historically a factor in implementing the electoral system that enables citizens to exercise the right to vote, but the court erroneously conflates the implementation of a constitutional right with the acceptable boundaries on that right.

It embraces the vague notion of protecting the “social contract”, a principle in which individuals who make laws must also obey them, as a legitimate purpose to restrict the voting rights of expatriates. But really, expatriates remain bound by Canadian laws, particularly those affecting taxation, citizenship, and property…[2] Laws passed in Canada, far from having “little to no practical consequences” for my expat family as the majority opinion contends, affect us financially (at least in terms of loans and taxes), affect my parents’ property and retirement assets and income, and influence our choices later down the road about whether or not to return to Canada.

… and it’s not like every resident citizen is affected by every law anyways! Bear with me for a moment; consider this perspective: the scope of a law often excludes those people who supported it. A law limiting concealed carry handguns, for instance, would probably be passed by those people who themselves have no need or desire to engage in the actions that the law prohibits. Indeed, this ruling actually enables resident citizens to violate the social contract principle supposedly being protected: a hypothetical law imposing 50% taxes on foreign income earned by nonresident citizens, for example, could be passed by representatives of resident citizens living comfortably in Vancouver and Toronto unaffected, while disenfranchised citizens abroad would be the ones affected.

This case better make its way to the Supreme Court of Canada.

Footnotes

Footnotes
1 It’s worth noting that American expatriates retain the right to vote indefinitely while abroad, and even some citizens who have never even set foot on U.S. soil can nevertheless vote in several states. Hurrah to the Constitution?
2 Increasingly in today’s world, laws that apply to surveillance and foreign intelligence, too, come to mind.

Changing this site’s tagline

Previously, my site tagline was “News, technology, life, and more.”

As of today, it is now “Technology, law, life, and more.”

When I first started this blog in 2008, I labelled it “A blog discussing current events, news, politics, technology, law and more.” Even then, as a high schooler, I was interested in the law—and in the intersection of law and technology.

I distanced myself from law for a while, enticed by opportunities in engineering and medicine, right around the time I was applying to university and completing my first year of undergrad. Mirroring this stage of my life, I removed the keywords “politics” and “law”. I blogged about healthcare-related issues.

As I now decide between two fantastic law schools to attend next year, I’ve realized that my entire path has been leading me to this intersection of law & technology. But no matter where I go, I will always be a technologist first; the order of words in “Technology, law, life, and more” reflects that (and the deliberate Oxford comma).

It was time to update my blog to publicly acknowledge my choice of path in life—indeed, my return to my true passions.

Dear HP

image

To whichever engineers at Hewlett-Packard decided that it would make sense to pollute our frequencies with unneeded ad-hoc printer wifi networks enabled by default… You messed up.

Now every university dorm has to cope with unimportant personal printers putting out stronger signals than the nearest real access point. And houses in residential neighbourhoods receive neighbours’ printer signals more strongly than the high-power N/AC router.

I get that owners can connect them to routers instead of being separate APs. But guess who’s not turning off this “feature”? All of your least tech savvy customers.

(Side note: Comcast’s wider deployment of cable modem-router devices in homes and businesses with secondary xfinitywifi hotspots produces the same issue when customers are plugging in their own wireless routers right next to the Comcast device. I love using xfinitywifi, but there are real issues unless Comcast has configured these hotspots to scan for surrounding networks before deciding whether to broadcast a signal. And again, while there may be an opt out option, it’s the least tech savvy users who don’t turn it off, who generate potential interference for their neighbours. Negative externalities!)

It bothers me that the current default is a situation where tech-dumb people piss off tech-smart ones.

Spambots gone wild

On one of my sites running WordPress, Akismet (and other antispam plugins) is not installed. In some ways, it has served as a honeypot, revealing interesting tidbits about how spambots work.

Fascinatingly, there were several hundred of these comments, all identical to each other. They look like templates for comments to be generated by spam-producing software, except that the software never processed the templates and posted them verbatim instead: