Nerding while sweating

I was slowly cranking my way of Claremont Avenue the other day on my trusty Bianchi when I started wondering why I was so slow. Well, that was easy. I’m pretty heavy and I’m somewhat out of shape. But which is more important, which would have a bigger impact if improved?

First, I used a website like this one to determine the average grade over a certain familiar portion of the route. In this case, it was 13.3%. I also have a speedometer on my bike that tells that I average about 5 mph over that stretch. Finally, I weigh about 100 kg, and my bike is another 10 kg.

So, given that the energy to raise a mass up h height is m*g*h, the power to raise a mass at r rate is m*g*r.

Result:

claremont_power: 317.67222 (watts)

That is, that’s how much power it takes to lift my mass up a hill at that rate. Note the trig to change my speed up the hill to a vertical speed. There are losses in pedaling a bike, and on the tires on the road, etc, but this is a good estimate of the overall order of how much power I can comfortably sustain. Let’s call it 300W.

Now, another thing I’ve noticed while riding is that on flat ground, I can maintain about 17 mph. In that case, I’m not adding power to climb a hill at all, all of my power is overcoming road friction and drag.

It happens that power going to aerodynamic drag goes by the cube of the velocity. (There is more going on here than wind drag, but, eh, it probably dominates at higher speeds…) So, if we assume that on level ground I’m capable of the same ~300W that I do while climbing, I can calculate the constant in:

P = c * v^3

This is a simplification of the more general equation linked above, assuming constant air density, yadda. For 17 mph and 317 W, I get about 0.72376 kg / m. kg/m is a strange dimension, but it it what it is.

So then, I wondered, how fast should I be able to go with a given power budget while climbing different grades?

I created this equation which combines the power to climb and the power to overcome drag

P = c v^3 + m g v sin(theta)

where P  is power, c  is the drag power constant calculated above, m  is mass, g  is the acceleration of gravity, and theta is the angle of the hill. (The angle is the arctangent of the grade, by the way.) Oh, and v  is my speed.

It turns out that my brain doesn’t perform the way it once did and I can’t solve that cubic equation on my own, so I resorted to a Python-based solver which is part of the sympy package.

This function gets the job done:

Note this equation has three solutions, two of which are complex. Only interested in the “real” solution.

Now, this is finally where the fun starts. Want to know how fast I can climb different grades, or how actual athletes who can summon more power than me can get up?

How fast I might get up hills if I could make more power.
How fast I might get up hills if I could make more power. (mass = 110 kg)

Like I said, I can make about 300W, but I saw a youtube video of a dude who could make about 1kW, at least for long enough to make toast.

Then I was wonder, would losing weight help much? It does. Interestingly, it helps on the middle grades. On the highest grades, I’m nearly stopped, and the numbers get small. On flat grades, drag (a function of my shape, not my size) dominates. But in the middle, yeah, there’s an effect.

Dave might go faster if we was less fat.
Dave might go faster if we were less fat.

So there you have it. If I lost 10 kg and could increase my power output by 15% I could go from about 5 mph on Claremont to about 6 mph.

Actually, that’s depressing.

What is the “Middle Class?”

On the radio today, All Things Considered did a little “Brief History of the Middle Class.” Apparently, according to Pew Research center, a family is in the middle class if its income is between about $47k/yr and $141k/yr. They also have breakdowns of wealth (if you are in net debt, you are not middle class) and consumption.

 

My own definition middle class has more to do with economic security than it does with wealth, income, or many types of consumption. To wit:

If you do not need to worry about food, housing, transportation, health care, education for your children, and safety, and can look forward to a retirement with those same basic needs satisfied, and you are not at risk of losing any of those things immediately on some negative shock, like an accident, negative diagnosis, or loss of job, then you have achieved middle class status. My definition doesn’t have anything to do with iDevices, high speed Internet, vacation or dining out.

It’s tricky, because I think a lot of people who do have nice things, like fancy cars, and big houses, don’t actually have solid economic security. I don’t know if they’re middle class or not.

What do you think the definition of middle class should be?

technological progress, freedom to v. freedom from

Technology progresses. Most of the time, progress is good, sometimes bad, but in all times it creates new circumstances, and those circumstances have winners and losers. Our society is not good at recognizing when circumstances have changed. We tend to take, for a long time at least, the world-as-it-is as the world-as-it-ought-to-be.

But I see no reason it must be so. I wish we were better at evaluating our reality, deciding if we like it or want something else, and then, coming to consensus on what, if anything, should be done at a policy level to control our circumstances.

 

For example, remote control airplanes have been around for quite some time. They were rather expensive toys, and not easy to fly. Similarly, aerial photography has existed almost since the dawn of flight. Because paying a pilot of fly over some location for you and photograph it is not cheap, it tends to be done where value of the resulting photograh is high enough to justify the expense.

For whatever reasons, we were pretty much OK with that status quo and the laws surrounding it. For example, yes, someone could photograph you through your window, and a passing plane could catch you sunning in your yard. People do not like those thigns, but it was hard enough to do and easy enough to stop, that basically, everyone but celebs and paparazzi seemed fine with the world as it was.

Enter inexpensive, simple aerial photograph with UAVs. Today, anybody with a few hundred bucks can get aerial imagery, and in a few years, that might be $10’s or even $1’s. Whole new possibilities for surveillance open up and people are suddenly uncomfortable about their vulnerability.

Does this mean we need laws to stop aerial surveillance “abuse?” Or maybe we need to adjust our expectations of privacy? I dunno. We need to evaluate the situation anew, since technology has changed circumstances. The fact that the existing laws were fine does not mean they are fine.

Totally rad UAVI can think of lots of contemporary examples of this sort of change: facial recognition along with ubiquitous video cameras make it possible to track everyone, everywhere they show their faces. License plate reader technology allows someone to track everywhere you go. You could do the same before, with detectives or private eyes, but now it can be done in bulk, cheaply. Cookies on websites allow someone to track most of what you look like on the Internet. In essence, people’s expectation of privacy was actually the complex combination of the state of technology and the law together, not either separate from the other.

None of these technologies are sinister in and of themselves, but dropped into a an environment that was in legal equilibrium without them, I think we should expect that equilibrium to shift.

Zoom!Of course, there are historical examples of such adjustments. Prior to the ubiquity of the automobile, people did not need carriage licenses, nor did they need to carry liability insurance for carriage accidents. How long after cars became popular did we realize they were dangerous enough and important enough that we should require that drivers get training? I think most (though not all) people today regard drivers’ licenses as a good idea. A few decades after that, we started requiring drivers to carry liability insurance and today most states have some requirement, though it is amazingly low in some places. (I know that agreement is hardly universal that liability requirements are a good idea, but we have them.)

One contemporary problem that is not typically considered in this light is gun violence. One might say that extremely capable weapons have been available for a long time, but that they have been expensive enough and just tricky enough to obtain, that we, as a society, were comfortable with the status quo. Collectors and sportspeople had them, and they used them safely, more or less. Enter cheap, easily available weapons, and all of a sudden the game has changed. In fact, today you can 3D print a gun at home, and maybe in a few years you’ll be able to 3D print a most of a not-too-shabby automatic weapon. The technology is not going to go away, but because of the technology change, the status quo is going to shift. Can or should we try to shift it back?

 

My point is that I think there are many  people who advocate for a kind of technological determinism, suggesting, “well, tech marches on.” But history tells us that we clearly do not have to accept such outcomes if we don’t want them.

Freedom-loving readers will notice a whole lot of “we’s” in this essay. I’m afraid they’re right. I’m suggesting that the group sometimes make decisions that restrict an individual’s freedoms. I know there is a cost to that. But I also see costs in letting individuals restrict the freedom (and well-being) of many other individuals.

As always, practicality and balance will be hard to achieve. We all seem fine with driver’s licensure, but pet grooming licenses seem perhaps too far. Required liability coverage for drivers is OK, but we probably would not tolerate such a requirement for many other potentially dangerous-to-others activities.

I hope we will have spirited, informed debates on issues like privacy and autonomy and that the outcome, if not new norms and laws, are new, explicit reiterations of existing norms that were previously implicit.

Gah… Apple

I use a Mac at work. It’s a fine machine and I like the screen and battery life, but I’m not a generally fan of Apple the company or its products. Sometimes I forget why, and I need to be reminded.

Like today, when I decided, even though Safari is basically a sucky product, there are probably people that use it, so I might just port my little political statement Chrome extension to Safari. I’d already done so to Firefox, so how hard could it be?

Well, it turns out, not too hard. Actually, for the minimalist version that most people are using, it required no code changes at all. It did take me awhile to figure out how everything works in the Apple extension tool, but overall, not too bad.

I knew I would have to submit to reviewers at Apple to get it published. I had to do the same at Mozilla for Firefox. But what I did not know is that in order to do that, I had to sign up to be an Apple Developer. Moreover, I could only do so under my real name (ie, not dave@toolsofourtools.org) and most annoying, they wanted $99. A year. or as long as the extension is up.

I’m not going to play $99/yr to provide a free plugin for the few people who are dumb enough to use Safari on a regular basis.

In an odd way, this gets right to the heart of one of the many reasons I do not like Apple. They are constitutionally opposed to my favorite aspects of the computing and the Internet: the highly empowering ability for people to scrappily do, say, make anything they want for next to nothing, and at the level of sophistication that they want to deal with. Apple doesn’t like scrappy things in its world, and actively weeds them out.

Apple, you suck. Thanks for the reminder never to spend my own money on your polished crap.

Clever, disturbing

Apple was recently granted a new patent for technology that will disable your phone’s camera at concerts where photography is forbidden.

The patent uses an infrared signal, which could be picked up by the imaging sensor itself. This is rather ingenious and cunning, because you could not disable the shut-down sensor without disabling the camera yourself, since they are one and the same.

IPhone_5S_main_cameraDepending one how pervasive such tech became, and how closely integrated the detection, decoding, and disabling is to the actual silicon image sensor, it could become nearly impossible to defeat this tech, or to obtain a phone that doesn’t include it.

I find blocking cameras at concert venues mildly annoying, but the potential for abuse of this technology seems large. Will folks on the street use it to block being photographed? Will it be deployed in government buildinds? Outside cop-cars? Will the secret for how to disable everyone else’s phone get out?

Over the last few years we’ve seen some exciting benefits from ubiquitous deployment of cameras. People are getting caught doing things that are illegal or at least shameful. I’d be bummed to see some technology from Silicon Valley reverse this progress.

 

 

The code we unwittingly run

This will come as no news to tech-savvy people, but when you open a webpage, you are running a metric shit-ton of code from all over the Internet.
A bunch of garbage nobody needs.
A bunch of garbage nobody needs.
Since I’ve been doing some Chrome Extension development over the past couple of days, I’ve been opening up the dev tools that let you see the “console” output of all the javascript that runs on a page. It’s a lot. I have an ad-blocker running, so most of those GETs and POSTs generate error messages and go nowhere. But there are a lot of them. And the code keeps trying over and over.
And it’s from a lot companies, too. On the NYT alone, I get messages from various systems from google, amazon, facebook, doubleclick, moatads.com, brealtime.com.
Aside from the privacy and tracking aspects, it feels like a theft of resources, too. They’re using my CPU to do work that has nothing to do with rendering their page.

Detrumpify2 — some cleanup

Even though my short brush with Internet fame appears to be over (Detrumpify has about 920 users today, up only 30 from yesterday), pride required that I update the extension because it was a bit too quick-n-dirty for my taste. Everything in it was hard-coded and that meant that every update I made to add new sites or insults would require users to approve an update. Hard-coding stuff in your programs is a big no-no, starting from CS 101 on.

So, I have a rewritten version available, and intrepid fans can help me out by testing it. You will not find it by searching on the Chrome Web Store, instead, get it directly from here. It is substantially more complicated under the hood than before, so expect bugs. (Github here, in “v2” folder.)

An important difference between this and the classic version is that there is an options page. It looks like this:

Screen Shot 2016-06-28 at 11.33.34 AM The main thing it lets you do is specify an URL from which a configuration file will periodically be downloaded. The config file contains the actual insults as well as some other parameters. I will host and maintain several configuration files ToolsOfOurTools, but anyone who wants to make one (for example, to mock a different presidential candidate) will be able to do so and just point to it.

If you want to make changes locally, you can also load a file, click on the edit button, make changes, and then click on the lock button. From then on the extension will use your custom changes.

The format of the config file is simple. Here’s an example with most of the names removed:

Explanation:

  • actions  is a container that will hold one or more named sets of search and replace instructions. This file just has one for replacing trump variations, but one can make files that will replace many different things according to different rules
  • find_regex  inside the trump action finds a few variations of Trump, Donald Trump, Donald J. Trump.
  • monikers  section lists the alternatives.
  • randomize_mode  can be always , hourly , daily , and tells how often the insult changes. In always , it will change with each appearance in the document.
  • refresh_age  is how long to wait (in milliseconds) before hitting the server for an update.
  • run_info  tells how long to wait before running the plugin and how many times to run. This is for sites that do not elaborate their content until after some javascript runs. (ie, every site these days, apparently). Here, it runs after 1000ms, then runs four more times, each time waiting 1.8x as long as the last time.
  •   bracket  can be set to a two-element array of text to be placed before and after any trump replacement.
  • schema  is required to ID the format of this file and should look just like that.
  • whitelist  is a list of sites that are enabled to run the extension. Et voila.

Let me know if you experience issues / bugs! The code that runs this is quite a bit more complex than the version you’re running now. In particular, I’m still struggling a bit with certain websites that turn on “content security policies” that get in the way of the config fetch. Sometimes it works, sometimes it doesn’t.

 

Marriage proposal from Jezebel

The fine folks at Jezebel want to marry me! Though I am married in Real Life, I see no reason that should preclude an Internet-based group arrangement.

Because this is clearly the beginning and end of my fifteen minutes, I will paste a few comments from the post:

  • This is basically a marriage proposal to us as a group, right? We accept so hard.
  • This is the best thing that has ever happened in the known universe, space, and time. Ever.
  • I am not going to get any work done for the rest of the day…
  • this is making me positively giddy
  • Firmly believing that the entire Gawker Media empire was brought into existence specifically so this moment could happen. This is fantastic. BRING ON THE AMBITIOUS CORNDOGS, Y’ALL.
  • Whoever made this is a goddamn genius.
  • You are doing a wonderful service for your country! Love love love this.
  • Somebody please tweet this to Colbert? He’s been doing incredible take-downs of Trump and I’m sure would love to demo this on the Late Show.
  • Installing this on my work PC was a mistake. I’m crying.

In the words of Ken Burns, I think this really is my Best Idea.

 

Detrumpify

nbc-fires-donald-trump-after-he-calls-mexicans-rapists-and-drug-runnersApropos of nothing, I have written a very simple Chrome extension (and a Firefox add-on) that replaces references to the Short-Fingered Vulgarian with any of several other aliases. The initial “seed” for the list came from Jezebel, which published a list of 70 such names for the Cheeto-Faced Ferret’s 70th birthday.

I really should take the time to make this plugin user-configurable, so that you can add your own insults.  However, that seems a lot of work for something that basically works ok as it is. If you want to see the (very simple) code, check it out here on Github. I’ll take pull requests. [Edit 7/6: have now done this and the link above points to the new version. Original version still available here.]

I plan to add new insults as I come across them (feel free to provide), at least through November 2016. If you have suggestions, please note that I’m only using family-friendly insults.

Enjoy!

 

 

PS — A few people have noted that the plugin doesn’t run on this or that website. That’s because it uses a whitelist of websites. I chose to do this to make the plugin as compatible and friendly as possible. It will run on the New York Times, but not on GMail, for example, nor will it interfere with your transactions at First National Bank of Trump. If you are running the current version, Detrumpify2, you can change that list yourself by adjusting the configuration file. If using the “classic” version, you’ll have to write me and ask to change it, and when I do, you’ll have to re-approve the plugin with the new permissions. Because of that, I’m going to try to avoid adding new sites to the “classic” extension too many more times.

 

Interchangeability

I think one of the rites of your mid-40s is assessing what you have accomplished relative to what your young self thought you were going to accomplish — and feeling blue about it.

I’ve been thinking a lot lately about my interchangeability. That is, the notion that in the vast majority of my own endeavors in life, I have been basically an interchangeable part in a larger system. This is in spite of being a pretty clever engineer, pretty good policy analyst, or even Really Smart Guy. I can’t really point to any professional situation where someone else, similarly trained and skilled, would not have performed the job more or less as I did. Or perhaps it’s just the nature of employment in our world that even if my particular combination of traits is uncommon, most jobs only require only a couple of them.

I’m not saying that we are not each unique, special snowflakes, but that in the vast majority of situations, that uniqueness just isn’t operational. Which is kind of a rough realization. It’s probably best for young folks to avoid realizing this as long as they can.

Of course, there are aspects of life in which even the least accomplished of us is not interchangeable. Obviously, the personal aspects come to mind. My spouse and kids would probably be nonplussed to wake up one day to find me replaced with someone who was “a lot like me.” Though maybe in a week, year, or decade they’d mostly get over it.

Some people transcend interchangeability. Artists and musicians create unique things that nobody else could possible have created. Sometimes scientists discover things that would otherwise have gone undiscovered for a long time. These are things whose profound singularness are easily recognizable, whether or not you know the creator herself. That’s pretty amazing if you think about it. Can anyone do this or is it just for rare talents?

Maybe, part of the secret to a happy second half of life is the acceptance of interchangeability. So what if I’m not leaving a unique mark on the world? Maybe it’s lifts a huge burden to accept that it’s more than enough that your family and friends love you (I have received reliable assurances that mine do) and that has nothing to do with your worldly accomplishments. Or, is that prematurely throwing in the towel on the world?

Or, maybe interchangeability — an assessment of value of self as perceived by the outside world —  is a wholly inappropriate way to consider one’s own life. An alternative approach might be to totally disregard what the world “thinks” and just “be” whatever works for me. The world probably isn’t even real, anyway? Because of my non-liberal arts background, I wasn’t exposed to much philosophy in my education, but in high school I had a teacher who was really big into the existentialists. Didn’t really resonate for me then, but it’s starting to much more these days.