ng serve does not work

The key is to have both global and local Angular-cli versions the same. Let’s say we want to fixate it to eg. 1.0.0-beta.15. So you can try to fixate the version in npm install -g [email protected] and in your package.json fixate it to the same version: “angular-cli”: “1.0.0-beta.15”. Then run npm install –save-dev. Currently Angular CLI can be found on NPM under @angular/cli instead of angular-cli. Here are links … Read more

How to replace local branch with remote branch entirely in Git?

Make sure you’ve checked out the branch you’re replacing (from Zoltán’s comment). Assuming that master is the local branch you’re replacing, and that “origin/master” is the remote branch you want to reset to:git reset –hard origin/master This updates your local HEAD branch to be the same revision as origin/master, and –hard will sync this change into the index … Read more

Simple Random Samples from a Sql database

There’s a very interesting discussion of this type of issue here: http://www.titov.net/2005/09/21/do-not-use-order-by-rand-or-how-to-get-random-rows-from-table/ I think with absolutely no assumptions about the table that your O(n lg n) solution is the best. Though actually with a good optimizer or a slightly different technique the query you list may be a bit better, O(m*n) where m is the number … Read more

difference between ‘static int’ and ‘int’ in java

Take a look here: Understanding Instance and Class Members When a number of objects are created from the same class blueprint, they each have their own distinct copies of instance variables. (…) Sometimes, you want to have variables that are common to all objects. This is accomplished with the static modifier. Fields that have the static modifier … Read more

Astonishing that no answer addresses or mentions the actual problem here. The CSS selector button #rock says “give me an element with the id rock inside a <button> element”, like this: But what you wanted is a <button> element with the id rock. And the selector for that would be button#rock (note the missing space between button and #rock). And as @Greg already mentioned: #rock is already specific enough to target the button and … Read more

What is the difference between ASP.NET and ASP.NET MVC?

ASP.NET MVC2 web application is based on MVC pattern in order to facilitate unit test, without mocking pipeline asp.net, because it’s very difficult. you don’t have code on Code Behind in order to separate your code graphic and your code functional. With MVC your application become independent from view. you can replace easily technology of … Read more

Sorting arrays in javascript by object key value

Use Array.prototype.sort(), eg The sort() method accepts a comparator function. This function accepts two arguments (both presumably of the same type) and it’s job is to determine which of the two comes first. It does this by returning an integer Negative (less-than zero): The first argument comes first Positive (greater-than zero): The second argument comes first Zero: The arguments are considered … Read more