Tutorial by Examples: du

A Sub is a procedure that performs a specific task but does not return a specific value. Sub ProcedureName ([argument_list]) [statements] End Sub If no access modifier is specified, a procedure is Public by default. A Function is a procedure that is given data and returns a value, ideally...
The core concepts of RxJava are its Observables and Subscribers. An Observable emits objects, while a Subscriber consumes them. Observable Observable is a class that implements the reactive design pattern. These Observables provide methods that allow consumers to subscribe to event changes. The ev...
If you have a type definition file (d.ts) for the module, you can use an import statement. import _ = require('lodash'); If you don't have a definition file for the module, TypeScript will throw an error on compilation because it cannot find the module you are trying to import. In this case, yo...
Exceptions are errors which occur when a program is executing. Consider the Java program below which divides two integers. class Division { public static void main(String[] args) { int a, b, result; Scanner input = new Scanner(System.in); System.out.println(&qu...
To duplicate a table, simply do the following: CREATE TABLE newtable LIKE oldtable; INSERT newtable SELECT * FROM oldtable;
In AS3, display assets are not visible until they are added to the Display List. The AIR/Flash runtime has a hierarchical display structure (parent child relationship where children can have their own children), with the stage being the top level parent. To add something to the display list, you u...
Module Pattern The Module pattern is a creational and structural design pattern which provides a way of encapsulating private members while producing a public API. This is accomplished by creating an IIFE which allows us to define variables only available in its scope (through closure) while return...
Data frames are likely the data structure you will used most in your analyses. A data frame is a special kind of list that stores same-length vectors of different classes. You create data frames using the data.frame function. The example below shows this by combining a numeric and a character vector...
Lists allow users to store multiple elements (like vectors and matrices) under a single object. You can use the list function to create a list: l1 <- list(c(1, 2, 3), c("a", "b", "c")) l1 ## [[1]] ## [1] 1 2 3 ## ## [[2]] ## [1] "a" "b" &q...
stri_dup("abc",3) # [1] "abcabcabc" A base R solution that does the same would look like this: paste0(rep("abc",3),collapse = "") # [1] "abcabcabc"
You can specify different application IDs or package names for each buildType or productFlavor using the applicationIdSuffix configuration attribute: Example of suffixing the applicationId for each buildType: defaultConfig { applicationId "com.package.android" minSdkVersion 17 ...
Stored procedures can be created through a database management GUI (SQL Server example), or through a SQL statement as follows: -- Define a name and parameters CREATE PROCEDURE Northwind.getEmployee @LastName nvarchar(50), @FirstName nvarchar(50) AS -- Define the query to be...
This function lets you iterate over the Cartesian product of a list of iterables. For example, for x, y in itertools.product(xrange(10), xrange(10)): print x, y is equivalent to for x in xrange(10): for y in xrange(10): print x, y Like all python functions that accept a v...
Fortran 2003 introduced intrinsic modules which provide access to special named constants, derived types and module procedures. There are now five standard intrinsic modules: ISO_C_Binding; supporting C interoperability; ISO_Fortran_env; detailing the Fortran environment; IEEE_Exceptions, IEEE_...
EXTENDED_ARG = 145 # All opcodes greater than this have 2 operands HAVE_ARGUMENT = 90 # All opcodes greater than this have at least 1 operands cmp_op = ('<', '<=', '==', '!=', '>', '>=', 'in', 'not in', 'is', 'is ... # A list of comparator id's. The indecies are used as opera...
To disassemble a Python module, first this has to be turned into a .pyc file (Python compiled). To do this, run python -m compileall <file>.py Then in an interpreter, run import dis import marshal with open("<file>.pyc", "rb") as code_f: code_f.read(8) # M...
In Fortran functions and subroutines need to be explicitly declared as recursive, if they are to call themselves again, directly or indirectly. Thus, a recursive implementation of the Fibonacci series could look like this: recursive function fibonacci(term) result(fibo) integer, intent(in) :: te...
To list installed packages: $ pip list # example output docutils (0.9.1) Jinja2 (2.6) Pygments (1.5) Sphinx (1.1.2) To list outdated packages, and show the latest version available: $ pip list --outdated # example output docutils (Current: 0.9.1 Latest: 0.10) Sphinx (Current: 1.1.2 Late...
import locale locale.setlocale(locale.LC_ALL, '') Out[2]: 'English_United States.1252' locale.currency(762559748.49) Out[3]: '$762559748.49' locale.currency(762559748.49, grouping=True) Out[4]: '$762,559,748.49'
It's important to let finalization ignore managed resources. The finalizer runs on another thread -- it's possible that the managed objects don't exist anymore by the time the finalizer runs. Implementing a protected Dispose(bool) method is a common practice to ensure managed resources do not have t...

Page 7 of 47