Tutorial by Examples: basic

Razor code can be inserted anywhere within HTML code. Razor code blocks are enclosed in @{ ... }. Inline variable and functions start with @. Code inside the Razor brackets follow the normal C# or VB rules. Single line statement: @{ var firstNumber = 1; } Multi-line code block: @{ var sec...
First create an express app: const express = require('express'); const app = express(); Then you can define routes like this: app.get('/someUri', function (req, res, next) {}) That structure works for all HTTP methods, and expects a path as the first argument, and a handler for that path, w...
The STUFF() function inserts a string into another string by first deleting a specified number of characters. The following example, deletes "Svr" and replaces it with "Server". This happens by specifying the start_position and length of the replacement. SELECT STUFF('SQL Svr D...
Basic table usage includes accessing and assigning table elements, adding table content, and removing table content. These examples assume you know how to create tables. Accessing Elements Given the following table, local example_table = {"Nausea", "Heartburn", "Indigesti...
What is Serialization Serialization is the process of converting an object's state (including its references) to a sequence of bytes, as well as the process of rebuilding those bytes into a live object at some future time. Serialization is used when you want to persist the object. It is also used b...
The CREATE TABLE statement is used to create a table in a MySQL database. CREATE TABLE Person ( `PersonID` INTEGER NOT NULL PRIMARY KEY, `LastName` VARCHAR(80), `FirstName` VARCHAR(80), `Address` TEXT, `City` VARCHAR(100) ) Engine=InnoDB; Ev...
Step 1: Open a Workbook Step 2 Option A: Press Alt + F11 This is the standard shortcut to open the VBE. Step 2 Option B: Developer Tab --> View Code First, the Developer Tab must be added to the ribbon. Go to File -> Options -> Customize Ribbon, then check the box for developer. ...
INSERT INTO `table_name` (`field_one`, `field_two`) VALUES ('value_one', 'value_two'); In this trivial example, table_name is where the data are to be added, field_one and field_two are fields to set data against, and value_one and value_two are the data to do against field_one and field_two resp...
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 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 ...
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...

Page 5 of 43