Getting Started With Cucumber.js on Node.js

See the original posting on DZone Python

Cucumber.js

Cucumber.js is a Node.js library used for automation. Cucumber.js helps to test our site’s features using pure JavaScript and the Selenium WebDriver. So there is no longer the burden of installing jars and formatting the response and all sorts of time-consuming tasks like we used to do when writing automation scripts in Java using the Eclipse IDE. I am not comparing the power of Java with Node.js, but every language has its advantages and different learning curves. So, for getting a quick automation script working and impressing your colleagues, or for adding onto your resume for impressing your employer, let’s start coding and explore it.

Pre-Requisites: 

Before getting started, you should be well aware of Node.js async antipatterns and promises. We will be using Node.js 6.9.4 and a module named selenium-cucumber-js which is a clean package that comes with the selenium driver for Node.js, as well as a reporting mechanism by default. Wow! That’s awesome, right?

Top 10 Programming Languages in 2017

See the original posting on DZone Python

Programming is something vast and rather individual as each developer chooses tools that are most convenient for them. However, certain languages, platforms, and frameworks have claimed themselves as some of the easiest and most efficient to use. Thus we have collected for you the top-10 programming languages loved by developers nowadays. Which one is your favorite?

Python

Python is a dynamic and general-purpose language that emphasizes code readability and enables developers to use fewer lines of code (in comparison with Java or C++). It supports multiple programming paradigms and has a large standard library.

Creating Your First Angular 4 App Using Angular IDE

See the original posting on DZone Python

Some time ago, an article called Creating My First Web App with Angular 2 in Eclipse was published. Since then, Angular was upgraded and became Angular 4, and new tooling for it in Webclipse appeared. Let’s see how to create a simple application using Angular 4 and new Angular tooling looks.

Pre-Requisites

  • Angular IDE or Webclipse —We’ll do our development using this Eclipse-based IDE. If you want to go without it – please, refer to the previous article.
  • Node.js, NPM, Angular CLI—These are the core tools for Angular development. They would be installed automatically by the IDE.
  • Basic knowledge of TypeScript, HTML, and Eclipse.

Creating a New Angular Project

Switch to Angular perspective using the button at the top-right corner of your IDE.

ASP.NET Core: Building an Enum Provider to Convert C# Enums to JavaScript

See the original posting on DZone Python

My previous post about ASP.NET Core and getting C# enums to JavaScript was primitive and used simple attributes on enums to detect ones we need in JavaScript. This blog post extends the idea and makes some generalizations to also support those enums that are located in libraries we don’t control or on what we don’t want to apply attributes.

JavaScriptEnum Attribute

We start again by defining the JavaScriptEnum attribute and some sample enums that are decorated with this attribute. The JavaScriptEnum attribute is a marker attribute and it doesn’t carry any functionality.

Self-Contained UI: Running One ASP.NET Core MVC Site Inside Another

See the original posting on DZone Python

If you have ever used any 3rd party packages like Hangfire or Elmah you will have seen a self-contained UI before. These packages when added to a web project will have their own user interfaces which can be accessed from an admin route like /hangfire or /elmah. These packages don’t bring in any HTML, CSS or JavaScript resources, they just work, and they work well.

If you have ever tried to implement a similar self-contained UI in one of your projects you may have found it quite difficult to set up. The development workflow can also be a bit of a pain. You may have had to make trade-offs on development features like editing your HTML and seeing it refresh without having to recompile the app.

Memory Management and Garbage Collection in JavaScript

See the original posting on DZone Python

Memory Management and garbage collection in JavaScript is a slightly unfamiliar topic since in JavaScript we are not performing any memory operations explicitly, however, it is good to know how it works.

In the low-level languages like C, developers need to manually allocate and deallocate the memory using the malloc(), calloc(), realloc(), and free() methods. In the high-level languages like Java and JavaScript, we don’t need to explicitly allocate or release memory. JavaScript values are allocated when things are created (objects, Strings, etc.) and freed automatically when they are no longer used. This process is called Garbage collection.

Building Real-Life Applications With Functional Elements of HTML 5.2

See the original posting on DZone Python

What do you do when you need a widget-like functionality? At present, there is a whole generation of developers who, as a rule, are googling for ready-made jQuery plugins. Can’t we do better than that? With the advances of web-components, we are expected to compose UIs from these building blocks. They are many. One can find one for almost any task. They are highly customizable. One can reuse the functionality, but with your own original representation. They are isolated. One doesn’t need to worry about the collisions in the compound system. But in reality, the APIs required by true web-components still have poor support in user-agents. One has to load an emulator library like Polymer. When it comes to component-based frameworks, one can painlessly import a component or rather go with a set like Material UI. But what would you say about standardized, library/framework-agnostic solution with not dependencies? Interesting that with HTML 5.1 and HTML 5.2 we get a number of new functional elements, solving classic developer tasks such as dialog, expandables, date pickers, and others. At the time of writing this article, the support for spec among browsers isn’t that good, but the elements can be polyfilled where it lacks. Let’s see what’s available and how we can use it.

Expandables With Summary/Details

A pair of elements, details and summary, were introduced in HTML 5.1 and are now widely supported. They implement a disclosure widget that can be adopted for collapse, dropdown menus, tree navigation, and other tasks. By default, any child elements of details except summary are hidden. As one clicks summary, the properties of open details change to true and the hidden content comes into view. To put it in practice, we made the following HTML:

Best Practices for JavaScript Library Versioning

See the original posting on DZone Python

I spend most of my time on this blog talking about Clojure, but in real life, I work on a lot of projects written in a lot of languages. Lately, much of my time has been spent writing and maintaining React-based front-ends in JavaScript.

As far as I can tell, no language has solved the problem of dependency management. Some libraries are better than others, but upgrading dependencies is always an uncomfortable experience. That being said, I’ve never experienced more pain doing so than in JavaScript’s ecosystem.

Working With Content as XML/DOM in Crafter CMS

See the original posting on DZone Python

In a previous article (Querying Content in Crafter CMS), we talked about how you can query content in Crafter using content and search services. Under the hood, Crafter CMS saves all of the content you create through the authoring interface (Crafter Studio) as XML. This XML is published from Crafter Studio to dynamic delivery engines (Crafter Engine) and is available through the content services and is also indexed in Solr and thus available through Crafter’s search services. There are times in the rendering engine (Crafter Engine) when you may want to get access to values in the XML directly and work with the content as an XML Document Object Model (DOM) API.

In the example below, I will show you how you can:

ASP.NET MVC 6 Routing Technique

See the original posting on DZone Python

Before we jump to custom routing, we will have to take a look at the basic changes in MVC6 from MVC5. ASP.NET MVC6 places all startup necessary services, defined and configured dependencies for the application, in a single file, Startup.cs. The Startup.cs file replaces all the functionality of global.asax where we put the middleware and configuration logic.

As we know, the routing actions are getting managed by the Routes.MapRoute method. In ASP.NET MVC 6 Routes.MapRoute, you won’t find this method as a part of Startup.cs file which now contains very few lines of code. You will also notice that there is no ad-hoc configuration file to take care of RouteConfig.cs, WebApiConfig.cs or other intermediate handlers recurrently shipped with the earlier ASP.NET versions and MVC pattern project templates. Startup.cs file has services.AddMvc() and services.UseMvc() methods to handle the routing action.

Handling Incoming Webhooks in PHP

See the original posting on DZone Python

An increasing number of applications now offer webhooks as an integration, often in addition to an API. The classic example, familiar to most developers, is the GitHub webhooks which can notify your other systems such as CI tooling that a new commit has been added to a branch. If you imagine how many repositories exist on GitHub, and how many other systems react to changes on each repository… there’s a reason they are excellent with webhooks! Whether it’s your source control, updates from your IoT sensors, or an event coming from another component in your application, I have some Opinions (TM) about handling webhooks, so I thought I’d write them down and include some code as well, since I think this is an area that many applications will need to work with.

Receive and Respond

The majority of problems I’ve seen or created when working with incoming webhooks is to try to do too much in a synchronous way – so doing all the processing as the hook arrives. This leads to issues for two reasons:

5 Steps to Create an Effective Data Visualization With JavaScript

See the original posting on DZone Python

Did you know that 80% of our brain is dedicated to visual processing? This explains the common saying, “that a picture says more than a thousand words.” With that saying in mind, I would like to argue that a chart is capable of saying more than a thousand data points.

Turning data into charts and graphs, or using “data visualization” as it is known, is a critical component of modern-day communications, anywhere from the corporate boardroom, to your local sports blog.

How to Use ASP.NET Middleware in Web Apps

See the original posting on DZone Python

Middleware is quite simply a bridge between database and application. In the context of ASP.NET Core, middleware is also a bridge between two components. It is middleware that decides how to respond to HTTP requests in ASP.NET Core. ASP.NET app experts are often looking at Middleware to handle requests or to be a bridge.

Middleware also controls how the application looks when there is an error, and it is a key link in authenticating and authorizing users to perform specific actions. In other words, middleware are software components assembled into an application to handle request and response to performing user actions before/after another component is invoked.

When Vue.js Can’t Help You

See the original posting on DZone Python

If you want to build a web page with JavaScript, Vue.js can do one helluva job on it. But there’s a condition: it only works on parts of the page where it has unhampered control. Any part that might be interfered with by other scripts or plugins is a no-go for Vue.

This means the head and body tags are Vue-free zones. It’s a real bummer if you wanted Vue to manage a class on the body, to take one example.

1 2 3 79