Dad + Xander

Eminem, word geek

As a geek who experienced being a social outcast, and eventually found a group of people I feel at home with, I can relate to Eminem's song "Legacy". Have a listen (4:56). To summarize the lyrics:

Verse 1:
I used to be the type of kid that would always think the sky is fallin'
Why am I so differently wired? Am I a martian?

Eminem goes on to describe issues in his childhood from being different. Difficulty at school, being alone, being bullied.

Verse 2:
I used to be the type of kid that would always think the sky is fallin'
Why am I so differently wired in my noggin?

Eminem learns to tune out the world with music and biking around Detroit. He discovers that he enjoys writing lyrics and it gives him some confidence that he's okay. He learns to write about the kids bullying him as a coping mechanism.

Verse 3:
I used to be the type of kid that would always think the sky is fallin'
Now I think the fact that I'm differently wired's awesome

Eminem is fully actualized. He's proud of his ability with words. He realizes he's better at this than almost anyone, and it gives him strength and confidence. Em is comfortable in his own skin, and will shred anyone who tries to bring him down.

The best part about me is I am not you
I'm me, I'm the Fire Marshall and this is my legacy

As always, the rhyme schemes are complex, the word play addictive, and the back beat a worthy song on its own. This is a great anthem for anyone who had difficulty socially in school, and felt like they came into their own geekdom sometime later in life. For me it was college.
Dad + Xander

A common name

I didn't used to think my name was common. Data from the 1990 census indicates 0.041% of the U.S. population shares my surname (258th most common[1]). It looks to have slipped to #371 in the 2000 census [2].

My first name is relatively common; it was in the top 10 in my birth year, and has been common for most of the 70s and 80s. With this, an estimator shows 341 people with the same name as me in the U.S. [3]

Despite there being only about 340 people with the same name as me, I've run across several. My first job as an intern in Columbus, there was another person (Matthew S Fleming); I got several voicemails intended for him since I was in the company address book first. There was another Matthew Fleming at IBM who lived in Florida; I got at least one email intended for him.

Today, I see an email on the kexec-tools mailing list, which I just signed up for a month or so ago, since I'm working on it for my current employer. And today I see an email to the list, also addressed to matt.fleming AT

There's about 340 other Matthew Flemings in the country, and I've worked with or near three of them (maybe more; my memory isn't great). That's 1% of the people in the country who share my name.

Dad + Xander

A few thoughts from this morning

A few things I thought of this morning, in the order they occurred to me.

On music:

First, I bought every Insomnium album that was on Amazon. They're a Finnish melodic death metal band. The past few weeks at work I've been listening to various melodic death metal playlists, starting with the band names I could remember like In Flames and Amon Amarth. Insomnium hooked me like none other, mostly due to the start of the album "Since the Day It All Came Down". Have a listen to the first 2:15 or so if you like. The first two minutes are piano and some strings. I have a soft spot for a mix of metal with orchestra, like Evanescence and the Metallica S&M album. Anyways, after that first two minutes it turns into this really hard guitar, but it completely keeps the theme going. It's just amazing.

On capitalism:

On my bike ride this morning I was thinking about Capitalism, and specifically how Larry Page said he'd rather give his money to Elon Musk than to charity. Capitalism is neither good nor bad; it's a reasonable economic organization. To make some analogy between large corporations and a small village: no one minds a cobbler turning his/her time and skill into goods for sale (shoes) and selling them for enough money to cover expenses plus living, plus maybe a little for the future. That's the good side; people trade their time and skill using an abstract exchange for others time and skill.

What people object to is if the cobbler charges a lot more than is necessary to cover his/her time, skill, material expenses, and costs of living and doing business. And then when a new cobbler sets up in town charging less, the first one kills the new guy. Or gets the mayor or village council to pass a law saying that only cobblers with grey hair can practice. Or whatever other protectionist law you could think of. Or if the original cobbler starts a smear campaign saying the new guy is using leather made by satanists, or from baby seal skin, or whatever other lie would get people's emotions up and not spending money. That's what we all get angry about, I think: when companies are no longer competing on the basis of the quality and price of the goods and services they make, but instead lying or buying laws to protect their current way of working.

I think it's important to remember that lots of medium and large companies are making reasonable profit based on the investment of their time and knowledge. For instance, Elon Musk and Tesla: while it's possible there was something shady involving patents or existing inventions, mostly they seem to be making money by doing something innovative. They've created some new technology, some infrastructure to support it, and are turning their time into a product that consumers will pay money for. That's basically how capitalism should work. And if their work happens to significantly reduce greenhouse gases, and limit global warming, well, that's a net positive too. It's quite possibly the motivation for doing all that work in the first place.

The point is that capitalism and environmental stewardship can go hand in hand; lets not toss out a mostly functioning economic system because some actors want to cheat (e.g. by polluting and paying minimal fines). If there's externalities that aren't reflected in real cash money, let's fix that.

On milk and a low-carb diet:

Being on a low-carb diet means that everything tastes sweeter. I never thought milk tasted sweet before, but it has a decent amount of carbs, and lactose is a sugar. Whole milk tastes like dessert now. It's sweet, it's creamy, and I can drink it for breakfast. Even if you're not on a low-carb diet, whole milk can be a better choice than reduced fat. First, it tastes better, and life is too short to not enjoy the little things. Second, there's decent evidence that people who drink whole milk lose more weight than those who drink skim. Whether it's because the fat helps keep one satiated or other reasons is still unknown.

On the home remodel:

Earlier this week the shower in the master bath was finished. It's 4.5 feet by 5.5 feet, which didn't seem huge until the glass enclosure went up on Tuesday. There are two shower heads; one of those rain-style heads in the ceiling, and one that's on a bar so it can be adjusted vertically. Anyways, I took a shower this morning with two of the kids, and there was room to spare. It was very luxurious. The three-year-old has often insisted on taking a shower with me, and there's finally room for him without getting in the way. I had a two-person shower in Seattle, but it was about 3x6 and there definitely wasn't room for three without someone being on top of someone else.

And that's what my brain was doing the first two hours I was awake today.
Dad + Xander

Grumpy old man

The older I get the more some little things seem to annoy me. For instance, when products made in 2014 don't obey user interface principles known for 20+ years. When I take an action (push a button, click, etc.) a well-designed UI presents instant feedback to let me know the action was received.

In California, some kinds of indoor lighting require an occupancy or vacancy sensor attached, to save electricity. This doesn't bother me too much, though it's annoying to pay extra when I'm already anal retentive about turning off lights, and the marginal electricity cost for a few hours of use is only a few cents. What bothers me is that, when I manually turn off the light, it doesn't turn off. It dims itself off over about 5 seconds. So the first thing I see when I turn off the light is that nothing happened.

This isn't the only instance. I just discovered today that the oven light is the same way -- it turns on immediately when the button is pushed or the door is opened, but it shuts off slowly when the door is closed or the button is pushed. And again I am left wondering if I really turned it off or if the button is malfunctioning. Unhelpfully it's also one of those surface buttons with no action -- there is no click, no button depresses, you just have to hope you got it right. To not present the instant feedback of really turning off the light is a terrible, terrible UI failure.

I feel like this is even worse since these things used to just be on/off back 10 years or even 5 years ago. Some poor schmuck wrote code for the oven's microcontroller to do the light dimming. This is a feature no one needed, that no one should pay for, and is actively counterproductive.

Like I said, I'm old and I'm grumpy. Now get off my lawn.
Dad + Xander

On knowing what you're measuring

So someone on reddit read this blog entry on why you shouldn't use linked lists for number crunching, and was very concerned with "locality of reference".

It smelled fishy to me, mostly based on what exactly the blog author was measuring, so I spent some time last night and tonight experimenting. I found that a large cost was the time spent in malloc. Admittedly, I was measuring an O(n) operation, and I don't have pretty graphs because I'm lazy and don't blog much. I didn't make any effort to keep the items in any particular order, but I think they were always either forward or backwards through memory (a page at a time). For that experiment I used 1e6 elements.

Then I realized I hadn't properly tested the locality theory. I wanted to measure how long it took to iterate elements, by a list or by a vector. To eliminate any other difference, I used an array of
struct ele {
        long link;
        long val;

For the list, I had a[i].link = i + 1, and the last element had -1 in the link. When iterating as a vector I just ignored the link field. So the only difference between the two iterations was in how it computed the next element; either by reading the index from the current entry, or by adding one to the index. The disassembly is pretty close on each:
 sum_array_by_list:                           sum_array_by_index:
        pushq   %rbp                                 pushq   %rbp
        movq    %rsp,%rbp                            movq    %rsp,%rbp
        movq    %rdi,0xe8(%rbp)                      movq    %rdi,0xe8(%rbp)
        movq    %rsi,0xe0(%rbp)                      movq    %rsi,0xe0(%rbp)
        movq    $0x00000000,0xf8(%rbp)               movq    $0x00000000,0xf0(%rbp)
                                                     movq    $0x00000000,0xf8(%rbp)
        jmp     end                                  jmp     end
cont:   movq    0xe0(%rbp),%rax               cont:  movq    0xf8(%rbp),%rax
        shlq    $0x04,%rax                           shlq    $0x04,%rax
        addq    0xe8(%rbp),%rax                      addq    0xe8(%rbp),%rax
        movq    0x08(%rax),%rax                      movq    0x08(%rax),%rax
        addq    %rax,0xf8(%rbp)                      addq    %rax,0xf0(%rbp)
                                                     incq    0xf8(%rbp)
        movq    0xe0(%rbp),%rax                      movq    0xf8(%rbp),%rax
        shlq    $0x04,%rax
        addq    0xe8(%rbp),%rax
        movq    (%rax),%rax
        movq    %rax,0xf8(%rbp)
end:    cmpq    $0x00,0xe0(%rbp)                     cmpq    0xe0(%rbp),%rax
        jns     cont                                 jl      cont
        movq	0xf8(%rbp),%rax                      movq    0xf0(%rbp),%rax
        leave                                        leave
        ret                                          ret

Both algorithms are O(n). One does an extra memory read to get the next index, the other an increment. I had a theory that by-index would be faster due to how the Intel hardware does things; it has some specialized instructions to iterate until a count is zero. gcc didn't do that, though. They both have about the same test to see if they're done. Now for the money shot:
Sum 10000000 elements (index) in 50013 microseconds
Sum 10000000 elements (list)  in 73902 microseconds

So the difference here in run time is significant and mostly due to having to run more instructions (9 versus 11 in the main loop). To test the locality of reference theory, I then randomized the links (this has to be done carefully to ensure it's still iterating every element). Now the linked list run time is:
Sum 10000000 elements (list) in 1098717 microseconds

Well, that is a big difference. I don't yet have enough data to say why, though. Am I constantly missing in L1 cache now? This could be measured by keeping all the elements that fit in a cache line together, while randomizing the order I hit each cache line. Doing this (assuming a cache line size of 128), I get:
Sum 10000000 elements (list) in 214726 microseconds. This is much better already, but still kinda bad. So L1 cache isn't the only issue. (Note the whole data set is 160MB). So I tried some other contiguous sizes:

Contiguous bytes Time (usec) for 1e7 element iteration
16 1112199
32 695746
64 362445
128 214169
256 175248
512 126300
1024 98137
2048 83341
4096 75693
8192 75257
16384 74682

So that's interesting. Once the memory is accessed a page at a time the performance is almost back up to maximum. I think this means that the TLB is the difference here. L1 cache (64 byte cache line) clearly also makes some difference, based on how the speed changes with the number of contiguous bytes accessed -- it stops getting twice as fast once I crossed 64 bytes.
Dad + Xander

(no subject)

The Wall Street Journal editorial page is always funny. In this case, they celebrate Texas's loose government, lack of regulations, tort reform, etc., as bringing in huge job growth.

And then casually mention a regulation:
He cited a rule in place since 1998 in the backwash of the S&L debacle that limits mortgage borrowing to 80% of the appraised value of a home. Like a minimum down payment, this reduces overleveraging and means Texas wasn't hurt as badly by the housing crash as other states.

Oops, government regulation saved their asses. But don't worry, government is still always bad in the minds of the WSJ editorial staff.
Dad + Xander

The itch, it is reduced.

I've had issues with dandruff for years. Head and Shoulders and Selsun Blue and others would help but I'd still itch. In the past few years I've kept my hair very short since it cuts down on the itching.

Now for some science:

Dandruff is caused by a yeast/fungus that feeds on the oily secretions of the scalp. The oils are secreted by the sebaceous glands to keep hair healthy. Quoting wikipedia from a 2006 paper: "[the yeast] metabolizes triglycerides present in sebum by the expression of lipase, resulting in a lipid byproduct oleic acid (OA). Penetration by OA of the top layer of the epidermis, the stratum corneum, results in an inflammatory response in susceptible persons which disturbs homeostasis and results in erratic cleavage of stratum corneum cells."

Now for hypothesis:

Certain fungus are known to secrete anti-bacterial compounds; this is where we get penicillin from. So, why would M. globosa create oleic acid when metabolizing its food? Perhaps to kill off or reduce the bacteria on the scalp that would compete with it. So neutralizing the acid could be a two-fer: it will directly help with the itching. Also, it may allow competing bacteria to grow in larger numbers. How can we reduce the acidity of the scalp? With a baking soda rinse.

So I've been washing my hair with nothing but baking soda for the last few months, and my dandruff problems are much reduced. My scalp itches a lot less, and I'm growing my hair out for the first tie since 2004. I can feel a difference when I skip the baking soda for a few days.

Also note that baking soda does not strip any of the natural oils off the scalp and hair, so things like conditioner that restore all the goodness that shampoo just stripped are also not necessary.

It's not a flashy cure, it costs practically nothing, and it's not instant. And no for-profit company would ever spend the money for a study to confirm that a baking soda rinse helps dandruff, because then they couldn't sell the much more expensive, and less useful, dandruff shampoos.
Dad + Xander

(no subject)

I went over to the new house on Saturday and again this morning. The kitchen has been ripped out, and this morning the electrician is doing his work, and was asking about where we wanted lights. I asked him to run some cat5 to a few places too.

On Saturday we got a piece of red oak and got some stain samples, and this morning looking at the hardwood in the house we've picked a stain color for the new hardwood that will be laid in the kitchen and dining room. The old color palette was too grey so Michelle is going to get some more samples that we can put on the walls to see if the new color palette looks good.

The kitchen cabinets probably won't be ready for 5 weeks yet. Saturday we bought appliances at a huge appliance sale and probably saved several thousand dollars. The new refrigerator, washer, dryer, oven, dishwasher, range hood, and induction cooktop all together cost just under $10k, which was less than I was expecting to spend.

The Austin house should be ready to sell soon, if the contractor there will get moving, and then we'll have some cash again. So now we're thinking about re-doing the bathrooms now instead of later. It's possible we can get that done before we move in as well. We've extended our lease until April 30, so M is going to get us set up with some movers now that we know a date.
Dad + Xander

Screen time

William and Xander are sitting in front of the computer, which has a background image of two clownfish swimming in an anemone. They're playing with Lego ships they built, and W decided to mount a rescue mission for the fishes since they're being attacked by "the green things".

Xander says, "I don't have any fire!"

William responds, "here, you can borrow my fire." Xander shoots the fish. William says, "no Xander, you can't shoot the fish, you can only shoot the green things!"

"Boom! Pow!"

So my kids are playing with Legos in front of the computer, doing pretend about the static background image. And naturally, the question any concerned 21st century parent would have is, does this count as screen time? Am I still a bad parent? :-)