Tutorial by Examples: c

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. */
Assume your data examples are already read to a python's variable and you would like to read it n times, in batches of given size: import numpy as np import tensorflow as tf data = np.array([1, 2, 3, 4, 5]) n = 4 To merge data in batches, possibly with random shuffling, you can use tf.train.b...
OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library. It was built for various purpose such as machine learning, computer vision, algorithm, mathematical operations, video capturing, image processing etc. Over the years it has become ve...
Objective C: view.backgroundColor = [UIColor redColor]; Swift: view.backgroundColor! = UIColor.redColor() Swift 3 view.backgroundColor = UIColor.redColor
local collections are not allowed in select statements. Hence the first step is to create a schema level collection. If the collection is not schema level and being used in SELECT statements then it would cause "PLS-00642: local collection types not allowed in SQL statements" CREATE OR R...
When mapping our entities to database table names we rely on a @Table annotation. But if we have a naming convention for our database table names, we can implement a custom physical naming strategy in order to tell hibernate to calculate table names based on the names of the entities, without explic...
In bash, you have to quote arguments in order to preserve white space: # bash function print_first_argument { echo "$1" } argument="has white space" print_first_argument "$argument" In Zsh, you don't need the quotes, because of different evaluation orde...
A pattern rule is indicated by a single % character in the target. The % matches a non-empty string called the stem. The stem is then substituted for every % that appears in the prerequisite list. For example, this rule: %.o: %.c $(CC) $(CFLAGS) -c $< -o $@ Will match any target ending ...
If a target matches multiple pattern rules, make will use the one whose prerequisites exist or can be built. For example: %.o: %.c $(CC) $(CFLAGS) -c $< -o $@ %.o: %.s $(AS) $(ASFLAGS) $< -o $@ Will compile foo.c to foo.o or assemble foo.s to foo.o, depending on which one of foo...
If the target pattern doesn't contain slashes, make will remove the directory part from the target it's trying to build before matching. The directory will then be put in front of the stem. When the stem is used to build the target name and prerequisites, the directory part is stripped from it, the ...
Passing a 2d array to a functions seems simple and obvious and we happily write: #include <stdio.h> #include <stdlib.h> #define ROWS 3 #define COLS 2 void fun1(int **, int, int); int main() { int array_2D[ROWS][COLS] = { {1, 2}, {3, 4}, {5, 6} }; int n = ROWS; int m...
If you want to add a UIImageView to the center of the screen with width and height of 100 pixel, you need to set center x constraint and center y constraint to the superview from the UIImageView and width, height constraint to the UIIMageView. Here is the code. There is way to do this in storyboard ...
A NullReferenceException is thrown when you try to access a non-static member (property, method, field or event) of a reference object but it is null. Car myFirstCar = new Car(); Car mySecondCar = null; Color myFirstColor = myFirstCar.Color; // No problem as myFirstCar exists / is not null Color...
PHPUnit provides the following functions to watch for thrown exceptions, which were released with 5.2.0: expectException($exception) expectExceptionMessage($message) expectExceptionCode($code) expectExceptionMessageRegExp($messageRegExp) These are used to watch for an exception to be thrown...

Page 580 of 826