Day 50: Divisions

Currently, the rate of COVID-19 hospitalization in many parts of the US is climbing rapidly. Here in Texas there are many hospitals that are at capacity, and are unable to take any more patients. The point of “flattening the curve” wasn’t to stop the virus; it was just to keep our medical system from being overwhelmed. We are seeing this happening now across Texas.

In the midst of all this, we have many voices calling for the re-opening of schools when the fall term starts next month. That would be great, except we’re not even close to being able to do that safely. Remember, it’s not just the safety of the children at stake, but that of teachers, custodians, food service staff, bus drivers, administrators, and everyone else involved in running a school. Some districts are choosing to delay in-person classes for at least two more months, but others are rushing forward, such as Orange County, California, whose school board is allowing in-person classes with no masks or social distancing. Understandably, many parents are angry at the callousness of the school board, and are asking them to reconsider.

What is needed is for people to come together in opposition to these short-sighted actions. Yes, there are some parents who want their kids back in school, but the vast majority would place their children’s safety above any other consideration. When people join their voices together, they are much more powerful than when acting individually. But that seems almost impossible these days.

When it was discovered that Russia had been using bots to influence the 2016 election, it turned out that they weren’t just promoting Trump; they were also promoting Hillary, and in roughly equal numbers. The goal was to divide the American people against each other, preventing them from being able to come together and unite against an enemy. Just look at that division has taken a simple thing like wearing a mask during an infectious pandemic has become a political issue, not a health issue.

There are wide differences of opinion on many political matters, such as immigration, monetary policy, and the like. We can continue to oppose each other on those, but unite against the dangers of the pandemic. The divisions run deep, though – I don’t hold out much hope of them going away any time soon.

Day 49: Little Courtesies

Someone recently told me of the shopping cart test to gauge a person’s level of consideration for others: when you unload your groceries into your car, what do you do with the empty cart? Most people return them to one of the cart collection areas set up for that purpose, but many do not. They just leave it in an empty space by their car, and drive off. Sometimes they make a minimal effort to reduce the risk of the cart accidentally rolling away and denting another car by propping in on a nearby curb, but many times they simply leave it.

How difficult is it to walk the cart to a collection area? Some suggested that a person might have a disability that would make that difficult, but it does seem odd that they would be able to use the cart to do their shopping, and then push it to their car, but not be able to return it.

To me, this displays a lack of basic courtesy, rooted in selfishness. The cart served your needs, so it is just abandoned. There is no thought about potential damage to others’ cars, or making the employee work harder to gather the carts from the far-flung corners of the parking lot. It’s a simple test of one’s consideration for others.

There are many such things where you need to acknowledge that you are just one person in a common environment with others, and when we do, things just go much smoother. Did you use the last of the toilet paper roll? Or leave just a tiny bit? If you don’t make the small effort to replace it with a new roll, you’re making life more difficult for the next person. Same thing with cleaning the lint screen of the dryer after your load. It’s a small effort on your part to make someone else’s experience much better.

What do you think about people who can’t be bothered to do these little things? Sure, everyone forgets once in a while, but I’m talking about people who consciously choose not to do them.

I’m writing this in the shadow of the biggest social effort in some time: stopping the spread of COVID-19. Everyone is asked to do something very simple: wear a face mask over your nose and mouth to reduce the potential for spreading the virus, since people can be infectious before they have any symptoms at all. It’s not much to ask, but man, the way that some people react makes it sound like the worst oppression ever experienced by a human being!

My parents lived through World War II (my dad fought in the war), and I grew up hearing stories of the rationing that the entire country was expected to follow. I can’t imagine something like that working today, for one simple reason: back then people saw themselves as belonging to the same side against a common enemy. That’s no longer the case: too many people see themselves as a persecuted group

It’s sad, but that’s to be expected with the polarization that has spread across this country. Too many people have rejected the American vision of inclusion that we’ve been striving for for centuries, and want to return to the days of straight white male dominance, even if it means embracing our enemies.

Me? I’m going to continue to return my shopping cart to the cart return area.

Day 47: Python Virtualenvs

If you’re not a Python programmer, you probably won’t find much in this post. Sorry.

If you are a Python programmer, then you probably know about virtualenvs, or virtual environments. They allow you to create several different Python environments to work in: each can have it’s own version of Python, as well as its own installed packages. This means I can work on a project that has particular requirements, and then switch to a project with completely different requirements, and the two won’t affect each other.

A while ago I used to use vitualenvwrapper, which made working with virtualenvs a lot easier. But as I switched to Python 3 over the past few years, I started to have some issues where it didn’t work correctly (sorry, I no longer recall precisely what those issues were). I’m sure a lot had to do with the addition of the venv module into Python 3, which allowed you to create a virtualenv by running python -m venv /path/to/virtualenv.

For a while I ran all the commands manually, but I have the quality that makes for good programmers: I’m lazy. A lazy person doesn’t want to do any more work than they have to, so if I can automate something to save time over the long run, I will. And here’s what I came up with:

export VENV_HOME=$HOME/venvs function workon { if [ -z $1 ] then ls -1 $VENV_HOME else source $VENV_HOME/$1/bin/activate fi } function mkvenv { python3 -m venv $VENV_HOME/$1 workon $1 pip install -U pip setuptools wheel pip install ipython pytest-pudb requests } function rmvenv { command -v deactivate rm -rf $VENV_HOME/$1 } _venvdirs() { local cur="$2" COMPREPLY=( $(cd $HOME/venvs && compgen -d -- "${cur}" ) ); } complete -F _venvdirs workon rmvenv

These lines should be added to your .bashrc in Linux, or your .bash_profile for Macs. I haven’t tried them with zsh yet, so no guarantees there. Let’s go over what these lines do.

Line #1 defines the directory where the virtualenvs will be stored. You can store them anywhere; it doesn’t make any difference.

Lines #3–10 define the workon function, which activates the specified virtualenv, or lists all virtualenvs if none is specified. Lines 12–17 define the mkvenv function, which creates a new venv, and lines 19–22 define rmvenv, which deletes virtualenvs when you no longer need them.

I’d like to point out 2 lines in mkvenv that you can customize. Line #15 updates the installed versions of pip, setuptools, and wheel. If for some reason you don’t want the latest versions of these, edit or remove that line.

Line #16 is more interesting: nearly every virtualenv I create needs these packages installed. Rather than install them one-by-one, I add them when I create the virtualenv. If you have different packages you always want available, edit this line.

Finally, lines #24–29 are of utmost importance to someone lazy like myself: they provide auto-completion for the other commands. I had to learn about bash completion to get that working, but it turned out to be much easier than I had imagined.

Here is a gif showing it in action:

Try it out! Let me know if you find this useful, or if you have suggestions for improvement.

Day 46: The First Emergence

Today was very busy, but doing lot a lot of different things rather than one main task. So it’s the early evening and I’m finally sitting down to write.

The day started off early: I had just put water on for our morning coffee, and while it was heating I checked out the caterpillar enclosures. I saw a lot of fluttering in one, and sure enough, there was a male butterfly trying to find its way out.

First butterfly of the brood

When the butterflies emerge, they typically hang out for a couple of hours until their wings are fully expanded and dry before they try to fly away. This guy must have emerged a few hours earlier, because he was raring to go. I took the above picture as he was crawling up the side of the enclosure. Once he reached the top, off he flew!

This was the first adult butterfly that came from this large crop of eggs that I found a few weeks ago:

29 swallowtail eggs!

The enclosures have been filling up with pupas from that brood. Here are a few of them:

Lots of pupas!

You might recognize the contraption made of sticks from an earlier post; there are now 7 pupas attached to it! the five unattached pupas are either caterpillars that attached to a sprig of parsley, which will dry up in the enclosure. Notice that the one on the right still has a bit of parsley stalk attached to it. Other caterpillars sometimes give up trying to find a place to attach themselves, and just curl up on the ground. I’ve had that happen before, and they result in normal butterflies, so I’m feeling positive that these will too.

There are only a few caterpillars left who are still munching away and getting bigger. The rest have pupated, so in the coming days I’m sure I’ll find a lot more butterflies emerging from those pupas. I just hope that they have the decency to wait until I’ve had my coffee before doing so!

Day 45: Composing Music and Code

I am not a musician. Yeah, I was a vocalist in a couple of bands in high school and college, but all I really did is copy the original song. The notion of coming up with a new approach to a song was way beyond my imagination.

I am amazed by people who can write their own original songs. How can you create a melody from… nothing? It really is beyond my ability to comprehend. Lyrics seem straightforward enough, but the music?

A few years ago at a conference I was hanging around in the evening with some friends, several of whom were musicians that had brought their guitars. One of them played a song, and I asked him where the song was from. He replied that it was one of his own. “Wait: you wrote that yourself?” That surprised the hell out of me!

Now that my curiosity was piqued, I couldn’t help but ask him how he does it. He replied that sometimes he has some little bits of music in his head, just a couple of notes. When he’s practicing his guitar, he’d just sit around playing some small riffs; just a few notes here and there. He’ll play one, then change it up a little bit, and if it sounds better, he’ll start working with that. Over time he’ll have a few more such bits floating around in his head, and every now and then he’ll play a few that just start to flow together. At that moment he can hear the overall melody, and he has to write it down, or record it – anything to capture it before it fades. It doesn’t matter what time of day it is, or what else is happening; he can’t do anything else until he has it down on paper/tape/whatever.

Now I understood: his process for composing music was very similar to what I experience when coming up with a coding design to a given problem. I’ll play around in my mind with a few approaches I’ve used in the past, changing them around as needed to see if that would work. At some point, though, the pieces seem to align themselves into the solution I need, and I can see it clearly in my mind. At that point, I have to write down what I’m seeing before I lose it. I can remember times when I missed appointments because I was heads-down writing such a solution.

The act of creation is remarkably similar for both cases: playing around with ideas/riffs, and once the solution “appears”, a furious effort to record it. And it’s that “playing around” part that is really hard to explain to others: to them, it just looks like you’re screwing around instead of working.

I do my best thinking when I’m walking, not when I’m planted in front of a keyboard. If you’re ever stuck trying to come up with a solution, try changing what you’re doing. Go for a walk, work on your garden, vacuum the floor – anything to move away from the computer and get your body moving. That act alone helps free the brain to make connections that it might otherwise never make.