Tutorial by Examples: and

A context manager is an object that is notified when a context (a block of code) starts and ends. You commonly use one with the with statement. It takes care of the notifying. For example, file objects are context managers. When a context ends, the file object is closed automatically: open_file = ...
Windows Environment Install XAMPP or WAMP Download and Unzip the package from Codeigniter.com Extract all the document in the server space (htdocs or www directory) Mac Environment Install MAMP Download and Unzip the package from Codeigniter.com Extract all the document in the server sp...
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...
Requirements: Protractor requires the following dependencies to be installed prior to installation: Java JDK 1.7 or higher Node.js v4 or higher Installation: Download and install Node.js from this URL: https://nodejs.org/en/ To see if the Node.js installation is successfull, you can go an...
Use the begin/rescue block to catch (rescue) an exception and handle it: begin # an execution that may fail rescue # something to execute in case of failure end A rescue clause is analogous to a catch block in a curly brace language like C# or Java. A bare rescue like this rescues Stand...
You can handle multiple errors in the same rescue declaration: begin # an execution that may fail rescue FirstError, SecondError => e # do something if a FirstError or SecondError occurs end You can also add multiple rescue declarations: begin # an execution that may fail rescue ...
CSS div{ width: 150px; height:150px; background-color: red; transition: background-color 1s; } div:hover{ background-color: green; } HTML <div></div> This example will change the background color when the div is hovered the background-color change will...
Directives are one of the most powerful features of angularjs. Custom angularjs directives are used to extend functionality of html by creating new html elements or custom attributes to provide certain behavior to an html tag. directive.js // Create the App module if you haven't created it yet va...
Download and install Visual Studio. Visual Studio can be downloaded from VisualStudio.com. The Community edition is suggested, first because it is free, and second because it involves all the general features and can be extended further. Open Visual Studio. Welcome. Go to File → New ...
Breaking out of the loop and continuing to the next iteration is also supported in Go, like in many other languages: for x := 0; x < 10; x++ { // loop through 0 to 9 if x < 3 { // skips all the numbers before 3 continue } if x > 5 { // breaks out of the loop once x...
In Python you can define a series of conditionals using if for the first one, elif for the rest, up until the final (optional) else for anything not caught by the other conditionals. number = 5 if number > 2: print("Number is bigger than 2.") elif number < 2: # Optional cl...
Basic usage: PropertyInfo prop = myInstance.GetType().GetProperty("myProperty"); // get the value myInstance.myProperty object value = prop.GetValue(myInstance); int newValue = 1; // set the value myInstance.myProperty to newValue prop.setValue(myInstance, newValue); Setting rea...
This example use the default boxplot() function and the irisdata frame. > head(iris) Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4 0.2 setosa 3 4.7 3.2 ...
Using the Reflection API, it is possible to change or get the value of a field at runtime. For example, you could use it in an API to retrieve different fields based on a factor, like the OS. You can also remove modifiers like final to allow modifing fields that are final. To do so, you will need t...
To use Vagrant on Windows platform you need to install virtualization software and an ssh command-line tool first. This example will use freeware VirtualBox and Cygwin. Install VirtualBox Download the latest VirtualBox version from the official download page and run the downloaded file. Note that ...
Classes in MATLAB are divided into two major categories: value classes and handle classes. The major difference is that when copying an instance of a value class, the underlying data is copied to the new instance, while for handle classes the new instance points to the original data and changing val...
A simple program that writes "Hello, world!" to test.txt, reads back the data, and prints it out. Demonstrates simple file I/O operations. package main import ( "fmt" "io/ioutil" ) func main() { hello := []byte("Hello, world!") //...
package main import ( "fmt" "io/ioutil" ) func main() { files, err := ioutil.ReadDir(".") if err != nil { panic(err) } fmt.Println("Files and folders in the current directory:") for _, fileInfo := range fi...
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...
While many people think that ^ means the start of a string, it actually means start of a line. For an actual start of string anchor use, \A. The string hello\nworld (or more clearly) hello world Would be matched by the regular expressions ^h, ^w and \Ah but not by \Aw

Page 15 of 153