Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon

Tech News - Server-Side Web Development

85 Articles
article-image-blazor-0-5-0-is-now-available
Natasha Mathur
28 Jul 2018
3 min read
Save for later

Blazor 0.5.0 is now available!

Natasha Mathur
28 Jul 2018
3 min read
Blazor 0.5.0 is here. Blazor is an experimental .NET client-side web framework that uses c# and HTML. It runs on a browser using WebAssembly mechanism. Here component logic and DOM interactions occur in the same process. The latest release includes features such as server-side Blazor, a new startup model, and early support for in-browser debugging among other updates. Let’s discuss the highlights of Blazor 0.5.0 release. Server-side Blazor Blazor 0.5.0 release makes it possible to adopt the out-of-process model for Blazor by stretching it over a network connection so that you can run Blazor on the server with ease. With Blazor 0.5.0 it is possible to run your Blazor components server-side on .NET Core. UI updates, event handling, and JavaScript interop calls get handled over a SignalR connection. You can also use JavaScript interop libraries while using server-side Blazor. New Startup Model Blazor 0.5.0 projects now make use of a new startup model, similar to the startup model in ASP.NET Core. To configure the services for your Blazor app, each Blazor project consists of a Startup class with a ConfigureServices method. There’s also a Configure method for configuring the root components of the application. Calling .NET from JavaScript There’s a new feature added in Blazor 0.5.0 which lets you call .NET instance methods from JavaScript. You can do it by passing the .NET instance to JavaScript and wrapping it in a DotNetObjectRef instance. The .NET instance then gets passed by reference to JavaScript. This allows you to invoke .NET instance methods on the instance by using the invokeMethod or invokeMethodAsync functions. Adding Blazor to HTML file In earlier releases, the project build had modified index.html in order to replace the blazor-boot script tag with a real script tag.  This made it difficult to use Blazor in arbitrary HTML files. This mechanism has now been replaced in Blazor 0.5.0. You can add a script tag for client-side projects that references the _framework/blazor.webassembly.js script (which is generated as part of the build). You can add the script reference _framework/blazor.server.js. for server-side projects. Support for in-browser debugging Blazor 0.5.0 provides very basic debugging support in Chrome for client-side Blazor apps that run on WebAssembly. Despite the debugging support being limited and unpolished, it does show the basic debugging infrastructure. For more info on Blazor 0.5.0 updates, check out the official release notes. Masonite 2.0 released, a Python web development framework Node 10.0.0 released, packed with exciting new features  
Read more
  • 0
  • 1
  • 2183

article-image-tornado-5-1-releases-simple-quick-python-web-server
Pavan Ramchandani
19 Jul 2018
2 min read
Save for later

Tornado 5.1 releases: Simple & Quick Python web server

Pavan Ramchandani
19 Jul 2018
2 min read
Tornado recently announced the release of version 5.1 and dropped the plans for a major release of Tornado 6.0. Tornado is a Python-based web framework and consists of asynchronous networking libraries for complete web development in Python. It is known for its ability to scale a huge number of connections on the web and is considered ideal for the applications that require uninterrupted connectivity on the web. Features included in Tornado 5.1 Improvement in the command-line wrapper. It will no longer clash with the active processes on Windows. New module to support non-ASCII characters in username and password Consistent behavior of the client-server modules like simple_httpclient and curl_httpclient Improved compatibility with GNU Hurd Improved WebSocket modules to protect against DoS attacks Preparation for Tornado 6.0 Tornado 6.0 will drop the support for Python versions 2.7 and 3.4 while making Python 3.5.2 as the minimum supported version. To make sure systems running on older Python versions do not break, the deprecation warnings are emitted. In order to receive the deprecation warnings, you need to run -wd argument or set the environment variable for your Python ecosystem. Also, Tornado maintainers have informed that the applications running on Python 3, which do not receive the deprecation warning will be able to move to Tornado 6.0 without breaking. To avoid the risk of errors that are introduced due to the connection leak, the ExceptionStackContext module will be removed from Tornado 6.0. Tornado 6.0 will remove obsolete packages to make a lean standard framework. For example, the Stack context module will be removed as it will stand obsolete after the introduction to co-routines. To learn more about the deprecated features in Tornado 5.1 and in-depth feature notice, you can check out the release notes page of Tornado 5.1. Read more Masonite 2.0 released, a Python web development framework Python web development: Django vs Flask in 2018 Python founder resigns – Guido van Rossum goes ‘on a permanent vacation from being BDFL’
Read more
  • 0
  • 0
  • 2835

article-image-deploying-node-js-apps-on-google-app-engine-is-now-easy
Kunal Chaudhari
22 Jun 2018
3 min read
Save for later

Deploying Node.js apps on Google App Engine is now easy

Kunal Chaudhari
22 Jun 2018
3 min read
Starting from this month Google App Engine will allow web developers to deploy Node.js web applications to its standard environment. The App Engine standard environment is nothing but container instances running on Google's infrastructure. These containers previously supported runtimes in Java 7, Java 8, Python 2.7, Go and PHP. Node.js 8 is the new addition to this long list of environments. Developers who always wanted a ready and quick platform to build web applications on Cloud scale with a very low cost to start or wanted to get rid of the burden of managing and provisioning infrastructure have found that Google App Engine is a very good choice. It has been a developer’s favorite due to its zero-config deployments, zero server management, and auto-scaling capabilities. This move from Google brings in numerous advantages such as fast deployments and automatic scaling, better developing experience, and reliable security features. Fast Deployment and Automatic scaling The app Engine standard environment is known for it’s shorter deployment time. A basic Express.js application can be deployed under a minute with the standard environment. Not only that but App Engine allows the apps to automatically scale based on the incoming traffic to that application. For example, App Engine automatically scales to zero when there is no request made for that particular application. This allows developers to implement cost-effective measures while developing or deploying their applications. Enhanced Developer Experience Google has always been striving to provide a smoother developer experience with all its products. That’s also true for this new improvement to the App Engine. The new Node.js runtime comes with no language or API restrictions. This allows developers to choose npm modules of their choice. Along with this, App Engine also provides application logs and key performance indicators in Stackdriver, which takes care of Monitoring, logging, and diagnostics for applications on the Google Cloud Platform. Reliable Security: Updating the operating system or Node.js for any major or minor versions is a tedious task. App Engine takes care of all this by automatically handling all the updates required for your application to work smoothly with all the latest features. Not only that but App Engine’s automated one-click certificate generation allows developers to serve their application under a secure HTTPS URL with their own custom domain. The relationship between Node.js and Google goes a long way beyond GCP as Node.js runs on V8, Google's open source high-performance JavaScript engine. This recent collaboration between Node.js and Google also comes with better crafted node.js libraries that allow developers to use GCP products within their node.js applications. To try out all these new features on the App Engine you can visit their official website. Building chat application with Kotlin using Node.js, the powerful Server-side JavaScript platform Node 10.0.0 released, packed with exciting new features How to deploy a Node.js application to the web using Heroku
Read more
  • 0
  • 0
  • 4014
Banner background image
Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at $19.99/month. Cancel anytime
article-image-masonite-2-0-released-a-python-web-development-framework
Sugandha Lahoti
18 Jun 2018
2 min read
Save for later

Masonite 2.0 released, a Python web development framework

Sugandha Lahoti
18 Jun 2018
2 min read
Masonite, the popular Python web development framework, has released a new version. Masonite 2.0 comes with several new features to Masonite including new status codes, database seeding, built in cron scheduling, controller constructor resolving, speed improvements and much more. A new ‘Tinker’ Command Masonite 2.0 adds a new Tinker command that starts a Python shell and imports the container. It works as a great debugging tool and can be used for verifying that objects are loaded into the container correctly. A new Task Scheduler Masonite 2.0 adds a task scheduler,  a new default package that allows scheduling recurring tasks. You can read about the Masonite Scheduler under the Task Scheduling documentation. Automatic Server Reloading A huge update to Masonite is the new --reload flag on the serve command. Now the server will automatically restart when it detects a file change. You can use the -r flag as a shorthand. Autoloading With the new autoloading feature, you can list directories in the AUTOLOAD constant in the config/application.py file and it will automatically load all classes into the container. Autoloading is great for loading command and models into the container when the server starts up. Database Seeding Support Masonite 2.0 adds the ability to seed the database with dummy data. Seeding the database helps in populating the database with data that would be needed for future development. Explicitly Imported Providers Providers are now explicitly imported at the top of the file and added to the PROVIDERS list, located in config/providers.py. This completely removes the need for string providers and boosts the performance of the application substantially. Status Code Provider Masonite 2 removes the bland error codes such as 404 and 500 errors and replaces them with a cleaner view. It also allows adding of custom error pages. Upgrading from Masonite 1.6 to Masonite 2.0 Masonite 1.6 to Masonite 2.0 has quite a large number of changes and updates in a single release. However, upgrading takes only around 30 mins for an average sized project. Read the Masonite upgrade guide for a step-by-step guide to upgrading. You can read the release notes, for the full list of features. Python web development: Django vs Flask in 2018 What the Python Software Foundation & Jetbrains 2017 Python Developer Survey had to reveal Should you move to Python 3? 7 Python experts’ opinions
Read more
  • 0
  • 0
  • 4392

article-image-jest-23-facebooks-popular-framework-for-testing-react-applications-is-now-released
Sugandha Lahoti
05 Jun 2018
3 min read
Save for later

Jest 23, Facebook’s popular framework for testing React applications is now released

Sugandha Lahoti
05 Jun 2018
3 min read
A new version of Jest, the popular framework for testing React applications is now available. Jest is developed by Facebook and can be used for testing JavaScript functions, but is specifically aimed at React. Jest is a zero configuration testing platform with features such as snapshot testing, parallelized test runs, built-in code coverage reports, and instant feedback. Jest 23 features major updates. Here are the top ones. Babel and Webpack join the Jest community Webpack saw their total test suite time reduced 6x from over 13 minutes to 2 minutes 20 seconds, after converting from Mocha to Jest 23 Beta. Interactive Snapshot Mode The newly incorporated Interactive snapshot mode, is added as a default watch menu option. With this new mode, testers can browse through each failing snapshot in each failing suite, and review, update or skip each failed snapshots individually. Snapshot Property Matchers Jest now has Snapshot property matchers through which testers can pass properties to the snapshot matcher which specify the structure of the data instead of the specific values. These property matchers are then verified before serializing the matcher type to provide consistent snapshot results across multiple test runs. Jest Each Jest 23 features a new jest-each library inspired by mocha-each and Spock Data Tables. This library defines a table of test cases, and then runs a test for each row with the specified column values. Support is provided for both array types and template literals for all flavors of describe and test. Watch Mode Plugins The watch mode system now allows adding of custom plugins to watch mode. These watch mode plugins can hook into Jest events and provide custom menu options in the watch mode menu. Other changes include: Test descriptions and functions are a mandate. Jest 23 will fail tests that do not include both a function and a description. Undefined props from React snapshots are now removed. MapCoverage, jest.genMockFunction and jest.genMockFn are deprecated. Snapshot name (if provided) is now added to the snapshot failure message so it's easier to find the snapshot that's failing. Mock timestamps are replaced with invocationCallOrder since two or more mocks may often have the same timestamp, making it impossible to test the call order. Mock function call results are added to snapshots so that both the calls and the results of the invocation are tracked. For the complete list of changes and updates, see the changelog. Testing Single Page Applications (SPAs) using Vue.js developer tools What is React.js and how does it work? How to test node applications using Mocha framework
Read more
  • 0
  • 0
  • 3655

article-image-whats-new-in-vapor-3-the-popular-swift-based-web-framework
Sugandha Lahoti
08 May 2018
3 min read
Save for later

What’s new in Vapor 3, the popular Swift based web framework

Sugandha Lahoti
08 May 2018
3 min read
Vapor, the popular web framework written in Swift has released its next major update. Vapor 3 is a complete rewrite of the existing versions and all of its related packages. The release is centered around three new features. Async: Vapor 3 is all ready to handle high levels of concurrency as it is completely non-blocking and runs on Apple’s SwiftNIO. Services: With Vapor’s new Dependency Injection framework Services, all JSON configuration files are replaced by Swift. Codable: Codable integration throughout all of Vapor brings type safety and better performance to Parsing and serializing content from HTTP messages, creating database models, and rendering views. The main focus of this release is on building a foundation for developers to work on based on the growth of Vapor and server-side Swift over the past two years. The release is updated across four major categories. Packages Vapor 3 offers a couple of new packages this release. Most notable are the MySQL and PostgreSQL packages which are now non-blocking and built on SwiftNIO. Some of these packages include: SQLite: SQLite 3 wrapper for Swift. PostgreSQL: Non-blocking, event-driven Swift client for PostgreSQL. MySQL: Pure Swift MySQL client built on non-blocking, event-driven sockets. Fluent: Swift ORM framework (queries, models, and relations) for building NoSQL and SQL database integrations. FluentSQLite: Swift ORM (queries, models, relations, etc) built on SQLite 3. Auth: Authentication and Authorization layer for Fluent. JWT: JSON Web Token signing and verification. Leaf: An expressive, performant, and extensible templating language built for Swift. A complete list of packages is available in the vapor documentation. Better updated Documentation A large part of the release focuses on better documentation. Subsequently, Vapor 3 improves API docs with 100% docblock coverage including: Helpful code samples where possible. Method parameter descriptions. MARK and code re-org to help make things readable in API doc form. Also, the main docs are moving more toward a guide / tutorial feel. These guide docs cover broad use cases and practices, in contrast to the API docs which heavily focus on particular methods and protocols. Moving to Discord and introducing Books Vapor’s official team chat is now moved to Discord. The team has also announced two books (Server Side Swift with Vapor and Server-side Swift (Vapor Edition)) written specifically for Vapor 3. Benchmarks Vapor 3 introduces certain benchmarks for this release available on GitHub. The benchmarks were run on two identical Digital Ocean droplets. One for hosting the frameworks and one for running the benchmark. The benchmarker program is a small script written in Swift that runs wrk and captures the results. It is capable of doing multiple runs and averaging the results. Vapor achieved state-of-the-art results on both the plaintext benchmarks. To know further updates and other minor changes, be sure to Check out the updated website. Your First Swift Program [tutorial] Swift for TensorFlow is now open source [news] RxSwift Part 1: Where to Start? Beginning with Hot and Cold Observables [tutorial]
Read more
  • 0
  • 0
  • 4215
article-image-node-10-0-0-released-packed-with-exciting-new-features
Kunal Chaudhari
30 Apr 2018
4 min read
Save for later

Node 10.0.0 released, packed with exciting new features

Kunal Chaudhari
30 Apr 2018
4 min read
Node.js 10.0.0 released, packed with exciting new features, it will be the next candidate in line for the Long Term Support (LTS) in October 2018. So what exactly is an LTS and why is the Node.js foundation releasing a major version every six months?   Node.js History and the Significance of LTS When Ryan Dhal first created Node.js, he decided to follow Linux kernel style odd/even version releases. Odd version releases represented internal development with no guarantee for stable releases, whereas even releases guaranteed stability. But this release scheme didn’t last long, as version 0.12 represented the last release under that versioning scheme. Later in 2015, Node.js 4.0 was announced, dubbed famously as the “Converged Release”. This meant that both io.js and Node.js projects under the Node foundation were merged together, providing a unified release plan for all Node products. In order to attract more enterprise users and to provide more stability to the platform, the Node foundation announced the “Long Term Support” strategy. The plan was simple, every six months a major version of the platform will be released which would follow semantic versioning. The even releases would be scheduled in April while the odd ones would come out in October and every even-numbered release will automatically become a candidate for the LTS. Long Term Support release lines focus on stability, extended support and provide a reliable platform for applications of any scale. Most Node.js users and companies prefer to use the Long Term Support releases. A candidate covered in the LTS plan is actively maintained for a period of 18 months from the date it enters LTS coverage. Following those 18 months of active support, they transition into "maintenance" mode for 12 additional months. To read more about the LTS release plan and schedule visit the official Node.js Foundation Release Working Group page. Source: Node.js Foundation Release Working Group Node.js 10 features Codenamed “Dubnium” Node.js 10.x comes with plenty of new features like OpenSSL 1.1.0 security toolkit, upgraded npm, N-API, and much more. Let’s take a closer look at each one of them. N-API and Native Node HTTP/2 becomes stable N-API, an abbreviation for Native API is used for building native addon, while Native HTTP/2 is module that improves the standard HTTP protocol. Both these features were first announced as experimental projects in Node.js 8 release and now have been confirmed as stable features in the 10.x release. N-API aims to solve two main problems namely, reducing the maintenance cost for native modules and reducing difficulties in upgrading Node.js versions in production deployments for users. The native HTTP/2 module will help improve Node servers and the web experience that they provide. Upgraded npm npm has recently been upgraded from v5.7 to v6.0, while Node.js 10 ships with npm 5.7, the 10.x line will be upgraded to npm Version 6 later on. This major version increase in npm provides improvements in all areas including performance, security, and stability. OpenSSL Version 1.1.0 With the recent finalization of the TLS 1.3 specification, a huge step forward for the security of the web, OpenSSL release their newest version of the security toolkit which supports this TLS specification. It didn’t take long for Node.js to start supporting OpenSSL, since it would provide more secure communication between applications on the Node platform. While Node is just supporting OpenSSL version 1.1.0 in this latest release, it plans to upgrade it in the future versions of the 10.x release, bringing the brand new TLS support for the developers.   What to expect in the future releases Plenty of exciting features like better support for the ECMAScript (ES) modules, JavaScript Promises, new infrastructure for build/automation support, and functional testing for third party modules are in line for the next releases. Node 10 will remain in LTS from October 2018 until April 2021. This LTS release will also mark the deprecation of Node.js 4. While the features released so far are already very impressive, the Node team remains adamant on bringing even more cutting edge technology to the platform, making the life of developers easier. To get a more detailed description of the new features or to download the latest version of Node.js, please visit their official web page. How is Node.js Changing Web Development? How to deploy a Node.js application to the web using Heroku
Read more
  • 0
  • 0
  • 3849

article-image-build-achatbot-with-microsoft-bot-framework
Kunal Chaudhari
27 Apr 2018
8 min read
Save for later

How to build a chatbot with Microsoft Bot framework

Kunal Chaudhari
27 Apr 2018
8 min read
The Microsoft Bot Framework is an increbible tool from Microsoft. It makes building chatbots easier and more accessible than ever. That means you can build awesome conversational chatbots for a range of platforms, including Facebook and Slack. In this tutorial, you'll learn how to build an FAQ chatbot using Microsoft Bot Framework and ASP.NET Core. This tutorial has been taken from .NET Core 2.0 By Example. Let's get started. You're chatbot that can respond to simple queries such as: How are you? Hello! Bye! This should provide a good foundation for you to go further and build more complex chatbots with the Microsoft Bot Framework, The more you train the Bot and the more questions you put in its knowledge base, the better it will be. If you're a UK based public sector organisation then ICS AI offer conversational AI solutions built to your needs. Their Microsoft based infrastructure runs chatbots augmented with AI to better serve general public enquiries. Build a basic FAQ Chabot with Microsoft Bot Framework First of all, we need to create a page that can be accessed anonymously, as this is frequently asked questions (FAQ ), and hence the user should not be required to be logged in to the system to access this page. To do so, let's create a new controller called FaqController in our LetsChat.csproj. It will be a very simple class with just one action called Index, which will display the FAQ page. The code is as follows: [AllowAnonymous] public class FaqController : Controller { // GET: Faq public ActionResult Index() { return this.View(); } } Notice that we have used the [AllowAnonymous] attribute, so that this controller can be accessed even if the user is not logged in. The corresponding .cshtml is also very simple. In the solution explorer, right-click on the Views folder under the LetsChat project and create a folder named Faq and then add an Index.cshtml file in that folder. The markup of the Index.cshtml would look like this: @{ ViewData["Title"] = "Let's Chat"; ViewData["UserName"] = "Guest"; if(User.Identity.IsAuthenticated) { ViewData["UserName"] = User.Identity.Name; } } <h1> Hello @ViewData["UserName"]! Welcome to FAQ page of Let's Chat </h1> <br /> Nothing much here apart from the welcome message. The message displays the username if the user is authenticated, else it displays Guest. Now, we need to integrate the Chatbot stuff on this page. To do so, let's browse http://qnamaker.ai. This is Microsoft's QnA (as in questions and answers) maker site which a free, easy-to-use, REST API and web-based service that trains artificial intelligence (AI) to respond to user questions in a more natural, conversational way. Compatible across development platforms, hosting services, and channels, QnA Maker is the only question and answer service with a graphical user interface—meaning you don’t need to be a developer to train, manage, and use it for a wide range of solutions. And that is what makes it incredibly easy to use. You would need to log in to this site with your Microsoft account (@microsoft/@live/@outlook). If you don't have one, you should create one and log in. On the very first login, the site would display a dialog seeking permission to access your email address and profile information. Click Yes and grant permission: You would then be presented with the service terms. Accept that as well. Then navigate to the Create New Service tab. A form will appear as shown here: The form is easy to fill in and provides the option to extract the question/answer pairs from a site or .tsv, .docx, .pdf, and .xlsx files. We don't have questions handy and so we will type them; so do not bother about these fields. Just enter the service name and click the Create button. The service should be created successfully and the knowledge base screen should be displayed. We will enter probable questions and answers in this knowledge base. If the user types a question that resembles the question in the knowledge base, it will respond with the answer in the knowledge base. Hence, the more questions and answers we type, the better it will perform. So, enter all the questions and answers that you wish to enter, test it in the local Chatbot setup, and, once you are happy with it, click on Publish. This would publish the knowledge bank and share the sample URL to make the HTTP request. Note it down in a notepad. It contains the knowledge base identifier guide, hostname, and subscription key. With this, our questions and answers are ready and deployed. We need to display a chat interface, pass the user-entered text to this service, and display the response from this service to the user in the chat user interface. To do so, we will make use of the Microsoft Bot Builder SDK for .NET and follow these steps: Download the Bot Application project template from http://aka.ms/bf-bc-vstemplate. Download the Bot Controller item template from http://aka.ms/bf-bc-vscontrollertemplate. Download the Bot Dialog item template from http://aka.ms/bf-bc-vsdialogtemplate. Next, identify the project template and item template directory for Visual Studio 2017. The project template directory is located at %USERPROFILE%DocumentsVisual Studio 2017TemplatesProjectTemplatesVisual C# and the item template directory is located at %USERPROFILE%DocumentsVisual Studio 2017TemplatesItemTemplatesVisual C#. Copy the Bot Application project template to the project template directory. Copy the Bot Controller ZIP and Bot Dialog ZIP to the item template directory. In the solution explorer of the LetsChat project, right-click on the solution and add a new project. Under Visual C#, we should now start seeing a Bot Application template as shown here: Name the project FaqBot and click OK. A new project will be created in the solution, which looks similar to the MVC project template. Build the project, so that all the dependencies are resolved and packages are restored. If you run the project, it is already a working Bot, which can be tested by the Microsoft Bot Framework emulator. Download the BotFramework-Emulator setup executable from https://github.com/Microsoft/BotFramework-Emulator/releases/. Let's run the Bot project by hitting F5. It will display a page pointing to the default URL of http://localhost:3979. Now, open the Bot framework emulator and navigate to the preceding URL and append api/messages; to it, that is, browse to http://localhost:3979/api/messages and click Connect. On successful connection to the Bot, a chat-like interface will be displayed in which you can type the message. The following screenshot displays this step:   We have a working bot in place which just returns the text along with its length. We need to modify this bot, to pass the user input to our QnA Maker service and display the response returned from our service. To do so, we will need to check the code of MessagesController in the Controllers folder. We notice that it has just one method called Post, which checks the activity type, does specific processing for the activity type, creates a response, and returns it. The calculation happens in the Dialogs.RootDialog class, which is where we need to make the modification to wire up our QnA service. The modified code is shown here: private static string knowledgeBaseId = ConfigurationManager.AppSettings["KnowledgeBaseId"]; //// Knowledge base id of QnA Service. private static string qnamakerSubscriptionKey = ConfigurationManager.AppSettings["SubscriptionKey"]; ////Subscription key. private static string hostUrl = ConfigurationManager.AppSettings["HostUrl"]; private async Task MessageReceivedAsync(IDialogContext context, IAwaitable<object> result) { var activity = await result as Activity; // return our reply to the user await context.PostAsync(this.GetAnswerFromService(activity.Text)); context.Wait(MessageReceivedAsync); } private string GetAnswerFromService(string inputText) { //// Build the QnA Service URI Uri qnamakerUriBase = new Uri(hostUrl); var builder = new UriBuilder($"{qnamakerUriBase}/knowledgebases /{knowledgeBaseId}/generateAnswer"); var postBody = $"{{"question": "{inputText}"}}"; //Add the subscription key header using (WebClient client = new WebClient()) { client.Headers.Add("Ocp-Apim-Subscription-Key", qnamakerSubscriptionKey); client.Headers.Add("Content-Type", "application/json"); try { var response = client.UploadString(builder.Uri, postBody); var json = JsonConvert.DeserializeObject<QnAResult> (response); return json?.answers?.FirstOrDefault().answer; } catch (Exception ex) { return ex.Message; } } } The code is pretty straightforward. First, we add the QnA Maker service subscription key, host URL, and knowledge base ID in the appSettings section of Web.config. Next, we read these app settings into static variables so that they are available always. Next, we modify the MessageReceivedAsync method of the dialog to pass the user input to the QnA service and return the response of the service back to the user. The QnAResult class can be seen from the source code. This can be tested in the emulator by typing in any of the questions that we have stored in our knowledge base, and we will get the appropriate response, as shown next: Our simple FAQ bot using the Microsoft Bot Framework and ASP.NET Core 2.0 is now ready! Read more about building chatbots: How to build a basic server side chatbot using Go
Read more
  • 0
  • 1
  • 11366

article-image-web-security-update-casl-2-0-releases
Sunith Shetty
13 Apr 2018
2 min read
Save for later

Web Security Update: CASL 2.0 releases!

Sunith Shetty
13 Apr 2018
2 min read
CASL has released a new version 2.0 bringing with it several compelling opportunities for enhancing web app authorization methods. CASL is an isomorphic authorization JavaScript library which allows you to fix user abilities in the system. It grants you to set permissions in order to access the required resources in the system. You need to define the permissions in a single location since you cannot duplicate them across UI components, API services, and database queries. Some of the noteworthy changes available in CASL 2.0 are: Package Refactoring Refactoring is a process of changing a software system to improve the internal structure of the code without altering the external performance.   The lerna project has refactored CASL 2.0 to monorepo. Because of which MongoDB related functionality is moved into a different package, thus decreasing the core library size. You can find the core package at casl/ability and MongoDB related functionality at casl/mongoose, while helper function at casl/ability/extra. You don’t need to worry about updating your dependencies, thanks to renovate bot. CASL procures Frontend frameworks CASL now has complementary packages for leading frontend frameworks such as React, Vue, Angular and Aurelia. You can now integrate CASL into different single page applications with ease.   For more details, you can refer the README file for each library: CASL Vue package CASL React package CASL Angular package CASL Aurelia package Set abilities per fields Now you can set permissions per field of your application. For example if you want certain users with the ability to change the name of the product but not the product description. You can see suitable form fields for different roles in the admin panel Demo Examples If you want demo tutorials as per CASL 2.0 and complementary packages you can visit: Integrate CASL authorization in Vuejs2 application using CASL and Vue Integrate CASL authorization in React application using CASL and React Integrate CASL authorization in Aurelia application using CASL and Aurelia Integrate CASL authorization in Expressjs application using CASL and Expressjs Integrate CASL authorization in Feathersjs application using CASL and Feathersjs If you want to start implementing CASL library in your project or work, you can visit the GitHub page.
Read more
  • 0
  • 0
  • 5064
article-image-sails-js-1-0-has-arrived-on-the-shores
Sugandha Lahoti
04 Apr 2018
2 min read
Save for later

Sails.js 1.0 has arrived on the shores

Sugandha Lahoti
04 Apr 2018
2 min read
Sails v1.0 is here! Sails.js is an MVC framework for Node.js, to easily build custom, enterprise-grade Node.js apps. It combines the familiarity of working with MVC pattern of frameworks like Ruby on Rails, with the requirements of modern apps, such as data-driven APIs with a service-oriented architecture. Version 1.0 promises to provide a better developer experience over backward compatibility. Because of this, the upgrade to Sails 1.0 may include more breaking changes than previous versions. Here’s an overview of what's changed in this release and some of the new features you might want to take advantage of in your app. Sails v1.0 no longer supports Node v0.x; the earliest version it supports is Node 4.x. Sails v1.0 introduces custom builds. These custom builds provide more control over an app’s dependencies as certain core hooks are now installed as direct dependencies of an app. It also makes npm install sails run considerably faster. The new Sails also comes with several improvements in app configurations. This includes: datastores, which is by far the biggest change in app configuration. Datastores represent the data sources configured for an app. automatic install of lodash and async are now customizable to any version. view engine configuration syntax has been normalized to be consistent with the approach in Express v4+. The new blueprint API is getting expanded to include a new endpoint which might require developers to make changes in the client-side code. Most importantly, Sails v1.0 comes with a new release of Waterline ORM (v0.13). This Waterline version introduces full support for SQL transactions, picking/omitting attributes in result sets, dynamic database connections, and more granular control over query behavior. It also comes with a major stability and performance overhaul. These cover the majority of changes that Sails version 1.0 has introduced. A comprehensive list of all changes along with the necessary code files required to upgrade to the version 1.0 is available on the Sails Documentation.
Read more
  • 0
  • 0
  • 3481