Tutorial by Examples: st

The special LOOP NAMED foo syntax allows you to create a loop that you can exit early from. The exit is performed using return-from, and can be used from within nested loops. The following uses a nested loop to look for a complex number in a 2D array: (loop named top for x from 0 below (arr...
CSS and JS files should be reside under 'static' directory in the root directory of module (the rest of subdirectory tree under 'static' is an optional convention): static/src/css/your_file.css static/src/js/your_file.js Then add links to these files unsing one of the 3 ways listed in the fol...
Odoo v8.0 way is to add corresponding record in the XML file: ​Add XML file to the manifest (i.e. __openerp__.py file.): ... 'data' : [ 'your_file.xml' ], ​... Then add following record in 'your_file.xml': <openerp> <data> <template id="...
Note: you should use this way if you've installed a "website" module and you have a public website available. Add following record in 'your_file.xml': <openerp> <data> <template id="assets_frontend" name="your_module_name assets" inherit...
Add following record in 'your_file.xml': <openerp> <data> <template id="assets_common" name="your_module_name assets" inherit_id="web.assets_common"> <xpath expr="." position="inside"> <link rel...
Starting with a three-dimensional list: alist = [[[1,2],[3,4]], [[5,6,7],[8,9,10], [12, 13, 14]]] Accessing items in the list: print(alist[0][0][1]) #2 #Accesses second element in the first list in the first list print(alist[1][1][2]) #10 #Accesses the third element in the second list in...
{-# LANGUAGE OverloadedStrings #-} import qualified Data.Text as T myText :: T.Text myText = "\n\r\t leading and trailing whitespace \t\r\n" strip removes whitespace from the start and end of a Text value. ghci> T.strip myText "leading and trailing whitespace" ...
Type ghci at a shell prompt to start GHCI. $ ghci GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help Prelude>
Arrays can be used as plain constants and class constants from version PHP 5.6 onwards: Class constant example class Answer { const C = [2,4]; } print Answer::C[1] . Answer::C[0]; // 42 Plain constant example const ANSWER = [2,4]; print ANSWER[1] . ANSWER[0]; // 42 Also from versi...
Lets suppose you have 2 Lists A and B, and you want to remove from B all the elements that you have in A the method in this case is List.removeAll(Collection c); #Example: public static void main(String[] args) { List<Integer> numbersA = new ArrayList<>(); List<Intege...
def str = 'Single quoted string' assert str instanceof String
def str = "Double quoted string" assert str instanceof String
def param = 'string' def str = "Double quoted ${param}" assert str instanceof GString assert str == 'Double quoted string' The parameter is by default resolved eagerly, this means this applies: def param = 'string' def str = "Double quoted ${param}" param = 'another stri...
def str = '''multiline string''' assert str instanceof String
def str = ''' multiline string''' assert str.readLines().size() == 3
def str = '''\ multiline string''' assert str.readLines().size() == 2
def param = 'string' def str = """ multiline $param """ assert str instanceof GString assert str.readLines().size() == 3 assert str == ''' multiline string '''
def str = / multiline string no need to escape slash \n / assert str instanceof String assert str.readLines().size() == 4 assert str.contains('\\n')
def param = 'string' def str = / multiline $param no need to escape slash \n / assert str instanceof GString assert str.readLines().size() == 4 assert str.contains('\\n') assert str.contains('string')

Page 122 of 369