Building Conversations With Alexa

Having an Amazon Echo Dot in my office is quite fun, and I’ve accidentally started writing more skills and giving a few talks about building skills for the Alexa toolchain. Today I created a skill that uses multiple steps to make a conversation and thought I’d better write down what I did so I’d be able to remember!

The basic idea is that when creating the “intent”, i.e. the action that you want Alexa to do, you also define “slots”. The slots are the variables; if this were a command line tool, they’d be the arguments you typed. It’s possible to include both intent and slots in your wording when you speak to Alexa, but equally you can just invoke the skill and have it prompt you for the rest of the information. Continue reading

Package Parameters in OpenWhisk

I love OpenWhisk but I struggled a little to get the parameters attached in a sane way for a while so I am capturing my notes here for future reference! Parameters can be attached to actions or packages; I tend to break my actions down really small and pass data into them, while preferring to set parameters on the package that the actions belong to. Continue reading

Where was that GitHub Discussion?

Did GitHub change their activity feed? Or am I getting more confused now I contribute to so many different projects that I’m not a maintainer of? Either way, I struggle sometimes to find the pull request or issue that I had a discussion on to revisit or continue that discussion (yes, I get email notifications – and no, I don’t take good enough care of them to find things that way).

GitHub has brilliant advanced search functionality, and what I wanted was:

is:pr commenter:lornajane sort:updated-desc

Which gives me a list of all the pull requests I’ve commented on, with the most recent first. I couldn’t remember the exact repo name and I also often switch is:pr for is:issue as appropriate, but this search string has been very helpful for finding those odd things you want to follow up on.

Do you have a favourite GitHub search string combination? Would you care to share it in the comments? Thanks :)

Multiple Search Keys in CouchDB

I work quite a bit with CouchDB (Cloudant, a hosted CouchDB solution, is part of Bluemix, IBM’s cloud platform – and I work for IBM so I get to use this as much as I like) and today I found a feature I hadn’t seen before. I struggled to find the docs, so I thought I’d post my working example here in case anyone else is solving a similar problem: wanting to use more than one set of key ranges when filtering a CouchDB view. Continue reading

One OpenWhisk Action Calls Another

Working with openwhisk, it’s easy to create many isolated actions and build them up into sequences; the output of one action is passed to the next action in the sequence. In my case, I wanted one action to spawn potentially many other actions. I had to look up how to do it and here it is so I can look it up more quickly next time! Continue reading

Alexa Project Name Generator on OpenWhisk

I’m having lots of fun with my Amazon echo and echo dots, creating skills for them. Initially I used Amazon’s lambda platform since that’s a very easy way to get started – but I’m an advocate for IBM and was looking for an excuse to play with OpenWhisk (an open source serverless offering that Bluemix has a hosted version of) anyway so this was a great opportunity!

Configuring Skills

There are a bunch of good resources around for setting up skills, picking the name, configuring the “invocation” which is what to say to make the code happen, and so on. I’ll skip this section and instead just share a couple of tutorials that I rely on a lot:

Once your skill is configured, it’s time to write the code (note: UK users need to pick English (UK) and not English (US) as otherwise your skill will mysteriously fail in your home region. Guess how I learned that??) Continue reading

Working With Sorted Sets in Redis

I work with a bunch of datastores and I probably shouldn’t have favourites – but if I did, Redis would be one of them! I used the sorted sets in something I was building and remembered how much I liked the feature so here’s a quick primer on what it is and when it can be handy. Continue reading

One-Line Command For Newest OpenWhisk Logs

One of my current project uses OpenWhisk, which is an open source serverless technology stack. IBM has it on their Bluemix platform, and since I work there, I get to play with it as much as I like! One thing that did seem clunky is that it takes more than one step to get the logs of the most recent function run via commandline – first you list the activations, then you request the logs of the activation you’re interested in. Of course, when you’re developing, that’s usually the most recent one so here’s my shortcut for that:

wsk activation list -l1 | tail -n1 | cut -d ' ' -f1 | xargs wsk activation logs

From left to right, sections separated by the pipe | character, this is what happens:

  • get a list of activations, limited to just one activation (it sorts the newest one first by default)
  • grab only the last line of that output (there’s some extra titles and stuff in there)
  • use the `cut` command with the space character as a field delimiter, and use only the first field (this gets the ID of the activation)
  • get the logs of that activation

Of course it’s wrapped up in a script so I just run that from the commandline and check where I went wrong this time …

Exclude a Directory when Grepping

As a developer-of-another-discipline who is now transitioning into a bunch of NodeJS projects, I grep a LOT. However I am usually only interested in the code in the project at hand, and not the dependencies – of course grep has a switch for that! To grep your project and not the dependencies in the node-modules folder, try this:

grep -R --exclude-dir node_modules [what to search for] * 

If you’re using a different tech stack you may want to exclude a different directory (for PHP, the directory would be called vendor), but this is a very handy tip and a bit nicer than the older approach I was using which did the whole search and then used a second grep to eliminate things by using the -v switch.

Sewing Machine Cover

I don’t blog about craft projects all that often, if you have this post in your feed and didn’t want it, then try my “tech” feed specifically rather than all of the blog posts (recommended as I will be blogging a few non-tech things in the coming months). Anyway, I love to make things, code or otherwise, and since I’m not travelling a lot at the moment, I have time to make things AND to write about them. Today: my new sewing machine cover!

New Sewing Machine Cover

Continue reading