Tutorial by Examples

With the virtual hard drive just created, boot the virtual machine with the android-x86 image as the optical drive. In the booting options of the Live CD choose "Installation - Install Android to hard disk" Choose the sda1 partition and install android and we'll install grub. Reboot t...
An example of implementation which give a possibility to detect if user single or double tap on UITableViewCell. override func viewDidLoad() { viewDidLoad() let doubleTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleDoubleTap(sender:))) double...
An example of implementation UITableView which allows to detect if cell has been tapped single or double time. override func viewDidLoad() { viewDidLoad() let doubleTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleDoubleTap(sender:))) doubleTa...
Create new instance of UISegmentedControl filled with 3 items (segments): let mySegmentedControl = UISegmentedControl (items: ["One", "Two", "Three"]) Setup frame; mySegmentedControl.frame = CGRect(x: 0.0, y: 0.0, width: 300, height: 50) Make default s...
For those who haven't played with these two designs, the scope of lazy and eager is within a specific Session of SessionFactory. Eager loads everything instantly, means there is no need to call anything for fetching it. But lazy fetch usually demands some action to retrieve mapped collection/object....
To create a background with a gradient you can use the CAGradientLayer class: Swift 3.1: func createGradient() { let caLayer = CAGradientLayer() caLayer.colors = [UIColor.white, UIColor.green, UIColor.blue] caLayer.locations = [0, 0.5, 1] caLayer.bounds = self.bounds self...
To add a custom image for the thumb of the slider, simply call the setThumbImage method with your custom image: Swift 3.1: let slider = UISlider() let thumbImage = UIImage slider.setThumbImage(thumbImage, for: .normal)
step 1: Create Project - Application - app.js - Controllers - appController.js - Factories - SignalR-factory.js - index.html - Scripts - angular.js - jquery.js - jquery.signalR.min.js - Hubs SignalR version use: signalR-2.2.1 Step 2: Startu...
multiply-square-matrix-parallel(A, B) n = A.lines C = Matrix(n,n) //create a new matrix n*n parallel for i = 1 to n parallel for j = 1 to n C[i][j] = 0 pour k = 1 to n C[i][j] = C[i][j] + A[i][k]*B[k][j] return C
matrix-vector(A,x) n = A.lines y = Vector(n) //create a new vector of length n parallel for i = 1 to n y[i] = 0 parallel for i = 1 to n for j = 1 to n y[i] = y[i] + A[i][j]*x[j] return y
A is an array and p and q indexes of the array such as you gonna sort the sub-array A[p..r]. B is a sub-array which will be populated by the sort. A call to p-merge-sort(A,p,r,B,s) sorts elements from A[p..r] and put them in B[s..s+r-p]. p-merge-sort(A,p,r,B,s) n = r-p+1 if n==1 ...
Suppose we have a simple class with validation annotations public class UserDTO { @NotEmpty private String name; @Min(18) private int age; //getters/setters } A controller to check the UserDTO validity. @RestController public class ValidationController { @Reque...
In following example we will create table movies with AWS Ruby SDK v2. Here, each Movie as one unique Partition Key as id, and Range Key year. Apart from this we want to be able to query movies with their name, hence we will create a Global Secondary Index (GSI) name-year-index with name as Hash Ke...
Q-learning is a variant of model-free reinforcement learning. In Q-learning we want the agent to estimate how good a (state, action) pair is so that it can choose good actions in each state. This is done by approximating an action-value function (Q) that fits in equation below: Where s and a are ...
Input :- 14 15 16 17 18 21 19 10 20 11 54 36 64 55 44 23 80 39 91 92 93 94 95 42 Output:- print value in index 14 15 16 17 18 21 36 39 42 95 94 93 92 91 64 19 10 20 11 54 80 23 44 55 or print index 00 01 02 03 04 05 15 25 35 34 33 32 31 30 20 10 11 12 13 14 24 23 22 21
function noOfLooping(m,n) { if(m > n) { smallestValue = n; } else { smallestValue = m; } if(smallestValue % 2 == 0) { return smallestValue/2; } else { return (smallestValue+1)/2; } } function squarePrint(m,n) { v...
So the good news is that Apple kindly includes a Ruby interpreter. Unfortunately, it tends not to be a recent version: $ /usr/bin/ruby -v ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16] If you have Homebrew installed, you can get the latest Ruby with: $ brew install ruby...
import core.thread, std.stdio, std.datetime; void some_operation() { // Sleep for two sixtieths (2/60) of a second. Thread.sleep(2.seconds / 60); // Sleep for 100 microseconds. Thread.sleep(100.usecs); } void main() { MonoTime t0 = MonoTime.currTime(); some_opera...
This example show you how you add new sounds to your MOD and play them. First of all you need a sound file which has the format *.ogg. Any other format is not allowed by the Minecraft application and will be rejected. The soundfile has the name: sound1.ogg Put the sound file under the following pa...
Integration to open database using password. -(void)checkAndOpenDB{ sqlite3 *db; NSString *strPassword = @"password"; if (sqlite3_open_v2([[databaseURL path] UTF8String], &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL) == SQLITE_OK) { const cha...

Page 1250 of 1336