CodeMesh 2017

Summary

I was on 8-9 November in London on the conference “Code Mesh”. It was a tough and very interesting conference about non-mainstream technologies. The knowledge which was presented is not something which you can directly implement into your daily work because we don’t have ideas available in our C# language. But each knowledge, in my perspective, should inspire you to do interesting stuff and we shouldn’t close just to one language. I will describe the most interesting talks.

Topics which you can inspire or interest you:

I will describe the other two topics in a short time (mrugnięcie)

Automate suggestions in your command line!

Intro

Hi all, today I would like to say something about automation of work. I use cmder as my standard command line. I would like to focus today on clink integration. It is the very powerful tool, which allows you among other things to add your code completions. And this post will be devoted to that. Because in my current work I use vagrant. I lacked very many suggestions of provisions and snapshots syntax support. There is some support for vagrant suggestions, but this stuff wasn’t implemented. So I started investigating and added it 😉


Lua – extend your clink in cmder

During my beginning of investigation how it is working. I found this directory:

{your_path}\Cmder\vendor\clink-completions

And I found repository related to clink-completions where I’ve contributed. So as you can see the language used for code-completion is Lua. Lua is functional and scripting language. Probably the reason why this language is chosen is that  clink already uses Lua to parse the commands:

To implement straightforward map write something like that:

To run your new system suggestion just open a new command line and start typing chris1 and press tab

Printed suggestions.

If you want to check graph of your parser just invoke command below:

chris_parser:dump()

Then on the new command line, it will show you a graph of your abstract syntax tree like this:

Everything is easy when you need to provide just simple map. But what if you need to do something more complicated?

The answer is: declare function which returns collection of strings. The order of code matters. So to use function which you would like to use you need to define it first.

So to provide some custom functionallity you need to use function and then you can use all of good of Lua language. Additionaly, you have also modules in module directory:

{your_path}\Cmder\vendor\clink-completions\modules

which you can load to your scripts.

When lua scripts are loaded in cmder?

Lua scripts of code-completion in cmder are loaded at each time when open new console.

If you consider file `.init.lua` in code-completion folder you will notice that every file with lua extension is taken into consider when your clink/cmder is running.

Vagrant addendum

If you go to my github you can see that I’ve contributed to clink-completions and I added two things:

  1. Snapshots
  2. Suggest name of provisions

I did it in 3 Pull Requests:

First pull request where I did the most of stuff. The main mechanism is like this:

  • Find Vagrantfile – mostly analogous as finding .git folder in git suggestions
  • Find matching regex
  • Return matches as collection for parser

Enhance regex for provision names

Bug fix of unclosed file

References

Microsoft Bot Framework

Introduction

Hi, as I said in my previous post I would like to describe here my experience from conferences. So let’s start!
I was the most amazed on DDD north by Become a chatbot builder with Microsoft Bot Framework presented by James Mann. I was surprised how fast you can create exact intelligent chatbot. The funniest thing was that I didn’t know which talk I should choose in that slot and I decided to go to it by deduction.

Microsoft Bot Framework

So Microsoft Bot Framework is a framework which integrates Bot service hosted on Microsoft Azure with the most known channels like slack, messenger, skype, etc.
The first thing to start coding is to go to the URL:
  1. Download template for VS – it will allow you create project in that framework with all dependencies in nugget (SDK Bot Framework)
  2. Download the emulator (for testing purposes)
The primary purpose of this framework is to integrate all these channels. As self, it hasn’t got inbuild AI framework, but you can integrate it with other services from Microsoft Core Services. It provides you with an ASP.NET controller with methods where you can process text input and return your answer.
There exist three techniques in that framework which you can use
  1. Question and Answers – for some specific text you return a particular answer.
  2. Dialog – it gives you a possibility of context in conversation. So you can ask for some details and fill the form and do some computation depend on it.
  3. FormFlows – it gives you a window with suggesting questions.
It is your responsibility for providing interpretation and prevent typos by users. The framework as self just gives you an opportunity to process messages in particular channel.

So how to make intelligent things?

James showed two tools from Microsoft Cognitive Service
It provides you with a ready solution to create an intelligent model based on your FAQ. You can feed your model with FAQ link, file or manually. Even though after feeding your model with data, you still can train your model with specific questions and choose what is the best answer. So in the end, end-user can make typos, differently expressed queries than initially and still he will get a proper answer from your chatbot.
When you publish your service, you will get all necessary info to feed your Microsoft Bot Framework. You need to just add a QnAMakerService attribute in your dialogue.
This service is free for preview purposes, and it allows you to do 10 transactions per minuter, up to 10 000 transactions per month.
So I’ve tested this website, and I fed my model from FAQ of Redgate about product. You can try it here:
> Note that bot sometimes needs more time to answer for the first connection. Please be patient, or I said earlier keep in mind that a number of transaction for the free preview can be used.
2) Luis.ai – it is a service to interpret natural human language. It uses two concepts to understand language:
  • intent
  • entity
The entity is the generic placeholder for value. The intent is expression/utterance where you express sentence using entity placeholder. Luis will try to fit user utterance to existing data and returns these intents and entities with a probability of understanding the sentence. To understand more check prebuild domains or check https://www.luis.ai/welcome
Currently, (16/10/2017) Luis supports following languages: Brazilian Portuguese, Chinese, Dutch, English, French, French Canadian, German, Italian, Japanese, Korean, Spanish, Spanish Mexican.

How to create Azure account

References