Tutorial by Examples

By default Controllers, ViewComponents and TagHelpers aren't registered and resolved via the dependency injection container. This results in the inability to do i.e. property injection when using a 3rd party Inversion of Control (IoC) container like AutoFac. In order to make ASP.NET Core MVC resolv...
dispatch_group_t preapreWaitingGroup = dispatch_group_create(); dispatch_group_enter(preapreWaitingGroup); [self doAsynchronousTaskWithComplete:^(id someResults, NSError *error) { // Notify that this task has been completed. dispatch_group_leave(preapreWaitingGroup); }] dispatch...
Difference from PHP Array PHP's default Array type is actually implemented as ordered hash maps, which allow us to create arrays that consist of key/value pairs where values can be of any type and keys can be either numbers or strings. This is not traditionally how arrays are created, however. S...
Prerequisites Have a strong grasp of a programming language such as Python, C, C++, Ruby, or any of the other languages out there. Have your favorite code editor or IDE installed (one such example is VSCode) Stay motivated. Constructing a compiler is not easy, so keep pushing; it's worth the ef...
In Google Chrome's developer tools "Elements", you can see that the selected line shows ==$0 that is the DOM node index(as shown below): $0 returns the most recently selected element or JavaScript object, $1 returns the second most recently selected one, and so on. This is useful ...
#include <ctype.h> #include <stdio.h> typedef struct { size_t space; size_t alnum; size_t punct; } chartypes; chartypes classify(FILE *f) { chartypes types = { 0, 0, 0 }; int ch; while ((ch = fgetc(f)) != EOF) { types.space += !!isspace(ch); types.al...
#include <ctype.h> #include <stddef.h> typedef struct { size_t space; size_t alnum; size_t punct; } chartypes; chartypes classify(const char *s) { chartypes types = { 0, 0, 0 }; const char *p; for (p= s; p != '\0'; p++) { types.space += !!isspace((unsigned ...
Configuration Log4j configuration file can be in any of these formats: JSON YAML properties (text file) XML Configuration discovery Log4j will inspect the log4j.configurationFile system property and, if set, will attempt to load the configuration. If no system property is set log4j wil...
For example, we have two environments: CI - Staging and want to add some customizations for each environment. Here I will try to customize server URL, app name. First, we create two targets for 2 environments by duplicating the main target: For each target, we will define a custom macro. Here I ...
C++ #include "opencv2/objdetect/objdetect.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include <iostream> #include <stdio.h> using namespace std; using namespace cv; // Function Headers void detectAndDisp...
There is a useful package in Python - chardet, which helps to detect the encoding used in your file. Actually there is no program that can say with 100% confidence which encoding was used - that's why chardet gives the encoding with the highest probability the file was encoded with. Chardet can dete...
You can nest enumerations one inside an other, this allows you to structure hierarchical enums to be more organized and clear. enum Orchestra { enum Strings { case violin case viola case cello case doubleBasse } enum Keyboards { case...
This example has more tests available in unit testing. Employee.vb (Class Library) ''' <summary> ''' Employee Class ''' </summary> Public Class Employee ''' <summary> ''' First name of employee ''' </summary> Public Property FirstName As String = &q...
Animation to show how selection sort works Below example shows selection sort in ascending order: public class MySelectionSort { public static int[] doSelectionSort(int[] arr){ for (int i = 0; i < arr.length - 1; i++) { int index = i; ...
Many Flask applications are developed in a virtualenv to keep dependencies for each application separate from the system-wide Python installation. Make sure that mod-wsgi is installed in your virtualenv: pip install mod-wsgi Then create a wsgi wrapper for your Flask application. Usually it's kep...
The advantage of using Apache over the builtin werkzeug server is that Apache is multi-threaded, meaning that multiple connections to the application can be made simultaneously. This is especially useful in applications that make use of XmlHttpRequest (AJAX) on the front-end. /etc/apache2/sites-ava...
To set the environment to Development SET ASPNETCORE_ENVIRONMENT=Development Now running an Asp.Net Core application will be in the defined environment. Note There should be no space before and after the equality sign =. The command prompt should not be closed before running the application b...
Homebrew calls itself 'the missing package manager for macOS'. It can be used to build and install applications and libraries. Once installed, you can use the brew command to install PostgreSQL and it's dependencies as follows: brew update brew install postgresql Homebrew generally installs the...
The single line comment begins with "//" or "#". When encountered, all text to the right will be ignored by the PHP interpreter. // This is a comment # This is also a comment echo "Hello World!"; // This is also a comment, beginning where we see "//" ...
The multi-line comment can be used to comment out large blocks of code. It begins with /* and ends with */. /* This is a multi-line comment. It spans multiple lines. This is still part of the comment. */

Page 930 of 1336