The NPrinting API for Noobs

NPrinting is important for many users. In the 2017 June release, on-demand reporting is enabled with the NPrinting API. Immediately after the release, the above question was raised to me. I spent a few days trying to prototype a solution but ended up with something that is so simple that anyone can do it in 10 minutes. Frustrating? Yes, because I spent so much time on something that is just a little bit better than “Hello, World!” On the other hand, simple is awesome; simple means even a non-technical user can implement it without problem. Pretty cool.
With that, I’m sharing my experience in case I can help others stuck with a similar problem.


Working With URL Interceptor/Servlet Filters in Crafter CMS

A filter in Crafter is a Groovy-based controller that allows you to intercept inbound requests for content and API responses and dynamically apply rules, modify the request or transform the response. A Crafter Filter has the same interface and mechanics as a Java J2EE Servlet Filter. Some examples of filter use are:

Apply security rules: Check for SAML2, Site Minder, or other security tokens before allowing the request to proceed.
Active Record: Example: before serving the requested resource, look up and load the user’s profile into the request so it is available to all components of the system.
Apply compression: Gzip all of the data returned by the requested resource (page, API, etc)

In this article, we’ll learn the specific mechanics of creating and configuring a filter in Crafter CMS.


Easy JavaScript, Part 1: Learn the “let” Statement

Using the let statement, you can create Block-scoped local variables in JavaScript. The let  statement was introduced in the ECMAScript 6 standard of JavaScript.
Before you go ahead and learn about let, I recommend you to check out Infragistics jQuery-based library Ignite UI, which helps you write and run web applications faster. You can use the Ignite UI for JavaScript library to help quickly solve complex LOB requirements in HTML5, jQuery, Angular, React, or ASP.NET MVC. (You can download a free trial of Ignite UI here.)


Finish Him: Kill All the WebDriver C# Code

Most of my articles are about WebDriver. Today, I am going to write about a common problem that people usually hit. Have you experienced this? Your tests finish and then all of a sudden, the browser is still opened? The next time you try to clean the build folder, you cannot because the current driver’s EXE is still in use. Such a pity. From now on, your builds start failing. Many people complain about the flakiness of WebDriver, and this is one of the reasons. Here, I am going to propose to you a solution: As they say in Mortal Kombat, “Finish Him!" (kill all of the processes).
Test C# Code
Once again, I will use one of my favorite test pages: Bing. Below, you can find the page object that we will use in the tests.


Understanding Ruby Metaprogramming and DSLs

A DSL, or Domain Specific Language, is a language that has a specific purpose rather than a general purpose, like C or Java. One of the most popular DSLs is SQL because it’s the standard for querying a relational database and its syntax is specific to activities such as sorting, filtering, and displaying data.
SQL falls under the category of external DSLs, which means it requires its own parser and implementation of all of the necessary components. Other examples of external DSLs are Gherkin, for writing feature files, Make Files, for building C and C++ applications, and HTML, for declaring webpages).


CSS Containment Modules

One of the new hidden gems in the new CSS modules, which is supposed to drop in new browser versions in the future, is CSS containment. In this short post, I’ll explain what is the new contain property and why you will want to use it.

CSS Containment Module
The CSS containment module defines a new indication, using the contain property, that an element’s subtree is independent of the rest of the page. This will enable browsers to optimize the performance of rendering/painting.


Easy JavaScript: What Are Template Literals?

In ES6, two types of literals were introduced:

Template Literals for string concatenation and expression embedding in a string
Tagged Template Literals to tag the Template Literal in a function so the literal can be evaluated in the function

Let’s assume that you need to do the string concatenation with a dynamic expression or with the value of a variable. Take a look at the following code:


Advanced RxJS With Angular and Web Speech (Part 2)

This is Part 2 of our 2-part tutorial. RxJS Advanced Tutorial With Angular and Web Speech: Part 1 covered the following:

Introduction to reactive programming with Rx* and observables
Setting up our Angular app
Integrating the Annyang library for speech recognition support
Implementing a form component allowing users to speak or type words to use in the madlib story

In Part 2, we will cover:


Create Spring Beans in Your Site With Crafter CMS

Crafter CMS supports scripting in Groovy. It’s awesome. It’s lightweight. It’s fast. It’s easy. That said, when solutions start to become more sophisticated, developers need ways to manage the complexity. Spring bean factory is an inversion-of-control implementation that has become a standard for wiring components of a system together. Crafter CMS lets you create classes in Groovy and wire them together as Spring beans that can be used by other scripts in the system.
Step 1: Create Your Classes
Put your classes under scripts/classes/groovy. For example, you could put them under scripts/classes/groovy/mysite/AddressBook.groovy.