Tutorial by Examples: bas

Template literals are a special type of string literal that can be used instead of the standard '...' or "...". They are declared by quoting the string with backticks instead of the standard single or double quotes: `...`. Template literals can contain line breaks and arbitrary expression...
Inheritance in Python is based on similar ideas used in other object oriented languages like Java, C++ etc. A new class can be derived from an existing class as follows. class BaseClass(object): pass class DerivedClass(BaseClass): pass The BaseClass is the already existing (parent)...
A rebase switches the meaning of "ours" and "theirs": git checkout topic git rebase master # rebase topic branch on top of master branch Whatever HEAD's pointing to is "ours" The first thing a rebase does is resetting the HEAD to master; before cherry-picking...
Functions can be declared without parameters or a return value. The only required information is a name (hello in this case). func hello() { print("Hello World") } Call a function with no parameters by writing its name followed by an empty pair of parenthesis. hello() //output...
Defining a new protocol: @protocol NewProtocol - (void)protocolMethod:(id)argument; - (id)anotherMethod; @end
Data Manipulation Language (DML for short) includes operations such as INSERT, UPDATE and DELETE: -- Create a table HelloWorld CREATE TABLE HelloWorld ( Id INT IDENTITY, Description VARCHAR(1000) ) -- DML Operation INSERT, inserting a row into the table INSERT INTO HelloWorld (D...
The key to correctly stretching is in the top and left border. The top border controls horizontal stretching and the left border controls vertical stretching. This example creates rounded corners suitable for a Toast. The parts of the image that are below the top border and to the right of the ...
The Spinner can be reskinned according to your own style requirements using a Nine Patch. As an example, see this Nine Patch: As you can see, it has 3 extremely small areas of stretching marked. The top border has only left of the icon marked. That indicates that I want the left side (complete ...
An if statement checks whether a Bool condition is true: let num = 10 if num == 10 { // Code inside this block only executes if the condition was true. print("num is 10") } let condition = num == 10 // condition's type is Bool if condition { print("num is 10&...
The term "IFrame" means Inline Frame. It can be used to include another page in your page. This will yield a small frame which shows the exact contents of the base.html. <iframe src="base.html"></iframe>
A class is a user-defined type. A class is introduced with the class, struct or union keyword. In colloquial usage, the term "class" usually refers only to non-union classes. A class is a collection of class members, which can be: member variables (also called "fields"), mem...
To get started with the jQuery UI library, you'll need to add the jQuery script, the jQuery UI script, and the jQuery UI stylesheet to your HTML. First, download jQuery UI; choose the features you need on the download page. Unzip your download, and put jquery-ui.css and jquery-ui.js (and jquery.js)...
Properties can be added to a class or struct (technically enums too, see "Computed Properties" example). These add values that associate with instances of classes/structs: class Dog { var name = "" } In the above case, instances of Dog have a property named name of type...
Output buffering allows you to store any textual content (Text, HTML) in a variable and send to the browser as one piece at the end of your script. By default, php sends your content as it interprets it. <?php // Turn on output buffering ob_start(); // Print some output to the buffer (via...
Using the threading module, a new thread of execution may be started by creating a new threading.Thread and assigning it a function to execute: import threading def foo(): print "Hello threading!" my_thread = threading.Thread(target=foo) The target parameter references the fun...
Every format type is related to an HTML tag. The First Heading refers to the <h1> tag and is visualized like: Hello World and it's written underlining the text with =: Hello World =========== or by prepending # to the text: # Hello World The Second Heading refers to the <h2&gt...
Using the following code with the format string yyyy/MM/dd hh:mm.ss, we will receive the following output 2016/04/19 11:45.36 // define the format to use String formatString = "yyyy/MM/dd hh:mm.ss"; // get a current date object Date date = Calendar.getInstance().getTime(); //...
The base keyword is used to access members from a base class. It is commonly used to call base implementations of virtual methods, or to specify which base constructor should be called. Choosing a constructor public class Child : SomeBaseClass { public Child() : base("some string for th...
At its simplest, a unit test consists of three stages: Prepare the environment for the test Execute the code to be tested Validate the expected behaviour matches the observed behaviour These three stages are often called 'Arrange-Act-Assert', or 'Given-When-Then'. Below is example in C# tha...
Occasionally you will find the need to encode binary data as a base64-encoded string. For this we can use the DatatypeConverter class from the javax.xml.bind package: import javax.xml.bind.DatatypeConverter; import java.util.Arrays; // arbitrary binary data specified as a byte array byte[] bi...

Page 4 of 65