Sakshi Tyagi

Full stack software developer

Technology

Variable Hoisting In JavaScript

Javascript handles function and variable declartions quite differently and you must have got stuck in one of the awkard scenarios due to it. First of all, you should be familiar with Scoping in JavaScript. If you are, then you would know already that JavaScript only has function scopes and no block scopes. [js] var a = 'hello'; ...

12-Oct-2014

Technology

Explicitly providing ng-model to DOM elements

In AngularJS, we can easily write our own custom directives to achieve required functionality. There are certain attributes which we provide in directive definition like restrict , scope , template, link, transclude etc. There is one more attribute named : require , which gives us the liberty to include another directive and inject...

28-Jul-2014

Technology

A level ahead with text search in mongoDb

In our previous post, we saw how simply we could use the free text search feature from MongoDB. In continuation to that, in this post we would be looking at how can we create multiple text indexes and understand how actually the things work. Document Scoring MongoDB assigns a score to each of the document that contains the search term...

11-Jul-2014

Technology

Free text search in MongoDb

MongoDb introduced free text search beta in its v2.4 but it was in experimental phase. In v.2.6, MongoDb has finally made its free text search (the most requested feature) production ready. In this post, we will have a look at how can we use this pretty useful feature that MongoDb offers us. To enable Free text search, Mongodb...

30-Jun-2014

Node.js

Generate PDF in NodeJS using “node-phantom” module

PhantomJS is used to emulate browsers through command line, for generating PDFs, web page manipulation, headless testing and much more interesting stuff. Npm provides us a module called "node-phantom" which helps us to use PhantomJS in our NodeJS application in a non-fussy way. A prerequisite for using this module is, you must have...

27-Jun-2014

Technology

$sce in angular

In my Angular project, I came across a situation where i had to render some html markup, but the tricky thing was, the markup was contained in some angular scope variable. And when outputting it, it just printed out the html markup as basic text. A quick Google search informed me about the directive ng-bind-html and...

27-Apr-2014

Technology

Layouts in Dust.js

For building an application with user friendly and consistent UI, we generally use the concept of "master page" and "layouts", so that just the content can vary within the pages. This helps user to easily navigate through the website as well as faster loading of the web pages. For example, generally we make header and footer static...

12-Mar-2014

Technology

Dust your views

In our node js application, we can use variety of templating engines like "jade" , "ejs", "mustache" etc. Dust.js is an asynchronous templating engine which can be used both on server side as well as client side and provide easy caching with high performance. In my previous blog on EJS as a templating engine, i have mentioned how we...

11-Mar-2014

AngularJS, Front End Development

AngularJS : copy vs extend

While using AngularJS, you will usually come across this situation when you want to copy one object to another object. In such case you will have only two solutions: angular.copy() or angular.extend(). Lets see how these solutions work. 1. angular.copy(source, destination) : It creates a deep copy of source object or array and...

06-Feb-2014

Technology

Using EJS in your Node.JS application

EJS as the name implies embedded JavaScript, is a JavaScript templating library used to render html code along with JSON data in an easy and clean way. In a Node.JS application(here we are using an express application), you need to set the value of 'view engine' parameter to 'ejs'. [js] var app = express(); app.set('view engine',...

31-Jan-2014

AngularJS, Front End Development

Writting Your Own Filters In Angular JS

While using AngularJS, we come across situation in which we want to display some data in certain format or some specific condition to be applied on the data. In this case, filters comes to rescue. We can define our custom filters and return filtered data in whichever way we want to display it. Lets learn it through an example: ...

29-Jan-2014

Technology

Capped Collections In Mongodb

We can create collections in mongoDb on which we can apply size limit. These special type of collections are called Capped Collections. These are a kind of circular queues, in which if allocated size limit is reached, it makes space for new documents by overwriting the oldest documents in the collection. How to create Capped...

26-Jan-2014