Skip to main content

Posts

Showing posts from 2017

Virtual machines vs. Containers

One of the questions that often comes up to anybody who's in the cloud space is, what are the differences between virtual machines and container? When should use one versus the other? Unfortunately the answer is not so simple clear-cut. We can't say you should always use containers or always use virtual machines. But, there are some things to keep in mind. There are certain kinds of applications which benefit from running in containers or using micro services in general. Microservices means taking an application and decomposing it into smaller parts. This is really good if you need to build a web scale application and you need to have the ability to turn up different dials of performance somewhat independent of each other. For example, take the middleware piece or the front end or the database piece and you need to scale them individually. The other benefit of containers is a consistency between the development environment and the production environment where you can take thing

Javascript - Unanswered questions - Part 1

What is Event delegation? Event delegation is Javascript as it relates to the DOM. It basically means that if you attach an event listener to a DOM element that listener is not only firing on that DOM element. It's actually firing on every children in that. So, for instance if you have a navigation and so you've got an unordered list you've got list items and then you've got anchor tags inside that navigation what you have. If you add an event listener to the ul element in essence you're actually adding event listener to all of the children as well. In short, JS event listeners fir not only on a single DOM element but on all its descendants. What is Event Bubbling? It's actually inverse of Event delegation. Also known as propagation, events on an DOM element will bubble up and also fire on all parents.  What's the difference between "target" and "currentTarget"? target is the actual element that triggered the event for example clicked, wh

Microservices vs. APIs

It still surprises me just how many times I come across misconceptions around Micro Services and APIs. Often hearing phrases like micro services are fine grained web services or API is themselves are equivalent to micro services. These all sort of show fundamental misconceptions under the covers. So, I've written this just to really break that out and explain about what the key differences are in those two concepts. What is an API? An API, fundamentally Application Programming Interface, that is an interface. It's a way of making requests into a component. So it's the route that you go in to make those requests. In modern use that typically means a REST API, that's a call made using HTTP protocol using JSON data as the payload. What are Micro Services? So let's ensure we also have a clear crisp definition on what a micro service architecture really is. Micro-Services architecture is about breaking down large silo applications into smaller components. That are more m

Microservices vs. SOA

What is a micro service? Small, individually, independently deployable application components that are self-contained and exposed through lightweight http based APIs. Here the independence of the of those components is really important because it has lot of ramifications in terms of how manage large-scale deployments of this architecture. Some people may say micros services are contrary to service oriented architecture. Actually, that's not true, Micro services are extension or evolution of service oriented architecture. The same principles still hold true but then it fixes lots of problems that were there in the service oriented architecture like large ESBs (Enterprise service bus), unwieldy configurations and scalability issues. It breaks that down into small reusable components that now you can scale individually or you can manage individually, so it gives lot more flexibility. Why IT industry has moving towards Micro Services? Well, obviously Agile and Scrum are big factor in t

Node.js for Everything

Lots of web applications using Javascript for front end for a long time. Javascript enabling people to build really really interactive great products, we can use Javascript on the front end and on the back end. So, what do we do on the back end? Node.js is the answer. Here we'll see some of the npm packages that'll help us to enable Javascript in back end as well. Load balancing is the main one when you plan to host your application server environment. Node offers pm2 package to easy your job. It's modern CLI process manager for Node apps with a builtin load-balancer. npm install pm2@latest -g pm2 start app.js Next thing is running applications continuously. Yeah, we've a node package named forever. It's a simple CLI tool for ensuring that a given node script runs continuously. npm install forever -g forever start app.js Enabling debugging in Javascript client applications are easy. Debugging a node application is sometimes a black box sometimes not, but one of the

Your connection is not private

Almost all web developers facing this issue without knowing the path of the problem. When we try to access the secure web sites, I mean https, Google Chrome browser says "Your connection is not private". What we do usually, just click ADVANCED link and Proceed to (unsafe).  At times, we will not see Proceed to (unsafe) link after clicking ADVANCED. We see the below screen instead which says "You cannot visit right now because the website uses HSTS. Network errors and attacks are usually temporary, so this page will probably work later."  If you see the above screen don't get upset. Type chrome://net-internals/#hsts in address bar and hit Enter. In Delete domain enter your domain name and do delete. You can verify you domain's status in Query domain. Once you done the specified steps then you can see Proceed to (unsafe) link.  Enjoy!

What are the HTTP methods supported by REST?

REST supports the following HTTP methods: GET: It requests a resource at the request URL. It should not contain a request body as it will be discarded. May be it can be cached locally or on the server. It can have request headers. POST: It submits information to the service for processing; it should typically return the modified or new resource. It can have both request body and request headers. PUT: At the request URL it update the resource. It can have both request body and request headers. DELETE: At the request URL it removes the resource. It can have both request body and request headers. OPTIONS: It indicates which techniques are supported. HEAD: It returns meta information about the request URL.

Is NPM INSTALL a valid command?

Yeah, It looks like a weird. Did you try anytime this command? NPM INSTALL is not a valid command. All the NPM commands should be in lower case. 

What's Virtual DOM?

There’s no big difference between the regular DOM and the virtual DOM. It’s better to think of the virtual DOM as React’s local and simplified copy of the HTML DOM. It allows React to do its computations within this abstract world and skip the real DOM operations, often slow and browser-specific. Real DOM operations are really really expensive. The Virtual DOM is an abstraction of the HTML DOM. It is lightweight and detached from the browser-specific implementation details.  One thing you should remember that the DOM itself was already an abstraction. So, Virtual DOM is an abstraction of an abstraction. :)

Why Web Developers interested in React Js?

The amount of JavaScript tools is steadily increasing, turning the selection of appropriate technology into a challenge. But why developers are most interested in React js among those libraries. Nowadays all the web applications are in SPAs. It means the DOM trees are huge nowadays, in turn we need to modify the DOM tree incessantly and a lot. This is a real performance and development pain. Consider a DOM made of thousands of divs. We have lots of methods that handle events - clicks, submits. What can do by the library like jQuery? jQuery will find every node interested on an event and update it if necessary It has two problems: It’s hard to manage and it’s inefficient. The solution to problem 1 is declarativeness. Instead of low-level techniques like traversing the DOM tree manually, you simple declare how a component should look like. But this doesn’t solve the performance issue. This is exactly where the Virtual DOM comes into action. First of all - the Virtual DOM was not invented

What is SPA?

Single-Page Applications (SPA) are Web apps that load a single HTML page and dynamically update that page as the user interacts with the app. SPAs use Javascript libraries and HTML5 to create fluid and responsive Web apps, without constant page reloads. However, this means much of the work happens on the client side, in JavaScript.