justin․searls․co

Just realized it's much more acceptable to say I'm too busy writing to have time for reading than it is to admit I'm too busy talking to have time for listening.

Nice set of reminders on how to validate e-mail addresses in Rails models and was glad to find his second example to be almost identical to what I found in my newest app:

class User < ApplicationRecord
  validates :email,
    format: { with: URI::MailTo::EMAIL_REGEXP },
    presence: true,
    uniqueness: { case_insensitive: true }
end

One thing I'd be sure to add, though, is the new normalizes class method to ensure all email addresses saved by your app are easily compared by stripping whitespace and lower-casing them. From my User class:

normalizes :email, with: ->(email) { email.strip.downcase }

Never hurts to revisit the stuff you wrote on the first day of an app's life.

"It is currently estimated that new models with significant changes to the Vision Pro specification may not be in mass production until 2027," Kuo said today.

This makes me glad I bought at launch as opposed to waiting, and even more glad I opted for monthly AppleCare payments as opposed to buying the fixed two-year contract.

Until yesterday, I had never heard anyone but me in the Ruby community express confusion over the fact that Rails produced both paper_trail the audit log gem and Papertrail the logging SaaS.

But seriously, how the hell did everyone else keep these straight in conversation? (My bet is that they didn’t, actually)

Breaking Change artwork

v6 - Pausing doesn't pause

Breaking Change

[UPDATE: In this episode, I referenced Stripe having an IPO in the past tense. I was mistaken, they are not (yet) publicly traded. We regret the error.]

The audio is better this week! I'm learning.

Also, I finally had something to talk about that has nothing to do with Apple! The target of the ion cannon that is my mouth this time? drumroll… it's Stripe! Sorry, Stripe. If you like rants about software quality and the systemic reasons everything is terrible, hoo boy! This one brings the heat. 🔥🔥🔥

We're starting to work down our mailbag backlog, so help me freshen it up by e-mailing the show at podcast@searls.co and our dedicated staff (me) will read it and—potentially, maybe—respond on the air!

And now, some URLs:

Show those show notes…

One of the most valuable things about writing automated tests is that they force you to run your code very many times in very many ways.

It’s important to understand this is not a value of testing per se, though, and that there are other valid ways to achieve the same goal.

Captchas have really gotten away from us

Thanks to recent advancements in AI, the only way to pass this captcha and prove you’re a human is to mutter, "what the fuck are we even doing here anymore," into your device’s microphone.

Two decades as a programmer hasn't made me any better at estimating how long it'll take me to write software, but it's made me MUCH better at estimating how long other things will take. I'm a master at intuitively timing multiple dishes to finish simultaneously, for example.

In hindsight, I think I may have spent a large number of years misdiagnosing myself as having a push notification management problem when I actually had a "too many people in my life" problem.

What's a framework feature you probably ought to use but you nevertheless avoid?

For me, it's file generators. I can barely remember why, but with the sole exception of database migrations I never take advantage of any of Rails' generator commands.

A lot of people are surprised Vision Pro’s field-of-view is so narrow, but it makes sense if you think about it: even if Apple invents all the technologies needed to release a Vision product in an eyeglass form factor, it’ll never be much wider than 90º.

Apple’s resistance to proper VR features suggests they don’t want us getting used to anything that wouldn’t be possible in their ideal version of the product.

Better 404 design

There are exactly three things I want from a 404 page:

  1. Something approaching an apology
  2. An easy way to report the broken link
  3. Copy that might elicit a sensible chuckle

This page only took a few minutes to make. The "let us know" link pre-populates the entire e-mail and is implemented in a Rails view thanks to a helper method that makes constructing mail_to links a little nicer:

def mail_to_url(email, **options)
  "mailto:#{email}?" + options.map { |k, v|
    "#{k}=#{ERB::Util.url_encode(v)}"
  }.join("&")
end
<%= link_to "let us know", mail_to_url("support@betterwithbecky.com",
  subject: "I got a 404!",
  body: "I clicked a link that led me here, but got a 404 message:\n\n#{request.url}"
) %>

Wish people spent more time sweating details like this.

Breaking Change artwork

v5 - Regressive Web Apps

Breaking Change

Welcome to Breaking Change, the 14th most popular technology podcast in Argentina! (And 30th in Norway!)

It's been a couple weeks since my last breaking change and, guess what, I done broke things again.

If you would prefer I not make so many breaking changes (or if you wish me to break even more of them!), e-mail me at podcast@searls.co and let me know and/or share your darkest secrets under a pseudonym using a throwaway account. Nobody needs to know.

Links and so forth:

Show those show notes…

I haven't been happy with the size or weight of any of Apple's notebook computers since 12" MacBook. And since moving to 14" and 16" for the MacBook Pro, I've been praying for a 12" MacBook Pro to be released. But now, with the Vision Pro among us, my desire for an ultralight Mac has only increased. In fact, about a month ago, I tried to get DALL•E and Midjourney to generate images of a headless MacBook Pro device (like an Apple II but in a modern industrial design language), but they weren't up to the task.

I had never even considered beheading a MacBook Air, but this guy sure did:

The fact this mod is as straightforward as it is is a real testament to Apple's improvements in repairability over the last few years. The only shame of it is that there's no way to reliably log into the device after a reboot (short of guessing at the state of the password entry screen). If it weren't for that I seriously might consider doing this to my own M2 MacBook Air after its warranty is up.

UPDATE: Rob Carlson inspires some hope that a headless MacBook isn't as unusuable at boot as I might have worried:

I log into a headless MacBook Pro all the time. Just hit the "up volume" key a bunch of times until VoiceOver turns on, then it'll prompt you for username, then password, and give three beeps if you're right.

Accessibility truly is for everyone!

UPADATE: Confirmed

As I discussed on my Breaking Change podcast a couple weeks ago, Apple it's downright impressive how well Apple is executing on a strategy of malicious compliance in response to the EU's Digital Markets Act.

One tidbit from a week ago was that third-party browser rendering engines wouldn't be able to be saved to the home screen and launched as progressive web apps (PWAs). Well, in order to level the playing field, Apple's apparently decided to just disable PWAs entirely for EU customers:

Apple appears to be turning off the ability to use web apps right from the iPhone’s homescreen in the European Union. Support for progressive web apps appeared to be broken inside in the EU during the first two betas of iOS 17.4, but today developer Maximiliano Firtman said in a post on X that web apps are still turned off in the third beta, which arrived yesterday. “At this point, it’s a feature disabled on purpose,” Firtman wrote.

If you haven't heard Firtman's name before, he's been the guy following Apple's largely-undocumented, unnecessarily circuitous path to progressive web app support in iOS, so if that's his read, that's probably the case.

I know a lot of people are angry at Apple's flagrant display of spite as they take their ball and go home on all these issues, but I really can't manage any other reaction but to be impressed by their commitment to the bit. After the DMA passed but before Apple released their response, there was expectation that similar laws would pass in other developed countries over the next 18-24 months. But Apple's ability to outpace this months-old legislation so completely is probably throwing cold water on those plans, if they exist. The EU could choose to deny Apple's proposals, but something tells me that substantive changes would require even more complex legislative changes which would only invite even more sophisticated technical and policy countermeasures by Apple.