Posts

Responsive ui

To create responsive ui Following steps To set view port Html 5 tag This one sets width is device width size use media queries in css3 @media only screen and (max-width: 768px) {     /* For mobile phones: */      .header{        width : 200px;      } } Mobile orientaion view : Potrait / Landscape @media only screen and (orientation: landscape) {     body {         background-color: lightblue;     } }

Wrap external http request in node js

Wrap external http request in node js var http = require('http'); var url = require('url').URL; var shimmer = require('shimmer') var api = {} api.wrapEmitter = require('emitter-listener') var Origional = http.get; shimmer.wrap(http, 'get', function getWrap(get) {     return makeRequestTrace(get); }) function makeRequestTrace(request) {     return function trace(options, callback) {         var req = request.call(this, options, function (res) {             console.log('Response===================' , res)             shimmer.wrap(res, 'on', function onWrap(on) {                 return function on_trace(eventName, cb) {                     if (eventName === 'data') {                         on.call(this, 'data', func...

one way binding vs two way binding

Image
React is one way binding (Uni directional) and its used for View layer Angular is  two way binding and follows MVC pattern One-way binding (React) When properties in the model get updated, so does the UI. Only one watcher exist Virtual dom https: //www.codecademy.com/articles/react-virtual-dom http://reactkungfu.com/2015/10/the-difference-between-virtual-dom-and-dom/ Two-way binding (Angular js) When properties in the model get updated, so does the UI. When UI elements get updated, the changes get propagated back to the model. When angular sets up databinding two "watchers" exist

Application monitoring tool essentials and links

basic APM tool should monitor 1. Down time of the applications 2. Capture  the slow responses 3. Compare the response time metrics for before commit  vs after commit  4. Show distributed transactions (Call trace) 5. Alerting the security issues (Ex: If external library has the security issue then it should indicate the alert )  Good Nodejs  APM  tools https://www.appdynamics.com/ https://newrelic.com/ https://www.dynatrace.com/ https://opbeat.com/ https://www.instana.com/ https://traceview.solarwinds.com/ https://risingstack.com/

__proto__ vs prototype

The  __proto__  property of  Object.prototype  is an accessor property (a getter function and a setter function) that exposes the internal  [[Prototype]]  (either an object or  null ) of the object through which it is accessed. __proto__  is the actual object that is used in the lookup chain to resolve methods, etc.  prototype  is the object that is used to build  __proto__  when you create an object with  new : _proto_ var parent = {   color : 'white' } var child = {} child  = Object.create(parent) child.color //White parent.color = 'black' child.color  // 'black' because of _proto_ chain Prototype function   Soldier ( )   { } Soldier . prototype  =   {   weapons :   [ 'rifle' ,   'grenade' ,   'bayonet' ] ,   weaponOfChoice :   'rifle' } ; var  GIJoe  =   new   Soldier ( ) ; var  Ram...

Inheritance in nodejs

To inherit the properties we can use util.inherits method var util  = require('util') util.inherits(child, parent) /**  * Inherit the prototype methods from one constructor into another.  *  * The Function.prototype.inherits from lang.js rewritten as a standalone  * function (not on Function.prototype). NOTE: If this file is to be loaded  * during bootstrapping this function needs to be rewritten using some native  * functions as prototype setup using normal JavaScript does not work as  * expected during bootstrapping (see mirror.js in r114903).  *  * @param {function} ctor Constructor function which needs to inherit the  * prototype.  * @param {function} superCtor Constructor function to inherit prototype from.  */ exports.inherits = function(ctor, superCtor) {     ctor.super_ = superCtor;     ctor.prototype = Object.create(superCtor.prototype, {         const...

Install mysql in Zip format

Run mysql zip file in windows 1. First create the my.ini 2. Add the paths in myini file    [mysqld] # set basedir to your installation path basedir=E:\\mysql # set datadir to the location of your data directory datadir=E:\\mydata\\data 3. Run mysqld    It will find defaultly my.ini file.    mysqld   --initialize or --initialize-insecure      After completes it created some files in data folder 4. Run sql server    mysqld  --console    mysql -u root  //Default user root https://dev.mysql.com/doc/refman/5.7/en/windows-create-option-file.html Reset the password 1. Create file mysql-ini.txt and add these 2. Add contents  mysql-ini.txt   ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';   SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass'); based on versions Run command mysqld --init-file=D:\\docs\\databases\\sql\\mysql-5.7.10-winx64\\mysql-5.7.10-wi...