
by via Awwwards - Sites of the day
"Mr Branding" is a blog based on RSS for everything related to website branding and website design, it collects its posts from many sites in order to facilitate the updating to the latest technology.
To suggest any source, please contact me: Taha.baba@consultant.com


This article was originally published on Alibaba Cloud. Thank you for supporting the partners who make SitePoint possible.
The cloud, despite its ubiquity, is still an emerging technology with vast innovations across multiple industries. Owing to its flexibility and advanced security model, organizations have already started to move most of their IT workloads to the cloud. Some of the high-level reasons to move to cloud are listed below:
Seamless integration is what we all expect when it comes to information technology, especially with migration. However, this is easier said than done. Cloud migration is fairly complicated because it involves so many elements, from picking a suitable operating system (OS) to selecting the best geographical region for our deployments. Migration also involves some standard processes and considerations and is no small feat.
Migration strategies differ on a case-by-case basis, however as a whole, cloud migration should be based on best practices from previous examples. An effective migration strategy should maintain a reliable, real-time migration, with less or zero down time. Migration can be broadly categorized into physical to virtual (cloud migration), virtual to virtual (multi-cloud), and virtual to physical (hybrid cloud). Migration can have any combination of these categories.
In this article, we are focused on physical to virtual and virtual to virtual migration. Here the target is going to be the Alibaba Cloud platform. This whole process involves Alibaba tools for image conversion, OSS for storage, and some third-party tools to synchronize the data in real time.
For a successful migration, the standard process and procedures below are applicable for most organizations.
Cloud migration can be perform in two ways: application level migration and virtual machine (VM) migration. The choice is based on the applications running on virtual/physical servers; we may need to plan which one will be best suitable for migration.
During migration assessment, we need to check how many applications can support real time migration. For example, Microsoft Exchange can use native DAG; SQL replication tools can be used for database mirroring.
Irrespective of any application and platform, it is always better to get an insight from application experts. Typically, a migration expert will create similar infrastructure as the source on the target platform (such as Alibaba Cloud), and then establish a connection using VPN/MPLS to create site-site connection. Some applications can simply be migrated using public IP without VPN.
Do real time replication/migration using native methods and switchover. Switchover/cutover requires several steps to be performed by administrators like changing DNS, routing configuration, firewall customization and so on.
If there is no available method for application migration, or if the application level migration is complicated, VM migration is an alternative. Also known as image migration, VM migration is the best option for any organization to simplify the migration process.
This method is sometimes simply referred to as migrating from a platform to another platform. Alibaba Cloud runs on the KVM/XEN platform, so we need to ensure that it has all required drives to support automation, licensing, and all other cloud dependencies.
There are few migration scenarios listed below:
Irrespective of any source platform Alibaba Cloud has a tool called Alibaba Cloud Migration Tool (Cloud Migration Tool) to perform migration to create ECS instances. Alibaba Cloud invests resources into various categories of image migration to carry out the process with ease and effectiveness.
Before you use the Alibaba Cloud Migration Tool, you need to consider the following:
For on-premises servers running Windows OS
For on-premises servers running Linux OS
oCentOS: Run yum install rsync –y.
oUbuntu: Run apt-get install rsync –y.
oDebian: Run apt-get install rsync –y.
oOther distributions: See the installation documents of the distributions on their official website.
The migration process is as follows:
Below are the steps performed to migrate a simple web server from Azure to Alibaba cloud.
Operating System: Windows Server 2016
1. Extract the folder and locate JSON > Open with > Notepad

2. Modify as below. Refer to this link for more parameters. To create and obtain new access key, refer here.
{
"access_id": "ENTER_YOUR_ACCESS_ID",
"secret_key": "ENTER_YOUR_SECRET_KEY",
"region_id": "me-east-1",
"image_name": "KingsonWS",
"system_disk_size": 60,
"platform": "",
"architecture": "",
"data_disks": [],
"bandwidth_limit": 0
}
3. Save the file and run go2aliyun_client tool as an administrator.
Continue reading %How to Migrate a Simple Web Server from Azure to Alibaba Cloud%
In this article, we’ll dig into the best way to implement a singleton in JavaScript, looking at how this has evolved with the rise of ES6.
Among languages used in widespread production, JavaScript is by far the most quickly evolving, looking less like its earliest iterations and more like Python, with every new spec put forth by ECMA International. While the changes have their fair share of detractors, the new JavaScript does succeed in making code easier to read and reason about, easier to write in a way that adheres to software engineering best practices (particularly the concepts of modularity and SOLID principles), and easier to assemble into canonical software design patterns.
ES6 (aka ES2015) was the first major update to the language since ES5 was standardized in 2009. Almost all modern browsers support ES6. However, if you need to accommodate older browsers, ES6 code can easily be transpiled into ES5 using a tool such as Babel. ES6 gives JavaScript a ton of new features, including a superior syntax for classes, and new keywords for variable declarations. You can learn more about it by perusing SitePoint articles on the subject.

In case you’re unfamiliar with the singleton pattern, it is, at its core, a design pattern that restricts the instantiation of a class to one object. Usually, the goal is to manage global application state. Some examples I’ve seen or written myself include using a singleton as the source of config settings for a web app, on the client side for anything initiated with an API key (you usually don’t want to risk sending multiple analytics tracking calls, for example), and to store data in memory in a client-side web application (e.g. stores in Flux).
A singleton should be immutable by the consuming code, and there should be no danger of instantiating more than one of them.
Note: there are scenarios when singletons might be bad, and arguments that they are, in fact, always bad. For that discussion, you can check out this helpful article on the subject.
The old way of writing a singleton in JavaScript involves leveraging closures and immediately invoked function expressions . Here’s how we might write a (very simple) store for a hypothetical Flux implementation the old way:
var UserStore = (function(){
var _data = [];
function add(item){
_data.push(item);
}
function get(id){
return _data.find((d) => {
return d.id === id;
});
}
return {
add: add,
get: get
};
}());
When that code is interpreted, UserStore will be set to the result of that immediately invoked function — an object that exposes two functions, but that does not grant direct access to the collection of data.
However, this code is more verbose than it needs to be, and also doesn’t give us the immutability we desire when making use of singletons. Code executed later could modify either one of the exposed functions, or even redefine UserStore altogether. Moreover, the modifying/offending code could be anywhere! If we got bugs as a result of unexpected modification of UsersStore, tracking them down in a larger project could prove very frustrating.
There are more advanced moves you could pull to mitigate some of these downsides, as specified in this article by Ben Cherry. (His goal is to create modules, which just happen to be singletons, but the pattern is the same.) But those add unneeded complexity to the code, while still failing to get us exactly what we want.
Continue reading %JavaScript Design Patterns: The Singleton%