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

How to change the href for a hyperlink using jQuery

How to change the href for a hyperlink using jQuery

How can you change the href for a hyperlink using jQuery? 1:$("a").attr("href", "http://www.google.com/")...Will modify the href of all hyperlinks to point to Google. You probably want a somewhat more refined selector though. For instanc

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

Convert matrix to 3-column table ('reverse pivot', 'unpivot', 'flatten'

Convert matrix to 3-column table ('reverse pivot', 'unpivot', 'flatten'

I need to convert the Excel matrix FIRST in the table LATER: FIRST: P1 P2 P3 P4F1 XF2 X XF3 X XF4 X XLATER:F P VALUEF1 P1 XF1 P2F1 P3F1 P4F2 P1 XF2 P2 XF2 P3F2

event.preventDefault() vs. return false

event.preventDefault() vs. return false

When I want to prevent other event handlers from executing after a certain event is fired, I can use one of two techniques. I'll use jQuery in the examples, but this applies to plain-JS as well:1. event.preventDefault()$('a').click(function

protected data in abstract class

protected data in abstract class

My question involves specifically Java, abstract classes, and the use of protected data. I am being told that all the data should be private, and protected getters/setters used only.Now, I understand we want to shield data from direct mani

Which HTTP code to use for an empty subresource in a REST API?

Which HTTP code to use for an empty subresource in a REST API?

Let's say I've a resource articles at /articles.These articles may have related articles, so I fetch them by GETting /articles/{id}/related.What should I return is there is no related articles?I can think of:404 Not Found, maybe with an emp

How can I stop an IFrame reloading when I change it's position in the DOM?

How can I stop an IFrame reloading when I change it's position in the DOM?

Is there any way to stop an Iframe re-loading it's contents when I change it's position within the DOM? Simple example:

org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]A child cont

org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]A child cont

I am struggling for the past 6-7 hrs trying to figure out what went wrong with my Apache Tomcat Server. In all of my projects, the jdk version got switched to 1.6 from 1.8. To solve the version conflict, I verified whether compiled version

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

BinaryWrite exception “OutputStream is not available when a custom TextWriter is used” in MVC 2 ASP.

BinaryWrite exception “OutputStream is not available when a custom TextWriter is used” in MVC 2 ASP.

I have a view rendering a stream using the response BinaryWrite method. This all worked fine under ASP.NET 4 using the Beta 2 but throws this exception in the RC release: "HttpException" , "OutputStream is not available when a custom Tex

AngularJS + Django: URL refresh or direct access not loading correctly

AngularJS + Django: URL refresh or direct access not loading correctly

We have AngularJS embedded into our Django application, with URL routing handled by AngularJS ui-router. All is working fine navigating between partials using ui-sref and clicking around within the application.return $stateProvider.state('r

Text was truncated or one or more characters had no match in the target code page including the prim

Text was truncated or one or more characters had no match in the target code page including the prim

I'm trying to import a flat file into an oledb target sql server database.here's the field that's giving me trouble:here are the properties of that flat file connection, specifically the field:here's the error message: [Source - 1894297910

Hotlink resources like JavaScript files directly from GitHub [duplicate]

Hotlink resources like JavaScript files directly from GitHub [duplicate]

This question already has an answer here: Link and execute external JavaScript file hosted on GitHub 12 answers I asked a question about including reso

Is there a Scala unit test tool that integrates well with Maven?

Is there a Scala unit test tool that integrates well with Maven?

My company is beginning to write some code using Scala. I've been moved onto this project, and am a big fan of TDD, so I would like to get a unit-testing framework in place. However, the build system we're using for this project is Maven,

CSS using negative relative positioning issue

CSS using negative relative positioning issue

I have a header, mainbody and footer. Header and mainbody are properly styled. Now for footer I want to make it appear behind mainbody, so I used:z-index: -1;position: relative;top: -60px;This gives the desired result, but I get an extra sp

Asp.Net MVC3 RC Razor views : syntax for embedding code inside  block

Asp.Net MVC3 RC Razor views : syntax for embedding code inside block

Having trouble embedding c# code inside a javascript block with MVC3 RC1 razor view. What syntax should I use to make this working? I get warnings eg. Expected constant on the isOk variable among other. (Without text tag, the following code

iOS Google+ Safari cannot open page because address is invalid

iOS Google+ Safari cannot open page because address is invalid

I have two apps one is free and another is paid version. I have implemented google+ share on paid and its working fine. But when I copied code to my free version it doesn't work. I have one Google apis project and added two clients for both

How to use Querystring with $location.path() in AngularJS

How to use Querystring with $location.path() in AngularJS

I want to redirect user to another page after successful login using query string. If I copy & paste to browser's address bar http://example.com/#/login?ref=/path/to/redirect it works fine. But if I use$location.path("/login?ref=/path/to/re

Should I return bool or const bool?

Should I return bool or const bool?

Which is better:bool MyClass::someQuery() const;const bool MyClass::someQuery() const;I've been using 'const bool' since I'm sure I remember hearing it's "what the ints do" (for e.g. comparison operators) but I can't find evidence of that a

Jupyter: can't create new notebook?

Jupyter: can't create new notebook?

I have some existing Python code that I want to convert to a Jupyter notebook. I have run: jupyter notebookNow I can see this in my browser:But how do I create a new notebook? The Notebook link in the menu is greyed out, and I can't see any

jquery: submit form after a value is selected from dropdown

jquery: submit form after a value is selected from dropdown

I have this form in my html: anybody knows how to submit it when a value is selected in the 'themes' dropdown ? 1:The other solutions will submit all forms on the page, if there should be any. Better would be:$(function() { $('#the

Dotless failing to compile ; in Bootstrap 3 less source

Dotless failing to compile ; in Bootstrap 3 less source

I use dotless 1.3.1.0 compiling less-files. This worked fine with bootstrap 2.x, but after switching to bootstrap 3.0.0 (downloaded the source from here: http://getbootstrap.com/getting-started/), I suddenly get this error: Expected ')' bu

Print all variables available in a Smarty template

Print all variables available in a Smarty template

How do you print all variables available in the context of a Smarty template? Something like the Django debug trace that lists everything being passed.Thanks 1:Use {debug} From the manual: {debug} dumps the debug console to the page. T

How to show multiple images in one figure?

How to show multiple images in one figure?

I use Python lib matplotlib to plot functions, and I know how to plot several functions in different subplots in one figure, like this one, And when handling images, I use imshow() to plot images, but how to plot multiple images together in