JavaScript: online editor

https://es6console.com seems pretty handy.

 

 

Advertisements

Git: move or rename a file or folder

as


If you want to change the case of a file or folder, but not rename it, then you need to do this in 2 steps. E.g. given a folder [Test], that I want to change to [test], then do this:

git mv Test temp

git mv temp test

Github Desktop, for example, will interpret that as a single rename (Test -> test), and you can commit without further ado. I could not find a single step way to do this rename.

 

JavaScript and ES6: looping

As I am pretty much a noob at JavaScript (Alexa-related posts passim), I thought makes sense to incorporate the use of ES6 from the start. So I need to loop through an array… does ES6 bring anything new to the table on that? Googled that, found this.

The author and the series looks a good place to consult for ES6, so will return to his posts.

And for looping, this is the answer:

for (var value of myArray) {
 console.log(value);
}

 

Alexa and Node.js: Deploying to AWS

So far, the combination of Alexa, AWS and Node.js has proven to be a combination that really works for me – I had absolutely zero production experience (sure, it’s not proper-production, but it’s more than a training room example that you do and forget because you don’t have a compelling use-case) in server-side JavaScript and its various frameworks.

However, I find/found that I was still using certain crutches that Amazon offers. For one, I have been avoiding packaging… because I didn’t understand the errors. So although I have been testing (well, not yet automated) and checking in to GitHub, I have not been doing an deployment worthy of the name. For now these screengrabs will have to do to illustrate packaging up the very simplest thing, and then checking that the LaunchRequest function is called…

Alexa Skill: almost ready for certification

Turns out you can send your mates invitations to do beta testing on your Skill/App before you have submitted it for certification.

Amazon Echo: Alexa Skill working locally without Certification

(See the previous post ref developing a Skill).

The development from the previous post was all done just using a PC, no device available to me at that point.

I now have an Amazon Echo. Once I hooked it up to my wifi using the Android Alexa app, then my Skills in development just appeared on the [All Skills] tab in the Android Alex app. A key point here, is that I have not got to the Certification steps, proving that as long as you are working locally, you can test on a real device.

Now to be awkward (with myself doh), I called the Skill one thing (GovanBuses), and the invocation name of the Skill another thing (StuffOnAShip). Consequently, I was dumbly asking Alexa to “Ask GovanBuses…”, when I should have been saying “Ask StuffOnAShip…”. It is the invocation name that Alexa recognises. Moral: the name of the Skill and its invocation name should probably be the same, unless there is a very good reason to do otherwise. I cannot think what that good reason might be.

By the way: don’t be looking for anything functionally useful in all this. I have taken some inspiration from the Amazon tutorial, and some nods to my intended use-case… more of which in the near future. But the combination right now just proves that I can talk to devices and endpoints, QED.

Alexa Skills – ACTUALLY getting started

The tutorials from Amazon themselves are great – no need for third parties, imo. That said, you slightly need your wits about you as the churn in the UI seems pretty frequent.

Good tutorials from Amazon are here and here: and here.

And this one is very good on Intents, Utterances, Slots, and Slot Types.

This is what I have and have not, thus far:

  • a working Skill, in that it takes an Utterance (in the UI emulator right now, rather than the VUI), …
  • passes it to an endpoint on AWS, referencing the required lambda function
  • the “server” calls the lambda function on behalf of the skill, and responds
  • the client side (the UI emulator) receives the response, and utters it (well, renders it, and then for now I press the Listen button.