You don’t see it coming until it’s here. The day you realize that you’re not going to be arranging any more funerals. You’re the one who’s next. It may not — you hope and believe — be for years. Decades! But it’s coming. And it’s coming for you.
You see the fading memories of the ones who went before you differently in that light. When you realize you’re the only person left who remembers the things you experienced together. And when you’re gone, that’s it. Those events never happened. At least, not to anyone who is still alive to care about them.
And what did your time amount to, anyway? What impact have you left on the world, and is it a good one? Bad? Or, most likely, utterly inconsequential. You never existed.
Maybe it’s melodramatic. But that doesn’t mean it’s not true. So if all that matters is the moment, while you’re in it… how are you going to live it?
First off, this is not solving a problem. It’s making it easier to deal with the fallout of the problem.
Here’s the problem: bad actors steal credit card numbers, and sell batches of those credit card numbers to other bad actors who like to find ways to test out the credit card numbers to see if any are still active.
One way they like to do this is to find WooCommerce sites that sell cheap products — especially stickers, which are generally priced at $5 or less — and they use a script to spam the site with fake orders… well, real orders… for these cheap items, using fake contact information and the stolen credit card numbers. Most of them are already canceled and the transactions fail, but a small percentage of the cards are often still active, and the ability to place an order with them confirms it. I suspect the reason they place very small orders is that it’s easier for those transactions to go unnoticed by the real card owners.
Anyway, this is a problem I am seeing with increasing frequency on my clients’ WooCommerce sites, and there are generally two ways I address the problem.
First, I install Brian Henry’s WooCommerce Checkout Rate Limiter plugin. This can be very effective at throttling the scripts that place these huge blasts of orders from the same IP address, which leads to…
Second, I get the fake orders’ IP addresses and block them in the server’s firewall. You can get the customer IP address of any order in WooCommerce by clicking through to the detail page for an order. There are various ways to block IP addresses, including WordPress plugins, but I like to go straight to the source and block them in the ufw firewall right at the Linux OS level.
But the bad actors are perhaps becoming aware of these techniques to block them, and are modifying their tactics. I can see three ways they would do this, although I am only personally able to observe two of them: 1) slowing the rate of submissions, 2) spreading the submissions across multiple different sites, and 3) using different IP addresses. The first and third are the ones I can observe, of course, unless by chance the multiple sites are all maintained by me. (I do support a very large number of client sites, but not enough that this has happened yet.)
Anyway, we are now getting to the point of this post. I wanted a way to quickly see the customer IP address for a whole list of orders, instead of having to click through to each individual order’s detail page. Sure, I could fire up phpMyAdmin and do direct SQL queries, but I prefer the convenience of having this happen right within the WordPress admin. And so, I present to you a code snippet that will add an IP Address column to the WooCommerce admin Orders page:
That can go into your theme or a small plugin. The first block of code adds the IP Address column to the table on the Orders page, and the second block outputs the customer’s IP address in that cell in each row of the table.
Of course, this won’t stop bad actors from being bad actors. But it might help you reduce the number of fake orders your clients have to refund.
QR codes are a convenient way to open a URL with your phone without having to type a long string of text (especially since it’s hard to avoid typos in a URL on a phone touchscreen).
But.
The iPhone’s QR Code Scanner app in the Control Center has a really annoying feature: It doesn’t open URLs in the Safari app; it opens them in its own embedded browser.
I’m not really sure why Apple chose to do this, or why they don’t realize what an issue it can create for users. What is that issue?
If you leave the app, when you go back to it, you’re back to the camera view for scanning a new QR code, rather than whatever web page you were interacting with.
There is no “history” in Code Scanner. No “back” button on the camera screen.
Sometimes this can be trivial. Sometimes not. Here’s a scenario I just went through that turned out not to be an issue, but it very well could have been.
It was time to renew the vehicle registration on my car with Minnesota Driver and Vehicle Services. (Yes, in most states we’re talking about the DMV, but since Minnesota always has to be different, here it’s DVS.) DVS is getting into the 21st century, and they’ve started emailing out the renewal notices instead of sending paper copies. And, the email included a QR code for me to jump-start the renewal process. Cool!
So, I scanned the code (off my Mac screen) with my iPhone, and started the process. (Maybe it’s possible for the Mac to read QR codes out of an on-screen PDF… I should investigate that.)
At the end of the process, since I was paying with my debit card, I got a pop-up alert from my bank’s app about the transaction. I would have ignored that, but I got two alerts from the bank. Worried I had double-submitted, I jumped over to the bank app. No, it was fine; the second charge was just the 2.15% credit card processing fee the DVS website had warned me about.
But now… oh no! I had been completing all of the process in the Code Scanner app, so the little “back” link at the top left of my iPhone screen took me back there, which of course forgot about that complex series of web form screens I had just stepped through, and blithely displayed the camera again for me to scan a new code. Damn! Was the process complete? Probably. I hope so. I opened up my email and saw a confirmation from DVS, so presumably everything was finished. But I won’t know for sure until I get my tabs in the mail. Ugh.
Now see, here’s the thing I keep forgetting in the moment. When you scan a QR code with Code Scanner, and that QR code is a web URL, Code Scanner opens the page in its own embedded browser. But there’s a little button at the bottom right to open the page in Safari.
If you have the foresight (or memory) to tap on that little Safari compass icon as soon as you’ve scanned a QR code, all will be well with the world. But if you’re just focused on whatever you’re trying to do with the web page you’ve just opened, it’s really easy to ignore the subtle interface differences between the two apps.
I shouldn’t have to play “Can you spot the differences?” like this is a kids’ placemat at a family restaurant in the 1980s. I shouldn’t have to remember to tap the Safari icon if I’m about to embark on a seven-part journey through the minds of the lowest-bid contractors who won the job to develop a government website.
Apple needs to understand how its products are used in the real world.
“Double dating” is a concept my wife and I have talked about for a while; it’s where a piece of media — usually a movie or TV show — exhibits elements of two distinct time periods. Most commonly it results from the art being set in a particular time period, but unintentionally carrying distinctive elements of its own time period as well, which don’t really become apparent until much later. Think “Happy Days.” It’s set in the ’50s, but there are definitely elements (like hair styles) that are more characteristic of the ’70s era when the show was actually produced.
Over the past year or so, I’ve been having a lot of the same feelings towards the music of Com Truise. I discovered Com Truise (stage name of musician and graphic designer Seth Haley) around 2012 when his In Decay album was released. I immediately latched onto the hazy nostalgia it evoked for my early ’80s childhood and the exciting technologies of that era.
I listened to a lot of Com Truise from about 2012 to 2014. And now when I listen to this music, I have a different kind of nostalgia. I still feel that pull to my ’80s childhood, but I also have much more distinctive memories from the early 2010s to associate with the music as well. I had a lot of good things going on in those years. My business was relatively new and growing, my kids were in school and starting to have their own distinctive personalities, and I was just generally enjoying a lot of what was going on in the world because things seemed to be pointing in a positive direction.
I’ve lost a lot of that optimism over the past 8 years though. In a nutshell, it’s not so easy as a white person to ignore all of the terrible things other white people do in the world. And even as a light has been shone upon these transgressions, the worst among us are doubling down on bad behavior and destructive attitudes. Plus we have the increasingly frequent climate change-related disasters that only the most stubborn or brainwashed can continue to deny.
But there have been more personal struggles as well: aging (and then eventually dying) parents, the difficulties of adolescence for our kids, my own aging body, the souring of some aspects of my business (*cough* Gutenberg *cough*). There have been plenty of good things too though, especially around my involvement in music. But overall, I would give the past several years a negative score.
All of that does make me nostalgic for the halcyon days of the early 2010s, and that’s a period I strongly associate with the music of Com Truise.
Look, it’s all well and good that CSS has a hyphens property. The problem is, that property is really dumb. It’s all-or-nothing, with no rhyme or reason to whether a word absolutely needs to be hyphenated. It will literally hyphenate any and every multi-syllable word at the end of a line.
You really almost never want that.
In my particular case, I’m looking at a very specific situation. Specific, but I am guessing probably the most common situation where a web developer wants a browser to hyphenate words: words in large headings that are too long to fit on a line. What I mean here is individual words that are by themselves too long to fit on a line, typically in a mobile browser, in headings with large or extra-wide fonts.
There are proposals to improve this, but there is currently nothing with broad browser support. So I invented my own.
This is a crafty little combination of CSS and JavaScript. (OK, technically it’s jQuery, but you could reasonably adapt this to vanilla JavaScript if that’s your thing. Since I’m deeply immersed in the jQuery world of WordPress, I just went with jQuery because it’s simpler for me that way.)
The first thing you need is a special CSS class for hyphenation. Since I only want it to apply on mobile devices, I gave it a logical name, and defined it in my CSS media query for the mobile breakpoint:
OK, with that set up, then we just need a little jQuery function to determine where it’s going to be applied. I want it to get added automatically to any h1, h2, h3 or h4 tag. (I’m skipping h5 and h6 because they’re small enough text that we shouldn’t need it.) I also made the somewhat arbitrary decision to set the minimum word length at 15 letters. This is something you may need to adjust based on your font size. Here’s the jQuery:
jQuery('h1, h2, h3, h4').each(function() {
var words = jQuery(this).text().split(' ');
var i = 0;
var hyphenate = false;
while (i < words.length) {
if (words[i].length >= 15) { hyphenate = true; break; }
i++;
}
if (hyphenate) {
jQuery(this).addClass('hyphenate-on-mobile');
}
});
And then you just want to make sure that jQuery gets fired off when the page loads. It works!