Tutorial by Examples: al

There are two ways of creating aliases in Git: with the ~/.gitconfig file: [alias] ci = commit st = status co = checkout with the command line: git config --global alias.ci "commit" git config --global alias.st "status" git config --global alias....
There is a complementary function for filter in the itertools-module: Python 2.x2.0.1 # not recommended in real use but keeps the example valid for python 2.x and python 3.x from itertools import ifilterfalse as filterfalse Python 3.x3.0.0 from itertools import filterfalse which works...
Both the math and cmath-module contain the Euler number: e and using it with the builtin pow()-function or **-operator works mostly like math.exp(): import math math.e ** 2 # 7.3890560989306495 math.exp(2) # 7.38905609893065 import cmath cmath.e ** 2 # 7.3890560989306495 cmath.exp(2) # (...
The math module contains the expm1()-function that can compute the expression math.e ** x - 1 for very small x with higher precision than math.exp(x) or cmath.exp(x) would allow: import math print(math.e ** 1e-3 - 1) # 0.0010005001667083846 print(math.exp(1e-3) - 1) # 0.0010005001667083846 p...
Click the Run button in the toolbar (or press ⌘R) to build & run your project. Click Stop (or press ⌘.) to stop execution.   Click & hold to see the other actions, Test (⌘U), Profile (⌘I), and Analyze (⇧⌘B). Hold down modifier keys ⌥ option, ⇧ shift, and ⌃ control for more variants.  ...
CREATE TABLE HR_EMPLOYEES ( PersonID int, LastName VARCHAR(30), FirstName VARCHAR(30), Position VARCHAR(30) ); CREATE TABLE FINANCE_EMPLOYEES ( PersonID INT, LastName VARCHAR(30), FirstName VARCHAR(30), Position VARCHAR(30) ); Let's say we want to ...
You can list existing git aliases using --get-regexp: $ git config --get-regexp '^alias\.' Searching aliases To search aliases, add the following to your .gitconfig under [alias]: aliases = !git config --list | grep ^alias\\. | cut -c 7- | grep -Ei --color \"$1\" "#" The...
dict have no builtin method for searching a value or key because dictionaries are unordered. You can create a function that gets the key (or keys) for a specified value: def getKeysForValue(dictionary, value): foundkeys = [] for keys in dictionary: if dictionary[key] == value: ...
CSS enclosed in <style></style> tags within an HTML document functions like an external stylesheet, except that it lives in the HTML document it styles instead of in a separate file, and therefore can only be applied to the document in which it lives. Note that this element must be insid...
To check the equality of Date values: var date1 = new Date(); var date2 = new Date(date1.valueOf() + 10); console.log(date1.valueOf() === date2.valueOf()); Sample output: false Note that you must use valueOf() or getTime() to compare the values of Date objects because the equality operato...
Rebasing reapplies a series of commits on top of another commit. To rebase a branch, checkout the branch and then rebase it on top of another branch. git checkout topic git rebase master # rebase current branch onto master branch This would cause: A---B---C topic / D---E---F---G...
The system header TargetConditionals.h defines several macros which you can use from C and Objective-C to determine which platform you're using. #import <TargetConditionals.h> // imported automatically with Foundation - (void)doSomethingPlatformSpecific { #if TARGET_OS_IOS // code t...
To have Git ignore certain files across all repositories you can create a global .gitignore with the following command in your terminal or command prompt: $ git config --global core.excludesfile <Path_To_Global_gitignore_file> Git will now use this in addition to each repository's own .git...
int foo(void) { /* do stuff */ /* no return here */ } int main(void) { /* Trying to use the (not) returned value causes UB */ int value = foo(); return 0; } When a function is declared to return a value then it has to do so on every possible code path through it. Undefined beh...
alias word='command' Invoking word will run command. Any arguments supplied to the alias are simply appended to the target of the alias: alias myAlias='some command --with --options' myAlias foo bar baz The shell will then execute: some command --with --options foo bar baz To include mul...
alias -p will list all the current aliases.
The type of the literal Prelude> :t 1 1 :: Num a => a choosing a concrete type with annotations You can specify the type as long as the target type is Num with an annotation: Prelude> 1 :: Int 1 it :: Int Prelude> 1 :: Double 1.0 it :: Double Prelude> 1 :: Word 1 it :: ...
The type of the literal Prelude> :t 1.0 1.0 :: Fractional a => a Choosing a concrete type with annotations You can specify the type with a type annotation. The only requirement is that the type must have a Fractional instance. Prelude> 1.0 :: Double 1.0 it :: Double Prelude> 1....
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char **argv) { /* Exit if no second argument is found. */ if (argc != 2) { puts("Argument missing."); return EXIT_FAILURE; } size_t len = str...
A function can return one or more values to the caller: func AddAndMultiply(a, b int) (int, int) { return a+b, a*b } The second return value can also be the error var : import errors func Divide(dividend, divisor int) (int, error) { if divisor == 0 { return 0, errors.New(...

Page 9 of 269