How do I use $scope.$watch and $scope.$apply in AngularJS?

How do I use $scope.$watch and $scope.$apply in AngularJS?

I don't understand how to use $scope.$watch and $scope.$apply. The official documentation isn't helpful.What I don't understand specifically:Are they connected to the DOM?How can I update DOM changes to the model?What is the connection poin

Why is there an unexplainable gap between these inline-block div elements?

Why is there an unexplainable gap between these inline-block div elements?

I have two inline-block div elements, that are the same, positioned next to eachother. However there seems to be a mysterious space of 4 pixels between the two divs despite the margin being set to 0. There are no parent divs effecting them

Why would a JavaScript variable start with a dollar sign?

Why would a JavaScript variable start with a dollar sign?

I quite often see JavaScript with variables that start with a dollar sign. When/why would you choose to prefix a variable in this way?(I'm not asking about $('p.foo') syntax that you see in jQuery and others, but normal variables like $name

How does “this” keyword work within a function?

How does “this” keyword work within a function?

I just came across an interesting situation in JavaScript. I have a class with a method that defines several objects using object-literal notation. Inside those objects, the this pointer is being used. From the behavior of the program, I

What is a segmentation fault?

What is a segmentation fault?

What is a segmentation fault? Is it different in C and C++? How are segmentation faults and dangling pointers related? 1:Segmentation fault is a specific kind of error caused by accessing memory that “does not belong to you.” It’s a help

Understanding garbage collection in .NET

Understanding garbage collection in .NET

Consider the below code:public class Class1{ public static int c; ~Class1() { c++; }}public class Class2{ public static void Main() { { var c1=new Class1(); //c1=null; // If this line is

Generating random whole numbers in JavaScript in a specific range?

Generating random whole numbers in JavaScript in a specific range?

How can I generate a random whole number between two specified variables in Javascript, e.g. x = 4 and y = 8 would output any of 4, 5, 6, 7, 8? 1:There are some examples on the Mozilla Developer Network page:/** * Returns a random number

What is a debugger and how can it help me diagnose problems?

What is a debugger and how can it help me diagnose problems?

This is intended to be a general purpose question to assist new programmers who have a problem with a program, but do not know how to use a debugger to diagnose the cause of the problem.This question covers two classes of more specific ques

What are advantages of using a one-to-one table relationship? (MySQL)

What are advantages of using a one-to-one table relationship? (MySQL)

What are advantages of using a one-to-one table relationship as opposed to simply storing all the data in one table? I understand and make use of one-to-many, many-to-one, and many-to-many all the time, but implementing a one-to-one relatio

Project not build in active configuration Visual Studio MacOS .net Core

Project not build in active configuration Visual Studio MacOS .net Core

I have created an Console Application(.Net Core) in Visual Studios MacOS Preview. In the project solution I don't see my program.cs also other things are not available it says Project not built in active configurationwhereas the project sol

How to view complete commits when tracking history of a single file in Git?

How to view complete commits when tracking history of a single file in Git?

I have a Git repository with about a two years of history in it. I have single file in it, for which I wish to find all the commits, and for each commit: all the other files that were committed in it. Let's assume this file is named file.tx

Naming convention and structure for utility classes and methods

Naming convention and structure for utility classes and methods

Do you have any input on how to organize and name utility classes?Whenever I run in to some code-duplication, could be just a couple of code lines, I move them to a utility class. After a while, I tend to get a lot of small static classes,

checkbox jquery or javascript oncheck?

checkbox jquery or javascript oncheck?

I do not know the correct terminology for this, but I want the same effect as onclick but for a check box with jquery or javascript.onclick version:LinkI want the same effect as above but for a checkbox. The end result will be that the page

VS 2012: Post Build xcopy error 2

VS 2012: Post Build xcopy error 2

i want to make VS copy the .lib-file it created after the build process to a specific folder.So i went to the project config, post-build event, and entered the following command:if exist $(TargetPath)xcopy "$(TargetPath)" "C:\Users\Incubbus

Rhino Mocks stubs and mocks are only good for interfaces?

Rhino Mocks stubs and mocks are only good for interfaces?

Is it correct that Rhino Mocks stubs and mocks are only good for interfaces, not concrete classes? I spent quite a time trying to make this piece of code working. I did not expect the stubbed pubSubClient to always call Send method from the

Javascript: How to truly reload a site with an anchor tag?

Javascript: How to truly reload a site with an anchor tag?

Take this code snippet for example:window.location.href = 'mysite.htm#images';Already being on the site mysite.htm and triggering the reload thru location.href won't reload the page but jump to the anchor named within the URL.I need a mecha

Python - Extracting inner most lists

Python - Extracting inner most lists

Just started toying around with Python so please bear with me :)Assume the following list which contains nested lists:[[[[[1, 3, 4, 5]], [1, 3, 8]], [[1, 7, 8]]], [[[6, 7, 8]]], [9]]In a different representation:[ [ [ [

“SELECT VALUE” - value keyword in LINQ/Entity Framework query

“SELECT VALUE” - value keyword in LINQ/Entity Framework query

What does the keyword "value" mean in this statement, and where would I go to learn more?What happens if I leave out the keyword "value"? In the code below, z is an entity framework class. string queryString = "SELECT VALUE q from x.zs as q

“Metadata information not found” while using EF4's POCO Template?

“Metadata information not found” while using EF4's POCO Template?

I just installed the POCO Template for EF4. I have a single entity in my model, AnnouncementText, and the T4 files seem to be properly generated. Attempting to access this new entity is throwing the following error when I access the auto-

How can I fix the T-SQL editor in VS 2012 after installing SQL Server 2012 SP1?

How can I fix the T-SQL editor in VS 2012 after installing SQL Server 2012 SP1?

I can suddenly no longer open .sql files in VS 2012 by simply double clicking in the Solution Explorer. I get the error message: Unable to open Transact-SQL file in custom editorI strongly suspect this is after installing SP1 for SQL Serve

Why is null not allowed for DateTime in C#?

Why is null not allowed for DateTime in C#?

Why it is not allowed to assign null to a DateTime in C#? How has this been implemented? And can this feature be used to make your own classes non-nullable?Example:string stringTest = null; // OkayDateTime dateTimeTest = null; // Compile er

SQL Server: IF EXISTS ; ELSE

SQL Server: IF EXISTS ; ELSE

I have a tableA:ID value 1 100 2 101 2 444 3 501Also TableB ID Code12Now I want to populate col = code of table B if there exists ID = 2 in tableA. for multiple values , get max value.else populate it with '123'. Now here is what I used

Array NullPointerException? [duplicate]

Array NullPointerException? [duplicate]

This question already has an answer here: What is a NullPointerException, and how do I fix it? 12 answers Ok. I don't get why my code is reporting a Nu

Backwards compatible PageTransformer

Backwards compatible PageTransformer

I'm trying to animate items in a ViewPager and the PageTransformer fits the bill. I want it to be backwards compatible to Android 2.2 so am using the support v4 library. However... As property animation is only supported as of Android 3.0

Drag and drop images in gridview in android

Drag and drop images in gridview in android

I'am developing a sample android application to learn about drag & drop in android. On start of the app, i'am displaying few images on a grid view. Now i need to drag one image at a time over to the place of another. After dropping an imag