In my last post I announced a challenge: the first pull request on my TicTacToe for AL GitHub repository that contains a properly written event handler with “AI” that either beats the human player or ends in a draw gets a special reward. Honestly, I didn’t expect to see any submissions there, because NAV community is not too GitHub savvy. I rarely get any hands up in the air when in my sessions or workshops I ask who uses GitHub. But, three forks arrived soon and one submission quickly followed. It provides a clean and working solution that properly applies the handler pattern and never loses a game.
And, the winner is: Bartel de Leeuw!
Bartel has provided a good solution that satisfies all of the criteria: it never loses a game, it wins if given a chance by the human player, and it properly handles the handler pattern, thus providing a loosely bound AI algorithm for the game. I kept good on my promise too, so Bartel has got a standing ovation from my family (all the audience I had available at the time, and they did give me a strange look at first before they joined me in cheering and applauding), and here’s a public acknowledgement on my blog. I’ll also always use his solution and mention him when presenting control add-ins demos, or NAV event-driven architectures.
That’s it, now back to serious stuff.
The post TicTacToe challenge winner announcement appeared first on Vjeko.com.
As a part of preparation for my last event of this year that concludes the conference season 2017 for me, I played around with the latest addition to the AL language stack for VS Code: control add-ins.
If you haven’t already tried it out, or heard about it, then you should get yourself a copy of NAV developer preview, and then visit the Control Add-In Object documentation for AL on MSDN to learn a little bit about how it works. The demo provided over there is, well, basic, to say the least, so I prepared two demos.
The first part is the Google Maps demo which you get as an end result of completing my 1.5 hour hands-on workshop about controladdin object type. I hope you understand why I can’t provide the hands-on materials online, but the end product is something different. It’s available on my GitHub, under the https://github.com/vjekob/controladdin1 repo. It has two branches: master branch is the end-result of the Exercise A and B of the workshop, and ExerciseC branch is the final end result. The direct link is here: https://github.com/vjekob/controladdin1/tree/ExerciseC
This control add-in is fairly simple, it shows the Google map for the customer address which updates as you navigate the customer records in the customer card, and when you click on a valid address on the map, it can update the customer address on record in the NAV database.
This demo showcases the following features:
The second demo is a simple Tic Tac Toe game for your NAV where the control add-in takes care of the presentation, and the actual “AI” logic is implemented in AL. In essence, you are literally playing it against NAV You can find the repo on this URL: https://github.com/vjekob/TicTacToeAL
This repo has a number of branches, corresponding to different stages of my demo during the workshop delivery, and you should in fact only be concerned with the master branch which contains the final bits.
The AI logic I implemented in AL is in fact stupid – it plays random moves, and it actually takes effort to lose to it. However, it applies the event-driven architecture based on the handler pattern. If you are not familiar with the pattern, it’s one of rare official Microsoft’s NAV patterns that’s not described in the NAV Design Patterns Wiki. Mark Brummel was first do publicly describe it on his blog at https://nav-skills.com/2015/11/25/the-handled-pattern/. While I find this pattern a bit clumsy, it’s the best thing we have for true loose coupling in AL. So, back on track, the AI logic uses this pattern to allow you to provide your own AI Tic Tac Toe algorithms to handle the logic simply by subscribing to OnGetAIMove event and providing the move information.
And – as always – see you in the cloud!
The post A couple of AL controladdin demos – Google Maps and Tic Tac Toe appeared first on Vjeko.com.
Another NAV TechDays are behind us, and as always, this one was a blast, too. So many people, so much enthusiasm, such great energy and positive vibe, no wonder Luc fills up the conference to the last seat every year.
Last year it took me nearly a month and a half to find time to sort my materials and publish them on my blog, and I won’t let that happen again. So, while waiting for my flight back to Zagreb, I decided to be productive, rather than just get lost in something on my Kindle, so here it is.
I won’t be publishing the slide-deck directly, as Luc will soon publish both the slide deck, and the session recordings on Mibuso and YouTube, so you’ll be able to get your hands on that part. What I am publishing, though, should be quite enough for you to get your hands on my Azure Functions demos:
After the session completed, Waldo told me that the one thing he learned from me in this session was: “trust me, it works” Apparently, he was a good pupil, because he used the line as many times in his session, as I did in mine Well, admittedly, I said it too many times during the session (once being already too many, and I believe I’ve used the line three times in total). Well, what else should I have said, when things that do work just don’t happen to work in front of the big audience. While I do hope you learned more than that line from the entire 90-minute session, here’s what went wrong.
My first hunch was that what went wrong was Docker. Perhaps NST, running from within its Docker container, couldn’t talk to a port opened locally, but that couldn’t have been the case because when I attempted to access my local Azure Function through Chrome, everything still seemed stuck. So, the culprit was something else.
Then I got a hint from my friend Bart, who said that the problem – in fact – was that I had an active selection in the command prompt window started by the Azure Function local demo environment. Apparently, if you select anything in the command prompt window in which the local Azure demo environment runs, all threads hang, until the selection is taken away. I have just tested that claim and can confirm it – when there is no active selection, everything works fine, but as soon as you select anything, everything stops.
Now, I did select in that window, because I was copying the function URL out of the window, but the selection must have gone away the moment I pressed Enter. However, I managed to repeat the problem just now by simply clicking in the window once, which selected a single character in there, and likewise made the Azure demo environment to stop responding. A stupid glitch to ruin a perfectly working demo. So – trust me, it works!
Another thing I failed to show because of the lack of time was that after the update by Git continuous integration, the function has truly changed its behavior. Well, you can verify it yourself at any given point of time, because I have decided to leave all my Azure Functions out there for you folks to play around and try out. While there is certainly not much value in it, you can access them if you want to benchmark the performance of your network towards a specific Azure data center, so here are the endpoints:
I will keep those endpoints alive for as long as nobody here decides to take a revenge on me and writes a script that causes any of these to actually cost me any money. So, gentlemen, and gentlegirls, please behave
For some other demos I was showing, Azure Portal was just painfully slow, and it still is today while I am writing this post, and there was nothing I could do about it. When you are demoing Azure while using Azure Portal, you must count on it not being the fastest thing in the world. Still, I hope you managed to get the gist of it all and learned about how good, and useful, and – above all – how easy to use Azure Functions really are. Good luck with Azure Functions, and – trust me – they work!
The post Trust me – it works! NAV TechDays 2017 Wrap-up appeared first on Vjeko.com.
The “Invoking Azure Functions from AL using Visual Studio Code” webinar is over, and it was a pleasure delivering it for you, folks. There were 350+ people registered for it, and over 200+ people attended it. With those kinds of stats, who wouldn’t want to deliver more of these?
So, I can promise to prepare a couple of more Azure Functions from AL seminars, covering different kinds of topics, including handling binary data, XML, advanced JSON, and similar. Stay tuned.
In the meanwhile, if you didn’t have a chance to watch the session today in prime time, you can access it on YouTube: https://www.youtube.com/watch?v=Wp13-nfVoEg&feature=youtu.be
Thanks to Mark and folks at NAV-Skills and Liberty Grove for making this possible.
The post Invoking Azure Functions from AL recording available appeared first on Vjeko.com.
Long time, no see, eh? Life and work sometimes kick in and that’s exactly what they did to me recently. I am not complaining, but I would have been happier, too, if I had been more active here.
Now that I am, in fact, here, let me announce the Invoking Azure Functions from AL in Visual Studio Code webinar that I will deliver next Tuesday, August 29, at 16:00, Central European Time.
This webinar, which is organized in cooperation with NAV-Skills, will cover the theory I scratched in my last blog post here, but will cover some more stuff. On top of a little more substance and structure than covered in my blog, it will also give you an opportunity to ask questions and make fun of me in front of an audience. Last opportunity for this before Directions US
So, grab your seat by registering here. It’s free, but even if it wasn’t, you should still be there. Don’t let me find you absent, you are not excused!
See you in the cloud!
The post Webinar: Invoking Azure Functions from AL in Visual Studio Code appeared first on Vjeko.com.