Tutorial by Examples: ast

This is a snippet of master report. Two parameters and the connection (for example, jdbc) are passing to the subreport. One value is returned from the subreport back to the master report, this value (variable) can be used in master report <subreport> <reportElement x="0" y=&...
A statement is constructed with a function such as sqlite3_prepare_v2(). A prepared statement object must be cleaned up with sqlite3_finalize(). Do not forget this in case of an error. If parameters are used, set their values with the sqlite3_bind_xxx() functions. The actual execution happens whe...
var='line 1 line 2 line3' readarray -t arr <<< "$var" or with a loop: arr=() while IFS= read -r line; do arr+=("$line") done <<< "$var"
var='line 1 line 2 line3' while IFS= read -r line; do echo "-$line-" done <<< "$var" or readarray -t arr <<< "$var" for i in "${arr[@]}";do echo "-$i-" done
Let's assume that the field separator is : var='line: 1 line: 2 line3' while IFS= read -d : -r field || [ -n "$field" ]; do echo "-$field-" done <<< "$var" Output: -line- - 1 line- - 2 line3 -
Let's assume that the field separator is : var='1:2:3:4: newline' arr=() while IFS= read -d : -r field || [ -n "$field" ]; do arr+=("$field") done <<< "$var" echo "${arr[4]}" Output: newline
a='I am a simple string with digits 1234' pat='(.*) ([0-9]+)' [[ "$a" =~ $pat ]] echo "${BASH_REMATCH[0]}" echo "${BASH_REMATCH[1]}" echo "${BASH_REMATCH[2]}" Output: I am a simple string with digits 1234 I am a simple string with digits 1234
To round out simple examples of CRUD operations, we present the following examples. Always use great care in deleting documents. (: When we know the URI, we can delete it very easily :) let $uri := "/stuff/mysimpledocument.xml" return xdmp:document-delete($uri) or simplified: xdmp:d...
This example has two parts - some boilerplate steps for adding Castle Windsor to your WCF service, and then a simple, concrete example to show how we configure and use Windsor's container. That makes the example a little bit long. If you already understand using a DI container then you likely only ...
In C and C++, the asterisk in the declaration of a pointer variable is part of the expression being declared. In C#, the asterisk in the declaration is part of the type. In C, C++ and C#, the following snippet declares an int pointer: int* a; In C and C++, the following snippet declares an int ...
Increase the saturation level of an image with ctx.globalCompositeOperation = 'saturation'; The amount of the effect can be controled with the alpha setting or the amount of saturation in the fill overlay // Render the image ctx.globalCompositeOperation='source-atop'; ctx.drawImage(image, 0, ...
In order to prevent a button from firing multiple times within a short period of time (let's say 2 clicks within 1 second, which may cause serious problems if the flow is not controlled), one can implement a custom SingleClickListener. This ClickListener sets a specific time interval as threshold (...
This a python example function for sequence writing in fasta format. Parameters: filename(String) - A file name for writing sequence in fasta format. seq(String) - A DNA or RNA sequence. id(String) - The ID of the given sequence. desc(String) - A short description of the given sequence. im...
This example shows how to use fast enumeration in order to traverse through an NSArray. When you have an array, such as NSArray *collection = @[@"fast", @"enumeration", @"in objc"]; You can use the for ... in syntax to go through each item of the array, automatical...
C-Style casting can be considered 'Best effort' casting and is named so as it is the only cast which could be used in C. The syntax for this cast is (NewType)variable. Whenever this cast is used, it uses one of the following c++ casts (in order): const_cast<NewType>(variable) static_cast&...
element.style only reads CSS properties set inline, as an element attribute. However, styles are often set in an external stylesheet. The actual style of an element can be accessed with window.getComputedStyle(element). This function returns an object containing the actual computed value of all the ...
The trick is to use a look-behind with the regex \G, which means "end of previous match": String[] parts = str.split("(?<=\\G.{8})"); The regex matches 8 characters after the end of the last match. Since in this case the match is zero-width, we could more simply say "...
Same as the known length example, but insert the length into regex: int length = 5; String[] parts = str.split("(?<=\\G.{" + length + "})");
When a table has an AUTO_INCREMENT PRIMARY KEY, normally one does not insert into that column. Instead, specify all the other columns, then ask what the new id was. CREATE TABLE t ( id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, this ..., that ..., PRIMARY KEY(id) ); INSERT I...
Private Sub Get_Last_Used_Row_Index() Dim wS As Worksheet Set wS = ThisWorkbook.Sheets("Sheet1") Debug.Print LastCol_1(wS) Debug.Print LastCol_0(wS) End Sub You can choose between 2 options, regarding if you want to know if there is no data in the worksheet :...

Page 19 of 26