Tutorial by Examples: control

import AVFoundation class QRScannerViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate { func viewDidLoad() { self.initCaptureSession() } private func initCaptureSession() { let captureDevice = AVCaptureDevice .defa...
You can also use this code to setup an LED with a button switch with a pull up resistor, this could preferably be with the next step after setting up the intial LED controller int buttonState = 0; // variable for reading the pushbutton status void setup() { // initialize the LED pin as an ...
A controlled component is bound to a value and its changes get handled in code using event based callbacks. class CustomForm extends React.Component { constructor() { super(); this.state = { person: { firstName: '', lastName: '' } } } ...
In Apache Spark while doing shuffle operations like join and cogroup a lot of data gets transferred across network. Now, to control the number of partitions over which shuffle happens can be controlled by configurations given in Spark SQL. That configuration is as follows: spark.sql.shuffle.partiti...
Dependenct Injection Intro An application is composed of many objects that collaborate with each other. Objects usually depend on other objects to perform some task. When an object is responsible for referencing its own dependencies it leads to a highly coupled, hard-to-test and hard-to-change code...
We can create a service to set and get the data between the controllers and then inject that service in the controller function where we want to use it. Service : app.service('setGetData', function() { var data = ''; getData: function() { return data; }, setData: function(requestData)...
An Orbit Camera is one that allows the user to rotate around a central point, but while keeping a particular axis locked. This is extremely popular because it prevents the scene from getting "tilted" off-axis. This version locks the Y (vertical) axis, and allows users to Orbit, Zoom, and P...
Here's an example of a custom camera controller. This reads the position of the mouse within the client window, and then slides the camera around as if it were following the mouse on the window. index.html <html> <head> <title>Three.js Custom Mouse Camera Control Ex...
import WatchConnectivity var watchSession : WCSession? override func awake(withContext context: Any?) { super.awake(withContext: context) // Configure interface objects here. startWatchSession() } func startWatchSession(){ if(WCSession....
Let's say that you have the following class: public class PersonInfo { public int ID { get; set; } [Display(Name = "First Name")] [Required(ErrorMessage = "Please enter your first name!")] public string FirstName{ get; set; } [Display(Name = "L...
If you have a cmake module . You can create a folder called in to store all config files. For example,you have a project called FOO, you can create a FOO_config.h.in file like: //=================================================================================== // CMake configuration file, base...
The following example shows how to apply custom fonts to a Navigation Bar and includes fixes for some quirky behaviors found in Xcode. One also may apply the custom fonts to any other UIControls such as UILabels, UIButtons, and more by using the attributes inspector after the custom font is added to...
We assume a fully working UIScrollview named _scrollView; Note that UITableView, UICollectionView are also scrollviews, hence the following examples would work on those UI elements. First, creation & allocation UIRefreshControl refreshControl = new UIRefreshControl(); Second, connecting th...
This example assumes that you have already added Fresco to your app (see this example): SimpleDraweeView img = new SimpleDraweeView(context); ImageRequest request = ImageRequestBuilder .newBuilderWithSource(Uri.parse("http://example.com/image.png")) .setProgressiveRende...
Consider the following test: it('should test something', function() { browser.get('/dashboard/'); $("#myid").click(); expect(element(by.model('username')).getText()).toEqual('Test'); console.log("HERE"); }); In the following test, when the console.log() is ex...
var indexController = myApp.controller("indexController", function ($scope) { // Application logic goes here });
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init]; [refreshControl addTarget:self action:@selector(pullToRefresh:) forControlEvents:UIControlEventValueChanged]; self.scrollView.alwaysBounceVertical = YES; [self.scrollView addSubview:refreshControl]; - (void)pullToRefresh:(UIRe...
There are 2 ways to set formBuilder controls parameters. On initialize: exampleForm : FormGroup; constructor(fb: FormBuilder){ this.exampleForm = fb.group({ name : new FormControl({value: 'default name'}, Validators.compose([Validators.required, Validators.maxLength(15)])) }); ...
UITabBarController building in Swift 3 Change image color and title according to selection with changing selected tab color. import UIKit class TabbarController: UITabBarController { override func viewDidLoad() { super.viewDidLoad() self.navigationController?.isNavigat...

Page 10 of 13