Posts

Showing posts from March, 2017
Hi Folks, Object literal notation Object literal notation, which we also cover in the Module pattern section, can be thought of as an object containing a collection of key-value pairs with a colon separating each pair of keys and values, where keys can also represent new namespaces. eg: var appMyapp = {}; appMyapp.foo = function(){ return "bar"; } appMyapp.utills = fuction(){ toString:function(){ }, }
Hi Folks, Prefix Namespacing in Javascript. One solution to the above problem, as mentioned by  Peter Michaux , is to use prefix namespacing. It’s a simple concept at heart, but the idea is we select a unique prefix namespace we wish to use (in this example,  myApplication_ ) and then define any methods, variables, or other objects after the prefix as follows: var myapplication_property1 = {}; var myapplication_property2 = {}; function myapplication_method(){ //..... }
Hi Folks, Namespacing in Javascript Single Global Variable: One popular pattern for namespacing in JavaScript is opting for a single global variable as our primary object of reference. A skeleton implementation of this where we return an object with functions and properties can be found below: var myApp = (function () {       function(){        //......       }, return{       //......       } })
Hi Folks,  There are two ways to store the data in HTML as object locally: LocalStorage -store data across session access SessionStorage -store data for current session only Data will be stored in key/value pair format. eg: localStorage.empid = "420"; SessionStorage.companyname = "hi ";
Hi Folks, In pattern matching is so useful for me. Actually i use grep for filtering (or) pattern matching. for eg: ls -l | grep "Hello "
SERVER-SIDE PDF GENERATION AND ANGULAR $RESOURCE I ran into a problem recently where my Angular application needed to consume an API call that returned a PDF response. Apparently there are options to generate PDF documents client-side, such as Mozilla's  PDF.js , but in this case I had no control over the data. The scenario looked like this: Send a HTTP request with an Accept header of  application/pdf  and expect to recieve a PDF byte-stream response. Allow the user to download this PDF from their browser after making the call. I had no access to the server in this scenario since my Angular application is stateless and relies primarily on ngResource to consume external API payloads. I simply wanted the user to click a "Download PDF" button and have the browser prompt them to download the file. I managed to accomplish this by adding a new method to the ngResource object: pdf: { method: 'GET' , headers: { accept: 'application/pdf...
Hi Folks, Linux vi editor is a wonderful one, for copy the full line yy and paste p . 
Linux grep command   find . -name *.html|xargs grep "search" This command is for, grep the value from that path inside the file also it will search.