a work in progress

panorama of Vancouver/English Bay in summer

Month: February 2016

Going on record with my Jon Snow theory

Before we get to the next season of Game of Thrones, I want to get my personal theory about what’s going on with Jon Snow published so I can point back at it and gloat later.

Much as I adore Joanna Robinson and her crew at Cast of Kings and her other crew at Storm of Spoilers, I have a fundamental difference of opinion from them regarding Jon Snow.

They all seem very convinced that what’s going to happen in Season 6 is that Melisandre will resurrect Jon Snow from his vicious murder by Ollie (a la Thoros of Myr resurrecting Beric Dondarrion). See, me, I don’t buy it. Not because I think Jon’s gonna stay dead, but because I don’t think he ever died in the first place.

GRRM’s text left it hanging, the same way he did when Arya was blinded, when Tyrion was supposedly drowned by the Stone Men, etc etc etc. Sure, Jon was stabbed. A lot. And in the show, sure, that was a pretty big pool of spreading blood and Kit Harington’s lovely blue eyes were open and staring up at the sky, unblinking. But y’know what keeps you from bleeding out so fast? Motherfucking freezing temperatures. I actually know this firsthand from an unfortunate slip & fall when I was in grade 1 in Saskatchewan. I had a pretty harsh cut on my little head that stayed frozen and contained until I got home and inside when it really started bleeding.

See, we know that sometimes, they come back wrong. Beric didn’t, but he didn’t come back fully right, either. Lady Stoneheart came back wrong (although, in my opinion, she wasn’t that right when she was alive either – her predecessor falls in the “Ron Weasley” category of fictional characters for whom I have very little sympathy). And if Jon is going to be the hero I think he will be, as important to the show/series as we all think he is, then it’s important that he is fully human, not a shade, not a zombie (whether an ice zombie or a fire zombie or whatever. A slush zombie). It’s crucial that he not have died.

So my money is on him walking up to the brink of death & not stepping off that cliff. Melisandre may help keep him from dying. But I unequivocally do not accept him dying & being resurrected. That breaks a fundamental part of what makes him a compelling character – he needs to be OUR hope, which means he needs to be human, like we are.

Nope.

Building SelfControl from [REAL] scratch

As someone who is easily distracted by brightly coloured shiny things, which is great when scuba diving in the tropics, but not so great when working on a pretty Retina Display Mac with all sorts of bouncing icons, infinite browser tabs, etc, I use the tools available to remove obstacles in my way. Or indeed, the ones NOT in my way but off to the side of where I want to be going but that are so tantalizing. One such tool is the open source Mac app SelfControl.

The basic functionality of SelfControl is that you set up either a blacklist of sites you don’t want to allow yourself to access for some amount of time or you go hardcore and set up a whitelist of sites that you WILl allow and ban the rest of the world as unacceptable distractions. [Aside: an anti-spam/anti-virus company I used to work for preferred the terms ‘blocklist’ and ‘allowlist’ instead of ‘blacklist’ and ‘whitelist’ for a variety of reasons, some cultural, and where I need to use them, I’ll be using those terms as well.]

With SelfControl, you  decide how long you want to focus for, set the slider for that amount of time, and press ‘Start’.

The way it blocks sites is by modifying the Mac’s hosts file (and firewall) so it needs to use admin privileges, which is why you have to enter your password. For many, that’s a decent way of it asking “Are you sure?” because the average user isn’t going to know how to undo the changes manually – that’s part of why it’s effective.

And that’s a perfectly helpful use case: person says “I need to focus for 2 hours straight, and I’m my own worst enemy, so block distractions RIGHT NOW”. But it’s not the one I’m most interested in, personally.

You see, when there’s something that I’m particularly avoiding starting (usually writing), I won’t necessarily even get to the point of starting the app. There are different tiers of self control and what I’d like to do is set myself a regular schedule with blocks at certain times of day. There’s an argument to be made that if I can’t even boot the app & click the button, I have bigger problems to sort out, but if there’s a way to make the process more structured and automatic, I’d prefer that. And I’ve heard from others that they feel the same way – they think scheduling would be useful.

There are a number of things that I’ll need to work through to get that going (not least of which is figuring out how to automate the privilege escalation on a scheduled basis – maybe cron?) but the first hurdle I had was getting the app to build at all.

I had tried to do this about 8 months ago, with NO success. I haven’t been a Mac developer at all and until fairly recently, I hadn’t been a developer for over 10 years. A lot has changed, y’all! And one of the biggest changes has been the burgeoning mass of package managers to simplify installation of apps, libraries, etc. Although I use Homebrew to install apps on my Mac, I hadn’t heard of CocoaPods and didn’t know there was a required step to run ‘pod install’ to get the required prereq libraries installed in the build directory. [It’s useful to run your build instructions past true newbies to find the steps that are SO familiar/basic that it doesn’t occur to you to write them down].

At the Recurse Center, I learned about a lot more package managers, and that there’s at least one for every platform. I already knew about npm & gem, but not pip, and definitely not pod. So I realized that there was a missing step in the SelfControl instructions – one that would be so automatic for Mac app developers that they wouldn’t consider it missing, but for someone who wanted to start their Mac OSS development with SelfControl, it was pretty crucial. Now, I don’t want to suggest that I don’t know how to search for solutions to issues, nor that you don’t. But when you run up against something where you don’t have a reference point for what’s missing, the amount of the unknown is completely unbounded. You have no idea how far away the finish line is, and if your drive to do this is hobbyist-level, you may bail, like I did last summer.

So, armed with this new knowledge, I tried again to build SelfControl from scratch. I got a bunch of failures (including the promised code-signing ones) but some of them are due to a recent Ruby change that apparently breaks CocoaPods. This post is getting long, so here’s a link to how I got through ’em. It’s ALSO long but that’s largely due to a bucketload of screenshots.

Steps to build SelfControl from scratch with no prior OSX dev experience

Preamble

This post documents the steps required to be able to clone and build SelfControl from absolute scratch – as in, you haven’t done any Mac development to speak of before at all *as of Feb 12, 2016*. I assume you’re running El Capitan.

The only prerequisite I’m going to assume you have is Xcode because:

  1. I really don’t want to try to fully uninstall it from my machine for the purposes of this walkthrough and
  2. if you haven’t got it fully installed, the steps to getting that going are trivial (if you try to run something and it says you need to install more components, install those components. If it says you need to accept the command-line license, page through the full license text in the Terminal and type ‘agree’ (or whatever it asks you to type – I don’t recall the exact text)

(Edited: the above is not quite true. While writing the below I realized that I’m also assuming you are using Homebrew. Look, I’ve tried Macports, and I’ve tried Homebrew, and although there are a lot of pluses about Macports, the developer zeitgeist seems to be around Homebrew. It’s just easier, ok?)

Other than that, I’m assuming you don’t have any extra libraries or tools installed. The reason I’ve listed an exact date above is that I think that part of why this didn’t work for me but did for others is because of a recent change to Ruby that broke CocoaPods. So others couldn’t help me because either they weren’t using that version of Ruby or they’d already gotten their pods successfully installed; the SelfControl build wasn’t failing for them.

Steps

We’ll start with the official build instructions & go from there. I may submit a pull request to update some of the steps – step 2 is definitely wrong once you install the CocoaPods.

  1. Clone the repository
  2. Open SelfControl.xcodeproj in Xcode
  3. Switch the Scheme selector (upper-left-hand corner) to SelfControl — not Distribution
  4. Build!
1. Clone the repository

This is completely correct. However, if your goal is to contribute to SelfControl, you probably want to fork the repo and then clone your fork instead (after all, why are you building from scratch if you aren’t planning to contribute?). But for this walkthrough, you can just clone the official repo if you want. Go to the directory where you want to do your build and run:

git clone https://github.com/SelfControlApp/selfcontrol.git

If you forked the repo, you’d just replace it with your copy, e.g.

git clone https://github.com/karamcnair/selfcontrol.git

That’s what I did. Here’s what you’ll have in the directory after the clone.

 

git_clone

2. Open SelfControl.xcodeproj in Xcode

Nope. I’m not sure if the instructions are just out of date or whether there are multiple paths to building this project with CocoaPods but if you follow the instructions directly and try to build the .xcodeproj file you’ll get missing dependencies because the CocoaPod libraries aren’t there.

See?

So we’re going to take a detour from the official instructions at this point because this is what threw me off last summer and where we’re going off-road in our quest to get this working.

Let’s install CocoaPods

The way we do that is to use ‘gem’, the Ruby package manager.  The process should be:

  1. gem install cocoapods 
  2. pod install ***

WARNING: CocoaPods is currently (remember, this post is as of 2016-02-12) in beta for a new version with a totally different Podfile format. At first I accepted their suggestion to upgrade to the beta version, ended up rewriting the file, and it STILL didn’t work. Do not accept the beta version at this point. That’s not what the problem is.

Note the error we’re getting here: Undefined method ‘to_ary’ ? ¯_(ツ)_/¯

And at the end of the output we see this:

Something that took me longer than I’m happy with to notice:

/usr/local/lib/ruby/gems/2.3.0/gems

[But why would I even care? It knows what it’s doing, right?]

So what is the problem? How come everyone else building SelfControl doesn’t have this error. Well, it turns out that we’re too up to date, my friend! Our systems are too pristine, too fresh! We have the newest Ruby, the version that ships with OSX, and it’s version 2.3.0 (in my case) and not version 2.2. And there’s a problem with 2.3.x, as far as CocoaPods is concerned.

github_writeup

(Look familiar?)

Let’s see if that’s the problem. What Ruby we have now?

Yup. That’s probably it. So how do we fix that? This helpful person has an answer for us:

 

pod_solution

To do that, we use these instructions and to install rvm (Ruby Version Manager) to tell OSX which version of Ruby we want to use. But before we do that, let’s get rid of our current (bad) install of CocoaPods.

I know I could have just had you start by using rvm to pick Ruby 2.2 so that you wouldn’t hit the failing pod install but there are two reasons I didn’t:

  1. there are probably a non-zero number of people out there who have the same problem with the bad CocoaPods & by following these steps, this includes how to recover from that setup and
  2. it’s useful to document thought processes of how to debug & fix borked systems

gem uninstall cocoapods

Then install RVM as per the instructions:

Huzzah! We have the right Ruby! Let’s see if we can fix the Pod Problem!

Let’s REALLY install CocoaPods

So

gem install cocoapods

followed by

pod install

Hey! look at that! It worked.

So here’s where something weird is, that I don’t want to take the time to fully replicate on a freshly installed machine: The first time I got this working, THIS was the output from the ‘pod install’ command:

Note that it says to use the .xcworkspace file, not the .xcproject file. And it’s telling the truth. My directory has a SelfControl.xcworkspace file in it after ‘pod install’ but it didn’t tell me to use it this time. But if I don’t, and use the SelfControl.xcproject file, here’s what Xcode complains about:

See? The pod dependencies aren’t built. So we use the Workspace instead:

Cool, cool. Now we’re actually getting somewhere. The pods are building and so is SelfControl! But. Here come the promised code signing issues.

 

codesign1

OK, this post is too long now. And the code signing issues are ones that are likely common to multiple projects that have nothing to do with CocoaPods, so I’ll be adding a follow-on post just to walk through the OSX Code Signing traps!

Stew Chicken with Rice & Beans

I’m stashing this here because I’m terrible about improvising on recipes, nailing one, and then not having any record of it later for reproduction (look, my brother’s the scientist in the family, my strength is logic, not careful replicable procedures (although I’m working on that with this weekend’s ReimageFest(tm))) (also, I’m the one in the family who’s comfortable with Lisps, as you might well glean from my rampant use of parentheses)

But tonight we’re making a variant of our beloved Belizean stew chicken with fried plantains, rice & beans, and coleslaw and I wanted to learn from my mistakes/victories. Here are the base recipes:

I’m futzing with them in the following ways:

  • 1/2 the amount of chicken in the recipe, but full amount of spices & vegetables. (Probably twice the cumin, tbh. Also, using achiote roja instead of recado because we’re out of the latter).
  • used white vinegar, not lemon juice.
  • adding the optional green pepper and a tomato (technically two seeded roma tomatoes but that’s roughly the size of a normal tomato). The jury is out on the cilantro and brown sugar. Cilantro doesn’t scream ‘belize’ to me.
  • roughly 3 cups of water to cover the chicken etc.
  • I totally don’t understand the “Heat the oil in a heavy pan or deep skillet and sprinkle flour, stirring to dissolve (like a thin roux) before adding chicken pieces.” No oil was specified in the ingredient list, nor flour. I winged (ha) it with about 2mm of grapeseed oil to cover the bottom of the pan (quite a wide pan – ~14″ diameter?) and ~3 tsp/1Tbsp flour.
  • oh, and I had it on medium-high heat. Also not specified 🙂
  • For the beans, we cheated on the soak time b/c we’re using an electric pressure cooker (hi, Instant Pot!). We got some small red beans (supposedly Chilean (I’m really annoyed that I didn’t make room in my suitcase to bring back the “Central American Red Beans” that I bought in NYC – surely those were the exact right ones! (GOYA brand, in case you care))) and soaked them for 3.5 hours.
  • We’re making 1/2 the recipe of this as well, so 1/2 lb beans & ~2.5 cups water (I used the soaking water because I’ve heard that helps with… um… digestion).
  • 1 onion, 3 cloves garlic, the soaked beans, the 2.5 c soaking water into the Instant Pot & set to ‘beans/chili’ for 10 minutes and then natural pressure release. Research suggested 8-9 minutes for beans soaked overnight & ~25 min for dry beans. No one is very clear on how much water so I winged that as well. If the beans aren’t done when the cooker is done, we can throw ’em back in before adding the rice.
  • We actually bought ‘normal rice’ for this! (My understanding is that normal rice is long grain white rice. YMMV. We have about a dozen different kinds of rice in the house but that was not one of them.) Plan is to halve that as well, which should be about 2 cups, but I’ll check the ratio of beans:rice when adding it before re-cooking on ‘rice’ setting.

Update: the beans lie like a rug. 10 min at pressure was not even close. 10 MORE minutes still wasn’t done! (although I may have needed to add more water that I didn’t. Fine. FINE. Added another cup+ of water & back in for another 10 minutes. Still waiting to add the rice. Apparently we’re eating at midnight.)

Chicken update: very flavourless – added all the rest of the achiote roja we had (which, to be fair, was probably stale & had suffered a loss of potency.) Finally, between adding that (about 6x the suggested amount of recado), about 1 Tbsp of Frank’s Red Hot sauce (because we’re almost out of Marie Sharp’s), and about 4 Tbsp of Worcestershire sauce and taking the lid off, we have something that is still basically flavourless to me but Bill says is really good (the peril of being the chef is that spending so much time among the odours means that you become desensitized and can’t necessarily judge the taste properly). So, original recipe, quintuple the spices, add Worcestershire & hot sauce, and we’re good, apparently.

Addendum: We’re also having cole slaw & fried plantains. Bill is a staunch advocate of plain mayonnaise (rather than Miracle Whip, which I prefer) so we based the recipe for cole slaw around that. Turns out that “salad cream” is what we really want (which is apparently better approximated by Miracle Whip than mayo, so there!) so we had to improvise. “Steve” suggests this approximation & although we don’t have any icing sugar, we made do with cane sugar. We shredded cabbage & carrots for the cole slaw & nothing else. The plantains are just plantains, fried in butter. Some things are best in simplicity.

Powered by WordPress & Theme by Anders Norén