This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$response = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Model Tree Structures in MongoDB | |
URL :http://docs.mongodb.org/manual/tutorial/model-tree-structures/#model-tree-structures-with-materialized-paths | |
To model hierarchical or nested data relationships, you can use references to implement tree-like structures. The following Tree pattern examples model book categories that have hierarchical relationships. | |
Model Tree Structures with Child References | |
(link) | |
The Child References pattern stores each tree node in a document; in addition to the tree node, document stores in an array the id(s) of the node’s children. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//first in main controller | |
var myApp = angular.module('starter.controllers', []); | |
myApp.constant('mySettings', { | |
apiUri: '/api/foo', | |
nsUri: 'mySite/foo.xsd', | |
nsPrefix: 's' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//in the controller | |
getEmail = function() { | |
var email = { | |
firstName: "Abhijit", | |
lastName: "Gaikwad", | |
address: "[email protected]", | |
subject: "Something interesting", | |
body: "Hey there, i m testing sending email in angular" | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//in the mail controller | |
var myApp = angular.module('starter.controllers', []); | |
myApp.filter('escape', function() { | |
return window.escape; | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add following to the controller | |
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$http({ | |
url: user.details_path, | |
method: "GET", | |
params: {user_id: user.id} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.use(function(req, res, next) { | |
res.header("Access-Control-Allow-Origin", "*"); | |
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); | |
next(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static List<ArrayList<Integer>> arrayCombinations(int[] inputArr) { | |
List<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>(); | |
result.add(new ArrayList<Integer>()); | |
for (int i = 0; i < inputArr.length; i++) { | |
ArrayList<ArrayList<Integer>> current = new ArrayList<ArrayList<Integer>>(); | |
for (ArrayList<Integer> local : result) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Arrays.copyOfRange(oldArray, startIndex, endIndex); |