The Unqualified Engineer: Episode 02

Coding Interview Problem: Dinner Party

You’ll find the text-form code from the second episode here. Following some very good critical feedback I got from friends and viewers, this episode is much, much shorter and focuses entirely on a coding challenge. The full video is here:

With this coding problem, you’re main challenge is generating combinations. There are some really fancy ways to achieve this. My favourite approach involves using bitmasks and Hamming Weights. Such an approach would just count up from 0 to 2^n looking for any number with a Hamming Weight of table_size. While that’s super snazzy, it’s also not super representative of what a person not familiar with these types of problems might come up with, so I didn’t take that approach for this video.

Instead, this video focuses on recursion. Reasoning about recursion can be a real challenge for our poor human brains. To ease this, in the video I draw the recursion chart shown here:

A diagram of a 4 choose 3 combination result created via a recursive function call.

A diagram of a 4 choose 3 combination result created via a recursive function call.

From this, you can get a basic idea of how a recursive approach to this problem might be solved. The really tricky thing for someone tackling such a problem for the first time is that you have to recurse twice in every function execution. Many people think of recursion as an approach where the function calls itself. The exciting thing about this algorithm is that the function calls itself not once, but twice!

import itertools

def find_dinner_party(friends, table_size):
  groups = combine_friends(friends, table_size) 
  print "%d groups" % len(groups)
  print groups
    
def combine_friends(friends, table_size, groups=[], group=[], pos=0):
  if len(group) is table_size:
    groups.append(group)
  elif pos < len(friends):
    # skip
    combine_friends(friends, table_size, groups, group, pos + 1)

    # take
    new_group = list(group)
    new_group.append(friends[pos]) 
    combine_friends(friends, table_size, groups, new_group, pos + 1)
    
  return groups

print "--"
find_dinner_party(['Fred', 'Paresh', 'Tom', 'Greenie', 'April'], 3)

"""
For comparison, here's the one-liner Python approach
"""
print "--"
friends = ['Fred', 'Paresh', 'Tom', 'Greenie', 'April'];
print [x for x in itertools.combinations(friends, 3)]

One flaw with this code I noticed only after finishing the video and uploading it is that my groups argument is actually a bug. Because the default arguments are static across all calls to a function, this list will continue to grow and grow every time the find_dinner_parties function is invoked. It’s an easy thing to fix, but I ran out of whiteboard anyway. For those playing along at home, please add a list for groups in the call to combine_friends inside find_dinner_parties.

The Unqualified Engineer: Episode 01

Coding Interview Problem: Least Disruptive Subrange

Here’s the code from the first episode. This is a basic coding interview question that you might be asked in an interview at a tech company. You can see the video associated with this code here:

The problem here can be stated pretty simply. Imagine that you need a function that can take two inputs: 1) a list of integers and 2) another list of integers. The first list could be thousands of integers long. It can contain positive and negative numbers. It’s not sorted in any way. Any integer could be at any position. The second list is similar except that it’s equal in length to the first list or shorter.

What we want to do with these lists is find where in the first list we could substitute the second list, integer for integer, that would create the least amount of change in each integer from the original list. For this problem, we consider change to be measured in number line distance (i.e. absolute value). So, you can’t use some negative distance to offset some positive distance. If you substitute -2 for 2, that’s a change of 4.

An example would be something like this:

original =    [1, 2, 3, 4, 5]
replacement = [3, 5, 3] 

In this example, the “disruption” created by each possible substitution looks like this:

0th position swapping
 0  1  2  3  4
---------------
[1, 2, 3, 4, 5]
[3, 5, 3] 
 2, 3, 0 -- total disruption of 5

1st position swapping
 0  1  2  3  4
---------------
[1, 2, 3, 4, 5]
   [3, 5, 3] 
    1, 2, 1 -- total disruption of 4

2nd position swapping
 0  1  2  3  4
---------------
[1, 2, 3, 4, 5]
      [3, 5, 3] 
       0, 1, 2 -- total disruption of 3

You can see from this, that the best replacement choice here would be the 2nd index, which would create a subrange disruption of just 3, compared to all the other options.

So how might you solve this? Well, here’s a bit of JavaScript that aims to tackle the problem. This algorithm runs in O(n*m) time, where n refers to the length of the first input and m is the length of the second input. Interestingly, the longer the second input is, the shorter the run of the algorithm will be. So, the worst case is something like the length of replacement being half the length of original. In that case, the algorithm will do something along the lines of m*m work. It’s a constant memory problem in that it uses no additional arrays or objects to store state. I guess you could achieve this with a hash table if you just felt like wasting RAM. 😀

function findBestFittingSubrangeIndex(
  original, replacement) {

  var ii;
  var jj;
  var distance;
  var distanceSum;
  var smallestDistanceSum = Infinity;
  var smallestDistanceSumIndex;


  //   0  1  2  3  4  5  6
  // [ 0, 1, 2, 3, 4, 5, 6 ] 
  //             [ 4, 5, 6 ]
  //   7 - 3 = 4
  // Need one more than that to make sure we 
  // compare the last set of digits

  for (ii = 0; ii <= original.length - replacement.length; ii++) {
    distanceSum = 0;
    console.log('Logging for pass #' + ii);
    for (jj=0; jj<replacement.length; jj++) {
      distance = 
		Math.abs(original[ii + jj] - replacement[jj]);
      console.log(
        '  ' + original[ii + jj] + ' is ' + distance + 
		' off from ' + replacement[jj]
      );
      distanceSum += distance;
    }

    console.log(
	  '  The total distance on this pass is ' + distanceSum
	);
	
    if (distanceSum < smallestDistanceSum) {
      console.log('  >>> Found a new low with that.');
      smallestDistanceSum = distanceSum;
      smallestDistanceSumIndex = ii;
    }
  }
  return smallestDistanceSumIndex;
}

console.log('---Test Run---');
console.log(
  findBestFittingSubrange(
    [2,5,9,1,-3,40,2,19],
    [10,-3,39]
  )
);

console.log('---Test Run---');
console.log(
  findBestFittingSubrange(
    [2,5,9,1,-3,10,-3,39],
    [10,-3,39]
  )
);

While this algorithm (as far as I know) is correct, it does leave many details unserved. For instance, I don’t address the potential to integer underflow by subtracting from the minimum integer value in JavaScript. Likewise, I could integer overflow by adding to distance until it bubbles over the maximum integer value in JavaScript. My test cases are also fairly limited and don’t test for cases like empty list inputs. Also, because JavaScript, I should be checking for null inputs and handling that case reasonably. I’m also not checking for the case where replacement could be longer than original. I’m sure there are like a dozen other defects here.

The point is not to create a bullet-proof library function. Rather, I was aiming to simulate a real coding interview focusing on what you’d have time to accomplish. Let me know what you think. Especially let me know if I got it all wrong!

Thinking About Knee Jerk Reactions

Original post here: https://www.facebook.com/jg/posts/10100265608855158

While I was running tonight, I had a thought about the extremely negative reaction so many privileged people have to being called sexist or racist or <insert thing here>-ist. It occurred to me that this group of people probably hates being unfairly labeled as something they don’t see themselves as and don’t want to be.

Then I thought about every black person I know who has been pulled over for driving while black. Or every woman I know who has been mansplained by someone who just assumed a woman wouldn’t know something. Or every gay person I know who has had to deal with homophobes who are convinced the evil gayness is going to rub off them and their children. People in this group constantly have to deal with people labelling them and applying a set of expectations to them that may not have anything to do with their identity.

Everyone dislikes having someone assume something of them unfairly. One curious thing about people in the second group is that most of the people I know who would fall into the second group actually have some compassion for the people in the first group. They don’t expect the people in the first group not to put labels on them. They deal with dozens of small instance of this every single day. It’s as inevitable as breathing.

Interestingly, the people in the first group can’t stand the idea of anyone putting labels on them. To them, it’s a hateful and unfair dismissal of some or all of their humanity. It’s bigotry and ignorance. An outrage! Maybe when you don’t regularly face it, you don’t build up any thick skin towards it. I still find it fascinating that so many people (and if I’m being real, I mainly mean white men here) don’t see how similar the natural emotions are from group A to group B or how dissimilar the contexts of those emotions are.

I’m guilty of this left and right. I complained relentlessly about how terrible it was getting into and out of the Tel Aviv airport because I was treated badly. They singled me out as a young(ish) guy traveling alone and grilled me. I griped relentlessly about what a shit show it was trying to get my visa to go to China. In both cases, a friend of mine who happens to have relatively darker skin just laughed at my frustration because he faces that kind of treatment every time he flies. He also comes from a country that doesn’t have a great political status relative to the US, so he has to play the “please can I have a visa” game for almost every country he visits.

For him, it’s a day to day pain in the ass. He reminds me of this every time I get indignant about the injustice. To me, it’s unthinkable. It’s outrageous. I suppose really, it’s just new to me. Now, I can understand where he’s coming from in a way that I couldn’t before.

The same applies when being called out for being sexist or racist or anything-ist in a way that doesn’t feel fair. It might be, it might not be — I’m not trying to answer that question. However accurate it is or isn’t, if you’re a privileged person, you might be feeling that sting for the first time. Rather than knee jerking away from it, take a minute to consider that it’s a day to day reality for people around you. How much shittier would it feel if that was the way people treated you all the time?

Birthday Question, Age 31

Original Post: https://www.facebook.com/notes/jackson-gabbard/birthday-question-age-31/10152781770934836

So the 21st was the day of the Birthday Question. It’s the 2014 edition and roughly the 4th year of asking it. I think for me, this is a fairly easy thing to decide on. Last year was a big year and one that I spent a lot of time reflecting about. I feel a lot more in touch with what’s actually important and where I’ve grown the most. I think the biggest difference between the me of today and the me of last year is that I can understand the gap between what I want for other people and what they need for themselves.

I’m kind of a steamroller. I usually have a strong sense of how things should be. I usually know what steps to take to get there. I’ve learned that if I’m acting alone or in some context where the outcome is objective and there are no strong feelings, my tendency to impart order onto chaos is a strength. Sometimes the grand future I see requires change in other people. In that case, this style of… let’s call it ‘assertive problem solving’ is actually problematic. I’ve learned why this year.

Last year, I learned to accept my flaws more than I ever had before. I learned that doing so makes me stronger rather than weaker like I had previously thought. This year, I learned that extending that love and acceptance to the people around me works exactly the same way. I learned that it was actually fear that kept me from loving and accepting the people around me in the first place. When someone has a major character flaw, I felt I had two options: push them away or hold a strong line about that issue and never give an inch.

On some level it’s probably good not to condone bad behaviours. So, in some small way, yay me for that. In reality though, my reaction to these flaws wasn’t based in a desire to help the person. No, it was to keep myself from catching the cooties. To keep me free from falling into that same flaw pit and being worse off for it. When I was young, this was a real risk and avoiding it, a valuable skill. This year I learned that now, it’s a mostly bogus vestige of being young and surrounded by people I didn’t want to end up like.

For instance, let’s say someone has a flaw that makes them a bad decision maker. It turns out that it’s pretty unlikely that I’ll absorb that flaw through unconscious osmosis. The very fact that I see the flaw means I’m probably insulated from it. It’s still in me to try to fix the problem. Importantly though, if I really want to make things better, there are much better things I can do than throw their flaws in their face or push them away. In fact, letting people know that there’s something about them that should be improved mostly has the opposite effect of making things better. At least, the way I was doing it — at arm’s length, trying my best not to let any part of them touch me lest I become the worse for it.

This year I learned that the fear of being bad is a really strong, growth-inhibiting fear. I learned that people are usually doing their best. That whatever we should be doing differently we probably would be doing if we could. Someone who comes along and happens to see a better way isn’t really offering much by just telling the person about how things could be.

It’s kind of like seeing a person who is straining to live life in a scary world. They’re wearing a suit of armour for protection. Old me would see the suit of armour and say, “Hey, if you weren’t wearing that silly helmet, you’d be way better off!” At best I sound like a complete dick. At worst, I only make the person pile on more armour — to guard themselves against me and other people who would criticise them for being guarded in the first place. The reality is that the person is already doing the very best they can, struggling to feel good. They aren’t armoured up for no reason. That’s the gap I used to miss. Or maybe wilfully ignore is more accurate — a sort of self-protection in its own right.

It’s interesting that it was so hard to see this. It was hard work to realise that the way I kick myself for not being perfect is actually unhelpful. It’s been just as hard to generalise that acceptance to everyone around me. At least, it’s certainly much easier to just have a simple pass-fail test and cut off things that I’m nervous about and can’t use force of will to change. The problem here is that this makes me a very prickly person. Someone for whom you either pass or fail. If you fail, you experience a very different, compassionless side of me. Not because I want to be that way, but because it’s the only way I can definitely keep you from making me something I’m afraid of being (rightly or wrongly). At least, so I thought. This has been such a useful growth strategy, it’s been really hard to let it go where it doesn’t actually work.

At the same time, I can see now that almost everyone I know can think of at least one thing they would improve about themselves. Most of the time, they can think of lots of things. So, it’s not as if they’re just fundamentally flawed people who might drag me down in blissful ignorance of their toxicity. In fact, if they could get to a better place, they would. In all likelihood, they will in time anyway. But what if I see something that trips the ‘fix it or GTFO’ alarm in my head? How do I fix it?

Well, the biggest lesson I’ve learned this year is that love helps. Acceptance helps. It turns out that I and so many people I know do weird shit because we’re armoured up for conditions that aren’t obvious. Life is stressful. The world is dark and terrible at times. No one I know carries around protective gear just for funsies. The thing that has helped me need less armour was chancing to trust people more, going against some very well-trained instincts. Trusting that, probably, everything will just be okay. That the moments where things aren’t okay also aren’t the end of the world. I’ve learned that if I want to help people, it’s not a hard push for a grand and beautiful future they need. Probably, they need some love and some acceptance. With more goodness, they’ll probably get to a good place on their own. It’s pretty likely it might be a place even better than what my purview included in the first place.

“Mate, really?” (Or, Why It Matters to Me)

Original Post: https://www.facebook.com/notes/jackson-gabbard/mate-really-or-why-it-matters-to-me/10152645525549836

I wrote a note a long while ago about a conversation I had over a dinner. I wrote the note to explain how the conversation was actually sexist and dismissive of women despite looking like a conversation that was praising some of the women we knew. I got a lot of flack for that note. Most of the harshest comments came directly to my inbox or came up in conversations between me and other outspoken men. I also got some push back from women. Interestingly, in all of these conversations, I often found myself being critiqued as a standard, privileged white male. As someone who isn’t in a position to take a strong line like I did in that note.

The most common push back I got was skepticism about my intentions. Everything from a gentle, “Mate, really?” followed by a sideways look suggesting there must be a girl I’m trying to impress or some other selfish goal I’m serving. Or, the less direct but more dismissive, “I can’t stand it when guys try to be white knights about stuff like this.” In most cases, the thing that was in question was what gives me the right and reason to even have an opinion here. It’s apparently highly suspect that an overtly privileged white guy would spend his time pushing back on sexism that he reaps the benefits of. For that matter, highly suspect that a guy like me would even use the word ’sexism’ or ‘misogyny’ or other words that can be easily dismissed as the vocabulary of someone with a ‘feminist agenda.’

Well, the truth is I’m not just some Standard Privileged White Guy™. I know from the outside, it’s easy to make that assessment. I work among lots of very privileged people. I’m white. I’m a guy. I have found myself in a lifestyle of greater privilege than anything I could have fathomed. Can’t deny those things.

So, if not a SPWG, what do I think am I? Here are some details. My family used to live in a really poor town in Oklahoma called Shawnee. A redneck town by every measure. Some of my most vivid early memories are just glimpses from dark times in that place. Like the time my mom rushed me and my brother to our bedroom when our neighbour, a woman my mom had known for years and a woman who was regular company in our home, knocked at the door. She was covered in blood and bruises. Her face was swollen and shiny from the blood, tears, and snot that intermingled when her husband, a guy called Gary, beat the hell out of her. I was a little kid at the time but the impression was strong. I can still see her standing shaking in the living room, trying to explain what happened as if it wasn’t already brutally legible. Gary was a shadowy presence in the neighborhood. My brother and I weren’t allowed to talk to him. His wife was a constant victim of his abuse and that was just how things worked.

We moved from Oklahoma to Booneville Kentucky. Booneville is the county seat of Owsley county, a county that boasts the second highest child poverty rate in the entire United States. Something like 41% of families fall below the poverty line. By relative measure, we had an amazing life there. We had a house, not a shack or a trailer. We had food to eat every day. We lived near enough to the school that we could walk there while other kids had to take buses through tiny, winding Appalachian roads. We didn’t have to leave school before the end of the semester to go help our family harvest tobacco.

I had an aunt who lived there most of her life. She was a spunky, rebellious lady who had paid the price on occasion for that kind of impertinence. For instance, one day she ran off and got married without permission. Though I never met the guy, the adjectives that I’ve heard used to describe him are ‘mean’ and ‘cruel’ and spoken by people who know what those things really are. Despite living in a situation that was pretty terrible, she was looked down on. She had run off and defied the natural order of things. The fun factoid about her elicit wedding is that she was something like 40 years old at the time.

Another time in Booneville, I was sitting around the dinner table with another aunt, my mom, a few other family members, and the woman who had taken care of my grandmother in her last years. She was a woman with strong arms despite being in her seventies. She would hug you like her next breath were her last and she needed to give all of the remaining love she had lest it be wasted. She spoke caring words in thick Appalachian speech. On this day, she was telling us the story of how she jumped out of a police car and landed on the road. The cop who was driving her tried to get her up. She attacked him, hoping that he would kill her. He didn’t.

Prior to all of this, her sister and she had married into the same neighbouring family. There aren’t a lot of families to marry into in Booneville. Her sister’s husband reached some impasse in their life together that he couldn’t deal with. So, he killed her sister by beating her to death. In the normal world, killing someone requires legal process and consequences (unless the person killed is black for instance or perhaps poor or a woman, like in this case). Anyway, there was a quick and tidy cover up with some help from the sheriff and a prominent preacher in town. Everyone just turned a blind eye because there was nothing more to be done. Almost everyone. Of course, the sister of someone brutally killed might object to the whole thing being ignored by everyone including your husband who is the brother of the murder. My grandmother’s caretaker objected.

So what happened? Well, she was kicked out of both families: her married family, for betraying them, and her own family, for being a dishonourable wife. As a result, she had a nervous break down. Her normal mode of caring for the elderly and being as tender and loving as any mother was replaced by what I can imagine to be the darkest and most destructive thoughts possible. At least dark enough that she would try to force a cop to kill her in the street.

Then of course there’s my own grandmother. No physically brutal life befell her, thankfully. She was brilliant. Graduated college at 17. She was a voracious reader and tack sharp her entire life until the very end. Her brother grew up to be a research scientist despite growing up in rural Kentucky. She grew up to become a wife and a school teacher. Do I think the apex of her abilities was in teaching children? Not by miles. Do I think the world she lived in held even the tiniest sliver of an open door for anything else? Doubtful. She was a respectable lady. She would never be so hasty as to go off and pursue her own career goals. She wouldn’t even have her own career goals. She was an obedient and supportive wife all her years. She asked for permission to go places. She had her husband escort her around. A grand woman, for sure. But also a woman who was capable of so, so much more than her world permitted.

So that’s all far away and long ago. I just moved flats in London. I live in a nice place in an insanely nice part of town. It costs more in a month than the family home I grew up in cost for a year. SPWG existence is pretty good. I was unpacking boxes two nights ago in my living room. I heard shouting outside. My ears perked up and I wandered toward the sound. It was a woman’s voice apologising for the actions of her kid (or at least of someone who wasn’t screaming). There was also a man’s voice. He was calling her a pig and stupid and stringing together reasons the current situation was unacceptable. He was shouting about what a stupid thing it was that the kitchen window wouldn’t close properly. She would try to close it, but couldn’t get the mechanism to disengage to let it down. Then he would try. Mostly he slammed it and shouted insults at her. This couple lives in my building in my privileged Zone 1 London world. Before someone managed to get the window closed, I could hear her begging for him to please just stop shouting. Not out of respect for her. Not because she expected reasonable treatment. Just for him not to draw attention. Not to expose how selfishly he was behaving and to keep quiet how brutal and mean he is being and how shameful the whole thing was. I walked around our manicured court yard to see if I could identify what flat it was. No idea what help I could really be, but you can be certain that I won’t just turn away from it. As I heard this exchange, I thought of the moments where I heard, ‘Mate, really?’ and all its variants.

So these are some stories. Some flashbulbs and some broad impressions. This is far from an exhaustive list of the moments in my life where women were on the receiving end of a culture that gives them little good and lots of bad while expecting everything of them. Believe me when I say these are not the most personal or intense stories I could be telling. These are the only ones I have the stomach and the right to tell.

So, why does this SPWG stand up for women and push against a sexist and patriarchal society? What’s my real goal? Who am I really trying to impress? I guess being super honest, I’m trying to impress my mom. And my grandmother. And my aunt. And my next door neighbour. And my sister-in-law. And my niece. And a lot of women. Impress upon them that things don’t have to suck and that there are men who care about making it better. I’m trying to impress the interview candidate I talked to last month who felt so relieved when she realized that, “I’m not that kind of guy,” but in fact one that she can have a frank and fair conversation with about gender in the work place. I’m also trying to impress the Gary-types of the world. Impress upon them that the years where abuse is tolerated and ignored are over, at least if I or other people like me are nearby. I’m trying to impress the other SPWGs out there. Impress upon them that it’s not some ethereal problem that doesn’t have a concrete form. That it’s not something that ‘people like us’ don’t really have to deal with.

So, sure, there is at least one girl I’m trying to impress. I’m also trying to look this far-from-civilized aspect of civilized life in the face and not be yet another person who sees but does nothing because that’s the way things are.

Review of Secret Cinema, Spoilers Included

Update: After a few pieces of earnest feedback that I’m actually taking away from people’s experiences, I decided to alter the details of this post to exclude direct mention of the movie. Given the strong negatives of the overall experience, I feel like what movie it is doesn’t really matter. Still, doesn’t do to diminish someone else’s time. Fair warning: This post still contains details from the event that are pertinent for giving a coherent review. Some people may feel these details are spoilers. I’m including them not to be a jerk, but to be illustrative.

Wanted to offer some feedback about Secret Cinema from Friday, March 21st. This is my second Secret Cinema experience and I was really looking forward to it. My first was the Casablanca showing about a year ago.

Upsides

Aspects of this Secret Cinema event were very good. I’ll just list them for brevity’s sake:

  1. Exploring the space was amazing. Every room was exquisitely detailed. The notion of serendipitous interaction with other people and actors is a brilliant idea that in some cases played out very well.
  2. Some of the actors were amazingly good. One actor in particular was a genuine pleasure to be in the presence of. My date and I lingered in his room for quite some time just watching him interact with people. So good.
  3. The court room scene was an unexpected and mostly fun experience.

Downsides

That said, the were some extremely negative aspects of the experience. To be honest, the negatives of the experience so far outweighed the positives, I don’t think I’m likely to participate in Secret Cinema again. Especially considering that some of the negatives were consistent from my first time at Secret Cinema last year.

Mean “Actors”

When we arrived, we were greeted by someone who told us to go “over there” where a group of people were gathered, so that we could get our hands stamped. We were immediately asked to show our tickets by a woman patrolling the line. I had the email on my phone, so I started loading it. The person asking me was very abrupt with me. She then moved on to the next people in line. As the line moved towards the front, I was asked my last name, and had my hand stamped without ever seeing the tickets. Which begs the question — why was I questioned about my tickets if all that was needed was my last name? Also, while waiting in this line, a man dressed as a police officer swore at the people in line in front of us and told them to speak when spoken to. Okay, if this were a prison movie or if we were in character as suspects for something (or kidnapped people perhaps) that makes sense. However, if his character is an officer on the street and we’re upstanding citizens, what sort of behaviour is that? Just felt oddly mean and degrading for no clear reason.

When we entered the Chinese Laundry, we were greeted by a character who was to shepherd us into the underworld. This character was openly antagonistic. Beyond being a bad actor whose awkward Boston-meets-Chicago-meets-London gangster accent was painful, he seemed to be just indulging in the opportunity to swear at us without making it feel like a legitimate experience at all. The mismatch between what would have made sense and what he was doing was so conspicuous that it took away from the experience. If he had chosen to say nothing at all, the effect would have been more resounding and interesting.

Once we were inside, I was greeted by a tall guy in a dark suit and hat. He bumped into me from behind. I turned to face him and apologised, unclear at that point that this was his act. Face to face, he leaned in close and blew e-cigarette smoke in my face. I could smell his not-clean breathe and feel the moistness of it on my lips. Gross. He then said, “You want to make a hundred bucks?” Let’s take a step back and think about real life. Let’s imagine that we’re in the real world. I’m in a club. Some guy walks up to me, runs into me, blows smoke in my face, then asks me if I want to do work for him. How would I feel? I would feel like punching the guy. I would settle for getting away from him as quickly as possible because he’s a really unpleasant guy to be around. So, given that this is ostensibly play (though there was nothing playful about him blowing smoke in my face), I just said “No. Not remotely.” He looked at me disgusted, told me “You’re not going to have any fun around here,” and walked away.

Ironically, he was pretty much right. What he didn’t understand is that I already wasn’t having any fun. No aspect of the experience so far put me in a state of freedom to play. Nothing so far felt like there were safe bounds between reality and play and that we were all in this together. No, in fact the experience felt much more power imbalanced in favour of those who knew what was going on than those who didn’t.

Secret Cinema feels more like the Stanford Prison Experiment than a playful immersion in the world of the movie.

Sadly, the list of bad interactions keeps going.

At one point, we were all ushered into a real court room to witness a fake trial. I was grabbed aside and drawn into a room with a guy who told us to render “Not Guilty” no matter what in exchange for $500 bucks. This seemed like the moment to be playful for me. Getting to participate in an intense jury debate sounds fun. Sadly that wasn’t the way this worked. I was to do as I was told here. Being told what to do and when to do it is not fun. Then, in the court room one actor posing as a bailiff told us to stand in one place. Then another came along, swore at us, and told us to go stand somewhere else, asking who told us to stand there in the first place. Hilariously, it was his fellow actor. Being treated like dogs expected to roll over again and again is not fun.

At another point, we tried to go into a club but we were stopped at the door by an actress. She told us it was members only and that we couldn’t just walk in “unless we had something for her.” So, playing along, we offered her as much money as we had. Yet, it wasn’t good enough. She kept up the act of surly door minder to the point that my date and I just felt truly unwelcome and walked away. It wasn’t mean-with-a-wink, it was just mean.

Later, I was standing in one of the rooms and a guy walked in, pointed harshly at me, said, “You — come with me,” and stormed out. Not a chance in hell. By this point, I was so fed up with the experience that I would rather stand off with the guy right then and there than engage in any more “play.”

I can keep going, but you get the point. I’ll leave out the other court room bailiff who stopped us to extract a “jury fee” from us and all the other small interactions that were antagonistic by default. Why couldn’t actors just have interesting personalities? Why was aggressive, exploitive behaviour the default interaction with every person? Sure, the movie they showed was a gritty movie, but that doesn’t mean that every person you meet should treat you badly as the first note of the interaction. Also, the fact that everyone in the movie is a grifter is ostensibly a secret, so we should have had no idea why the hell everyone was being so abusive. The whole thing feels like an indulgent experience for the “actors” and an abusive experience for the attendees.

The most absurd reality of this is that I’m an extremely playful person. I love fancy dress. I love acting a fool and not taking myself seriously. I do a lot of public speaking and feel very comfortable in a semi-structured environment that is semi-contrived and semi-real. I was once kicked out of a public park with some friends for acting out Hamlet on the amphitheatre stage after the park had closed. For god’s sake, I went to Burning Man last year and had an amazing time. I also got really into this night. I rented an authentic 20s suit and followed all the procedures ahead of time. So did my date. I wanted to come and have an exciting and playful night. If someone like me can’t get into Secret Cinema, who the hell is it for? Who would have a good time?

Cellphone Confiscation

Ruined screen protector

Back at the start of the night, after getting our hands stamped, we walked to where we had to give up our phones for the evening. Part of my work is building systems that operate at all hours of the day on complex infrastructure. Sometimes systems break and I have to act quickly to figure out what’s going wrong. It makes me very uncomfortable giving up my phone because it’s my notification mechanism when things go wrong. Also, I use my phone as part of two-factor authentication to lots of systems. If they lose my phone, it would be more than a day of work to get things back in order, starting with buying a new phone and a trip to my service provider to get a replacement SIM. Not to mention the trouble it would be trying to get them to cough up the money for the phone later. Not remotely my notion of a good time.

So, I questioned their procedure, asking what assurance I have that they were going to do this correctly and not cause me tons of grief. The response I got was a compassion-less “We haven’t lost a phone yet. This is company policy.”

Interestingly, none of the information I was given ahead of time included an explanation that this would be required. I went back through every email and every web page I was directed to. No mention at all. If they had told me ahead of time, maybe I would have changed my mind about going. Maybe that’s their reasoning behind surprising you with it when you get there.

The guy taking my phone explained that I would be given a ticket that would allow me access to my phone at any point if I needed it urgently. Unhappy but not willing to end the evening five minutes into it,  I gave up my phone, took my packet and went inside.

At the end of the night, my date and I went to retrieve our phones. There was already a group of people starting to accumulate, but we were first in line. A guy still acting half-way in character took our ticket, radioed for our phones to be brought up then walked away. Minutes into this, with no more info about what was happening, one of the other people waiting had someone return with a satchel with his ticket’s number on it. The woman returning his phone peeked inside the bag and then asked him to describe his phone to her. This is their system. They decided that a number and a satchel was the correct way to do this. Interrogating people afterward is insane. If you take my phone from me and give me a reclamation means for it, I do not expect to also have to prove my knowledge of my own property. It also rang closely of being asked for my tickets at the entrance when my name was all that was required.

Being honest, I lost my temper at this. I spoke harshly to this lady. Something along the lines of “Just give him his fucking phone back.” Reasonably, he looked surprised. She looked antagonistic right back at me and told me this was necessary because they wanted to make sure people got their correct phone. I would argue that it’s complete bullshit and that they should come up with a more reliable system if they wanted to take ownership of tens of thousand of pounds of nearly identical devices. If I found any ticket lying on the ground, went to them, answered their question with “an iPhone,” I would have a super high likelihood of walking away with a phone that wasn’t mine. It’s a bad system at best. Also, when we got our phones later, they didn’t ask for a description. Arbitrary treatment where someone else has power over you and you just have to do whatever they cook up for you to do is not fun.

Around that minute, chaos ensued. A group of people down the hall had been setting up a table for returning phones to people. It was unclear who we should be talking to. It was also completely obvious that the organisers had done nothing ahead of time. They were sorting the phone satchels numerically while fifty-ish people stood and waited. This was around 5 hours into the evening. It didn’t occur to them to have this done ahead of time? That at the end of the movie people would want to leave? Or to make sure the phones stayed in order as they were collected? I cannot understand why this was an issue at all. Every coat check I’ve ever been to just gets this right by default.

The group of us waiting for our phone grew from the original ten, to fifty, to probably half of the people at the event. This is an interesting data point, because we were leaving early. As we walked out of the movie hall, multiple people told us to stay because there was a dance afterward. We didn’t exactly feel like dancing. When the credits rolled, I felt like I had put up with the fullness of the experience and, relieved, could now leave. Perhaps some of the more than a hundred people gathered in the hallway felt the same way.

So at this point we were waiting somewhere between the desk and the table (theoretically, our phones would come to the desk where the guy had radioed for them), we heard someone shouting “Over 200 on the right, under 200 on the left”. They were trying to partition a mob of more than a hundred of people *after* it had become a mob. Also at this point, despite having left early to get out before the crowd, my date and I were now swimming in a mob of people with no idea where our phones my show up — the desk where the guy had radioed or the table where the mob was looking.

We walked to the tables (where they were still shuffling phones while people waited) and asked. We were told to please wait in line. There were no lines, just two mobs of people running the length of the hallway now. I was feeling sort of apoplectic at this point so I just walked away. I would rather sit quietly somewhere than wait in an infinitely long line while they sort out something that should never have been a problem. My date was more persistent with the person holding back the mob, got a bit aggressive, and had our phones returned immediately. I feel bad that we jumped the mob. I feel like we got special privilege because we were rude, which is not something I ever want to be. This feeling is counterbalanced by the fact that we took special efforts to get ahead of exactly that situation and the incompetent handling of the situation ruined that and left us standing around with no notion of what to do until the situation was going to be a mess no matter what.

When we got back home, my date noticed that they had managed to scratch up her screen protector in the process of confiscating and returning our phones. No damage to the phone, fortunately, but it indicates that they weren’t going out of their way to take care of our phones.

In sum, Secret Cinema made for a bad evening. If I had it to do all over again, I would skip the event without batting an eyelash. I would have had more fun watching a lot of other movies alone.

Lessons: A Year and A Decade

Original post: https://www.facebook.com/notes/jackson-gabbard/lessons-a-year-and-a-decade/10151936284329836

This is my answer to The Birthday Question for the 30th year of my existence. I was asked the question by a number of people this year, which I think is awesome. For those of you who haven’t been exposed, the question is this — what is the most important lesson you learned this year? Because this is a special year, I was also asked to answer the same question, but scoped over the last decade. Serious business.

To answer the original Birthday Question, I wrote a massive list of things I learned and then sorted them according to impact to my life. What follows below are the things from that list in order decreasing order of importance. I’ve omitted a few things that I don’t think make sense to share this way. If you’re itching to know, I’ll probably answer privately.

So, the most important lesson I learned this year is that it’s okay to fix me and also to love me while broken. Or, to put it less harshly, to accept myself as good, flaws and all. I would guess for a lot of people that’s a strange thing to hear me say. I probably come across as confident and happy (or at least upbeat even if I’m raging) most of the time. In reality, I have very high expectations of myself that sometimes I don’t stack up against. I don’t think anyone who knows me would blink if I said it’s my nature to put a lot of pressure on people to achieve. The part that not a lot of people know is that I have always put much, much more pressure on myself than I put on other people. Part of my internal ruleset is to avoid letting other people feel the pressure I apply to myself.

This year, I learned (in some senses the hard way) that I have to be able to accept myself even in the face of failing some of my internal checklists, especially if I want to love other people. I learned that letting the cracks show and not being so perfect means I can grow and heal, better and faster. I learned to be compassionate beyond what I knew was possible. It also means I can be an open heart for others because I’m not afraid of being faulty myself. Obviously, I’m not just a wide open heart all the time, but it’s something I can be. This year I learned that people respect you for owning your flaws.
This year I learned that what I think is most important might be something that not everyone else agrees with or sees value in. I guess I’ve known this for a long time, but not in general form. This year I learned that this can be true at work as well as family as well as friends, and so on. Sometimes that means doing things other people disagree with and being willing to deal with the consequences of the difference.

I learned that everything most likely will just be okay. That doesn’t mean I learned to trust that knowledge 100% of the time, but I try to and fundamentally I know it’s true. I also learned this year that trusting people is easier than I thought it was.

This year I learned that choosing to work on what I *need* to work on more than I what I *should* work on is a dangerous proposition. Sometimes serving one need means neglecting something else. This year I put less of myself in my work than I have in the past 5 or 6 years. I needed to. I had some healing to do and some growing and I wasn’t willing to let work hold me back on that front. It worked out poorly for me in my review, but I learned a lot in the process. Sometimes accepting the cost of “failing” in some way affords breathing room that is more valuable anyway.

This year I learned that finding a role model and letting that role model know she or he is a role model changes the relationship. Not necessarily in a good or a bad way. It’s just different than being quiet about it.

This year I learned that I’m on a mission to realize a world that I wish I had. I think I wasn’t aware of this before, but I was just as ardent about achieving it. Knowing makes a huge difference. I get to decide how much energy I want to devote to it and decide if the world I’m driving towards is a good one (and so I can change course if I’ve gone wonky).

In a broad sense, this year I learned to be less afraid. Also that being less afraid means other people get to be less afraid, too.

Because this is my 30th year, the wise and giving Chaitanya Mishra asked me to answer this question for the last decade. Same process, different answers.

This decade I learned that where I come from means only as much as I’ll have it mean. I learned that I want it to mean more than I thought I did. I learned that I respect and value my humble beginnings and never want to lose sight of what that feels like. Importantly though, who and what I want to be matters more than where I come from in the end.

This decade I learned that I don’t need much love and affection, but I do need some.

This decade I learned that I want important people in my life who stay in it.

This decade I learned that I’m capable of more than I had any working models for when I was young.

This decade I learned to code.

Sassy !== Assertive and Female

Original post: https://www.facebook.com/notes/jackson-gabbard/sassy-assertive-and-female/10151447333274836

At a dinner some weeks back, I was having a conversation with some male engineer friends of mine from a bunch of companies in the London area. The challenge of finding engineers who are women came up. It’s a topic that comes up a lot when I’m at the table because I think it’s really important for male engineers to understand the experience women have as the gender minority in technical roles. Usually I find these conversations enlightening. Especially if there’s a female engineer at the table, I often find bugs in my perspective as a guy. I’m far from bias-free as a man in tech (though I could probably just delete the “in tech” part).

 

At this particular dinner, I found the opposite to be true. As we talked through the factors that make hiring women in technical roles difficult, we started thinking through the characteristics women we work with have in common. There do seem to be some common things. Really strong technical skills was (and usually is) at the top of the list. We also talked about women who code not being afraid to be the only girl in the room a lot of the time. This is where something unexpected popped out of the conversation. It took me a while to grok why I was so bothered by it, but I think I understand it now. The flow of the conversation went something like this:

 

* Started with a trailing conversation about women in tech who are awesome, focusing on particular women we know. *

 

Male engineer #1 –

Yes, _redacted_ is really good. She just has a sassy personality that prevents her from getting pushed around by men.

 

Male engineer #2 –

I think a lot of women who do well in tech are sassy that way.

 

Me –

*semi-automatic facepalm, vague confusion*

So, by sassy — you mean, like, assertive and female?

 

Male engineers #1 and #2 –

*General agreement*

 

Me –

You know those aren’t synonymous — right?

 

Male engineers #1 and #2 –

*Lots of counter arguments*

 

All of us –

*Lots of terrible validation of gender stereotypes, completeley assinine judgments, and typically male presumed-top-of-the food-chain awfulness.*

 

 

It’s not all the time that I’m aware of subtly sexist things I do or say. If I’m being completely honest with myself, I’m pretty sexist in a bunch of ways that fall out in a lot of places. It’s embarassing to admit. It’s more embarassing to try to hide it. My goal here is not to flame some people for saying a sexist thing. I’m completely guilty of the occasional TWSS joke and definitely guilty of letting my biased thoughts roll out unfiltered into conversations with peers and coworkers irresponsibly. I have absolutely been that guy who has to stop laughing when a woman walks in the room because I’m too embarassed to try to answer her if she asks what’s funny. Knowing this about myself, a goal here is to point out a class of sexism that happens all over the place and to flesh out the underlying perspective that enables it. Also, to hopefully own my role in it in a way that will help me change.

 

Back to dinner. In the immediate conversation that followed, I called the guys out about it as much as I could then. I argued that sassy is not gender neutral and that it carries a bunch of bad connotations. Surprisingly, I got skepticism and push back. I don’t know why I’m suprised really. Smart engineers don’t fix problems that don’t exist. They want proof and want to do their own thinking about the proof they’re given. Why wouldn’t they push back against an accusation that, if valid, would require them to rethink a lot of how they think and behave? Why wouldn’t they push back against someone telling them that they need to be more self-critical about everything they say about women? Fair arguments. My response is: because it really, really matters.

 

Now let’s dig in to the tricky stuff. What’s actually the problem with sassy? Let’s start with why this is a bad way to describe someone, starting from least offensive to most.

 

For starters, let’s be clear about the meaning. Sassy means self-assured and bold. Good things. It also means impudent, saucy, cheeky, conceited, and pretentious (all from the OED, btw). Very bad things. Someone who is sassy has an agenda other than what is important in the moment. They might react overly strongly to something in a way that doesn’t fit the situation and probably draws attention to them.

 

I can see why that would be annoying if you’re trying to get work done. I can also see two massive reasons why being annoying is good and being labeled ‘sassy’ sucks in this context. Imagine the gentle discrimination felt by someone on the receiving end — someone assertive enough to address it — by people who don’t notice what they’re doing. That feeling of “wow, this sucks” can easily lead to a kind of “impertinence.” She’s pushing back on the loaded situation she’s in. Meanwhile, the guys are ignoring it because “hey, it’s not a problem I feel any evidence of.” In this situation she’s behaving reasonably, I think. I have done the same when someone is being dismissive. Labeling this as “sass” is sort of accurate (by definition) and also completely terrible in basically every way. It means short changing the person in the moment, frustrating her resolve to fix things, and simultaneously maintaining the hegemony. Triple facepalm.

 

Okay, so, that’s obviously really bad, but it’s not the worst of it.

 

Worse than that, sassy is a gender identifying term in this context. In my adult life, I have never heard a guy called sassy. To fully own my assertion here I will add that all of us at the dinner party actually discussed this very point in the same conversation. We agreed, because we’re terrible people, that sassy is a term only fit to describe women and gay men. My internal “I’m telling everyone what a massive asshole I am” alarm is going off like crazy as I write that, but I’m committed to being honest here so I’m ignoring that alarm. I’ll indict myself fully in the next paragraphs.

 

Most tragically, sassy is really, really belittling. After giving a lot of thought, I pretty sure it’s only appropriate to refer to children as sassy. Why? Because my right to label someone “sassy” implies that I know what’s appropriate in a given context and they don’t. It implies that I’m qualified to judge them. That they’re somehow under me in a way that makes it okay for me to assess and label their assertiveness one way or another. To put this more painfully, it shows that we men felt entitled to judge her and all women (and apparently even gay men, to my surprise) on their ability to participate at “our level” in things. That’s phenomenally bad.

 

The sum of all of this is pretty obvious but I’m going to spell it out anyway. We, men, these men, myself included, are still a bunch of male-supremacist assholes. When another man asserts himself or has a generally boisterous personality we probably call him things like boisterous or assertive. Maybe in the extreme case, aggressive or domineering, or an asshole. We probably also compliment him for it because he’s an engine — a steamroller. What’s interesting is that we describe him relative to how he makes us feel for the most part. With this woman, we described her in a way that reiterates her status relative to us. We put her beneath our implicit superiority — because she was trying to reach across and behave as a peer. We don’t give her the option of being able to make us feel any particular way other than sassed by an inferior.

 

For the haters:

‘Dude, you’re reading a lot into this one conversation?’

Yes. Yes, I am.

‘Man, is the problem really *this* bad? Aren’t you just making it worse drawing so much attention to it?’

Depends on how much you care about giving everyone who would love to be in technical roles the ability to be in them without having to look up a steep hill of tiny bias-pebbles every single day. I would say that’s pretty important.

 

‘Doesn’t it seem hopeless making this much noise when there are countless similar events happening in others contexts without anyone batting an eyelash?’

Not on your life. You have to start somewhere. This is my first attempt at changing things by being willing to be the guy who owns what we as guys think and to hold us accountable for it.

 

‘Oh, this again.’

Haters gonna hate.

 

Main point, again:

My goal in writing this isn’t to flame a handful of dudes about an offhand comment made at a dinner. It’s to point out, own, and debug a perspective problem that manifests in offhnad comments at dinners everywhere all the time. I want to be a guy that women want to work with. Someone a woman will trust to give her credit where it’s due — to take her just as seriously as anyone else with the same abilities and different anatomy.

 

Aside from the fact that it’s just extremely obviously wrong to feel any differently, I feel this way because my experiences working on teams with both women and men is that women make kick ass engineers and kick ass teammates. If you disagree fundamentally, you should be very skeptical of your perspective. You might be suffering from the same subtle biases I’m trying to get past.

This Web Page is a Dick: T-Mobile

Screen shot of a browser inspector showing the HTML that governs the behavior of a webpage

T-Mobile, why do you hate your users?

It boggles me endlessly when sites have draconian requirements for passwords. I use a password generator/store application called 1Password. This application lets me create crazy strong passwords for every site I interact with. This means I can ratchet up the special characters and length without any worry that I won’t remember the password. I know I won’t remember, I use a computer to do the remembering. Anyway, this works great unless I’m up against sites like T-Mobile that offer ridiculous rules:

  • Must be between 8 and 15 characters.
  • Must include letters and numbers.
  • Must contain uppercase and lowercase letters.
  • Cannot contain spaces or special characters (!, @, $, %, ‘).

So the first rule makes some sense. Short passwords are less secure. However, length of password should have no restriction because more bits means longer crack times in the case someone does get a hold of the hash. Senseless.

Requiring letters and numbers is good as is requiring upper and lower case letters. Adding more variety to the symbol set means someone trying to brute force the password will be at it for a lot longer.

No spaces or special characters… wtf? There are dozens of special characters available on a standard keyboard. Thousands if you count multi-key sequences that produce special characters. Allowing these characters would make it extremely burdensome to try to haxX0r people’s passwords.

As if that isn’t bad enough T-Mobile goes even further to make life miserable for its users: complete restriction on the input methods the user can use to set their password. In the screen shot above, you can see that the UI engineer who built this page has disabled pasting into the fields. They’ve also made the refuse to accept drag and drop text. I can’t fathom the product decision making that would require this sort of input. For me, this means that if I want to use a highly varied, randomly generated password that I would have to manually enter all 15 characters of it exactly correctly… twice. Fucking insanity. Fortunately for me at least, the HTML DOM is a dynamic place so I can just remove these dubious “features” via the web inspector and get back to what I was trying to do.  This web page is a dick.

Generating a Color Picker Style Color Wheel in Python

color gamut generated from Python

This color wheel was generated with Python. Check out the code on GitHub.

For the record, I am very bad at Python. Yet, it has become more and more my go-to language for doing little things that aren’t web. For instance, I recently undertook to create a color picker/color wheel in Python.

For the uninitiated, a color wheel or color spectrum is a series of hues that run from red to indigo (roughly purple to our eyes). It’s the rainbow. The color wheel is this same thing but wrapped around in a way that shows all the hues the human eye can see. In reality, indigo doesn’t converge on red as you go up in light frequency, but the hues that you would see if it did are colors we know well — magenta/pink.

So, generating a color wheel is an interesting challenge. The primary colors can be created from the hex colors 0xff0000 (red), 0x00ff00 (green), and 0x0000ff (blue). You probably see the pattern easily. A color breaks down into three channels, each of which has up to 0xff or 256 values from 0, completely absent, to 0xff, completely displayed. Blending from blue to green implies moving from 0x00ff00 to 0x0000ff by decrementing the green channel monotonically as you monotonically increment the blue channel. So, you can probably start to see how the logic for generating the color spectrum graphic will have to work. Of course I’m ignoring a few colors that are important. Red, green, and blue are only half the colors that are necessary for the color wheel to look complete. The others are 0x00ffff (cyan), magenta (0xff00ff), and yellow (0xffff00). These colors appear in color spectrum interwoven between the primary colors. If you’re wondering why red and green make yellow, you’ll probably want to read about Color by Addition. Though, from a numbers perspective it’s easy to see a relationship between 0xff0000 -> 0xffff00 -> 0x00ff00.

Creating the gamut requires calculating how much of each color to use in the blending. One important aspect of a color wheel is that any color you can select is a blend of at most two colors. So, one way to generate a color wheel is to go pixel-by-pixel through the image you want to create figuring out what sextant you’re in, deciding which color you’re closest to, then figuring out how much of the other color to blend into it. That’s the approach I took. It’s true that you can do this other ways. In fact, I’m pretty sure there is a slick algorithm for this that I didn’t realize. I was on a plane when I wrote this and consider it more about learning Python than about making the most compact implementation of color spectrum generation.

Anyway, here’s the code (using the Python Image Library) on GitHub.