Mark Grealish

> cats and wizardry

Ordinary Day

in ireland

Taken at Bull Island, October 14.

An ordinary day at Bull Island

Phoenix Park, September 2017

in ireland

Taken on September 24 on a wonderful warm autumn evening.

Phoenix Park
Phoenix Park
Phoenix Park

Poolbeg in Silhouette from Bull Island

in ireland


On Being Vulnerable (as a Good Thing)

in me

We discus vulnerability as a negative because we need to protect vulnerable persons, which is that’s fair. One of the marks of society is in the way we treat our weak and helpless.

What we overlook is being vulnerable as a positive. I mean, we’re vulnerable all the time. We’re vulnerable when we share with friends or lay out plans at work. Think about it for a moment: what is confident self-expression but my affirmation of trust in my audience? And what’s trust me granting you privileges over me with the hope that you won’t abuse them? When I open up to my friends, I do so with an implicit agreement: “I will talk to you if you respect what I have to say.”

The topics of abuse, vulnerability and agency have dominated my life since April. I learned that I wasn’t the type of person I believed myself to be. Over the summer and autumn I undertook a harsh deconstruction of who I am. How did I get here? What drives me? Can I ever be a better person?

My Journal

The first thing I learned about myself is that I never let myself be vulnerable around other people. You can’t hurt me if I don’t let you in. This is all well and good when you live alone, but in any kind of relationship, a refusal to be vulnerable drives destructive cycles. Logic: Trust is a grant of privileges with the expectation that the trustee won’t abuse them. A mutual grant of privilege underpins every healthy relationship. No relationship can flourish when one side refuses to give the other agency in their life. A person who cannot be vulnerable cannot give. They can take, yeah, but they’re too afraid to open and up and give back. The relationship devolves into one side only giving and the other side only taking. Nobody can only give forever.

And there goes all the relationships of my life. Yes, I was a completely awful person on top of this, but I operated my relationships around my refusal to trust anyone else. I mean, you can’t hurt me if I don’t let you in, which would be great except that our relationship will never go anywhere.

That’s me, and I can only talk for myself. For the rest of you, a refusal to be vulnerable also occurs when you’re afraid of the consequences. “What will X think of this? How will Y react?” Far too many people worry far too much about image, perception and reaction. They’re afraid of belittling comments, or losing the respect of their untrusted peers. Fear of being vulnerable leads too many people to stay silent about mental health problems. Silence kills. We worry too much about consequences that’ll never pass. So many people wave off blogging with the remark that “what if people see this?” So what? I’ve written about all sorts of everything since 2006. Two thousand, one hundred and fifty posts with only four negative comments ever.

To speak for me alone, learning to be vulnerable has made me happy. I get to write posts like this without worrying whether I sound stupid. This summer I reached out to people I hurt with humble apologies, and whatever else I might say about that, I rebuilt bridges when I opened up. It isn’t easy to come out and say “I fucked up, and here’s how,” but the act was well up there on the list of things I’m glad I did.

Being vulnerable can be positive. Yes, you might hurt me, but I can cut you out if you do. Don’t be afraid to keep a journal, talk to someone on the train, express yourself or take a chance. This is all the life we get. The more I pushed people out, the worse the destructive cycles.

When I say “be vulnerable,” I don’t mean that you should either cry “YOLO!” or build a challenge-free safe space. I mean only that you work to let other people in and combat your fear of repercussion from expression and interaction.

Such vulnerability goes both ways: someone changes you, you change them. There are amazing people to meet out there. The more I let others in, the more I learn to listen. The more I listen, the more I know, the more I can empathize with and understand you. And if I understand you without reserve, then I’ll know for sure that you won’t be the one to hurt me.

Forcibly Set Counter Cache Columns to Zero in Rails 5

in code

(Or any other value you like.)

So it turns out that counter cache columns are marked as readonly because Rails handles increment/decrement internally through methods such as increment_counter. Rails does not want you to update the counters by hand. It really wants you to leave the integrity of those fields to the framework itself. Every update_whatever method (even update_column) fails. The only way I found which works is a straight-up raw SQL write.

# Dirty hack to forcibly set readonly counter-cache attributes to zero.
# @see
# @param record [ApplicationRecord::*] Any kind of application record.
# @param counters [Array<Symbol>] List of counter-cache columns to zero out.
# @return record [ApplicationRecord::*] Reloaded record with zeroed counters.

def set_counters_to_zero!(record, *counters)
  table_name = record.class.table_name
  zeroed_counters = { |field| "`#{field}` = 0" }.join(',')

  ActiveRecord::Base.connection.execute <<-eos
    UPDATE `#{table_name}`
    SET #{zeroed_counters}
    WHERE `#{table_name}`.`id` = #{}


You should never ever ever use this code in production. It breaks data integrity. I wrote it to test certain jobs and model callbacks, and it does by forcibly zeroing-by deliberately breaking-the counters.

Menlo Skylight

in ireland

Looking up at Menlo Castle