Posted by tim in I hate technology. on November 2, 2022

For years (more than 20) I have been doing things the long way with PHP. One of the examples of this is processing files and putting the results in an array (or object) to serve as key/value pairs.

Consider the following:

Foo: bar
Baz: biz

Here's some content...

If you wanted to match these lines in a way that you only get the Foo: bar and Baz: biz into a key/value pair, you would need to somehow match those values into a variable. Something like this would work:

<?php
preg_match_all('/^(.*?): (.*?)$/m', file_get_contents($filename), $matches);

But this will give you something like this: Array ( [0] => Array ( [0] => Foo: bar [1] => Baz: biz )

    [1] => Array
        (
            [0] => Foo
            [1] => Baz
        )

    [2] => Array
        (
            [0] => bar
            [1] => biz
        )

)

But what if you want to have the matched group [1] be the keys, and matched group [2] be the values? A for loop would accomplish it, as would other array-walking techniques.

It's far easier than that, though!

<?php
preg_match_all('/^(.*?): (.*?)$/m', file_get_contents($filename), $matches);

$keyvaluepairs = array_combine($matches[1], $matches[2]);

If you print_r() that resultant variable, you'll find that it's exactly what you want:

Array
(
    [Foo] => bar
    [Baz] => biz
)

That's all I wanted to share. I hope it benefits you.

Posted by tim in I Feel Sick on March 18, 2022

As I've mentioned before, I have been dealing with a weird nervous system issue for most of my life, but getting worse in the last 3 years.

Last September, I had an EMG, which is short for ElectroMyoGram. It's a procedure in which neurologists can evaluate nerve health and (hopefully) form a diagnosis. In this procedure, based on my experience, a technician will apply sticky electrodes to your skin, much like a TENS unit. Then, they will use some sort of a probe that is connected to the same system those electrodes are. Gradually increasing the current, they will apply a shock and read how quickly it travels up the nerve and how much attenuation (signal loss) there is. After that, a doctor will come in and do almost the same thing, but this time the probe is replaced by a needle that is inserted into the flesh at the site of the nerve. They will then apply a small current to it, much like the technician did, but will move around until they have found the nerve. In order to verify that they found the nerve, they might watch a monitor or listen to the signal in an amplified audio form. Once the signal has been found, the doctor will instruct you to activate the muscle in a certain way, and will read the signals that come naturally. The results of all of this poking and shocking are recorded in a digital form, and will be sent to the doctor who ordered the test.

In my case, at least today, the shocking phase wasn't too bad. What was unpleasant was when the doctor had me activate the muscles with a needle in the nerve. I remember that being unpleasant last time, but this time it was more than unpleasant. In addition to the basics of that part of the test, the doctor also worked hard to trigger a cramp in my foot so she could read what was going on. I remember last time I was uncomfortable after, but this time It was almost enough to keep me from driving home.

When I got home I took some medicine to try and calm the pain down, and it's done a good job of that. However, my ability to focus and problem solve is gone, and I'm ready to fall asleep. Back to that lyric I quoted before: the medication just numbs the brain.

The doctor today seemed very happy with the results. Not necessarily in the sense that it was a good report, but that it was a very useful report. I'm hoping so, because I don't really want to have to go through another test like that any time soon.

EMG Testing Room
Posted by tim in I hate technology. on November 4, 2021

In the recent decade, the internet has moved away from written articles with figures and whatnot in them, in favor of things like YouTube videos. This cultural change has spread beyond YouTube and the public internet, though, and even includes major corporations, including the one I work for.

What I've found is that I am unable to really process anything that's presented in a video.

I am a decent reader, and over the last couple of decades or so, I've been able to cultivate a form of speed reading, which I use almost always. This allows me to take in loads of information rather quickly, not constrained to the limits of my ability to process spoken word, or another's ability to speak it. But when I am presented with either recommendations to watch a YouTube video to learn how to configure a piece of flight simulator software, or when I am issued mandatory education at work in the form of a video, I get incredibly frustrated, and I find that I'm unable to retain whatever it is that I observe.

When it comes to important things, where a certain set of steps must be followed precisely, or when it's a thing that I am required to do, PLEASE, I beg of you, don't throw a video at me.

Posted by tim in Crazy Weather on September 15, 2021

We've lived in this house long enough to have experienced 2 tropical storms: Harvey and Nicholas.

Last night, Nicholas was approaching us at bedtime, and the wind and a bit of rain kicked up. Sometime around 2:30am the power went out. I left it alone, then a little while later it flickered back on briefly, then back out. When the power comes on in our house, several things make a fairly loud beep sound. When the power flickers in the middle of the night, that beeping can be disruptive to my already-light sleep.

I wasn't wearing my watch most of the night to see how I slept, and I didn't take my typical medicines that would assist in my ability to stay asleep. I figure I got segments of sleep lasting about 20 minutes each, with a period of 15-20 minutes awake in between. The awake was partially due to the storm noise, but mostly due to how my body was responding to the weather and the lack of medication. Then when the power went out, those physiological responses got worse, leading to an all around shoddy night, sleep-wise.

I got up around 7:30am and decided that 5 hours off electricity was approaching the maximum for the refrigerator, and it was starting to get warm in the house with the sun peeking through the southern bands of the storm. I somewhat robotically marched out to the garage, flashlight in hand, and laid out the extension cords, wheeled the generator to the back porch, gassed it up, and got everything running. Then I got into the house to get the portable air conditioner going, and Emily helped me with it. Then I sat for a bit to try and recover some energy before I went to boil water on the grill for coffee.

We went for a walk at one point, just to see how the neighborhood faired, and afterwards I decided it was safe to take the meds that I had skipped last night. After I did, I laid down to attempt to sleep, which was interrupted repeatedly by a wound up nearly-six-year-old, until I finally got what felt like 10 hours of sleep (it was maybe 1 hour) and felt better.

At that point, Emily had fixed me some lunch and we sat and enjoyed our food together as a family.

We had some errands to run after that, and while we were out the neighbors sent a text message declaring victory against the lack of power. When we got home, the air conditioner had already brought the house down to the "cold" we like, and we went about getting things back to status quo.

Damage-wise, all I have been able to see so far was one branch off a rotted Japanese Wax tree, which I'm already planning to cut down. The loose bark on the Crepe Myrtle trees was blasted clean off the trees as well. Some neighbors didn't do as well: One reported an uprooted, large tree. Others had fences blown over. Some neighbors reported on Facebook that they heard a tornado blow through the neighborhood overnight. That was probably when I was either actually asleep, or just almost asleep and tuned it out completely.

Total time without power was almost exactly 13 hours. The longest cycle I ran between fuelings on the generator was from 7:30am to 10:30am. I think I only refueled it twice after the initial fueling. I've decided to not take storage actions with it just yet, as there's another storm on the maps that I am unsure about for this next week or so. With that in mind, I prefer to just leave everything ready to go, and refill my fuel supply sometime in the next few days.

All in all, it looks like the area did well, and we did well here, so it wasn't really that bad from our perspective.

Posted by tim in Pissed on July 19, 2021

There are certain times that mindlessness is understandable, but here lately I have been getting rather irritated with the complete lack of intellect people are putting into things. Before I get into the details about what's getting under my skin, I'll warn you, some of this may seem very trivial and like a dumb thing to be upset about, but there are some much deeper reasons behind why it bothers me than what you'll see at the surface. If you want to understand those more, feel free to reach out to me and ask.


Working in an internet business, I'm acutely aware of what proper customer communication means, and what the lack of it can result in. When we have to restart a service, apply an upgrade, even if it's remotely possible that it's a disruptive action, we have to plan, review, schedule, notify, wait, then act. Except in the case of emergencies, this is the well understood pattern, and failure to adhere to it can result in customers getting frustrated and leaving.

Where I'm starting to see issues with it are in a variety of things I use on the internet. First and most importantly, my home internet service. Perhaps having been working for a top 5 cloud provider for the last 10 years, I've become conditioned to expecting to be notified when my service is going to be interrupted. I've sat on the other side of the modem and issued those notices, so why am I not getting them on this side from my ISP? Last week alone I had 3 days where Xfinity (I really dislike their rebranding, but that's another topic for another day) had disruptive maintenance during my working day. Given that so many people are still working from home during this pandemic, that's just absurd that they'd take such actions. All they need to do is have a subscriber notification system by which they can send messages (email, text, Twitter, whatever) and give a heads up of an upcoming service disruption. Instead, they play the "it's easier to ask for forgiveness than to ask for permission" game, and start taking the service offline before they even throw an outage notice up. I know that this is how it's going because my cable modem sits on my desk, just to the right of my work computer screen, and when the lights flicker I know they're poking at things.

If my internet service is online, other things suffer. For example, I have been using online Minecraft gaming as an outlet for my fidgety hands during meetings, and as a means of keeping social during a time when the world frowns on face-to-face time, or my own health keeps me from it. There have been a few communities I've joined, and a couple that I've basically left because while they want players to give them money for features (I've paid a couple), they nerf the game, conduct service restarts, or somehow disrupt gameplay in another way. If it wasn't a thing that I put money towards (total I'm at about $30 spend, so it's not a lot to grumble about, I know), I'd expect the unstable service and the Mickey Mouse management. But alas, I can't even expect to have a relaxing time to enjoy what I put money and time towards, and it causes me to reconsider why I even gave them $0.01 in the first place.

At least in one of the communities I've thrown money at, they've asked me to help keep the service stable, so that's worth something at least.

I'm going to probably write another private entry about another case, but for this particular entry I'll just say that I'm starting to see laziness on these topics everywhere, no exclusions.

I understand we're all exasperated at the shape of the World today, and we just want to get back to "normal", whatever that was. I just want people and businesses to use their brains, and to approach things as if they were the customer and what the impact would be.

Maybe the transit providers need to gimp Xfinity to get that point across, and just say "oops, we have a guy working on it and it'll be back in now + 12 hours , be patient." Sure, the rest of us downstream from there will be feeling the pain as well, but I'm willing to bet money that Xfinity doesn't expect that sort of behavior, and they need 90+ days notice before a link is disrupted.

Copyright © 2024 SkuddBlog