Basics of Reactive Events in Angular2

In this article I want to show how to use the “Reactive Events” library RxJS to handle asynchronous event processing in AngularJS2.

In many Javascripts frameworks asynchronous events are handled by either providing a callback function to be called, or be retrieving a “Promise” object to get the data.

The RxJS libraray is taking the concept of promises even further with the interface Observable, which is a combination of a Promise and an Iterator. To be precise, an Observable describes a channel to receive an arbitrary number of events asynchronously over time.

Angular2 adapts this paradigm for all major interactions, as all asynchronous actions can be described by Observables:

  • DOM  Events (e.g. user clicks a button)
  • AJAX Requests
  • Timeouts and Timers

Continue reading

Introduction to Docker

In the past we often had some software (e.g. web application inside an application  server) that needed to be deployed on multiple servers, different stages (development, staging, production) and even on some machines hosted by a customer, but managed by ourselves.

To help with setting up the server and configuring the software, the container management tool Docker made a lot of this tasks easier by providing a defined and stable platform for application deployments.

The purpose of Docker

So, what are the aims of Docker and how can it help your deployment?

First of all, when you try to install and deploy your software on a linux server, there are a lot of uncertainties and variable conditions, that can influence your installation:

  • Used operation system distribution (CentOS, Ubuntu, Debian, or even Gentoo?)
  • Installed libraries and version of the libraries and tools (is java environment available? in which version by which provider in which path?)
  • System settings, like character set and time zone
  • Blocked ports by other services (is port 80 already taken? how to handle another server software, that also needs this port?)
  • Users, Groups, Permissions
  • Environment variables

Continue reading

Angular2 Release Candidate 1 (RC1) Changes

This article summarizes a couple of changes I encountered during the migration of angular2 beta 17 to angular2 rc1.

Angular2 Packages for RC1

Previously angular2 could be pulled in by npm using the following configuration entry in package.json

Now all packages have been split up and moved to @angular instead of angular2.

package.json

Continue reading

Scala Dependency Management with SBT

When you are building applications or libraries in the Scala programming language, you will most likely use a tool like “SBT” (Scala Build Tool) or “Lightbend Activator” (which is an extended distribution of SBT) to configure, build and package your project. These tools support automatic dependency management for your project.

Like in almost every build system, SBT allows you to define library dependencies which are resolved automatically, so you don’t have to download and package required libraries by yourself.

Currently SBT can handle a lot of repository types, including Ivy and Maven repositories, which gives you instant access to all libraries available in the Maven universe.

Continue reading

Introducing Git and GitFlow

Recently one of our customers faced the challenge of fixing a production error in his desktop client application. Using SVN this may be a time consuming and error-prone task. So I held a workshop about Git and GitFlow.

Git

Our customer’s application is deployed in different versions. It may also be deployed to different customers. With a different set of features. This scenario seems quite common nowadays. However a lot of software companies are not ready to tackle this problem.

distributed_vcs

Git – a distributed Version Control System

The easiest and most effective way to support this scenario is to implement a workflow based on Git. Therefore I held a workshop about Git and GitFlow.

Continue reading

Hangfire Dashboard and ASP .NET 5

This article demonstrates how the Hangfire dashboard can be set up in an ASP .NET 5 application including authentication via ASP .NET Identity.

Adding Hangfire Packages

project.json:

Since I am using Hangfire with SQL, I have to add Hangfire itself and Hangfire.SqlServer to the project.json.

Continue reading

302 Redirect VS 401 Unauthorized – ASP .NET 5 Identity

302 API Redirect Problem

If you make a request to a REST service and are not logged in, by default ASP .NET 5 Identity returns a 302 Redirect to login page. This is great if you are visiting the URL of a controller directly. If you make an Ajax request to a specific REST API and are not logged in however, you are also redirected to the login page and instead of the content of the API you will get the content of the login page itself. Probably without even noticing it right away.

So in instance of API calls I would prefer a 401 Unauthorized status code, e.g. $http requests using AngularJS. Here only the Ajax call itself gets redirected, but the URL of the browser remains the same. This means you won’t see that there is an “authentication problem” and you are not redirected to the login page.

Continue reading

Angular2 Http Authentication Interceptor

In my Angular2 application I want to be redirected to the login page whenever I get a 401 response during an Ajax call. Therefore I want to intercept all Ajax calls and check for the response code. In addition to that I also want to set a couple of default request headers for each Ajax call. The code below shows an interceptor for angular2 http requests.

Continue reading

ASP .NET 5 Identity with Entity Framework 7 Setup

In this article we will demonstrate how to provide authentication to ASP .NET 5 applications using ASP .NET Identity with Entity Framework 7.

Adding Packages

Add the following package to your ASP .NET project. This will automatically pull in additional required dependencies for ASP .NET Identity.

project.json

Continue reading