Marketing Genius

Over the past couple of months, in stolen moments and late night coding sessions, I’ve quietly been inventing a little piece of ham radio gear intended to facilitate using one’s radio remotely.

I thought it would be a good way to try my hand at designing a useful product, from start to finish, including complete documentation, packaging, etc.

I posted about it to a few ham radio forums and it turned out nobody was interested, so instead of making a product, I’m just throwing it up on github for people to ignore forever.

I’m no marketing genius.

 

 

Rigminder 2017-2017 RIP

Cold Turkey

This morning, I started my regular morning ritual as usual. I got up, complained about my back, put bread in the toaster, water in the kettle, and then went to my phone to see what’s happening.

Except that last thing didn’t work. Facebook wouldn’t load.

Why? Because my better half convinced me that it was time to take a Face-cation. Last night we logged into our accounts and let each other change our passwords. As a result, we are unable to access our own accounts, locked in a pact of mutual Facebook stasis.

I can say, that several times already today I have pretty much instinctually opened a tab to read FB. In my browser, just typing the first letter ‘f’ is all it takes to open that page. Each time I’ve been greeted by a password prompt. Poor me.

Well, if FB is my heroin, let this plug be my methadone. We’ll see how that goes.

How long until this nightmare is over?

I’m tired of this president already. What an awful combination of idiocy and cunning. To wit, just today from the Moron in Chief’s mouth:

This is more work than in my previous life. I thought it would be easier.

Jeebus.

Anyway, in anticipation of never having to hear about Trump every again, I wrote another little Chrome plugin yesterday. It tells you how many days until this is all over.

You can get it here: Trump Time Remaining

Normally, it’s just a little icon that tells you how much of Trump’s term remains. Here is it set to percent:

If you click on that icon, you get some more information:

That’s really all there is to it. You can change your reference date (election or inauguration) and you can adjust the expected number of terms (please, G-d, let it be just one), and you can change what is shown in the icon: days remaining, days passed, etc. Note that icons can only reliably show three digits, and we have more than 1300 days left, so days remaining may not work nicely in the icon on your computer.

So, how long until this nightmare ends? Well, 1362 days, give or day. Now you know.

 

ATIS in your kitchen

One ritual that every pilot observes before launching into the wild blue yonder (or dark gray muck) is tuning in the Automated Terminal Information Service, or ATIS. The ATIS is a recording, usually updated hourly, that contains a very terse version of the current weather and anything else new that pilots need to know.

ATIS is not the first weather information a pilot will hear before flying. In fact, it is more likely to be the last, after she has gotten a complete legal weather briefing (14 CFR 91.103), but before taking off. Pilots also listen to the ATIS at an airport at which they intend to land.

A similar system, called AWOS (Automated Weather Observation System) is like ATIS, except that it usually only carries the weather (no other info) and always sounds like a robot.

As it turns out, I have a doohickey in my home that 1) can connect to the Internet to get the weather and 2) sounds like a robot. I thought, maybe it would be fun to write an app that simulates ATIS on an Amazon Echo.

Well, here it is.

This is a rather straightforward Alexa Skill. A user specifies the airport of interest by using its four-letter ICAO identifier. Standard ICAO phonetics are supported. (alpha, bravo, charlie, …)

For example, Chicago O’Hare’s IATA code is ORD, but its complete ICAO code is KORD. You could say:

Alexa, ask airport weather to get kilo oscar romeo delta.

And it would read you the weather in Chicago. The skill also knows the names of many (but by no means all) airports, too, so you can specify an airport that way, too. And if you give only three letters (like an IATA code rather than an ICAO airport identifier), it will try to fill in that fourth letter if you. For European users, you can get the visibility and altimeter settings in metric format.

A few details of the skill:

  • written in node.js
  • Uses the Alexa Skills Kit API — Amazon handles all the voice stuff
  • Runs as a function in AWS Lambda
  • Accesses weather data from ADDS.
  • Stores user preferences in an AWS DynamoDB (a Mongo-like database thingy)
  • Caches weather info from ADDS for up to 5 minutes to reduce load on ADDS
  • Whole thing runs in the AWS “Free tier” — which is important, as I’m not going to spend money to host a free app.

One of the more fun aspects of the project was getting to maximal verisimilitude. The ADDS weather source actually provides a METAR, which has a lot of the same information as does the ATIS, but it’s not entirely the same in form or content, so I had to do some translation and adjustment. For example, wind directions in METARs are true-north references, but in ATIS, they are magnetic-north referenced. In Northern California, where I live, that’s a 16.5° difference — not trivial. The program makes the adjustment based on the location of the airport and calculations from the World Magnetic Model.

So this METAR

 becomes:

 There is even code there to try to get the pauses and pacing to be realistic.

Anyway, code is not the cleanest thing I ever did. Such is the case when things start as personal hacks and turn into “sofware.” Check it out on github.

More instructions here: http://toolsofourtools.org/alexa-metars-and-tafs

Update: Since coding this skill, I have added the Terminal Area Forecast (TAF) capability as well. Just as for the forecast.

Cultural variation in phalangeal deployment in the service conveying antipathy

I have a lot of thoughts about politics these days, but so does everybody else, right? So I will not write about politics.

Instead, I want to write about “the finger.” I’ve been giving the finger as long as I can remember. I probably learned it from my brother or sister, though, its use was heavily reinforced in social settings — at least those not policed by grown-ups.

I don’t give the finger very much these days, but I still enjoy seeing a good display. I noticed, recently, though, that there seems to be a lot of variation in how people give the finger, and I’ve become curious about it.

The gesture I learned, which I’ll call the “basic” finger requires that the middle finger be extended fully, and all the others be curled down as much as possible. This includes the thumb. It looks like these:

the_gesture021p5b3199

 

 

However, for a long time, I’ve been aware of an alternative interpretation of this gesture, which I will call the “John Hughes.” In this variation, the other fingers are not held down, but merely curled at the knuckles — sometimes only very slightly. The thumb may even be extended. In film, the person giving this gesture often wears fingerless gloves.

Here are some examples:

via GIPHY

 

14717243_10210240665588417_3905152048572238054_n

I actually find performing this variation rather difficult, as I cannot seem to get my middle finger to extend fully while the others are only bent. However, for my wife and many others, this is the default form — she does not associate it with the Chicago suburbs at all.

So, I ask you, my loyal readers, what’s going on? What drives this variation?

Some theories:

  • geography (soda / pop / coke)
  • class-based
  • disdain vs. anger

 

Does one skew more Republican and the other more Dem?

Are there more types out there? I realize that if you widen the scope internationally, there are many more variations, including the “V” and the thumb, but I’m mostly curious about the intra-US variation.

Trump: the disease

After last night’s embarrassing Clinton vs. Trump matchup, I’m once again feeling glum and confused. It caused me to reflect on a dichotomy that I was exposed to in high school: that of “great man” vs. circumstance. I think I believe mostly in circumstance, and maybe even a stronger version of that theory than is commonly proposed.

In my theory, Trump is not an agent with free will, but more akin to a virus: a blob of RNA with a protein coat, evolved to do one thing, without any sense of what it is doing. He is a speck floating in the universe, a mechanically fulfilling its destiny. A simulation running in an orrery of sufficient complexity could predict his coming.

This is his story:

Somewhere, through a combination of natural selection and genetic mutation, a strange child is born into a perfectly suited environment, ample resources and protection for his growth into a successful, powerful monster. Had he been born in another place or time, he might have been abandoned on an ice floe when his nature was discovered, or perhaps killed in early combat with another sociopath. But he prospered. With a certain combination of brashness and utter disregard for anything like humility, substance, or character, it was natural that he would be put on magazine covers, and eventually, television, where, because of television’s intrinsic nature, itself the product of a long, peculiar evolution, he killed, growing yet more powerful.

Later, perhaps prompted by something he saw on a billboard or perhaps due to a random cosmic ray triggering a particular neuron to fire, our virus started talking about politics. By chance, his “ideas” plugged into certain receptors, present in the most ancient, reptilian parts of our brains. Furthermore, society’s immune system, weakened through repeated recent attacks from similar viruses, was wholly unprepared for this potent new disease vector. Our virus, true to form, exploited in-built weaknesses to direct the media and make it work for its own benefit, potentially instructing the media to destroy itself and maybe taking the entire host — our world — in the process.

In the end, what will be left? A dead corpse of a functioning society, teeming with millions of new viruses, ready to infect any remnants or new seedlings of a vital society.

And the universe will keep turning, indifferent.

The end. 

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.

 

Detrumpify

nbc-fires-donald-trump-after-he-calls-mexicans-rapists-and-drug-runnersApropos of nothing, I wrote 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.

Over the years since I did this, I have taken pains to make this plugin more and more configurable. Most of the insults are loaded from a configuration file you can edit, and a bunch of options are available in the drop-down plugin options. 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 have added new insults as I’ve come across them (feel free to provide more). Considering that I started this project in summer 2016 and it is now fall 2019, it’s amazing that I still come across new good ones. But I guess we can thank Mango Mussolini for that.

Enjoy!

PS — A few people have noted that the plugin doesn’t run on this or that website. Note that by default it does not run on all websites. In the configuration menu you will see that you can set it to “blacklist” mode or “whitelist” mode, and then specify a list of sites to exclude, or include, respectively. The default is a whitelist of major news sites.

Simulate this, my dark overloards!

Apparently, both Elon Musk and Neil deGrasse Tyson believe that we are probably living in a more advanced civilization’s computer simulation.

Now, I’m no philosopher, so I can’t weigh in on whether I really exist, but it does occur to me that if this is a computer simulation, it sucks. First, we have cruelty, famine, war, natural disasters, disease. On top of that, we do not have flying cars, or flying people, or teleportation for that matter.

Seriously, whoever is running this advanced civilization simulation must be into some really dark shit.

simple string operations in $your_favorite_language

I’ve recently been doing a small project that involves Python and Javascript code, and I keep tripping up on the differing syntax of their join()  functions. (As well as semicolons, tabs, braces, of course.) join()  is a simple function that joins an array of strings into one long string, sticking a separator in between, if you want.

So, join(["this","that","other"],"_")   returns "this_that_other" . Pretty simple.

Perl has join()  as a built-in, and it has an old-school non object interface.

Python is object-orienty, so it has an object interface:

What’s interesting here is that join is a member of the string class, and you call it on the separator string. So you are asking a "," to join up the things in that array. OK, fine.

Javascript does it exactly the reverse. Here, join is a member of the array class:

I think I slightly prefer Javascript in this case, since calling member functions of the separator just “feels” weird.

I was surprised to see that C++ does not include join in its standard library, even though it has the underlying pieces: <vector>  and <string>. I made up a little one like this:

You can see I took the Javascript approach. By the way, this is how they do it in Boost. Boost avoids the extra compare for the separator each time by handling the first list item separately.

Using it is about as easy as the scripting languages:

I can live with that, though the copy on return is just a C++ism that will always bug me.

Finally, I thought about what this might look like back in ye olden times, when we scraped our fingers on stone keyboards, and I came up with this:

Now that’s no beauty queeen. The function does double-duty to make it a bit easier to allocate for the resulting string. You call it first without a target pointer and it will return the size you need (not including the terminating null.) Then you call it again with the target pointer for the actual copy.

Of course, if any of the strings in that array are not terminated, or if you don’t pass in the right length, you’re going to get hurt.

Anyway, I must have been bored. I needed a temporary distraction.