Skip to main content

Posts

Javascript Programming Basics.

Javascript Programming Basics. Difference between Primitive values and Reference values ? JavaScript has 6 primitive data types:  String ,  Number ,  Boolean ,  Null ,  Undefined ,  Symbol.  A  String  object wraps around a string primitive. All primitives are immutable. Primitive Values Reference Values Values that are stored on stack Values that are stored on heap. Values are stored directly to the location that variables accessing Values are stored in variable location is a pointer to a location in memory where the objects is stored. Undefined, null, Number, Boolean and string objects It's values, they have no properties. Objects are aggregation of properties

Difference between NPM and NPX

NPM Vs NPX npm  - Javascript package manager npx  - Execute npm package binaries https://docs.npmjs.com/files/folders#executables If you use  npm 5.1 or earlier , you can't use npx. Instead, install create-react-app globally: npm install -g create-react-app Now you can run: create-react-app my-app NPM: One might install a package locally on a certain project: npm install some - package Now let's say you want NodeJS to execute that package from the command line: $ some - package The above will  fail . Only  globally installed  packages can be executed by typing their name  only . To fix this, and have it run, you must type the local path: $ ./ node_modules /. bin / some - package You can technically run a locally installed package by editing your  packages.json  file and adding that package in the  scripts  section: { "name" : "whatever" , "version" : "1.0.0" , "scripts" : { ...

Find mutual friends count from given relation ship array. Substantive Expertise

This is a good example of the “substantive expertise” aspect of data science. users = [     { "id": 0, "name": "Hero" },     { "id": 1, "name": "Dunn" },     { "id": 2, "name": "Sue" },     { "id": 3, "name": "Chi" },     { "id": 4, "name": "Thor" },     { "id": 5, "name": "Clive" },     { "id": 6, "name": "Hicks" },     { "id": 7, "name": "Devin" },     { "id": 8, "name": "Kate" },     { "id": 9, "name": "Klein" } ] friendship_pairs = [(0, 1), (0, 2), (1, 2), (1, 3), (2, 3), (3, 4),                     (4, 5), (5, 6), (5, 7), (6, 8), (7, 8), (8, 9)] # Initialize the dict with an empty list for each user id: friendships = {user["id"]: [] for user in users} # And ...

Authentication in MVC

using System; using System.Web; using System.Web.Http; using System.Web.Mvc; using System.Web.Routing; using System.Web.Optimization; using System.Web.Security; using System.Web.Script.Serialization; using DynamicProject.Utility.Security; using System.Configuration; namespace DynamicProject.Web {         public class MvcApplication : System.Web.HttpApplication     {         protected void Application_Start()         {             AreaRegistration.RegisterAllAreas();             WebApiConfig.Register(GlobalConfiguration.Configuration);             FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);             RouteConfig.RegisterRoutes(RouteTable.Routes);             BundleConfig.RegisterBundles(BundleTable.Bundles); ...