Find the bug, Rails edition

Blog

I have this code in a model in a Rails project.

  validates :name, presence: true, on: :create
  validates :email, presence: true, format: { with: URI::MailTo::EMAIL_REGEXP }, on: create

Let's put it in an Author model:

class Author < ApplicationRecord
  validates :name, presence: true, on: create
  validates :email, presence: true, format: { with: URI::MailTo::EMAIL_REGEXP }, on: create
end

When retrieving a list of all of the authors without email addresses (because, well, we are cleaning up these things) with this line of code:

  authors = Author.where(:email: nil)

... two new blank authors are created at the WHERE query. Both of their names and emails are blank. This is absurd!

Find the bug.

I narrowed the problem down to those validates lines, but could not see the bug. After an hour of puzzling, I asked Katherine to look. When she said, "what the?" I felt a little bit better that this was something weird.

She figured it out, though.

class Author < ApplicationRecord
  validates :name, presence: true, on: :create
  validates :email, presence: true, format: { with: URI::MailTo::EMAIL_REGEXP }, on: :create
end

F'ing symbols. Yay for Katherine's second set of eyes! Whoo!

MEOW

Blog

<!--       _
       .__(.)< (MEOW)
        \___)   
 ~~~~~~~~~~~~~~~~~~-->

Is that offensive? Down a rabbit hole.

Blog

"I hope you take this the way it is intended, but, you'd make a good dyke."

Yes, yes, I would. I have the whole "who the F cares about clothes" vibe. Makeup and I don't get along, but I know the origins of that one. Though, let's be real, that's not really what being a dyke is actually about. Yet, I wholehearted agree I would, except that my attraction to women sexually is close enough to zero to be considered zero.

The comment, though, had me heading down the rabbit hole of "Is the word dyke offensive?" It has been reclaimed by the LGBTQ+++++++ community, so no, but, as always, context matters. Someone intending the word as a slur is offensive. Someone using the word as a term of endearment is not offensive. Like a lot of words.

And the etymology of the word? FASCINATING. Go read it.

Given my brother thought I was gay when I was in high school, I guess I give off gay, dyke vibes. Except to gay people. They know I'm not.

Covid Sucks, Slow Start

Blog

The thing that gets me about Covid is that 3-5 day incubation period between catching covid, and showing symptoms. Sure, Covid isn't a zombie virus that has a 28 day incubation period, which is good. I can only imagine how sucky we would be as a culture and society and race if Covid had a 28 day incubation period. We would have so many more deaths.

Anyway, friend caught covid. I had had dinner at his place last Tuesday evening, the day he was feeling off. At the end of dinner when we were all sitting around talking, as we often do, he commented he had a shooting pain up the back of his neck, similar to when he had Covid six weeks ago. "It's not Covid, I just had it," he said. "You can't build immunity to something that changes every month," I responded. I then left in a hurry, thinking flu, RSV, Covid, a cold, pick one, any one, they all suck. Two days later he was testing positive for Covid. I am sad for my friend. Covid sucks.

I mask in public by default, and avoid almost everyone these days, my few friends excepted, so isolating isn't difficult at least, if I am infectous. Yay for remote work.

I haven't tested positive so far this round. I have, however, been in bed or on the couch for 14+ hours a day for each of the last five days. Walking is about as much as I can manage, movement wise. I was going to start the 75 Hard challenge on February 1st. I skipped that. I don't know how much of this is psychosomatic and how much is shit-I-have-covid. See above: testing negative. Radical rest has been my default, though, this month so far.

Or maybe all this is just ennui, an attempt by my psyche to shift me over onto my path.

Biases of the Day

Blog

Through various and assorted internet consumptions, biases that have come into my awareness again today:

The Mandela Effect

The Mandela effect is the situation where a large number of people believe that an event occurred, when it, in fact, did not. It is the large-number-of-people version of the false memory phenomenon:

In psychology, a false memory is a phenomenon where someone recalls something that did not actually happen or recalls it differently from the way it actually happened. Suggestibility, activation of associated information, the incorporation of misinformation, and source misattribution have been suggested to be several mechanisms underlying a variety of types of false memory.

The Mandela part comes from the large number of people who believed Nelson Mandela died in the 1980s while in prison, though, in fact, he survived, was released, and went on to help South Africa reduce its apatheid (while abolish is supposed to happen, we know that biases and political change don't happen overnight, and I don't actually know if South Africa's system of discrimination on grounds of race is actually gone - given my understanding of racism through the lens United States' inability to see beyond gender and race and age, I'd be surprised if SA managed the removal of apartheid in fewer than two generations).

Sadly, the one oft quoted about the Fruit of the Loom is actually wrong: there was a horn on the logo for a short bit, though the company denies it.

The Michelangelo Phenomenon

The Michelangelo phenomenon is an interpersonal process in which close, usually romantic, partners influence or 'sculpt' each other. Over time, the Michelangelo phenomenon causes individuals to develop towards what they consider their "ideal selves," as their partner sees them, and therefore acts around them, in ways that promote this ideal.

One could argue that, "the Michelangelo model suggests that close partners sculpt one another's selves, shaping one another's skills and traits and promoting versus inhibiting one another's goal pursuits" works only if one is in a relatively stable relationship where at least one partner is able to model this behaviour. Said modeling would need to be strong enough to overcome the resistence of the other partner's beliefs about themselves if both partners aren't able to positively affect each other.

A good reason to stick with the partner that makes you want to be a better person.

Golem Effect

The Golem effect is a psychological phenomenon where low expectation placed on people causes a poor result or performance.

The Golem effect is a psychological phenomenon in which lower expectations placed upon individuals either by supervisors or the individual themselves lead to poorer performance by the individual. This effect is mostly seen and studied in educational and organizational environments. It is a form of self-fulfilling prophecy.

Yeah, assuming the worst will make the worst appear: "if I'm being punished for this, I might as well do it." In families, parents having no expectations for children definitely affects long-term quality of life of the children. This phenomenon just sucks everywhere is exists.

The Golem effect is not quite the opposite of the Michelangelo Phenomenon. The Michelangelo phenomenon sculpts positively. In relationships, the Golem effect is giving up, not trying in a relationship, assuming the worst in a partner. Actively sculpting negatively, though, pointing out everything bad, and focusing on all the disappointments, thereby sucking all the joy out of a relationship and destroying it, probably has a different term which hasn't surfaced for me yet today.

LMK if fields are missing that you need

Blog

There are times when I look back on what I've written and the phrasing of my words just plain catch me off guard. Like, who speaks like that?

Last week, a coworker asked for some data, and I sent it to her. I included a note, "LMK if fields are missing that you need."

"Let me know if fields are missing that you need." Technically, correct grammar. Subjectively, not particular clear or venacular.

"Let me know if fields that you need are missing." The part "that you need" goes with the fields, so should be before the verb there, though the "that" phrase applies to the fields even when placed at the end.

It is just weird, though.

Another one that rather hit me was a response to a tweet about an earthquake in New Zealand. I responded, "I hope everyone is unhurt!" Everyone else responded with, "I hope no one is hurt!" The author of the original tweet noted my unusual speech pattern.

Brains are weird. Communication is surprisingly more difficult than one would expect. We know what we mean, but, wow, others do not.

Pages