Tutorial by Examples: bas

Normally you would want to avoid using cursors as they can have negative impacts on performance. However in some special cases you may need to loop through your data record by record and perform some action. DECLARE @orderId AS INT -- here we are creating our cursor, as a local cursor and only a...
// You need a writable database to insert data final SQLiteDatabase database = openHelper.getWritableDatabase(); // Create a ContentValues instance which contains the data for each column // You do not need to specify a value for the PRIMARY KEY column. // Unique values for these are automatic...
Just execute lsb_release -a. On Debian: $ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux testing (stretch) Release: testing Codename: stretch On Ubuntu: $ lsb_release -a No LSB modules are available. Distributor ID: Ubun...
You can open the VB editor in any of the Microsoft Office applications by pressing Alt+F11 or going to the Developer tab and clicking on the "Visual Basic" button. If you don't see the Developer tab in the Ribbon, check if this is enabled. By default the Developer tab is disabled. To enab...
A Kotlin interface contains declarations of abstract methods, and default method implementations although they cannot store state. interface MyInterface { fun bar() } This interface can now be implemented by a class as follows: class Child : MyInterface { override fun bar() { ...
What is recursion: In general, recursion is when a function invokes itself, either directly or indirectly. For example: // This method calls itself "infinitely" public void useless() { useless(); // method calls itself (directly) } Conditions for applying recursion to a probl...
Running the latest Liferay CE is straightforward: Go to https://www.liferay.com/downloads. Choose a bundle among the ones listed. For beginners, the Tomcat bundle is a good choice. Click in "Download." Unzip the download package whenever you find fit. The unzipped directory will...
There are 4 looping constructs in Rust. All examples below produce the same output. Infinite Loops let mut x = 0; loop { if x > 3 { break; } println!("{}", x); x += 1; } While Loops let mut x = 0; while x <= 3 { println!("{}", x); x += 1; ...
for is the only loop statement in go, so a basic loop implementation could look like this: // like if, for doesn't use parens either. // variables declared in for and if are local to their scope. for x := 0; x < 3; x++ { // ++ is a statement. fmt.Println("iteration", x) } //...
XML is made of basic building blocks, which are: element text attributes comments processing instructions An element has angle brackets: <element/> <element>some content</element> An attribute appears in an opening element tag: <element attribute-name="...
A new thread separate from the main thread's execution, can be created using Thread.new. thr = Thread.new { sleep 1 # 1 second sleep of sub thread puts "Whats the big deal" } This will automatically start the execution of the new thread. To freeze execution of the main Thread, ...
Any type can be declared as an array using either the dimension attribute or by just indicating directly the dimension(s) of the array: ! One dimensional array with 4 elements integer, dimension(4) :: foo ! Two dimensional array with 4 rows and 2 columns real, dimension(4, 2) :: bar ! Three...
fn main() { // Statically allocated string slice let hello = "Hello world"; // This is equivalent to the previous one let hello_again: &'static str = "Hello world"; // An empty String let mut string = String::new(); // An empty String ...
This example aims to describe how one can utilize git rebase in interactive mode. It is expected that one has a basic understanding of what git rebase is and what it does. Interactive rebase is initiated using following command: git rebase -i The -i option refers to interactive mode. Using inte...
foo = 1 bar = 'bar' baz = 3.14 You can use str.format to format output. Bracket pairs are replaced with arguments in the order in which the arguments are passed: print('{}, {} and {}'.format(foo, bar, baz)) # Out: "1, bar and 3.14" Indexes can also be specified inside the bracket...
Strings in JavaScript can be enclosed in Single quotes 'hello', Double quotes "Hello" and (from ES2015, ES6) in Template Literals (backticks) `hello`. var hello = "Hello"; var world = 'world'; var helloW = `Hello World`; // ES2015 / ES6 Strings can be created...
You have started an interactive rebase. In the editor where you pick your commits, you decide that something is going wrong (for example a commit is missing, or you chose the wrong rebase destination), and you want to abort the rebase. To do this, simply delete all commits and actions (i.e. all lin...
After creating a new model or modifying existing models, you will need to generate migrations for your changes and then apply the migrations to the specified database. This can be done by using the Django's built-in migrations system. Using the manage.py utility when in the project root directory: ...
Statistical functions in R make heavy use of the so-called Wilkinson-Rogers formula notation1 . When running model functions like lm for the Linear Regressions, they need a formula. This formula specifies which regression coefficients shall be estimated. my_formula1 <- formula(mpg ~ wt) class(...
split allows to divide a vector or a data.frame into buckets with regards to a factor/group variables. This ventilation into buckets takes the form of a list, that can then be used to apply group-wise computation (for loops or lapply/sapply). First example shows the usage of split on a vector: Con...

Page 7 of 65