Monday, July 31, 2017

Hacking about on AWS Alexa

First AWS Summit.
First Alexa skill.
First Node.js app.

That's a lot of first all at once. In any event, Jeff Blankenburg's workshop inspired me, and Memo Doring's workshop got things moving.

Then I hit the typical 'how the hell do I debug this pile of slag?' roadblock. Thankfully, Nathan Grice already wrote all that down. (the post is a bit out of date at this point, almost a full year after the publication date, but it's a minor bit of mental version translation)

Step-through in VSCode for Alexa Lambda functions. Now it's time to get this thing working!

Frankly, this same general setup probably works for any AWS Lambda function with the right packages; Alexa is just the use case that made me search for the environment setup. And, yes, this post is simply to remind me where to find the instructions later. Here's hoping the link-rot stays away for a while.

SF

According to Neil Gaiman Science Fiction should be call Speculative Fiction.
After listening to the TED Radio Hour 'Spoken and Unspoken' episode I think perhaps Subjunctive Fiction fits better and (with Phuc Tran's talk as background context) evokes more of the power of the genre. SF can express ideas that could not be explored at all without the background fictional conceits used.

Though that also probably sounds too professorial for ordinary use.

Saturday, July 15, 2017

I've been asked for a list of my podcasts

Sadly I don't get to listen to as many as I'd like and most of the episodes go un-heard. If you're curious, I use an Android app called Beyondpod to manage subscriptions and the playlist (the Smartplay feature is extremely useful). The names below are whatever is listed in Beyondpod's feed list and may not be exactly the same as what you might find while searching. It'll be close enough to get you there though. It's also important to note that I don't groom this list very often. I'm pretty sure that some of what I'm subscribed to has gone defunct, but I frankly can't be bothered to prune the list.

Without further preamble here they are in no particular order.


  • NPR Hourly News Summary
  • Planet Money
  • StarTalk Radio
  • Science Friday Audio Podcast
  • APM: Marketplace
  • Up First
  • APM: Marketplace Tech
  • TED Radio Hour
  • Snap Judgement
  • Hanselminutes
  • On Being
  • Freakonomics Radio
  • Note to Self
  • LeVar Burton Reads
  • Hidden Brain
  • The Infinite Monkey Cage
  • Wait Wait... Don't Tell Me!
  • The Skeptic's Guide to the Universe
  • CodeNewbie
  • Skepticality
  • American Museum of Natural History Podcast
  • Intelligence Squared U.S. Debates
  • Undiscovered
  • Astronomy Cast
  • Only Human
  • The Adaptors



These are some new ones I've added but haven't formed an opinion on. I reserve the right to can them later, but they looked worth investigating.

  • The Titanium Physicists Podcast
  • Ask a Spaceman!
  • KQED Science News
  • Hubblecast HD
  • Physics World Science Podcast

Sunday, July 19, 2015

4Clojure: For the Win

(for [x (range 40)
    :when (= 1 (rem x 4))]
    x)

x is assigned the range of integer values from 0-39. x is finite so the for stops evaluating when x is fully consumed.
On each iteration the remainder of x/4 is compared to 1 and if they are equal the body is evaluated (which is just x).

(for [x (iterate #(+ 4 %) 0)
    :let [z (inc x)]
    :while (< z 40)]
    z)

x is assigned a lazy sequence of all the multiples of 4 (iterate from 0 applying +4 at each step using an anonymous function). x is infinite so the for is terminated with :while
Each iteration of the for symbol z is assigned x+1.
While z is less than 40 the body is evaluated (which is just z) and the for loop terminates when z >= 40.

(for [[x y] (partition 2 (range 20))]
    (+ x y))

The range from 0-20 is split into segments of 2 numbers. One segment deconstructed into x and y per iteration of the for. The sequence is finite so the for terminates when the full sequence is consumed.
x and y are added as the body of the for.

Each of these results in the same output (a list of each multiple of 4 incremented by 1 up to 37) just by a different mechanism. For my money the first option is probably the best combination of concise and obvious.

Clojure for macro keywords

These docs weren't incredibly helpful in figuring out the difference between :when and :while.
The examples
(for [x [1 2 3]
  y [1 2 3]
  :while (<= x y)
  z [1 2 3]]
  [x y z])
and

(for [x [1 2 3]
  y [1 2 3]
  z [1 2 3]
  :while (<= x y)]
  [x y z])

come close to exposing the difference, but what should really be stated explicitly somewhere is that :while stops attempting to evaluate at the first false result whereas (almost said while there >.> ) :when continues to try to evaluate after the false.

(for [x [1 2 3]
  y [1 2 3]
  :while (= x y)
  z [1 2 3]]
  [x y z])
;;([1 1 1] [1 1 2] [1 1 3])
(for [x [1 2 3]
  y [1 2 3]
  :when (= x y)
  z [1 2 3]]
  [x y z])
;;([1 1 1] [1 1 2] [1 1 3] [2 2 1] [2 2 2] [2 2 3] [3 3 1] [3 3 2] [3 3 3])

Perhaps I'm dense but this wasn't immediately obvious to me.

Edit: Or perhaps I should have actually read. Example 8 is pretty explicit. >.<

Saturday, June 6, 2015

Fuck Microsoft and their little dog too

I just wasted 3 hours trying to get a dev environment past the 3rd setup step. Why? Because VT-x was FUBARed by Hyper-V. 3 fucking hours googling and getting a headache trying to figure out why the Intel(R) Processor Identification Utility tool was saying my hot-shit Surface Pro 3 Core i7 processor didn't support 'Intel(effingR) Virtualization Technology' or Intel (shockingly not Red) VT-x with Extended Page Tables. All the while wondering if my CPU is weirdly broken and going to need an RMA after 6 months of settling into it. As it happens I tried deleting Hyper-V entirely after trying a good half dozen tools and workarounds, looking at the (honetly braindead) Surface BIOS UEFI, and I can't remember what all else. All I needed was to open PowerShell as admin and
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All

aka KILLITWITHFIRE

The HabitRPG dev environment uses Vagrant and VirtualBox, which was complaining that VT-x wasn't available and dieing horribly (presumably because it's a 64bit guest). But apparently Hyper-V EATS that part of your CPU so nobody else can use it. Or something. Whatever, don't bore me with the technical details, I just wish someone somewhere had thought to mention the critically important bit that HYPER-V WANTS TO MONOPOLIZE THE PLAYGROUND EQUIPMENT. Anyway. Learned my lesson (I might even remember it next time) and won't be touching Hyper-V ever. Unless by some perverse chance I opt to write something for Windows Phone. Which is incredibly unlikely knowing the debugging will require Hyper-V and thus explicitly ban me from doing a hundred other things. You can pretty much forget about that.
Now the vagrant guest is coming up and, with any luck, the VM I had decided was going to need to be wiped might actually be usable again. GAH, I was just starting to think MS gave a shit about computing in general, what with Community VS and free (sorta) Windows 10 upgrades.

Wednesday, April 1, 2015

Cancer

Cancer (n) - the phenomenon resulting from a cell making its division function recursive and forgetting a proper stopping criterion. The function will recurse until it crashes the system or is halted externally.