I have joined Anti-IF Campaign

Angularjs Best Practices : create controller

How to create secure and safe controller in Angularjs :


// Use strict mode globally to secure the code and speed up the execution
"use strict";

// Use anonymous function to not pollute the global scope
(function() {

// Declare new module
angular.module('mymod', []);

// Declare new controller with a standard javascript function
// to encourage IDE completion and simplify javascript code understanding
var myCtrl = function($scope, $http) {
 $scope.text = 'hello world';
};

// Explicitly define the dependencies required for controller to be insensitive to the minification
myCtrl.$inject = ['$scope', '$http'];

// Recover a module using its name without pollute the global context of unnecessary variables
angular.module('mymod').controller('myctrl', myCtrl);

})();


See that in action : jsfiddle

Deploy MongoDB shard cluster on Windows in one click.

Deploy MongoDB shard cluster on Linux is very easy with fork option (http://docs.mongodb.org/manual/reference/program/mongod/).
But if you want to do that on Windows (yes i know ...), it's a little bit more complicated.

In this post, i will show you how to use batch and javascript to easily deploy MongoDB (without Windows service).

Html5 LocalFileSystem polymer webcomponent

Purpose of this tutorial :


Develop a web component based on polymer and the Html5 Filesystem & FileWriter API.
Sorry but this web component works only on Chrome.