Tutorial by Examples: c

public async Task<Product> GetProductAsync(string productId) { using (_db) { return await _db.QueryFirstOrDefaultAsync<Product>("usp_GetProduct", new { id = productId }, commandType: CommandType.StoredProcedure); } }
With this example, we will see how to load a color image from disk and display it using OpenCV's built-in functions. We can use the C/C++, Python or Java bindings to accomplish this. In C++: #include <opencv2/core.hpp> #include <opencv2/highgui.hpp> #include <iostream> usi...
prop_evenNumberPlusOneIsOdd :: Integer -> Property prop_evenNumberPlusOneIsOdd x = even x ==> odd (x + 1) If you want to check that a property holds given that a precondition holds, you can use the ==> operator. Note that if it's very unlikely for arbitrary inputs to match the precondit...
A try/catch block is used to catch exceptions. The code in the try section is the code that may throw an exception, and the code in the catch clause(s) handles the exception. #include <iostream> #include <string> #include <stdexcept> int main() { std::string str("foo&...
You can make an UILabel with a dynamic height using auto layout. You need to set the numberOfLines to zero (0), and add a minimal height by setting up a constraints with a relation of type .GreaterThanOrEqual on the .Height attribute iOS 6 Swift label.numberOfLines = 0 let heightConstraint = ...
The recommended way (Since ES5) is to use Array.prototype.find: let people = [ { name: "bob" }, { name: "john" } ]; let bob = people.find(person => person.name === "bob"); // Or, more verbose let bob = people.find(function(person) { return person.na...
Common mobile-optimized sites use the <meta name="viewport"> tag like this: <meta name="viewport" content="width=device-width, initial-scale=1"> The viewport element gives the browser instructions on how to control the page's dimensions and scaling based...
Assembly language is a human readable form of machine language or machine code which is the actual sequence of bits and bytes on which the processor logic operates. It is generally easier for humans to read and program in mnemonics than binary, octal or hex, so humans typically write code in assemb...
Syntax {condition-to-evaluate} ? {statement-executed-on-true} : {statement-executed-on-false} As shown in the syntax, the Conditional Operator (also known as the Ternary Operator1) uses the ? (question mark) and : (colon) characters to enable a conditional expression of two possible outcomes. It c...
To make express web application modular use router factories: Module: // greet.js const express = require('express'); module.exports = function(options = {}) { // Router factory const router = express.Router(); router.get('/greet', (req, res, next) => { res.end(options....
After receiving the arguments, you can print them as follows: int main(int argc, char **argv) { for (int i = 1; i < argc; i++) { printf("Argument %d: [%s]\n", i, argv[i]); } } Notes The argv parameter can be also defined as char *argv[]. argv[0] may co...
Selenium Grid Node configuration resides on the Node itself and holds the information about network configuration and Node capabilities. The configuration can be applied in various ways: Default Configuration JSON Configuration Command line Configuration JSON Configuration The node configur...
In Python 3 and higher, print is a function rather than a keyword. print('hello world!') # out: hello world! foo = 1 bar = 'bar' baz = 3.14 print(foo) # out: 1 print(bar) # out: bar print(baz) # out: 3.14 You can also pass a number of parameters to print: print(foo, bar, b...
There are several R packages to read excel files, each of which using different languages or resources, as summarized in the following table: R packageUsesxlsxJavaXLconnectJavaopenxlsxC++readxlC++RODBCODBCgdataPerl For the packages that use Java or ODBC it is important to know details about your s...
The standard doesn't specify if char should be signed or unsigned. Different compilers implement it differently, or might allow to change it using a command line switch.
Background threads cannot modify the UI; almost all UIKit methods must be called on the main thread. From a subclass of NSObject (including any UIViewController or UIView): InvokeOnMainThread(() => { // Call UI methods here }); From a standard C# class: UIApplication.SharedApplicat...
In general, most of the objects you would interact with as a user would tend to be a vector; e.g numeric vector, logical vector. These objects can only take in a single type of variable (a numeric vector can only have numbers inside it). A list would be able to store any type variable in it, making...
# example data test_sentences <- c("The quick brown fox", "jumps over the lazy dog") Is there a match? grepl() is used to check whether a word or regular expression exists in a string or character vector. The function returns a TRUE/FALSE (or "Boolean") vecto...
Head over to CMake download page and get a binary for your operating system, e.g. Windows, Linux, or Mac OS X. On Windows double click the binary to install. On Linux run the binary from a terminal. On Linux, you can also install the packages from the distribution's package manager. On Ubuntu 16.0...
(loop for i in '(one two three four five six) do (print i)) (loop for i in '(one two three four five six) by #'cddr do (print i)) ;prints ONE THREE FIVE (loop for i on '(a b c d e f g) do (print (length i))) ;prints 7 6 5 4 3 2 1 (loop for i on '(a b c d e f g) by #'cddr ...

Page 103 of 826