Tutorial by Examples: def

Current updates the branch on the remote repository that shares a name with the current working branch. git config push.default current Simple pushes to the upstream branch, but will not work if the upstream branch is called something else. git config push.default simple Upstream pushes to t...
A compound literal is an unnamed object which is created in the scope where is defined. The concept was first introduced in C99 standard. An example for compound literal is Examples from C standard, C11-§6.5.2.5/9: int *p = (int [2]){ 2, 4 }; p is initialized to the address of the first ele...
The Preview pane displays default values for data binding expressions if provided. For example : android:layout_height="@{@dimen/main_layout_height, default=wrap_content}" It will take wrap_content while designing and will act as a wrap_content in preview pane. Another example i...
Default config is configured in import org.fusesource.restygwt.client.Defaults; Service root. By default, RestyGWT will use module name to get rest service root, to change it, call on module load: Defaults.setServiceRoot("/rest/"); Date format. By default, RestyGWT will send u...
The Object.freeze() method is available since version 5.1. For older versions, you can use the following code (note that it also works in versions 5.1 and later): var ColorsEnum = { WHITE: 0, GRAY: 1, BLACK: 2 } // Define a variable with a value from the enum var currentColor = Co...
There are a number of predefined global variables that you can set in the front matter of a page or post. VariableDescriptionlayoutIf set, this specifies the layout file to use. Use the layout file name without the file extension. Layout files must be placed in the _layouts directory.permalinkIf y...
Add a init.gradle to your user gradle folder. The init.gradle is recognized on every project. Unix: ~/.gradle/init.gradle These are also alternative locations where init script can be placed and loaded automatically:- Any *.gradle file in USER_HOME/.gradle/init.d Any *.gradle file in t...
[ContractClass(typeof(ValidationContract))] interface IValidation { string CustomerID{get;set;} string Password{get;set;} } [ContractClassFor(typeof(IValidation))] sealed class ValidationContract:IValidation { string IValidation.CustomerID { [Pure] get ...
This linker error happens, if the linker can't find a used symbol. Most of the time, this happens if a used library is not linked against. qmake: LIBS += nameOfLib cmake: TARGET_LINK_LIBRARIES(target nameOfLib) g++ call: g++ -o main main.cpp -Llibrary/dir -lnameOfLib One might also for...
Classes are vital aspects of OOP. A class is like the "blueprint" of an object. An object has the properties of a class, but the characteristics are not defined within the class itself. As each object can be different, they define their own characteristics. Public Class Person End Class ...
Since Laravel version 5.2.31 the web middleware is applied by default within the RouteServiceProvider (https://github.com/laravel/laravel/commit/5c30c98db96459b4cc878d085490e4677b0b67ed) In app/Providers/RouteServiceProvider.php you will find the following functions which apply the middleware on ev...
Casting: The Basics Casting is used to transform data from long to wide format. Starting with a long data set: DT = data.table(ID = rep(letters[1:3],3), Age = rep(20:22,3), Test = rep(c("OB_A","OB_B","OB_C"), each = 3), Result = 1:9) We can cast our data using the...
Methods are defined with the def keyword, followed by the method name and an optional list of parameter names in parentheses. The Ruby code between def and end represents the body of the method. def hello(name) "Hello, #{name}" end A method invocation specifies the method name, the...
We can use $q to defer operations to the future while having a pending promise object at the present, by using $q.defer we create a promise that will either resolve or reject in the future. This method is not equivalent of using the $q constructor, as we use $q.defer to promisify an existing routin...
In Racket, we use recursion very frequently. Here is an example of a function that sums all of the numbers from zero to the parameter, n. (define (sum n) (if (zero? n) 0 (+ n (sum (sub1 n))))) Note that there are many helpful convenience based functions used here, such as ...
qmake is a build automation tool, which is shipped with Qt framework. It does similar job to tools such as CMake or GNU Autotools, but it is designed to be used specifically with Qt. As such it is well integrated with Qt ecosystem, notably Qt Creator IDE. If you start Qt Creator and select File -&g...
It is possible to define a data type with field labels. data Person = Person { age :: Int, name :: String } This definition differs from a normal record definition as it also defines *record accessors which can be used to access parts of a data type. In this example, two record accessors are de...
There are two ways to define an anonymous function: the full syntax and a shorthand. Full Anonymous Function Syntax (fn [x y] (+ x y)) This expression evaluates to a function. Any syntax you can use with a function defined with defn (&, argument destructuring, etc.), you can also do with wi...
Enums are defined by the following the syntax above. typedef NS_ENUM(NSUInteger, MyEnum) { MyEnumValueA, MyEnumValueB, MyEnumValueC, }; You also can set your own raw-values to the enumeration types. typedef NS_ENUM(NSUInteger, MyEnum) { MyEnumValueA = 0, MyEnumValueB =...
Official page: https://www.rebar3.org/ Source code: https://github.com/erlang/rebar3 Rebar3 is mainly a dependency manager for Erlang and Elixir projects, but it also offers several other features, like bootstrapping projects (according to several templates, following the OTP principles), task exe...

Page 13 of 27