Tutorial by Examples

void function_with_try_block() try { // try block body } catch (...) { // catch block body } Which is equivalent to void function_with_try_block() { try { // try block body } catch (...) { // catch block body } } Note t...
struct A { ~A() noexcept(false) try { // destructor body } catch (...) { // exceptions of destructor body are caught here // if no exception is thrown here // then the caught exception is re-thrown. } }; Note that, although this...
Transformations are done with respect to a point which is defined by the transform-origin property. The property takes 2 values : transform-origin: X Y; In the following example the first div (.tl) is rotate around the top left corner with transform-origin: 0 0; and the second (.tr)is transformed ...
With Maven you can create Vaadin project with vaadin-archetype-application archetype. You can also add that archetype in IDE to create maven project with IDE. mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=7....
Function application syntax in Elm does not use parenthesis or commas, and is instead whitespace-sensitive. To define a function, specify its name multiplyByTwo and arguments x, any operations after equal sign = is what returned from a function. multiplyByTwo x = x * 2 To call a function, ...
Elm has a special syntax for lambda expressions or anonymous functions: \arguments -> returnedValue For example, as seen in List.filter: > List.filter (\num -> num > 1) [1,2,3] [2,3] : List number More to the depth, a backward slash, \, is used to mark the beginning of lambda ex...
It is possible to define local variables inside a function to reduce code repetition give name to subexpressions reduce the amount of passed arguments. The construct for this is let ... in .... bigNumbers = let allNumbers = [1..100] isBig number = ...
It is very convenient to use extension methods with interfaces as implementation can be stored outside of class and all it takes to add some functionality to class is to decorate class with interface. public interface IInterface { string Do() } public static class ExtensionMethods{ pu...

Mac

Ruby comes pre-installed on a Mac computer. Follow the instructions below to install Sass: Open CMD Run gem install sass If you get an error message, try sudo gem install sass Check it works using sass -v
Ruby will need to be installed first before setup. You can install Ruby through the apt package manager, rbenv, or rvm. Then Run sudo su -c "gem install sass"
The fastest way to get Ruby on your Windows computer is to use Ruby Installer. It's a single-click installer that will get everything set up for you super fast. After installing Ruby, follow the instructions below to install Sass: Open CMD Run gem install sass If you get an error message, try s...
File streams are buffered by default, as are many other types of streams. This means that writes to the stream may not cause the underlying file to change immediately. In oder to force all buffered writes to take place immediately, you can flush the stream. You can do this either directly by invokin...
dotimes is a macro for integer iteration over a single variable from 0 below some parameter value. One of the simples examples would be: CL-USER> (dotimes (i 5) (print i)) 0 1 2 3 4 NIL Note that NIL is the returned value, since we did not provide one ourselves; the v...
dolist is a looping macro created to easily loop through the lists. One of the simplest uses would be: CL-USER> (dolist (item '(a b c d)) (print item)) A B C D NIL ; returned value is NIL Note that since we did not provide return value, NIL is returned (and A,B,C,D are ...
List employees earning more than $50000 born this century. List their name, date of birth and salary, sorted alphabetically by name. SELECT employee_name, date_of_birth, salary FROM employees WHERE salary > 50000 AND date_of_birth >= DATE '2000-01-01' ORDER BY employee_name; Show...
Method chaining is a programming strategy that simplifies your code and beautifies it. Method chaining is done by ensuring that each method on an object returns the entire object, instead of returning a single element of that object. For example: function Door() { this.height = ''; this.w...
Installation The preferred way to install Mockito is to declare a dependency on mockito-core with a build system of choice. As of July 22nd, 2016, the latest non-beta version is 1.10.19, but 2.x is already encouraged to be migrated to. Maven <dependency> <groupId>org.mockito</...
In [1]: df1 = pd.DataFrame({'x': [1, 2, 3], 'y': ['a', 'b', 'c']}) In [2]: df2 = pd.DataFrame({'y': ['b', 'c', 'd'], 'z': [4, 5, 6]}) In [3]: df1 Out[3]: x y 0 1 a 1 2 b 2 3 c In [4]: df2 Out[4]: y z 0 b 4 1 c 5 2 d 6 Inner join: Uses the intersection ...
When you inherit from a class with a property, you can provide a new implementation for one or more of the property getter, setter or deleter functions, by referencing the property object on the parent class: class BaseClass(object): @property def foo(self): return some_calculate...
The following example listens to window.onerror event and uses an image beacon technique to send the information through the GET parameters of an URL. var hasLoggedOnce = false; // Some browsers (at least Firefox) don't report line and column numbers // when event is handled through window.addE...

Page 252 of 1336