Tutorial by Examples: and

#include <stdio.h> #include <string.h> int main(void) { /* Always ensure that your string is large enough to contain the characters * and a terminating NUL character ('\0')! */ char mystring[10]; /* Copy "foo" into `mystring`, until a NUL character is en...
Starting with a given list a: a = [1, 2, 3, 4, 5] append(value) – appends a new element to the end of the list. # Append values 6, 7, and 7 to the list a.append(6) a.append(7) a.append(7) # a: [1, 2, 3, 4, 5, 6, 7, 7] # Append another list b = [8, 9] a.append(b) # a: [1, 2, 3, 4, ...
Note: The width and height attributes are not deprecated on images and never have been. Their use has been made much stricter though. The dimensions of an image can be specified using the width and height attributes of the image tag: <img src="images/200x200-img.png" width="2...
Syntax for accessing rows and columns: [, [[, and $ This topic covers the most common syntax to access specific rows and columns of a data frame. These are Like a matrix with single brackets data[rows, columns] Using row and column numbers Using column (and row) names Like a list: Wi...
A typical email has three main components: A recipient (represented as an email address) A subject A message body Sending mail in PHP can be as simple as calling the built-in function mail(). mail() takes up to five parameters but the first three are all that is required to send an email (al...
MATLAB allows for several methods to index (access) elements of matrices and arrays: Subscript indexing - where you specify the position of the elements you want in each dimension of the matrix separately. Linear indexing - where the matrix is treated as a vector, no matter its dimensions. That ...
Given some JSON file "foo.json" like: {"foo": {"bar": {"baz": 1}}} we can call the module directly from the command line (passing the filename as an argument) to pretty-print it: $ python -m json.tool foo.json { "foo": { "bar...
To create a variable in Python, all you need to do is specify the variable name, and then assign a value to it. <variable name> = <value> Python uses = to assign values to variables. There's no need to declare a variable in advance (or to assign a data type to it), assigning a value ...
Install the svn client to start collaborating on the project that is using Subversion as its version control system. To install Subversion, you can build it yourself from a source code release or download a binary package pre-built for your operating system. The list of sites where you can obtain a...
Ruby offers the expected if and else expressions for branching logic, terminated by the end keyword: # Simulate flipping a coin result = [:heads, :tails].sample if result == :heads puts 'The coin-toss came up "heads"' else puts 'The coin-toss came up "tails"' end ...
In Ruby, there are exactly two values which are considered "falsy", and will return false when tested as a condition for an if expression. They are: nil boolean false All other values are considered "truthy", including: 0 - numeric zero (Integer or otherwise) "&qu...
The Problem The abstract equality and inequality operators (== and !=) convert their operands if the operand types do not match. This type coercion is a common source of confusion about the results of these operators, in particular, these operators aren't always transitive as one would expect. &...
InterruptedException is a confusing beast - it shows up in seemingly innocuous methods like Thread.sleep(), but handling it incorrectly leads to hard-to-manage code that behaves poorly in concurrent environments. At its most basic, if an InterruptedException is caught it means someone, somewhere, c...
use feature qw( say ); # Numbers are true if they're not equal to 0. say 0 ? 'true' : 'false'; # false say 1 ? 'true' : 'false'; # true say 2 ? 'true' : 'false'; # true say -1 ? 'true' : 'false'; # true say 1-1 ? 'true' : 'false'; # fa...
The pipe operator, %>%, is used to insert an argument into a function. It is not a base feature of the language and can only be used after attaching a package that provides it, such as magrittr. The pipe operator takes the left-hand side (LHS) of the pipe and uses it as the first argument of the ...
Use putAll to put every member of one map into another. Keys already present in the map will have their corresponding values overwritten. Map<String, Integer> numbers = new HashMap<>(); numbers.put("One", 1) numbers.put("Three", 3) Map<String, Integer> othe...
Since Groups are "numbered" some engines also support matching what a group has previously matched again. Assuming you wanted to match something where two equals strings of length three are divided by a $ you'd use: (.{3})\$\1 This would match any of the following strings: "abc$...
See full documentation on LIKE operator. This example uses the Employees Table from the Example Databases. SELECT * FROM Employees WHERE FName LIKE 'John' This query will only return Employee #1 whose first name matches 'John' exactly. SELECT * FROM Employees WHERE FName like 'John%' Ad...
/* declare items of the enum */ #define FOREACH \ X(item1) \ X(item2) \ X(item3) \ /* end of list */ /* define the enum values */ #define X(id) MyEnum_ ## id, enum MyEnum { FOREACH }; #undef X /* convert an enum value to its identifier */ const char * enum2string(int...
docker run docker/whalesay cowsay 'Hello, StackExchange!' This command tells Docker to create a container from the docker/whalesay image and run the command cowsay 'Hello, StackExchange!' in it. It should print a picture of a whale saying Hello, StackExchange! to your terminal. If the entrypoin...

Page 10 of 153