How to properly reference local resources in HTML?

A leading slash tells the browser to start at the root directory. If you don’t have the leading slash, you’re referencing from the current directory. If you add two dots before the leading slash, it means you’re referencing the parent of the current directory. Take the following folder structure notice: the ROOT checkmark is green, … Read more

Is this std::ref behaviour logical?

A small modification to f2 provides the clue: template<class T> void f2(T arg) { arg.get() = xx; } This now does what you expect. This has happened because std::ref returns a std::reference_wrapper<> object. The assignment operator of which rebinds the wrapper. (see http://en.cppreference.com/w/cpp/utility/functional/reference_wrapper/operator%3D) It does not make an assignment to the wrapped reference. In the … Read more

What would be a “Hello, World!” example for “std::ref”?

You should think of using std::ref when a function: takes a template parameter by value copies/moves a template parameter, such as std::bind or the constructor for std::thread. std::ref creates a copyable value type that behaves like a reference. This example makes demonstrable use of std::ref. #include <iostream> #include <functional> #include <thread> void increment( int &x … Read more

C++ Difference between std::ref(T) and T&?

Well ref constructs an object of the appropriate reference_wrapper type to hold a reference to an object. Which means when you apply: auto r = ref(x); This returns a reference_wrapper and not a direct reference to x (ie T&). This reference_wrapper (ie r) instead holds T&. A reference_wrapper is very useful when you want to … Read more

Assigning out/ref parameters in Moq

For ‘out’, the following seems to work for me. public interface IService { void DoSomething(out string a); } [TestMethod] public void Test() { var service = new Mock<IService>(); var expectedValue = “value”; service.Setup(s => s.DoSomething(out expectedValue)); string actualValue; service.Object.DoSomething(out actualValue); Assert.AreEqual(expectedValue, actualValue); } I’m guessing that Moq looks at the value of ‘expectedValue’ when you … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)