Tutorial by Examples: er

Floating point literals are used to represent signed real numbers. The following suffixes can be used to specify type of a literal: SuffixTypeExamplesnonedouble3.1415926 -3E6f, Ffloat3.1415926f 2.1E-6Fl, Llong double3.1415926L 1E126L In order to use these suffixes, the literal must be a floating p...
Character literals are a special type of integer literals that are used to represent one character. They are enclosed in single quotes, e.g. 'a' and have the type int. The value of the literal is an integer value according to the machine's character set. They do not allow suffixes. The L prefix bef...
When executing a Bash script, parameters passed into the script are named in accordance to their position: $1 is the name of the first parameter, $2 is the name of the second parameter, and so on. A missing parameter simply evaluates to an empty string. Checking for the existence of a parameter can...
There are some functions to help tear down Free computations by interpreting them into another monad m: iterM :: (Functor f, Monad m) => (f (m a) -> m a) -> (Free f a -> m a) and foldFree :: Monad m => (forall x. f x -> m x) -> (Free f a -> m a). What are they doing? First l...
Interfaces can seem abstract until you seem them in practice. The IComparable and IComparable<T> are great examples of why interfaces can be helpful to us. Let's say that in a program for a online store, we have a variety of items you can buy. Each item has a name, an ID number, and a price. ...
page.html - source code <html> <head> <script src="loadData.js"></script> </head> <body onLoad="loadData()"> <div class="container"> <table id="data" border="1"> <...
VB now allows string literals that split over multiple lines. Old syntax: Dim text As String = "Line1" & Environment.NewLine & "Line2" New syntax: Dim text As String = "Line 1 Line 2"
In Object Oriented Programming a common task is to compose objects (values). In Functional Programming it is as common task to compose values as well as functions. We are used to compose values from our experience of other programming languages using operators like +, -, *, / and so on. Value co...
In a statically typed language like F# we work with types well-known at compile-time. We consume external data sources in a type-safe manner using type providers. However, occassionally there's need to use late binding (like dynamic in C#). For instance when working with JSON documents that have...
Named Types Dim someInstance As New SomeClass(argument) With { .Member1 = value1, .Member2 = value2 '... } Is equivalent to Dim someInstance As New SomeClass(argument) someInstance.Member1 = value1 someInstance.Member2 = value2 '... Anonymous Types (Option...
Arrays Dim names = {"Foo", "Bar"} ' Inferred as String() Dim numbers = {1, 5, 42} ' Inferred as Integer() Containers (List(Of T), Dictionary(Of TKey, TValue), etc.) Dim names As New List(Of String) From { "Foo", "Bar" '... ...
You might expect a Python dictionary to be sorted by keys like, for example, a C++ std::map, but this is not the case: myDict = {'first': 1, 'second': 2, 'third': 3} print(myDict) # Out: {'first': 1, 'second': 2, 'third': 3} print([k for k in myDict]) # Out: ['second', 'third', 'first'] Py...
This example demonstrates POSIX Timer usage with CLOCK_REALTIME clock and SIGEV_THREAD notification method. #include <stdio.h> /* for puts() */ #include <string.h> /* for memset() */ #include <unistd.h> /* for sleep() */ #include <stdlib.h> /* for EXIT_SUCCESS */ #inc...
The main app file loads any routes files in which you would like to define routes. To do so we need the following directory structure: app.js routes/index.js routes/users.js app.js var express = require('express'); var app = express(); app.use('/', require('./routes/index')); app.use('/us...
Normally Android-SQLiteOpenHelper does not allow fully qualified path names where the database should be stored. So public database files are not possible. You can use the SQLiteOpenHelper with a custom path if you provide a custom ContextClass and if you have write access in the target directory. ...
Mockito provides a Matcher<T> interface along with an abstract ArgumentMatcher<T> class to verify arguments. It uses a different approach to the same use-case than the ArgumentCaptor. Additionally the ArgumentMatcher can be used in mocking too. Both use-cases make use of the Mockito.argT...
Pooling provides a higher level abstraction of the Worker functionality, including the management of references in the way required by pthreads. From: http://php.net/manual/en/class.pool.php Pools and workers provide an higher level of control and ease of creating multi-threaded <?php // T...
The UMD (Universal Module Definition) pattern is used when our module needs to be imported by a number of different module loaders (e.g. AMD, CommonJS). The pattern itself consists of two parts: An IIFE (Immediately-Invoked Function Expression) that checks for the module loader that is being i...
An example of "before" middleware would be as follows: <?php namespace App\Http\Middleware; use Closure; class BeforeMiddleware { public function handle($request, Closure $next) { // Perform action return $next($request); } } while &quot...
Iterator methods can be broken into two distinct groups: Adapters Adapters take an iterator and return another iterator // Iterator Adapter // | | let my_map = (1..6).map(|x| x * x); println!("{:?}", my_map); Output Map { iter: 1..6 } Note that the v...

Page 200 of 417