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
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!
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:
- https:[email protected]/build-your-first-alexa-skill-8a37dc3103d6#.h8ftaj84z
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
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 ...
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
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!
Now I'm working at IBM I am making extensive use of their Bluemix Platform, which is based on Cloud Foundry. The way that Cloud Foundry is set up is actually very neat, with everything you need contained in JSON structures within environment variables. Parsing out those values can be a pain however, so I thought I'd share the library that's helping me the most with this: cfenv. Continue reading
npm link command which is pretty handy. I hadn't seen it before so this blog post is basically the cheat sheet I wrote when I started using it... Continue reading
The scenario: the "main" repository of a git project has changed, either an organisation rebranded, a project got a new maintainer, or a fork became the acknowledged master. In Subversion, this was the
svn switch command and git has an equivalent. It's relatively easy in git to change your upstream - once you know how - so don't be tempted to just delete your local repo and re-clone! We can do better than that :) Continue reading