Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Building multilingual web applications

Saturday, November 18th, 2017 by Servage
multilingualMultilingualism is something you should plan before starting to work on a project. If you start with a single language, it may be difficult to add multiple languages at later stages of development if everything is hardcoded in the source code. If you have the slightest feeling that your application will support multiple languages at some point, it’s best to make it multilingual from the beginning. Here’s how you can do that on both the front and back end. Localization on the Back End Let’s start with the back end. Regardless of which framework you use, the process of setting up and using language files doesn’t differ significantly. A good practice is to ...

Getting started with Docker

Sunday, November 12th, 2017 by Servage
dockerDocker has been around for a few years now, and if you haven’t got your hands on it yet, now is your chance! Containers and virtualization have been used for a long time but Docker does it in a unique way, allowing developers to set up identical and lightweight environments for development, staging and even for production. Let’s dive into the idea behind Docker and how it can be used in a project. What is Docker? Docker is a software that lets you run lightweight containers with any type of software running inside. It can be a MariaDB database, Apache, Nginx, PHP or all of these at the same time. Containers are like virtual ...

HTTP requests with the new Angular 4 HTTP Client

Tuesday, November 7th, 2017 by Servage
angular-4Angular 4.3 comes with a new way of sending HTTP requests: the HttpClient class. The older Http class can still be used and it is not deprecated, at least for now. However, HttpClient brings some new features and will likely replace the old class in the future. Let’s go through some of the features the new HttpClient has to offer. Modifying Requests with Interceptors One of the handy new features is the ability to intercept HTTP requests with interceptors. Intercepting a request means modifying it on the fly. One common use case for interceptors is to attach a session token to every request automatically to easily authenticate with an API. Interceptors are classes that ...

What are progressive web apps

Thursday, November 2nd, 2017 by Servage
web-appThe term progressive web app (PWA) is a hot trend right now. It all started back in 2015 and quickly became popular due to the advantages it offers over traditional mobile applications. But what is a progressive web application? How does it differ from a typical mobile or web application? Let’s find out what the term PWA actually means and what makes an application a progressive web application. The Definition of Progressive In one sentence, a progressive web application is a website that looks and works like a mobile application. Modern HTML5 and CSS3 features allow developers to replicate many of the features native applications can do: storing data locally, using animations to ...

Understanding Observables

Sunday, October 29th, 2017 by Servage
Advanced Javascript development - Part 4Observables are heavily used in frameworks like Angular. Observables are especially useful in cases where you have to respond to an event but don’t know in advance when that event is going to take place. Therefore, you can set up an observable and one or more observers that listen to the event. What Are Observables? Observables are one of the two main objects in the observer design pattern. In the observer pattern, observables are objects that one or multiple objects listen to for events they are interested in. The listening objects are called observers. How Observers Work For example, you can connect a button to an observable, and whenever the ...

Resolving Merge Conflicts in Git

Wednesday, October 25th, 2017 by Servage
gitSooner or later every developer working with Git encounters a merge conflict. Especially if you are working with other developers, it’s possible that the code you are working on is changed by someone else at the same time. When that happens, you have to choose whose work you want to keep and what to discard, or perhaps you want to combine them by taking a piece from both versions. Let’s see what tools are available to do this and how the “git mergetool” command works. How Merge Conflicts Happen A merge conflict happens when you edit a file that changes in the remote repository at the same time. When one developer first commits ...

Permission Management in PHP with Bouncer

Saturday, October 21st, 2017 by Servage
php7Permission management doesn’t sound like an easy task. Fortunately, a PHP package called Bouncer makes it rather simple. Bouncer not only handles permissions but also user groups, and you can assign permissions to those groups. For example. You can allow editors to create blog posts with only a few lines of code. Installing Bouncer Since Bouncer is a PHP package, to no surprise it can be installed using Composer by running “composer require silber/bouncer”. Bouncer is a Laravel package so therefore it only works with Laravel projects. As usually with Laravel packages, you have to add the new package to the providers array of config/app.php: “Silber\Bouncer\BouncerServiceProvider::class”. Also add the following to the aliases ...

How JavaScript Promises Work

Sunday, October 15th, 2017 by Servage
javascript-codeA promise is an object that represents an asynchronous action that is yet to be completed. Consider an HTTP request that loads the details of a user account. If the request is sent inside a promise, your application can continue to work on other tasks while the HTTP request is sent. When it completes, a function is called where you can handle the data that was returned. Let’s have a closer look at promises and what makes them so powerful. Creating a Promise A new promise can be created with the new keyword using the Promise class. Promises are created inside a function that performs asynchronous tasks. Therefore, you could have the following ...

Building a Front End with Ember.js

Sunday, October 8th, 2017 by Servage
emberEmber.js is yet another JavaScript framework for building the UI for web applications. While there seems to be many JavaScript frameworks out there at the moment, each of them is targeted for a specific use case, or at least is more suitable for something than the others. Usually a single framework is not always the best choice for all kinds of websites and web applications. Let’s explore Ember together and figure out how it works and what types of websites benefit from it the most. Ember.js Quick Start If you have ever worked with Angular, chances are you find getting started with Ember quite easy. The process of setting up your first Ember ...

Angular 4 Best Practices

Monday, October 2nd, 2017 by Servage
angularAngular is one of the most popular front-end frameworks. Developers sometimes prefer to use their own approach when it comes to naming conventions, whitespace usage, file structure and so on. However, if every developer chooses their own path to follow, managing a single code base in a team becomes quite challenging. To solve this, Angular has a set of rules that all developers should follow when working on an Angular project. Let’s have a look at those recommendations set by the team behind Angular. File Names Let’s start with file and directory naming conventions. By following the Angular naming conventions, you can easily identify what a file does just by looking at the ...

Recent articles

Is Yarn package manager the successor of npm?

Npm has been the most popular package manager for JavaScript with little competition for years. Starting from 2016, an alternative called Yarn has become more and more popular for managing dependencies in JavaScript projects. How is Yarn different, what can it do and is it better than npm? The Benefits of Using Yarn Probably the biggest advantage of Yarn is that existing projects using npm work with Yarn out of the box. If ...

What is object-oriented CSS?

Object-oriented programming is a common practice in many programming languages. It helps you with the DRY principle (don’t repeat yourself) by allowing you to repeatedly use code from a single code base. How would applying the paradigm work with something other than a programming language, like CSS? Let’s find out how CSS can be written in the same way and what are the benefits of doing so. The Two Principles of OOCSS Object-oriented ...

What has changed in Laravel 5.5?

A new major version of Laravel is scheduled for release in late August 2017. In addition to being a long-term support release, many new features will be added to the framework, including a new error handler, custom validation rules, a new Artisan command and more. Let’s have a closer look at these new features. The “migrate:fresh” Command In previous versions of Laravel, the migrate:refresh command has been used as a quick way to ...

Getting started with Gulp

Gulp is a task runner for JavaScript that can automate away repetitive tasks so you can focus on coding instead. Gulp is an extremely versatile tool that can automate tasks from transpiling SCSS to live reloading with Browsersync. Let’s have a look at some of the most useful tasks you can automate with Gulp and a quick look at how to set it up. Transpiling SCSS Using a CSS preprocessor like Sass is ...

CSS grid and the future of Flexbox

Flexbox has been around for a while now and we have reached the point where you can safely use it in new projects. Recently, a new similar layout system called CSS Grid has been released. It comes with most of the features from Flexbox and some more. For instance, CSS Grid is a two-dimensional layout system compared to Flexbox which only supports one dimension. This article gives you a basic understanding ...