Tutorial by Examples: al

Imagine you are on the master branch and something is not working as expected (a regression was introduced), but you don't know where. All you know is, that is was working in the last release (which was e.g., tagged or you know the commit hash, lets take old-rel here). Git has help for you, finding...
Will provide the total number of records processed in the current awk instance. cat > file1 suicidesquad harley quinn joker deadshot cat > file2 avengers ironman captainamerica hulk awk '{print NR}' file1 file2 1 2 3 4 5 6 7 8 A total on 8 records were processed in th...
Single file plugin Put the file under $HOME/.vim/plugin or $HOME/vimfiles/plugin This would source the plugin on startup of Vim. Now the user could use everything defined in it. If the plugin however needs activation, the user either has to execute the command themselves whenever they want to use...
The factorial of a number (denoted with !, as for instance 9!) is the multiplication of that number with the factorial of one lower. So, for instance, 9! = 9 x 8! = 9 x 8 x 7! = 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1. So in code that becomes, using recursion: long Factorial(long x) { if (x < 1...
As we know we can declare an array with default values: int[] arr = new int[10]; This will create an array of 10 integers with each element of the array having value 0 (the default value of type int). To create an array initialized with a non-default value, we can use Enumerable.Repeat from the...
You might have heard that everything in Python is an object, even literals. This means, for example, 7 is an object as well, which means it has attributes. For example, one of these attributes is the bit_length. It returns the amount of bits needed to represent the value it is called upon. x = 7 ...
<svg width="800px" height="600px"> <defs> <filter id="greyscale"> <feColorMatrix type="matrix" values="0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0...
<svg width="800px" height="600px"> <defs> <filter id="greyscale"> <feColorMatrix type="matrix" values="0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 ...
OVERVIEW cocos2d-x is an open source, cross-platform game engine. It allows developers to code in C++, Lua and Javascript deployment into iOS, Android, Windows Phone, Mac OS X, Windows Desktop and Linux. PREREQUISITES Build Requirements Mac OS X 10.7+, Xcode 4.6+ Windows 7+, VS 2012+ Ubunt...
/*(8)*/ SELECT /*9*/ DISTINCT /*11*/ TOP /*(1)*/ FROM /*(3)*/ JOIN /*(2)*/ ON /*(4)*/ WHERE /*(5)*/ GROUP BY /*(6)*/ WITH {CUBE | ROLLUP} /*(7)*/ HAVING /*(10)*/ ORDER BY /*(11)*/ LIMIT The order in which a query is processed and description of each section. V...
HTML and Form Builder is not a core component since Laravel 5, so we need to install it separately: composer require laravelcollective/html "~5.0" Finally in config/app.php we need to register the service provider, and the facades aliases like this: 'providers' => [ // ... ...
Partial classes provide an ability to split class declaration (usually into separate files). A common problem that can be solved with partial classes is allowing users to modify auto-generated code without fearing that their changes will be overwritten if the code is regenerated. Also multiple devel...
Padding Remember, members of a struct are usually padded to ensure they are aligned on their natural boundary: struct t { int a, b, c, d; // a is at offset 0, b at 4, c at 8, d at 0ch char e; // e is at 10h short f; // f is at 12h (naturally aligned) lo...
Python will implicitly convert any object to a Boolean value for testing, so use it wherever possible. # Good examples, using implicit truth testing if attr: # do something if not attr: # do something # Bad examples, using specific types if attr == 1: # do something if att...
When Intel designed the original x86, the 8086 (and 8088 derivative), they included Segmentation to allow the 16-bit processor to access more than 16 bits worth of address. They did this by making the 16-bit addresses be relative to a given 16-bit Segment Register, of which they defined four: Code S...
TextInputDialog allows the to ask the user to input a single String. TextInputDialog dialog = new TextInputDialog("42"); dialog.setHeaderText("Input your favourite int."); dialog.setTitle("Favourite number?"); dialog.setContentText("Your favourite int: ");...
Related to Monads are F# computation expressions (CE). A programmer typically implements a CE to provide an alternative approach to chaining Monads, ie instead of this: let v = m >>= fun x -> n >>= fun y -> return_ (x, y) You can write this: let v = ce { let! x = m ...
Most programming languages, including F#, evaluate computations immediately in accord with a model called Strict Evaluation. However, in Lazy Evaluation, computations are not evaluated until they are needed. F# allows us to use lazy evaluation through both the lazy keyword and sequences. // define ...
F#, like most programming languages, uses Strict Evaluation by default. In Strict Evaluation, computations are executed immediately. In contrast, Lazy Evaluation, defers execution of computations until their results are needed. Moreover, the results of a computation under Lazy Evaluation are cached,...
Sometimes it is desirable to evaluate a nullable expression in an if-else fashion. The elvis operator, ?:, can be used in Kotlin for such a situation. For instance: val value: String = data?.first() ?: "Nothing here." The expression above returns "Nothing here" if data?.firs...

Page 96 of 269