Tutorial by Examples: def

C++14 Those following complex user literals are declared in the namespace std::literals::complex_literals, where both literals and complex_literals are inline namespaces. Access to these operators can be gained with using namespace std::literals, using namespace std::complex_literals, and using nam...
class SortDataObject extends DataObject { private static $db = array( 'Name' => 'Varchar', 'SortOrder' => 'Int' ); private static $default_sort = 'SortOrder DESC'; }
When should I use it When the code inside an inline listener is too big and your method / class becomes ugly and hard to read You want to perform same action in various elements (view) of your app To achieve this you need to create a class implementing one of the listeners in the View API. ...
Some LINQ methods return a query object. This object does not hold the results of the query; instead, it has all the information needed to generate those results: var list = new List<int>() {1, 2, 3, 4, 5}; var query = list.Select(x => { Console.Write($"{x} "); return ...
To show and hide a FloatingActionButton with the default animation, just call the methods show() and hide(). It's good practice to keep a FloatingActionButton in the Activity layout instead of putting it in a Fragment, this allows the default animations to work when showing and hiding. Here is an ...
package main import ( "fmt" "net/http" "os" "text/template" ) var requestTemplate string = ` {{range $i, $url := .URLs}} {{ $url }} {{(status_code $url)}} {{ end }}` type Requests struct { URLs []string } func main() {...
class Foldable t where {-# MINIMAL foldMap | foldr #-} foldMap :: Monoid m => (a -> m) -> t a -> m foldMap f = foldr (mappend . f) mempty foldr :: (a -> b -> b) -> b -> t a -> b foldr f z t = appEndo (foldMap (Endo #. f) t) z -- and a nu...
class (Functor t, Foldable t) => Traversable t where {-# MINIMAL traverse | sequenceA #-} traverse :: Applicative f => (a -> f b) -> t a -> f (t b) traverse f = sequenceA . fmap f sequenceA :: Applicative f => t (f a) -> f (t a) sequenceA = t...
The format of the struct statement is this: struct [structure tag] { member definition; member definition; ... member definition; } [one or more structure variables]; Example: declare the ThreeFloats structure: typedef struct { float x, y, z; } ThreeFloats; @inter...
PhpStorm offers default settings for code styling for a large amount of languages based on best practices and common standards. But you can customize the styling for each language on a per-project base within the PhpStorm Settings > Editor > Code Style. Schemes Schemes are collections of ...
PhpStorm already ships with a lot of predefined language schemes that are based on common code style guidelines and standards like PSR-2. There is kind of a hidden feature in the code style settings pages where you can import these standards and set them as your current configuration. To do so simp...
Hooks are defined in the application/config/hooks.php file. Each hook is specified as an array with this prototype $hook['pre_controller'] = array( 'class' => 'MyClass', 'function' => 'Myfunction', 'filename' => 'Myclass.php', 'filepath' => 'h...
(Wikipedia) Bioinformatics is an interdisciplinary field that develops methods and software tools for understanding biological data. As an interdisciplinary field of science, bioinformatics combines computer science, statistics, mathematics, and engineering to analyze and interpret biological dat...
User-defined method objects may be created when getting an attribute of a class (perhaps via an instance of that class), if that attribute is a user-defined function object, an unbound user-defined method object, or a class method object. class A(object): # func: A user-defined function object...
To define the struct called Person with an integer type variable age, integer type variable height and float type variable ageXHeight: struct Person { int age; int height; float ageXHeight; } Generally: struct structName { /+ values go here +/ }
MY_CONSTANT = "Hello, world" # constant Constant = 'This is also constant' # constant my_variable = "Hello, venus" # not constatn Constant name start with capital letter. Everything that start with capital letter are considered as constant in Ruby. So class and module are al...
def say_hi MESSAGE = "Hello" puts MESSAGE end The above code results in an error: SyntaxError: (irb):2: dynamic constant assignment.
class Message DEFAULT_MESSAGE = "Hello, world" def speak(message = nil) if message puts message else puts DEFAULT_MESSAGE end end end The constant DEFAULT_MESSAGE can be changed with the following code: Message::DEFAULT_MESSAGE = "Hullo, wo...
You should already have your backend REST resource available. On the client side (GWT) your need to Add RestyGwt dependency to your project with maven <dependency> <groupId>org.fusesource.restygwt</groupId> <artifactId>restygwt</artifactId> <vers...
Informally, a monad is a container of elements, notated as F[_], packed with 2 functions: flatMap (to transform this container) and unit (to create this container). Common library examples include List[T], Set[T] and Option[T]. Formal definition Monad M is a parametric type M[T] with two operatio...

Page 12 of 27