Tutorial by Examples: bas

class Car { public position: number = 0; protected speed: number = 42; move() { this.position += this.speed; } } class SelfDrivingCar extends Car { move() { // start moving around :-) super.move(); super.move(); } } ...
A Bootstrap carousel is a Bootstrap component that creates a slideshow which cycles through elements within the carousel. Here is a basic HTML usage example: <div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> <!-- Indicators --...
Carousel components can be instantiated via jQuery with the function $('.carousel').carousel(options), where $('.carousel') is a top-level reference to the specific carousel and options is a Javascript object specifying the carousel's default attributes. The options object allows for multiple prope...
The arc4random_uniform() function is the simplest way to get high-quality random integers. As per the manual: arc4random_uniform(upper_bound) will return a uniformly distributed random number less than upper_bound. arc4random_uniform() is recommended over constructions like ''arc4random() % uppe...
Ansible can be installed on CentOS or other Red Hat based systems. Firstly you should install the prerequisites: sudo yum -y update sudo yum -y install gcc libffi-devel openssl-devel python-pip python-devel then install Ansible with pip: sudo pip install ansible I can recommend for you to u...
From MSDN: An enumeration type (also named an enumeration or an enum) provides an efficient way to define a set of named integral constants that may be assigned to a variable. Essentially, an enum is a type that only allows a set of finite options, and each option corresponds to a number. By d...
Once connected you can publish messages by calling the ISubscriber.Publish method: // grab an instance of an ISubscriber var subscriber = connection.GetSubscriber(); // publish a message to the 'chat' channel subscriber.Publish("chat", "This is a message") Consumers can ...
package { import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.Event; public class Main extends Sprite { //Document Class Main Constructor public function Main() { ...
Backbone requires Underscore and (optionally) jQuery - for DOM manipulation (using Backbone.View) and RESTful persistence. The quickest way to get up and running with Backbone is to create an index.html file with simple script tags in the HTML <head>: <html> <head> ...
Event Emitters are built into Node, and are for pub-sub, a pattern where a publisher will emit events, which subscribers can listen and react to. In Node jargon, publishers are called Event Emitters, and they emit events, while subscribers are called listeners, and they react to the events. // Requ...
A VectorDrawable should consist of at least one <path> tag defining a shape <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24.0" android:viewpor...
An AnimatedVectorDrawable requires at least 3 components: A VectorDrawable which will be manipulated An objectAnimator which defines what property to change and how The AnimatedVectorDrawable itself which connects the objectAnimator to the VectorDrawable to create the animation The following...
Scala has a special type of function called a partial function, which extends normal functions -- meaning that a PartialFunction instance can be used wherever Function1 is expected. Partial functions can be defined anonymously using case syntax also used in pattern matching: val pf: PartialFunction...
Django uses special database settings when testing so that tests can use the database normally but by default run on an empty database. Database changes in one test will not be seen by another. For example, both of the following tests will pass: from django.test import TestCase from myapp.models...
A function can be defined with parameters using the param block: function Write-Greeting { param( [Parameter(Mandatory,Position=0)] [String]$name, [Parameter(Mandatory,Position=1)] [Int]$age ) "Hello $name, you are $age years old." } ...
const auto input = "Some people, when confronted with a problem, think \"I know, I'll use regular expressions.\""s; smatch sm; cout << input << endl; // If input ends in a quotation that contains a word that begins with "reg" and another word begining...
$a = "some string"; results in $a having the value some string. The result of an assignment expression is the value being assigned. Note that a single equal sign = is NOT for comparison! $a = 3; $b = ($a = 5); does the following: Line 1 assigns 3 to $a. Line 2 assigns 5 to $a....
To create a PostgreSQL ArrayField, we should give ArrayField the type of data we want it to store as a field as its first argument. Since we'll be storing book ratings, we will use FloatField. from django.db import models, FloatField from django.contrib.postgres.fields import ArrayField cla...
Simple form with labels... <form action="/login" method="POST"> <label for="username">Username:</label> <input id="username" type="text" name="username" /> <label for="pass">Pa...
Remarks Every motion can be used after an operator command, so the command operates on the text comprised by the movement's reach. Just like operator commands, motions can include a count, so you can move by 2words, for example. Arrows In Vim, normal arrow/cursor keys (←↓↑→) work as expected...

Page 11 of 65