If you haven’t seen Will YouTube Ever Run Out Of Video IDs?, it’s worth a watch, not only because Tom Scott recorded the 5-minute video in a single take, but also because in the middle of it he managed to recite seventy-three quintillion, seven hundred eighty-six quadrillion, nine hundred seventy-six trillion, two hundred ninety-four billion, eight hundred thirty-eight million, two hundred six thousand, four hundred sixty-four from memory.
There’s only one problem: he recited the wrong number.
Actually, there are a few problems*, but first, let me provide some background.
Every evening I get an email from my dad’s SPOT Satellite Messenger letting me know his latitude and longitude along the Pacific Crest Trail (and that he’s OK). He asked me to track his mileage, so at first I put his coordinates into Google Maps, which actually has the PCT plotted, but the mileages didn’t seem to match the “official” mile markers that he’s referencing from Halfmile. They offer a KMZ file of the PCT for Google Earth, but I totally failed at getting it installed on Ubuntu. Eventually I was able to commandeer Stephanie’s Mac to get it to work, but it seemed like a hassle when all I really wanted was a quick way to enter his current latitude and longitude from the email and find out what half-mile marker he’s the closest to.
There was a public service announcement I saw on TV in France which had a QR Code permanently displayed next to the chyron. It was amusing to me because the graphic was all white, so when the video behind it was light in color, the QR Code became unintelligible. I snapped a few quick shots as examples.
The double irony is that because they inverted the colors of the QR Code, many readers can’t decode it even when the background happens to be dark! (What’s white in the codes above should be black on a white background.) I struggled to get ZXing to decode it until I manually inverted the colors in Gimp. Same with the QR Droid app. And what does it encode, you might be curious to know? A generic Facebook page URL: http://www.facebook.com/consomag.TV?fref=ts
No, it’s not my QR code, but I thought it was an intriguing application of the technology.
Did we use it? No, we walked up to the counter like normal people. So what does the QR code encode? Good question: http://splitbread.com/1/16.html (location #1, table #16, I presume). For the record, I had a very tasty porchetta sandwich with cracklings and balsamic onion marmalade for dinner tonight. I’d definitely go back.
I want to query for parent records (those on the one side of a one-to-many relationship) that have no children that meet a specific set of criteria. The parents in the result set may have no children at all, or they may have many children, just none that meet the criteria. And I only want distinct parents in the result set. If a parent has two children that do not meet the criteria, I only want that parent returned once.
It turns out this type of behavior comes up more often than I’d expect. Imagine a database as part of a web service that has a table of users and a table logging the “lifecycle” email updates sent to those users. (Lifecycle emails are the periodic emails a service sends out over the course of your engagement with that service—they can be purely time based, e.g. 2 weeks after sign up, or they can be criteria based, e.g. after you place your first order. But in order to avoid being spammy/annoying, you usually only want to send these once, or once every X months.) In this scenario, I would want to query for all users (these are the parents) without a record of having received a certain type of email (the children). They may have received other emails, or they may have received no emails at all, but in either case, I want them returned in the result set. Let’s build up to the solution.