Tutorial by Examples

Copy the package installer unit file to /etc where changes will not be overwritten on an upgrade: cp /lib/systemd/system/docker.service /etc/systemd/system/docker.service Update /etc/systemd/system/docker.service with your options on ExecStart: ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0...
So you've just created your first class in Python, a neat little class that encapsulates a playing card: class Card: def __init__(self, suit, pips): self.suit = suit self.pips = pips Elsewhere in your code, you create a few instances of this class: ace_of_spades = Card('S...
class Card: special_names = {1:'Ace', 11:'Jack', 12:'Queen', 13:'King'} def __init__(self, suit, pips): self.suit = suit self.pips = pips # Called when instance is converted to a string via str() # Examples: # print(card1) # print(str(card1) ...
Return the index of the first occurrence of a substring (zero if not found) Syntax: INSTR ( string, substring ) SELECT INSTR('FooBarBar', 'Bar') -- return 4 SELECT INSTR('FooBarBar', 'Xar') -- return 0
Detailed instructions on getting bluetooth set up or installed.
In simple terms: UNION joins 2 result sets while removing duplicates from the result set UNION ALL joins 2 result sets without attempting to remove duplicates One mistake many people make is to use a UNION when they do not need to have the duplicates removed. The additional performance cost...
Ionic uses Gulp, so install gulp-babel and gulp-plumber. npm install --save-dev gulp-babel gulp-plumber Add babel to gulpfile.js like so: //... var babel = require("gulp-babel"); var plumber = require("gulp-plumber"); var paths = { es6: ['./src/es6/*.js'], sass: ...
QModelIndex does not actually know about it's parent/child indexes, it only contains a row, a column and a pointer, and it is the models responsibility to use this data to provide information an index's relations. The model therefore needs to do a lot of conversions from the void* stored inside the ...
Sometimes you have to deal with structures defined in terms of C data types from Perl. One such application is the creation of raw network packets, in case you want to do something fancier than what the regular socket API has to offer. This is just what pack() (and unpack() of course) is there for. ...
Raycasting means throwing a ray from the mouse position on the screen to the scene, this is how threejs determines what object you want to click on if you have implemented it. Threejs gets that information using an octree, but still in production you may not want to compute the result at each frame ...
Object picking using Raycasting might be a heavy task for your CPU depending on your setup (for example if you don't have an octree like setup) and number of objects in the scene. If you don't need the world coordinates under the mouse cursor but only to identify the object under it you can use GPU...
For example, in the sentence: That cake is extremely nice. The rules of the English language would make cake a noun, extremely an adverb that modifies the adjective nice, and through this analysis the meaning could be understood. However, this analysis is dependent on us recognising that the...
C# using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using OpenQA.Selenium.Interactions; namespace WebDriverActions { class WebDriverTest { static void Main() { IWebDriver driver = new FirefoxDriver(); driver.Navigate().GoToUrl(&quot...
#!/bin/bash #Print Date / Time in different Formats date1=$(date +'%d-%m-%y') date2=$(date +'%d-%m-%Y') date3=$(date +'%d-%b-%Y') date4=$(date +'%d-%B-%Y') date5=$(date +'%a %d-%b-%Y') date6=$(date +'%a %d-%b-%Y %Z') date7=$(date +'%A %d-%b-%Y') echo "Print Date in different forma...
The igraph package for R is a wonderful tool that can be used to model networks, both real and virtual, with simplicity. This example is meant to demonstrate how to create two simple network graphs using the igraph package within R v.3.2.3. Non-Directed Network The network is created with this pie...
One of the most straight forward way of making an LED blink is: turn it on, wait a bit, turn it off, wait again, and repeat endlessly: // set constants for blinking the built-in LED at 1 Hz #define OUTPIN LED_BUILTIN #define PERIOD 500 void setup() { pinMode(OUTPIN, OUTPUT); // sets t...
The elapsedMillis library provides a class with the same name that keeps track of the time that passed since it was created or set to a certain value: #include <elapsedMillis.h> #define OUTPIN LED_BUILTIN #define PERIOD 500 elapsedMillis ledTime; bool ledState = false; void setup...
This is very close to an example from the arduino docs: // set constants for blinking the built-in LED at 1 Hz #define OUTPIN LED_BUILTIN #define PERIOD 500 // this is in milliseconds int ledState = LOW; // millis() returns an unsigned long so we'll use that to keep track of time unsigned...
#include <elapsedMillis.h> void setup() { Serial.begin(115200); elapsedMillis msTimer; elapsedMicros usTimer; long int dt = 500; delay(dt); long int us = usTimer; long int ms = msTimer; Serial.print("delay(");Serial.print(dt);Serial.println(") to...
An example to perform login test based on Page object pattern: import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; /** * Class which models the view of Sign-In page */ publ...

Page 662 of 1336