Tutorial by Examples: com

The following method computes the sum of integers from 0 to N using recursion. public int sum(final int n) { if (n > 0) { return n + sum(n - 1); } else { return n; } } This method is O(N) and can be reduced to a simple loop using tail-call optimization. In f...
The following method computes the value of num raised to the power of exp using recursion: public long power(final int num, final int exp) { if (exp == 0) { return 1; } if (exp == 1) { return num; } return num * power(num, exp - 1); } This illustrates ...
Equality: value equality x == y (1 == 1.0 # true) value inequality x == y (1 != 1.0 # false) strict equality x === y (1 === 1.0 # false) strict inequality x === y (1 !== 1.0 # true) Comparison: x > y x >= y x < y x <= y If types are compatible, comparison uses natural o...
The complex entity complex, parameter :: x = (1., 4.) has real part 1. and complex part 4.. We can access these individual components as real(x) ! The real component aimag(x) ! The complex component x%re ! The real component y%im ! The complex component The x%.. form is new to F...
There are three types of comment: # This comment continues to the end of line -- This comment continues to the end of line /* This is an in-line comment */ /* This is a multiple-line comment */ Example: SELECT * FROM t1; -- this is comment CREATE TABLE stack( /*id_user int...
A common usecase for the ready() hook is to access the DOM, e.g. to initiate a Javascript plugin, get the dimensions of an element etc. The problem Due to Vue's asynchronous DOM update mechanism, it's not guaranteed that the DOM has been fully updated when the ready() hook is called. This usually ...
The use of Matlab Coder sometimes denies the use of some very common functions, if they are not compatible to C++. Relatively often there exist undocumented helper functions, which can be used as replacements. Here is a comprehensive list of supported functions.. And following a collection of alte...
Singleton Objects Scala supports static members, but not in the same manner as Java. Scala provides an alternative to this called Singleton Objects. Singleton objects are similar to a normal class, except they can not be instantiated using the new keyword. Below is a sample singleton class: object...
The = operator is used for assignment. The == operator is used for comparison. One should be careful not to mix the two. Sometimes one mistakenly writes /* assign y to x */ if (x = y) { /* logic */ } when what was really wanted is: /* compare if x is equal to y */ if (x == y) { ...
First you create a new Cordova project: cordova create HelloWorld my.application.identifier AppName This will create a blank Cordova project in the HelloWorld folder with identifier my.application.identifier (which should be unique for each application) with name AppName. Next you add th...
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <path d="M 10,10 L 100,50" stroke="blue" stroke-width="5" /> </svg> Result:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <path d="M 10,10 H 200" stroke="orange" stroke-width="5" /> </svg> Result:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <path d="M 10,10 l 90,90 M 100,10 l -90,90" stroke="red" stroke-width="10" /> </svg> Result:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <path d="M 10,10 V 200" stroke="green" stroke-width="5" /> </svg> Result:
Got to Tools | Options | Source Control | Visual Studio Team Foundation Server click on the Configure User Tools: You can add separate overrides for 'Compare' and 'Merge' operations. Click on Add and select the operation you want to override. You'd need to type the path to the tool you use, and ...
AngularJS directives are what controls the rendering of the HTML inside an AngularJS application. They can be an Html element, attribute, class or a comment. Directives are used to manipulate the DOM, attaching new behavior to HTML elements, data binding and many more. Some of examples of directives...
Python 2.x2.3 x = 'hello world!' vowels = [x for x in 'AEIOU'] print (vowels) # Out: ['A', 'E', 'I', 'O', 'U'] print(x) # Out: 'U' Python 3.x3.0 x = 'hello world!' vowels = [x for x in 'AEIOU'] print (vowels) # Out: ['A', 'E', 'I', 'O', 'U'] print(x) # Out: 'hello world!' ...
Everything to the right of // in the same line is commented. int i = 0; // Commented out text
.gitignore ignores files locally, but it is intended to be committed to the repository and shared with other contributors and users. You can set a global .gitignore, but then all your repositories would share those settings. If you want to ignore certain files in a repository locally and not make t...
Sent to a window procedure when: the user selects an item from a menu a control sends a notification to its parent window an accelerator keystroke is translated Message SourceHIWORD(wp)LOWORD(wp)lpMenu0Menu ID (IDM_*)0Accelerator1Accel ID (IDM_*)0Controlnotification codeControl idHWND of con...

Page 13 of 65