Posts

Showing posts from August, 2017

Azure Bot Framework: using URL to send poactivate message (Node.js)

Firstly create a chatbot using Azure Bot framework and then deploy to github and web app (Refer to this article https://github.com/fuselabs/echobot ). Using the function to send poactivate message based on this sample https://github.com/Microsoft/BotBuilder-Samples/blob/master/Node/core-proactiveMessages/simpleSendMessage/index.js Note: the function "sendProactiveMessage" must placed before the "server.get"code.  function sendProactiveMessage(address) {   var msg = new builder.Message().address(address);   msg.text('Hello, this is a notification triggered by url');   msg.textLocale('en-US');   bot.send(msg); } server.get('/api/custom', function(req, res, next) {   sendProactiveMessage(savedAddress);   res.send('home: ')   return next(); });  Before using above web app,  I used the Azure bot service to create a bot and then modified the code to add poactivate function. However, it didn't work and so I changed to use Azure...

T-SQL: Conver null or empty string to numeric value

I tried to use sum for a "varchar" type column in SQL table, and one day the code has error as there is a line contains empty value in this column and so the sum() function not working anymore. So I add following function NULLIF (<clumn>,0) The whole sum function is as below: sum(CAST(NULLIF(AMOUNT,0) AS DECIMAL(22,2))) Now I can get the sum amount value successfully.