Tutorial by Examples: er

If a covariant type appears as an output, the containing type is covariant. Producing a producer of Ts is like producing Ts. interface IReturnCovariant<out T> { IEnumerable<T> GetTs(); } If a contravariant type appears as an output, the containing type is contravariant. Produc...
LOOP AT itab INTO wa. ENDLOOP. FIELD-SYMBOLS <fs> LIKE LINE OF itab. LOOP AT itab ASSIGNING <fs>. ENDLOOP. LOOP AT itab ASSIGNING FIELD-SYMBOL(<fs>). ENDLOOP. LOOP AT itab REFERENCE INTO dref. ENDLOOP. LOOP AT itab TRANSPORTING NO FIELDS. ENDLOOP. Conditional L...
In Scala operators (such as +, -, *, ++, etc.) are just methods. For instance, 1 + 2 can be written as 1.+(2). These sorts of methods are called 'infix operators'. This means custom methods can be defined on your own types, reusing these operators: class Matrix(rows: Int, cols: Int, val data: Seq[...
The case modifier causes the Scala compiler to automatically generate common boilerplate code for the class. Implementing this code manually is tedious and a source of errors. The following case class definition: case class Person(name: String, age: Int) ... will have the following code automati...
emptyList = [] singletonList = [0] -- = 0 : [] listOfNums = [1, 2, 3] -- = 1 : 2 : [3] listOfStrings = ["A", "B", "C"]
Destructuring also gives you the ability to interpret a sequence as a map: (def my-vec [:a 1 :b 2]) (def my-lst '("smthg else" :c 3 :d 4)) (let [[& {:keys [a b]}] my-vec [s & {:keys [c d]} my-lst] (+ a b c d)) ;= 10 It is useful for defining functions with named p...
In oracle, the difference (in days and/or fractions thereof) between two DATEs can be found using subtraction: SELECT DATE '2016-03-23' - DATE '2015-12-25' AS difference FROM DUAL; Outputs the number of days between the two dates: DIFFERENCE ---------- 89 And: SELECT TO_DATE( '201...
The function toupper will convert a string to upper case (capital letters). For example: BEGIN { greeting = "hello" loud_greeting = toupper(greeting) print loud_greeting } This code will output "HELLO" when run.
Enum classes can also declare members (i.e. properties and functions). A semicolon (;) must be placed between the last enum object and the first member declaration. If a member is abstract, the enum objects must implement it. enum class Color { RED { override val rgb: Int = 0xFF0000 ...
A browser's debugging console can be used in order to print simple messages. This debugging or web console can be directly opened in the browser (F12 key in most browsers – see Remarks below for further information) and the log method of the console Javascript object can be invoked by typing the fol...
In the simplest use-case, just navigate to the directory your file is in, and type: pyinstaller myfile.py Pyinstaller analyzes the file and creates: A myfile.spec file in the same directory as myfile.py A build folder in the same directory as myfile.py A dist folder in the same directory as m...
$ pg_dumpall -f backup.sql This works behind the scenes by making multiple connections to the server once for each database and executing pg_dump on it. Sometimes, you might be tempted to set this up as a cron job, so you want to see the date the backup was taken as part of the filename: $ post...
The datetime module can convert a POSIX timestamp to a ITC datetime object. The Epoch is January 1st, 1970 midnight. import time from datetime import datetime seconds_since_epoch=time.time() #1469182681.709 utc_date=datetime.utcfromtimestamp(seconds_since_epoch) #datetime.datetime(2016, 7, 2...
For each environment you need to create a separate appsettings.{EnvironmentName}.json files: appsettings.Development.json appsettings.Staging.json appsettings.Production.json Then open project.json file and include them into "include" in "publishOptions" section. This lis...
The $_FILES["FILE_NAME"]['error'] (where "FILE_NAME" is the value of the name attribute of the file input, present in your form) might contain one of the following values: UPLOAD_ERR_OK - There is no error, the file uploaded with success. UPLOAD_ERR_INI_SIZE - The uploaded fi...
insert :: Ord a => a -> [a] -> [a] insert x [] = [x] insert x (y:ys) | x < y = x:y:ys | otherwise = y:(insert x ys) isort :: Ord a => [a] -> [a] isort [] = [] isort (x:xs) = insert x (isort xs) Example use: > isort [5,4,3,2,1] Result: [1,2,3,4...
Ordered merging of two ordered lists Preserving the duplicates: merge :: Ord a => [a] -> [a] -> [a] merge xs [] = xs merge [] ys = ys merge (x:xs) (y:ys) | x <= y = x:merge xs (y:ys) | otherwise = y:merge (x:xs) ys Top-down version: msort :: Ord a => [...
XML pre-defines five general entities that can be used without declaring them: & " ' < > They are associated with the names amp, quot, apos, lt and gt. <?xml version="1.0"?> <entities> & is an ampersand. " is a quote. ' is...
It is possible to define one's own general entities. The declaration occurs in the DTD subset, with a name and the associated replacement text. It can then be used in the document using the entity reference syntax &...;, either in text, or in attribute values. <?xml version="1.0"?...
Bash indirection permits to get the value of a variable whose name is contained in another variable. Variables example: $ red="the color red" $ green="the color green" $ color=red $ echo "${!color}" the color red $ color=green $ echo "${!color}" the ...

Page 91 of 417