Author Archives: david

Surgery recovery update

I realised that announcing that I was going to have surgery and then stopping updating the blog from the surgery date might be considered less than ideal, so this is just a quick update to reassure readers that I aten’t dead.

Anyway, I had my surgery last Tuesday as planned. It went fine according to my surgeon. It’s hard for me to tell – it’s somewhat in the nature of surgery recovery is that you spend a period immediately after where the thing you wanted to get better gets worse instead, and this one is very much exemplifying that. A week later I’m just about at the point where I can almost kinda breathe through my nose.

In general the recovery has been not much fun but entirely manageable – I spent the first couple of days useless, but since then I’ve been able to think OK. Despite feeling a lot like a bad cold it doesn’t seem to turn my brain to mush in the same way.

Anyway, hopefully in another week or so I might start seeing some benefit, or at least get back to feature-parity with pre-surgery me, I shall report back with some updated notes on the war on sleep when that happens.

Update: Apparently I was being unduly pessimistic. My breathing through my nose, while it still feels congested and uncomfortable, is actually now as good as or maybe slightly better than it was prior to the surgery in terms of measured airflow.

This entry was posted in Uncategorized on by .

Programmer at Large: Why aren’t you laughing?

This is the latest chapter in my web serial, Programmer at Large. The first chapter is here and you can read the whole archives here or on the Archive of Our Own mirror. This chapter is also mirrored at Archive of Our Own.


“Well… some of us think they just wanted to see what would happen.”

I blinked at Kimiko a couple times.

“What.”

“Oh come on, didn’t you read between the lines in history class? Half the point of culture design when you spawn a new ship is to try weird things and mess with people.”

“That… doesn’t seem much like what they told us. Isn’t it supposed to be all about designing for resilience and the long-term survival of the trade fleet and the human race?”

“Yeah. By messing with people. Societies doesn’t last long if they can’t take a joke. Well, here we are. We’re the joke. Why aren’t you laughing?”

“It doesn’t seem very funny.”

They sighed.

“It’s really not. Especially if you’re stuck in the middle of it. But I’m serious about the messing with people.”

“OK but… why?”

“A whole bunch of reasons, but it mostly boils down to evolution and data gathering. Trying random nonsense and seeing what works. Sometimes unexpected things turn out to be a really good idea and other people copy them, sometimes it all explodes horribly and the ship dumps a whole bunch of really good experimental data about what not to do onto the trade network. Most of them are somewhere in between, like us.”

“This still seems horribly irresponsible.”

They shrugged elaborately.

“And yet we’re the longest lasting civilisation in human history. As much as it hurts to be on the receiving end of this particular iteration, I can’t deny it works. In some ways we’re even a successful experiment – turns out having a dedicated minority to gently oppress is a great bonding exercise for the rest of the crew, and the systems in place are good enough at stopping things from blowing up. Our drama metrics are really low compared to most ships.”

“That’s horrible,”

“Believe me, I know. Fortunately it’d be a hard sell for any new ship design – it doesn’t have to just work, people have to actually buy into the design, and now that there’s data from us it’d be harder to repeat the experiment. But maybe our data will help somebody figure out a less dysfunctional way of doing it. That’s how the system works.”

I didn’t really know what to say to that, so I just floated there for a while with a slightly ill look on my face. Eventually, Kimiko continued speaking.

“So, uh, now that you know, what are you going to do about it?”

That, at least, was obvious.

“Oh, nothing.”

“Nothing? Really? You’re not going to make a fuss about it?”

“What? No, of course not. That would be stupid. I mean, let me know if I’m wrong and there’s something you want me to do about it, but until then I’m going to do the same thing I do with any complex problem that I don’t understand properly and the experts are already on top of: leave it alone until I do understand it properly.”

They breathed a sigh of relief.

“Good. Thank you. Right answer. And no, there’s nothing much you can do about it. Though, uh, I should warn you that you still might not want to be friends with me. It looks like you’re in enough social metrics trouble as it is without people calling you a sex fiend.”

“Oh, waste that. This whole thing is stupid and even if I’m not going to try and fix it I’m not going to make it worse. Besides, if I get kicked off because people think I’m having sex with you, at least that way I’ll be part of a group rather than all on my own surrounded by grounders.”

I gave a slightly pained smile to show I was only joking. Mostly.

Apparently I’d said something right anyway. I could feel a tension I hadn’t even realised they were holding go out of them.

“That’s… nice to hear. Thank you.”

They paused, grinned.

“And now of course, we must celebrate our new friendship in the way of my people. Let’s bang.”

They waggled their eyebrows suggestively.

I gave them an extremely flat look. Even I could spot that one was a joke.

They held the grin for a few seconds before bursting out laughing.

“Sorry, sorry, couldn’t help myself. Don’t worry, I know better than to actually hit on you. But let me know if you ever want to experiment.”

I nodded.

“I doubt I will, but thanks.”

I stifled a yawn.

“Sorry, excuse me. It’s getting close to my bed time. Is there anything else we need to talk about?”

They shook their head.

“I don’t think so. We’ve got the basic facts of life covered, you’re not going to treat me as a social pariah, those were the big things I wanted to check on, so I’m good if you are.”

They yawned too.

“To be honest though, I’m wiped. It’s a bit off cycle for me, but mind if I join you?”

“Sure, fine by me.”

I usually sleep alone. Not for any particularly good reason, it just happens that way. It would be nice to have some company for once.

“Now?”

“Might as well, if we’re done.”

We stripped off and plugged into the wall. It took a little while to find a comfortable position, but we eventually settled on Kimiko cuddling up to me from behind.

“Sleep well, Arthur”

“You too, Kimiko”

I triggered my sleep mode. Within seconds the world went fuzzy, and shortly after I was fast asleep.

This entry was posted in Programmer at Large on by .

A trick for getting to sleep

I used to have a lot of trouble getting to sleep. These days I manage better (partly because I’m sufficiently tired all the time that I’m much sleepier when I’m trying), but for a long time the biggest obstacle to my sleep was just that I couldn’t shut off my mind well enough to go to sleep.

And there are still nights where that’s the case and my thoughts end up keeping me up. e.g. because I can’t shut my brain off thinking about work, or because I’m having an anxiety day and my brain really wants to remind me of all my failings. Thanks brain.

The trick for those nights which I hit on ages ago is basically to give myself something to focus on that is sufficiently mentally engaging that I can keep paying attention to it, but insufficiently so to keep me up.

Historically I’ve basically made up stories to do this – not high quality ones, often just variations on whatever I’ve been reading recently (i.e. basically bad self-insert fanfic. Don’t worry, I won’t inflict it on you). This works… pretty well, some of the time. It rather relies on my feeling sufficiently creative in order to work though, which I often don’t.

But I’ve recently found a new technique that I think works strictly better. I thought I had got it from this article about a sleep app, but on a recent reread I realised that not only had I completely got the wrong end of the stick about what their technique was, what they’re actually proposing is completely impossible for me to use due to my inability to visualise.

So, uh, yay for creative misunderstanding?

Anyway, here’s the thing I do now:

  1. Pick a starting word. Usually something short with three or four letters (cat, was, rim, keel, etc).
  2. Repeatedly try to change your current word into another word. I vary what counts as a change but usually go for allowing you to add, delete, or replace one letter, or swap two letters.
  3. When you can’t find any new words starting from the current one, start again from the beginning with a new word (you can repeat words if you want to, you just don’t have to).

I tend to set myself minigoals while playing it – e.g. I normally default to trying to make the word longer, or if there’s some word that looks reachable nearby I try to get to it – e.g. how do you get from child to shield? (this one is actually moderately hard. I don’t currently know the answer and decided not to get distracted from writing this to figure it out. Edit: See end of post). Sometimes these turn out to be harder than expected and I abandon them. If I find I’m getting frustrated with a minigoal I definitely abandon it.

That’s all there is to it really. I just keep playing the word game until I fall asleep.

This ends up working pretty well – it’s mildly engaging, certainly enough that I don’t get bored of it, but it’s also not that interesting, so it doesn’t stop me falling asleep playing it.

The major limitation I run into with this (and all techniques in this space) is that sometimes when my thoughts are very fragmented – the sort of fragmenting that comes from say a headache or a fever, not the sort that comes from sleepiness – my working memory is shot and I can’t actually hold things coherently enough to. I don’t really have a good answer for that sort of scenario other than taking some painkillers and hoping that I’m drained enough already that that’s enough.

Fortunately that’s not the normal case for me (although I’ve got a bit of it at the time of this writing. Fortunately external memory is a good substitute when writing), and this works pretty well for the common case when the problem is just that my won’t shut off properly and it’s stopping me from getting to sleep.

Now if you’ll excuse me, I’m going to go implement A* search and get a computer to figure out that damned child to shield play.

Update: ‘child’, ‘chid’, ‘hid’, ‘hied’, ‘shied’, ‘shield’. I’d probably have given up before I got that (there are other shorter ones but they go via stupid words that I wouldn’t use without sowpod in front of me to check). If you’re suspicious of even that chid (past tense of chide, obviously) then there’s ‘child’, ‘chile’, ‘chide’, ‘hide’, ‘hied’, ‘shied’, ‘shield’.

This entry was posted in The War On Sleep on by .

Dispatches from the War on Sleep

It’s been a while since I’ve updated my notes here on The War On Sleep, largely because the past months have mostly consisted of waiting and/or incremental steps. I thought I’d write up some of what’s been happening recently.

Note: This is probably not that interesting unless you also have sleep issues (or for some reason like hearing details of my medical experiences).

Surgery

The story so far:

  • After my own experiments with Pulse Oximetry followed by some official ones which confirmed the same results, I’m now certain I don’t have Sleep Apnea. This is a very good thing, although does not help my particular problem.
  • After my nasal experiments, doing some research, and talking to a sleep clinic, I had reasonably high confidence that not being able to breathe through my nose is a significant contributing factor to my sleep quality issues.
  • After a visit to the ENT (Ear, Nose and Throat) clinic at Addenbrookes a couple of months ago where they stuck a bunch of things up my nose, I can confirm that my nose doesn’t work at all properly, and that there’s totally a surgery to fix that (correcting a deviated septum and enlarging my turbinates).
  • I’ll be having said surgery next week.

The link is that poor breathing through your nose means that you’ll sleep breathing through your mouth, which apparently can cause most of the symptoms I report – dry mouth and headaches in the morning and non-restorative sleep being the big ones. So it’s possible that all of my problems with sleep stem from my nose and could have been solved decades ago with an easy surgery.

I’m currently attempting to remain sceptical, and to convince myself to maintain an attitude where I don’t believe this will fix my sleep but that it will be a net good regardless of whether it does. This is mostly to prevent myself from getting excited and believing that this surgery is going to somehow magically fix everything, then being disappointed when all it does is improve my breathing and I still sleep terribly.

It’s somewhat working, but I’m still quite excited.

Monitoring

Another interesting recent development in the war on sleep is that I’ve recently acquired a HealthyPi. So far I wouldn’t particularly recommend rushing out and buying your own. The ECG doesn’t seem to really work for me (hopefully this will be fixed. According to the linked ticket this may be fixable in software and/or with better placement of electrodes), so right now it’s a pulse oximeter (which I already have. Also it doesn’t do heart beat off the pulse oximeter, only off the ECG, and SPO2 readings are basically not useful for anyone without sleep apnea because your SPO2 doesn’t budge unless something is very wrong) and a thermometer.

Still, the thermometer is useful. I’ve had the parts to put hook up an Arduino to a thermometer for about 6 months now and not gotten around to doing the work, so it’s nice to have that shortcut.

Unfortunately I’m also suspicious of the thermometer. As well as the linked issue I have a nagging suspicion that it’s reporting is slightly (maybe 0.25C at most) low, but it turns out that all the thermometers I have access to are slightly differently calibrated so I’m not sure (this has rather disillusioned me about home thermometer readings being a useful diagnostic tool, though they’re probably fine as long as you’ve taken a healthy reading with the same thermometer recently).

Still, I did an overnight temperature reading based on taping it to my armpit with a plaster and got the following graph:

This is interesting because it suggests (subject to concerns about both reliability of both the thermometer and reliability of external readings) that a thing I’ve believed for a while – that my body temperature rises at night when it should be falling – is probably true. The high there is only just over 37, but my body temperature according to other thermometers is typically a bit low (36.5 seems to be normal for me), and the body temperature the thermometer was showing for me after it stabilised in my reading earlier was 36.25, so 37 might actually be quite high.

It’s hard to say for sure though. The sharp drop at around 3:30 followed by the subsequent variability of the temperature is almost certainly not a result in changes of my body temperature (If your body temperature actually drops to 32 degrees then you are suffering from acute hypothermia and require immediate medical attention), but instead a result of the sensor coming partially detached. I’m going to try to get a more accurate reading tonight by, well, doing the obvious thing and sticking the thermometer up my butt (apologies for TMI, but science). Update: This didn’t work well. The HealthyPi thermometer is very poorly shaped for it.

If you have a recent (note: This is from the v3 ones that have just shipped. Older versions appear to use a different protocol) HealthyPi and are interested the code I used to gather the data for the above is based on this code I cobbled together which reads the USB serial port data stream and dumps the raw data as JSON. It’s based on a mix of experimentation and attempting to decipher the processing code for parsing the serial data and the code for writing it. It mostly seems to work (and I’ve checked its results against the GUI) but does very occasionally (I’ve seen it once) find a bad footer. I don’t know what’s up with that. It might be a bug in the healthypi, but it’s probably a bug in my code. Hard to say given the undocumented protocol.

Fortunately the packets are designed such that you can fairly reliably find the beginning of a new one, so it only gets one bad packet and then recovers just fine.

If I can get reliable temperature readings it will be interesting to see before and after results from the surgery. I’d be surprised if body temperature was related to nasal breathing problems, but not extremely surprised as there could be some indirect link.

Anxiety

If you go to a doctor complaining about being tired and sleeping poorly, they will spend a long time trying to convince you that you’re suffering from stress and/or anxiety (my working theory remains that they’re thinking “Well how do you think I feel?!” while doing it).

I’ve become pretty good at loudly repeating “No, these are physical symptoms X, Y and Z” and pushing my way through the system anyway. It’s a skill I recommend acquiring (and if you struggle with it, either personally or because doctors don’t take you seriously due to e.g. gender, note that in the UK at least you can bring someone with you to your GP appointments).

And I still believe the root cause of my sleep problems is physical. Maybe it’s the nose thing, maybe it’s something else, but they’ve presented too reliably regardless of my mental state to not be.

But, well, they’re not wrong about anxiety also causing sleep problems and tiredness, and I do suffer from anxiety, so it’s at least worth trying to deal with.

I tried an SSRI (Citalopram) on my doctor’s recommendation, but I had such a bad reaction to it (including substantially worse sleep!) that I ditched it almost immediately. I should probably consider trying again, but this is my second time on an SSRI and I’ve hated it both times, so I’ve been unable to talk myself into it. Ultimately I think my anxiety and depression are both mild enough that the cost/benefit analysis doesn’t work out.

I’ve also tried theanine for this. It seems to help a bit, but I’m not sure.

A lot of the problem here is I think that my baseline for sleep quality is so bad that it’s very hard to tell the difference. I’m probably going to revisit this question post-surgery.

I have vague intention to try meditating. It’s not something I’ve had a great deal of success at in the past. I’m currently reading The Mind Illuminated, which seems very well put together so far, but I’m currently having two difficulties:

  • It’s very hard to maintain stable attention when you’re spacey from lack of sleep.
  • The central meditation object suggested by the book is breathing through your nose.

So, um, yeah, there are a couple of things on the critical path here. Another thing to revisit post surgery.

The Future

Well, we’ll see. It all depends on what happens with the surgery. I’ll probably have more of an update about that in a month or so.

This entry was posted in The War On Sleep on by .

Programmer at Large: Why didn’t they see this coming?

This is the latest chapter in my web serial, Programmer at Large. The first chapter is here and you can read the whole archives here or on the Archive of Our Own mirror. This chapter is also mirrored at Archive of Our Own.


I spent another few ksecs triaging random interesting bugs. It wasn’t the best use of my time, but it was helping build up a picture of the state space around where the problem was occurring, and even if I didn’t find anything directly relevant it was still a useful clean up task.

It wasn’t very surprising what a mess this all was given how many different lineages we had systems and parts here for, and how long we’d spent shoring things up and adding fail safes for the fail safes for the fail safes rather than risking changing vital systems, but I hadn’t explored the plumbing system this broadly in a while and it was definitely disheartening.

I was staring in dismay at some visual programming language. It didn’t render at all well on a HUD, so I had had to find one of the larger pods with a wall-screen to even start to make sense of it.

I was increasingly convinced it hadn’t been worth bothering. The program was about a gigabyte in size (I thought most of that was some sort of standard library, but I wasn’t entirely certain) and literally all it did was decide whether some valves should be open or closed based on the temperature differential on either side and how that was changing over time.

So, even though I was slightly dreading it, I was very relieved when I got the notification from Kimiko that they were able to talk now if I still wanted to.

The pod I was in was easily big enough for five people, so I invited them to come join me.

They looked… off when they came in. The HUD cues said “hesitant, nervous”, which was odd. I was about to ask them what was wrong, but they preempted me.

“So is this the conversation where you tell me you don’t want to be friends with a pervert?”

I started. That was not the opening I expected.

“Uh, no? I’m not expecting it to be anyway. I just wanted to ask some questions.”

They still seemed wary.

“OK… what sort of questions?”

It took me a moment to even figure out how on the ground they’d even figured out the context for this conversation, but it eventually hit me – if I could do the social graph evolution analysis, so could they, and it would make sense to set up some alerts so it doesn’t blindside you…

“I mostly just want to know what’s going on with Brian attacking you! Why do you just let it happen? It’s obviously off charter! And what on the ground is up with this?!”

I manifested the sex graph into a shared space and flagged down the warning my HUD was giving me about tact. I knew I wasn’t being tactful, but I was frustrated and just wanted someone to tell me what was going on.

Anyway. HUD says I’ve confused rather than offended them.

“You… really don’t know what’s going on at all?”

“If I did I wouldn’t be asking! I don’t have this science-fiction ability to read minds that everybody else seems to!”

They sigh.

“I suppose this means you’ve gone and reported this?”

They wave their hand at the graph.

“No… I probably should have, but it seemed like something I shouldn’t touch without understanding, so I thought I’d ask you to explain first.”

They huffed a relieved noise.

“OK. Good. Thank you. It wouldn’t have done anything terrible, but it’s annoying for everyone involved to have to deal with.”

They paused for a couple of seconds.

“OK. So, explanations. You understand this is about sex, right?”

“Brian didn’t exactly let me miss that fact.”

“Right. And that isn’t a problem for you?”

I shrugged.

“I’m not completely OK with it, but it’s not a big deal. It’s like… you having bad taste in music or something. I don’t approve of your choices but I also mostly don’t actually care. Does that make sense?”

They barked out a laugh.

“That’s certainly one way to look at it I guess. I can work with that. So the first thing to understand here is that you’re weird.”

“Hey!”

I mean it’s true, but that was still quite harsh.

They gestured an apology.

“Sorry, what I mean is that you’re unusual in both your attitude and the fact that you don’t know about this already. I’m not sure how you missed it, frankly.”

They called up a bunch more graphs and visualisations. The short version is that most people felt much more strongly about this than I did, and while I wasn’t the last person to know about it there probably weren’t more than single digits of other people who had also missed it.

I nodded slowly. I could probably guess how I’d missed it – there was almost certainly some context or clue I missed that would have prompted someone to tell me about it before now. Also given my relative lack of socialisation it’s likely that Kimiko was the first person from the group I’d properly talked to. I checked HUD and it confirmed – I’d apparently met two of the others in passing but no more than that.

“OK. So if I’d reported it, the social unity people would have just told me they knew already?”

“There are a bunch of procedures they have to go through, and they would have had to make a showing of taking the report seriously, but basically yes. Even without reports the automated systems keep flagging our group up as needing attention, but as long as we don’t cross any of the hard thresholds they’re not required to take action.”

“But… OK, they’re not required, but isn’t it still their job to do something? Why hasn’t anything been done about this? If everyone knows there’s a problem surely we have to fix it?”

They sighed.

“And what would you do to fix it?”

“Oh.”

There were a couple of natural things to do, but the most obvious and the one that would almost certainly get implemented would be to simply kick them all off the ship at the next appropriate planet.

It wouldn’t be a death sentence for them – we’d leave them with plenty of money in the local economy and set them up with a perfectly good local infrastructure. They’d have each other. They’d still be crew… but they would be grounded, probably forever. I can hardly imagine anything worse. It was why I worked so hard to fit in myself.

I swallowed.

“OK. I get why you don’t want, but what’s stopping them? It’s obvious Brian has it in for you, and I can’t imagine they’re the only one, so why are you still here?”

“Because we’re protected by the charter. The same section that guarantees anonymity of sexual acts also guarantees freedom from persecution on the basis of them.”

“It sure doesn’t look like you’re free from being persecuted…”

“And we could make that case. At which point we’re officially a minority interest group, and the people who want the charter changed have enough to make the case that our protection should be removed.”

“This seems really stupid.”

They shrugged.

“Welcome to life as an edge case.”

“No, I mean… why didn’t they see this coming? It seems… really obvious that this would happen. Why would they design the system like this?”

“Officially, politics. They had enough support to start a normatively-asexual ship when forking, but not enough support to remove the sexual protection clauses from the charter, so that’s what they went with.”

“OK. And unofficially?”

“Well… some of us think they just wanted to see what would happen.”

This entry was posted in Fiction, Programmer at Large on by .