Tutorial by Examples: cv

If logic of generic class or method requires checking equality of values having generic type, use EqualityComparer<TType>.Default property: public void Foo<TBar>(TBar arg1, TBar arg2) { var comparer = EqualityComparer<TBar>.Default; if (comparer.Equals(arg1,arg2) {...
Functions within a class can be overloaded for when they are accessed through a cv-qualified reference to that class; this is most commonly used to overload for const, but can be used to overload for volatile and const volatile, too. This is because all non-static member functions take this as a hi...
When creating a nested class, you face a choice of having that nested class static: public class OuterClass1 { private static class StaticNestedClass { } } Or non-static: public class OuterClass2 { private class NestedClass { } } At its core, static nested c...
db.posts.find().forEach(function(doc){ if(!doc.foo){ db.posts.update({_id: doc._id}, {$set:{'foo':'bar'}}, false, true); } });
db.posts.find().forEach(function(doc){ if(doc.foo === 'bar'){ db.posts.remove({_id: doc._id}); } });
db.posts.find().forEach(function(doc){ if(doc.foo === 'bar'){ db.posts.update({_id: doc._id}, {$set:{'foo':'squee'}}, false, true); } });
When referring to gcc's documentation, you should know which version of gcc you are running. The GCC project has a manual for each version of gcc which includes features that are implemented in that version. Use the '-v' option to determine the version of gcc you are running. gcc -v Example Ou...
You can use the following code for going back and forward. if (!function_exists('mb_internal_encoding')) { function mb_internal_encoding($encoding = NULL) { return ($from_encoding === NULL) ? iconv_get_encoding() : iconv_set_encoding($encoding); } } if (!function_exists('mb_c...
This is a step-by-step guide to installing OpenCV 3 on a Debian-based Linux system from source. The steps should stay the same for other distros, just replace the relevant package manager commands when installing packages for the build. Note: If you don't feel like wasting time building stuff or di...
The result of casting a pointer to an integer using reinterpret_cast is implementation-defined, but "... is intended to be unsurprising to those who know the addressing structure of the underlying machine." int x = 42; int* p = &x; long addr = reinterpret_cast<long>(p); std::...
By default, npm installs the latest available version of modules according to each dependencies' semantic version. This can be problematic if a module author doesn't adhere to semver and introduces breaking changes in a module update, for example. To lock down each dependencies' version (and the ve...
UML is not about diagramming. It is about choosing the right words to express some (in most cases technical) context. Diagrams are a means to present the chosen text to humans since a visual perception is generally a good way to convey information. So you will be using graphical elements not in orde...
A Static variable declared locally is not destructed and does not lose its value when the Sub procedure is exited. Subsequent calls to the procedure do not require re-initialization or assignment although you may want to 'zero' any remembered value(s). These are particularly useful when late bindin...
PM> uninstall-Package EntityFramework -Version 6.1.2
You can use void (instead of Task) as a return type of an asynchronous method. This will result in a "fire-and-forget" action: public void DoStuff() { FireAndForgetAsync(); } private async void FireAndForgetAsync() { await Task.Delay(1000); throw new Exception(); ...
Within the context of an individual rule, Make automatically defines a number of special variables. These variables can have a different value for each rule in a makefile and are designed to make writing rules simpler. These variables can only be used in the recipe portion of a rule. VariableDesc...
Asynchronous validators allows you to validate form information against your backend (using $http). These kind of validators are needed when you need to access server stored information you can't have on your client for various reasons, such as the users table and other database information. To us...
We install OpenCV 3.1.0 on Windows and get started. There are two ways to install OpenCV on windows. One is to download the installer and run it. Other is to build from source. This is the easiest way to install OpenCV and get started. OpenCV gives pre-build binaries to install on Windows here. Aft...
Sometimes you need to replace a value matching a pattern with a new value that's based on that specific match, making it impossible to predict the new value. For these types of scenarios, a MatchEvaluator can be very useful. In PowerShell, a MatchEvaluator is as simple as a scriptblock with a singl...
A library can be 'pinned' to a specific version of Scala using the % operator between the groupId and the artifactId (the first two strings in a library dependency). In this example, we pin the library with the artifactId of slick to Scala version 2.10: libraryDependencies += "com.typesafe.sl...

Page 2 of 4