Programming: Existence is Pain

April 19, 2018

A rant.


My bike was stolen out of the backyard last night, so I’m feeling a little more aggravated by everything than usual.

This has had the effect of reminding me of a recurring sensation in my life as a software developer: that dealing with technology can be a fundamentally miserable experience, and that the skill of being ‘good’ at software is often mostly the same skill as being able to take a lot of crap from faceless, abusive machines in ways that you feel powerless to do anything about.

So while I’m all for the “let’s teach everybody to code!” movement, I do sometimes wish we’d stop writing yet another Learn Machine Learning With Python Tutorial, or whatever, and just make maybe take some time to work on making everything the world around us better in little incremental ways, by making what we’ve already got suck less, for ourselves and for all the newcomers and for just everyone, so we can have less stress and more peace in our lives.

Basically some days I can’t honestly tell anyone they should get into this, when on a good day you get to slowly hack your way through bullshit and on a bad day you might just succumb and give up.


An illustrative example

This morning I was trying to do some 3d graphing in Python. I’m just now getting comfortable in Python, finally, way later than I should’ve, after years of doing mostly Java and JS, so I’m looking up a lot of basic documentation.

I’m using MatPlotLib’s limited 3d support. It’s mostly a 2d drawing library, but has support for applying a projection matrix to 3d objects to render them onto a plane, and then doing rudimentary overlapping based on z-coordinates in the projection – or something like that. I don’t need much or I’d be using a more fully-featured, graphics-card-backed library, I guess.

See, look, I drew a thing:

Now, MatPlotLib is a library that’s used everywhere in the Python world, and students of programming everywhere are surely coming to this documentation. So when I go to look up how to make a 3d line plot, I do have to wonder why there aren’t quickly perusable code samples on the page to demonstrate usage of the APIs:

mplot3d documentation

Surely showing us an example of it in use would not take too much space here.

Aha, but at least there’s a (source code) button, so we’ll just open that in a new tab (I’m using Chrome on a Mac):

And it’ll just open:

Oh, that’s annoying. And shouldn’t there be a button that says “yes, open this”?

Maybe it’s hidden in those dots.

Hrm. Okay, that works, but I’m gonna be doing this a lot. I really prefer to open it in a tab instead of downloading it. I guess I regret clicking “open in new tab”, so I’ll just go back and open it the right way and see if I find it:

Phew, at least this time it downloads without complaining. I wonder why it worked that time.

Let’s just click on that:

And… oh. It opened in Xcode. I didn’t want that. Why would I want that? Why would Apple default to that? I never use Xcode.

Well, what I wanted was to open it in the browser, since it’s just a plain text .py file. But apparently there’s no way to set Chrome’s file associations in its settings. I looked, for a while:

Weird. I really thought that seting existed some years ago. Why would they take out something so useful?

I googled it, and found… some gibberish blog posts covered in ads instead of some simple documentation:

The first result is from some site, Chron.com, which I do not ever want to see again. Intuitively, it turns out to be filed under “Small Business» Types of Businesses to Start» Open a Bar»”, and is only for Windows, and isn’t even what I want, and is probably years old (there’s no date), and is a horribly manual way for setting OS file associations, rather than just telling the browser what I want.

I just want to tell Chrome what to open .py files with, and ideally that’s “in a tab”. Which should just be documented on the browser website, though it’s not like I’ve come to trust Google to do anything human-centric. So I guess I’ll ask a bit more specific question because, fortunately, these struggles are so common that people more driven than I do go ask about them:

There are two relevant results at the top. The first is… weirdly… the opposite of what I want. I wonder how they got it working in the first place?

The second is on ‘superuser.com’, which is a StackExchange for computer…. superusage… (of sudo, ie Super-User-DO, fame) which bodes well, because most of the community references on the internet are total trash and StackExchange/Overflow/their derivatives are the only thing keeping any of us sane.

Hey, it’s just what I’m looking for:

The asker is even asking directly about MatPlotLib documentation! But there’s no answers, just comments. Commenter Kat points me to another related question:

Which turns out to be also what I want and this time there’s an answer:

… but the answer says it’s built-in and can’t be changed, which is infuriating because it’s my computer and I should be able to do what I want. The answerer Synetech – bless their heart – submitted a bug to Chromium, which (thank god) was not closed with a “fuck you” like many issues on many issue trackers are (I mean, implicitly). But it’s a few years old and, despite having a few people chiming in that it’s important to them, nothing ever came of it:

And it was archived last year for inactivity:

So it’s probably not happening. Sigh. I know I should bump it, but… not today.

Now, I can work around this by reading the file locally, but I’m still annoyed at this point. Why do things have to be bad, on purpose? Why can’t they just be good?

Alright, back to the file on my computer, which I would like to open in Sublime text, not Xcode. Anyway, maybe I can tell Apple to open files with Sublime and Chrome will find out (even if it’s not willing to open things in tabs…):

I happen to know that if I want to change Mac’s default file association, I have to select ‘open with’ and tell it to always use this application, so I do that:

And I select Sublime Text and tick ‘Always Open With’:

And it just works:

Oh. Er. No. No, um… I wanted to open it, and I don’t care that it’s from an unidentified developer. Please?

Why is there no “go to security preferences…” button? Didn’t there used to be one? I know I’ve seen it somewhere before. There’s a (?) but it just goes to useless help pages. Where’s my ‘way out’?

Fine, I guess I know what to do here: I go to the Mac security preferences and, for some reason, tell it to open the last file it saw.

Weirdly, this menu knows about what it just did, and lets me override it. You’d think that would be on the error dialogue, but nothing makes sense anymore.

When I click “open anyway” (no password actually required?), I get the dialogue I should have gotten last time:

And finally I can click “open”, and I’m FINALLY done:

But for good measure, because I’m an engineer-y type of person, I should make sure to make this more efficient for next time. Maybe I can find a way to disable that useless security dialog that I see all the time and have never wanted or found useful and has never saved anyone from anything except?

I google something:

And find an Apple support page that lets me know I can control-click to override, next time:

(Or just right-click to open. I wonder if their docs are just not aware that people can right-click on Macs now? It is pretty new. Ten years, I think.)

Although

The safest approach is to look for a later version of the app from the Mac App Store or look for an alternative app.

To override your security settings and open the app anyway:

Which would be fine if it wasn’t a Python file. Which will never be trusted. Because it’s text. Sometimes I wonder if the designers of operating systems are… actually… people? Surely they share some of my frustrations? Surely they realize this sucks, and would add a “I’m a developer and I need to open files sometimes” option, or something? I’m not, like, running a file that’s going to steal my passwords. It’s plain text.

Okay, I fiddle with my search terms:

This time I find something more useful:

I learn a few things from here. 1: The thing in Mac that does this annoying prevention of opening downloaded files is called Gatekeeper. Useful for later searching.

2: There used to be a way to disable it permanently, and they… took it out. Here’s an older screenshot:

apparently not a thing anymore

This makes me hateful.

Anyway, there must be a way to do it, right? I google “disable gatekeeper 2018”, hopefully to only get articles that aren’t from before Apple made their product intentionally worse:

Which works swimmingly, though wow are these results sketchy:

Somehow the 5 stars on the second one, plus the drcleaner.com domain, makes me assume it’s going to try to get me to download a virus-scanner that hijacks my computer to mine bitcoins as soon as I click on it, so I don’t.

The first result turns out to want to show notifications (why? why does anyone do this?), has two sets of social media buttons (why? does anyone click those? please stop doing it so they go away. And why two?) and a bunch of other screen-filling garbage, and is from 2016 (maybe I should have searched for High Sierra)…

all of this comes before the article

…but at least it does recognize the issue and tells us that, yes, we’re not imagining things; Mac has been making this system more irritating with each release, and there is a way to fix it:

sudo spctl -–master-disable

But before we sudo a random command, maybe let’s check what it does so we don’t shoot ourselves?

And specifically:

That’s not very helpful. Maybe I don’t want to ‘master-disable’ every policy; maybe we just want to disable one policy? But when your APIs are stringly-typed and your documentation doesn’t document them… Ugh, I don’t know; this is not what I wanted to do today. I just wanted to learn how to make a line plot. I give up. Let’s just do it:

Hurrah! The button is back.

What fun! What a fun way to open a file to view some code.

Um, precisely none of this had to be this way, and it wouldn’t even have been hard.


In Summary

And please don’t forget to spend some time making your software less frustrating to use, even if you don’t know how to quantify the benefits of it. These things add up.