LIFT AND SHIFT MIGRATION TO THE CLOUD

Lift and Shift Migration to the Cloud

Lift and Shift Migration to the Cloud

Lift and shift is an approach, one among many, for migrating the apps to the cloud. It means moving an application and its related data to a cloud platform without restructuring the app.

There is no one-size-fits-all transition for moving an application from users on-premises data center to the cloud. But there are known core migration paths; many consider lift and shift is one of them. It is a way for organizations to safeguard their investments in business workflow, logic, and data trapped in on-premises hardware.

The lift-and-shift approach opens pathways to IT modernization by moving to an open and more extensible architecture in the cloud. Organizations consider lift and shift for solid business reasons, including minimized costs and improved performance and resiliency.

WHEN IS THE LIFT AND SHIFT CLOUD-MIGRATION MODEL A GOOD FIT??

With the lift-and-shift approach, on-premises applications can move to the cloud without redesigning. But they cannot always take complete advantage of native-cloud features, so this may not be the most cost-effective migration path. According to the survey, Gartner estimates that by 2020, organizations lacking cost-optimization processes will average 40% overspend in the public cloud.

STRATAGEMS TO CONSIDER

Rehost : This is infrastructure as a service (IaaS), or lift and shift. The user rehost his/her application in another hardware environment without changing the applications architecture. Migration is fast and comparatively low-priced, but ongoing operation can be costly because the user is not leveraging cloud efficiencies.

Refactor : Refactor is also known as platform as a service (PaaS), the user run his/her applications on a cloud provider’s infrastructure. Developers can reuse languages, frameworks, and containers leveraging code that’s strategic to the company.

Revise : Firstly, the user support legacy-modernization requirements by modifying or extending the existing code; then take the rehost or refactor route to the cloud. This means the user can leverage the cloud characteristics of their provider’s infrastructure but not without upfront development cost.

Rebuild : The user throws out the code for an existing app and re-architect it. The benefit is access to inventive features in the provider’s platform that improve developer’s productivity. The price the user pay is either lock-in or abandoning the application assets if the situation becomes unacceptable.

Replace : Discard the existing application set and adopt commercial software as a service (SaaS). When requirements for a business function change rapidly, this approach eludes the time and investment of mobilizing a development team. But there might be some issues such as inconsistent data semantics, difficult data-access, and vendor lock-in.

COMPONENT INTERACTION IN REACT

Component Interaction in React

Component Interaction in React

In React JS, there is often a need to pass data from one component to another. If you are passing data from somewhere in a component, to somewhere else inside the same component, this can be done through the state. So, let’s dive deep in and know more about component interaction in React.

WHAT IS THE STATE?

The heart of every React component is its “state”, an object that defines how that component renders and performs. In other words, “state” is what allows the user to create components that are dynamic and interactive.

Assume of the state as the difference between water, ice, and vapor. It is the same object, but subject on conditions, it can behave differently. That’s the same way to use state within components. The user can change the way objects appear, or interact by changing the state of those objects within a component.

HOW TO CHANGE STATE IN A COMPONENT?
Generally, the user would need to declare the state after setting the constructor.
class component_A extends Component {
constructor() {
super();
this.state = {
data: [],
};
}

In this case, we are outlining the state of data. We have defined it here as an empty array. We have to use an empty object, or empty quotes, depending on the data type we wanted to change the state of. Then when we are ready to change the state, we would simply use “this.setState.” With our instance above, it might look like this:

this.setState({data: data});

Here the user has two components, and the user needs to pass the data from one component to an other. The user would not be able to use state. The state can only be transferred within the component where it was created. Instead, the user can use props or properties.

Let’s say, the user has component_A, with files nested inside of it, and then it’s child components, component_B, and component_C. It is very probable that component_A would have data that the user would need to access in component_C. How can the user access that, or pass the data from component_A to component_C? Ultimately, what the user has to do, is;

If the user wants to pass the property of color from the parent component to one of the child components. The user can pass prop using “this” the same way set the state in a component earlier. In that instance, the state could then be used and passed throughout the component.

Passing data from parent to child components is little trickier, in that, the user cannot pass data in an unbroken chain to other components. In the above instance, the user actually needs to pass the data, in this case, {this.props.color} from component_A to component_B and then to component_C.

PROTOTYPE INHERITANCE IN JAVASCRIPT

Prototype Inheritance in JavaScript

INHERITANCE

Inheritance refers to an object’s capability to access methods and other properties from another object. Objects can inherit things from other objects. Inheritance in JavaScript works through prototypes and this form of inheritance is often called prototypal inheritance.

Prototype Inheritance in JavaScript

In this article, we will be covering a detailed note on prototypal inheritance and implementing inheritance.

PROTOTYPE

Almost all objects in JavaScript have the prototype property. The prototype is a reference to another object and it is used whenever JS cannot find the property the user is looking for in the current object. In simple, whenever the user wants to call a property on an object and it does not exist, JavaScript will go to the prototype object and look for it there. If it finds it will use it, if not it will go to that object’s property and look there. This can bubble up all the way to Object.prototype before returning undefined. This is the principle of the prototype chain and the behaviour that sits behind JavaScript’s inheritance.

THE PROTOTYPE CHAIN

To understand object prototypes, we need to discuss object lookup behaviour. When we look for a property of an object, the JavaScript engine will first check the object itself for the existence of the property. If not found, it will go to the object’s prototype and check that object. If found, it will use that property.

If not found, it will go to the prototype’s prototype, and on and on until it finds an object with a __proto__ property equal to null. So if the user is going to attempt to lookup the property someProperty on obj object from above, the engine would first check the object itself.

If it wouldn’t find it and would then jump to its __proto__ object which is equal to Object.prototype. It wouldn’t find it there either and upon seeing that the next __proto__ is null, it would return undefined.

This is called the prototype chain. It is normally described as a chain going downwards, with null at the very top and the object which the user is using at the bottom.

While performing a lookup, the engine will pass through up the chain looking for the property and return the first one it finds, or undefined if it is not present in the prototype chain.

__proto__ === null
|
|
__proto__ === Object.prototype
|
|
{ object literal }
FUNCTION PROTOTYPES

Functions all have a prototype property distinct from their __proto__ property. It is an object. A function’s sprototype’s __proto__ property is equal to Object.prototype.

function fn() {}
console.log(fn.prototype.__proto__ === Object.prototype);
// -> true

EXECUTING INHERITANCE

The user can work with a function’s prototype property directly and safely. By placing methods and other properties on a function’s prototype, and can allow all objects created by that function to access those properties through inheritance.

function Fn() {}
Fn.prototype.print = function() {
console.log(“Calling Fn.prototype’s print method”);
};
var obj = new Fn();
obj.print(); // -> Calling Fn.prototype’s print method

This works in a different way because, each object created by calling new Fn() will have its own version of print placed directly on the object. There will be different functions in memory. The difficulty with this is performance and memory usage.

PERFORMANCE

There may be times the user might need thousands of new objects created from a constructor function. Using this second way of attaching print, we now have thousands of copies of print, each one attached to one of the objects.

Using the prototype chain, no matter how many objects the user creates out of a Fn, the user will have one print sitting on Fn.prototype.

Big programs, however, often have tens of methods that objects need. If an object needs access to 20 methods and we create 100,000 objects, the JavaScript engine has created 2,000,000 new functions. If this needs to happen multiple times, this will cause visible speed and memory issues.

Using console.time and console.timeEnd, the user can directly show the difference in how long it takes.

THE VERDICT

Prototypes are more of a delegation tool and they do not really behave like classes. Now with the latest approach the user can create normal class hierarchies and use understandable syntax for them, but be cautious of possible problems that may occur. This syntax is only a beautiful facade for what’s going on inside.

CREATING SCHEMAS IN MONGODB USING MONGOOSE

Creating Schemas in MongoDB Using Mongoose

MONGOOSE
Mongoose is an “elegant MongoDB object modelling for Node.js “. If you have used MongoDB before and tried basic database operations, then you might have noticed that MongoDB is “schema-less”. When you are looking to implement a more structured database and want to leverage the power of MongoDB, Mongoose is one of the Object Data Mapping (ODM) solutions.

To quickly determine, run an insert command into a collection named users like the following:

Creating Schemas in MongoDB Using Mongoose

1db.users.insert({ name : ‘Arvind’, gender : ‘male’});

And right after that, you can run:

1db.users.insert({ name : ‘Arvind’, gender : ‘male’, password : ‘!@#$’});

MongoDB will never complain about the variation in the number of columns (key-value pairs). But when the user wants to keep the data more organized and controlled, the user would need to maintain that in server code, writing validation, making sure nothing unrelated is stored in a collection. This is where Mongoose makes task easy.

Mongoose provides a straight-forward, schema-based solution to modelling the application data and includes built-in typecasting, validation, query building, business logic hooks, and much more, out of the box.

In this article, we are going to show you how to use Mongoose for your MongoDB deployments to create a more straight-forward, schema-based solution to modelling your application data.

START DEVELOPING

After installing Node.js, create a new folder named “myMongooseApp” and open terminal/prompt and run:
1
npm init

This will help the user in setting a new node project. Fill it up as required. Next, install Mongoose as a dependency to the project and run;
npm install mongoose –save-dev
Then, start the MongoDB service by running:

Mongod

Then, create a new file named index.js at the root and then open it up in favorite editor. Add the below code:

var mongoose = require(‘mongoose’);
mongoose.connect(‘mongodb://localhost/myTestDB’);

var db = mongoose.connection;
db.on(‘error’, function (err) {
console.log(‘connection error’, err);
});
db.once(‘open’, function () {
console.log(‘connected.’);
});
Here, the user requires the Mongoose package to connect to the database and initialize the connection. The name of our database is myTestDB.
Then, run:
node index.js
The user should now see the connected message. The user can also use a node package named nodemon for automatically restarting the node server on changes.

MONGOOSE SCHEMA

Schemas are like skeletons of how the user data collection will look. If the user is dealing with a collection of customers, then the schema would look something like this:

Name – String
Age – Number
Gender – String
Date of Birth – Date

If the user is dealing with collection of products, then the schema would look like this:

SKU – String
Name – String
Price – Number
InStock – Boolean
Quantity – Number

The user can observe the drift. When the data is guarded with a schema, the probability of storing garbage data decreases drastically.

Now that we have got an understanding of schemas, let us try and build a user schema using Mongoose.

var Schema = mongoose.Schema;
var userSchema = new Schema({
name : String,
age : Number,
DOB : Date,
isAlive : Boolean
});

Then, create a model from the schema and add;
var User = mongoose.model(‘User’, userSchema);
The model is ready and now can use this as base schema to insert users into the database. This way, we know that every document in a user collection will have the fields listed on the schema. Now, let us create a new user instance and save it to DB.
var arvind = new User({
name : ‘Arvind’,
age : 99,
DOB : ’01/01/1915′,
isAlive : true
});

arvind.save(function (err, data) {
if (err) console.log(err);
else console.log(‘Saved : ‘, data );
});
The user should will find something like below:
Saved : { __v: 0,
name: ‘Arvind’,
age: 99,
DOB: Fri Jan 01 1915 00:00:00 GMT+0530 (IST),
isAlive: true,
_id: 536a4866dba434390d728216 }

DYNATRACE

Dynatrace

DynaTrace Software is an Application Performance Monitoring tool (APM), which is extensively used nowadays. It comes with advanced features for monitoring applications. Through which the user can without difficulty identify the performance of the application.

DynaTrace is used to discover the existence of defects in CPU performance, response time, transaction rate, throughput, and system usage. It will help the user to diagnose and fix many performance issues at an early stage and make the application more valuable.

HOW DOES IT WORK

DynaTrace server should be installed on the user’s system and it consists of host and agent. It will have a dashboard through which the user can diagnose the system in one place.

The server can easily interact with the agent if wanted, for that the user have to run the command through terminal and then can easily watch the interaction and also can alter the time.

PROS AND CONS OF DYNATRACE
Pros And Cons Of Dynatrace

WHAT ARE TEMPLATE LITERALS IN HTML5?

What are template literals in HTML5?

Template literals are enclosed by the back-tick (` `)

Template literals can contain placeholders. These are indicated by the dollar sign and curly braces (${expression}). The expressions in the placeholders and the text between them get passed to a function.

In order to embed expressions within normal strings, you can use the following syntax:

var a = 5;
var b = 10;
console.log(‘Fifteen is ‘ + (a + b) + ‘ and\nnot ‘ + (2 * a + b) + ‘.’);
// “Fifteen is 15 and
// not 20.”

Now, with template literals, you are able to make use of the syntactic sugar making substitutions like this more readable:

var a = 5;
var b = 10;
console.log(`Fifteen is ${a + b} and
not ${2 * a + b}.`);
// “Fifteen is 15 and
// not 20.”

Nesting Templates:

In certain times, nesting a template is the easiest and perhaps more readable way to have configurable strings. Within a backticked template it is simple to allow inner backticks simply by using them inside a placeholder ${ } within the template. For instance, if condition a is true: then return this templated literal.

EXPLAIN IN WINDOWS DNS SERVER WHAT IS PRIMARY, SECONDARY, AND STUB ZONE?

Explain in windows DNS server what is Primary, Secondary, and Stub zone?

In windows DNS server,

Primary Zone: In this, the file is saved as normal text file with filename (.dns).

Secondary Zone: It maintains a read-only copy of zone database on another DNS server. Also, it acts as a back-up server to the primary server by providing fault tolerance and load balancing.

Stub Zone: It consists of a copy of name server and SOA records which is used for reducing the DNS search orders.

EXPLAIN WHAT IS THE DIFFERENCE BETWEEN A THREAD AND A COMPUTER PROCESS?

Explain what is the difference between a thread and a computer process?

Computer Process: In computing, a process is an instance of a computer program that is executed sequentially by a computer system which can run several computer programs concurrently.

Thread: A thread is a several executable program that work together as a single process. For instance, one thread might send an error message to the user; another might handle error signals while the third thread might be executing the original action.

WHAT IS PAGE SPEED AND WHY DOES IT MATTER?

What is page speed and why does it matter?

Page speed refers to how fast your site loads for a user, something Google takes into account while ranking websites since a faster loading page directly translate to better user experience. If the interviewer asks what you would do to increase page speed, describe how you’ve achieved this in the past with examples such as reducing image sizes, enabling compression, reducing redirects, removing render-blocking JavaScript, leveraging browser caching, improve server response time, using a content distribution network to compress files, optimizing the code etc.