Tutorial by Examples: c

To add a method to a button, first create an action method: Objective-C -(void) someButtonAction{ NSLog(@"Button is tapped"); } Swift func someButtonAction() { print("Button is tapped") } Now to add this action method to your button, you have to wri...
from scipy.sparse import csr_matrix A = csr_matrix([[1,0,2],[0,3,0]]) >>>A <2x3 sparse matrix of type '<type 'numpy.int64'>' with 3 stored elements in Compressed Sparse Row format> >>> A.todense() matrix([[1, 0, 2], [0, 3, 0]]) >>&g...
Sometimes it is necessary or desirable to place the legend outside the plot. The following code shows how to do it. import matplotlib.pylab as plt fig, ax = plt.subplots(1, 1, figsize=(10,6)) # make the figure with the size 10 x 6 inches fig.suptitle('Example of a Legend Being Placed Outside of...
An Explain infront of a select query shows you how the query will be executed. This way you to see if the query uses an index or if you could optimize your query by adding an index. Example query: explain select * from user join data on user.test = data.fk_user; Example result: id select_type...
The type alias keyword combination gives a new name for a type, but the type keyword in isolation declares a new type. Let's examine one of the most fundamental of these types: Maybe type Maybe a = Just a | Nothing The first thing to note is that the Maybe type is declared with a type ...
Fired when one or more of the component or directive properties have been changed. import { Component, OnChanges, Input } from '@angular/core'; @Component({ selector: 'so-onchanges-component', templateUrl: 'onchanges-component.html', styleUrls: ['onchanges-component.'] }) class ...
Fire after the initialization of the content of the component or directive has finished. (Right after OnInit) import { Component, AfterContentInit } from '@angular/core'; @Component({ selector: 'so-aftercontentinit-component', templateUrl: 'aftercontentinit-component.html', styl...
Fire after the view has been fully initialized. (Only available for components) import { Component, AfterContentChecked } from '@angular/core'; @Component({ selector: 'so-aftercontentchecked-component', templateUrl: 'aftercontentchecked-component.html', styleUrls: ['aftercontentc...
Fire after the check of the view, of the component, has finished. (Only available for components) import { Component, AfterViewChecked } from '@angular/core'; @Component({ selector: 'so-afterviewchecked-component', templateUrl: 'afterviewchecked-component.html', styleUrls: ['afte...
Allows to listen for changes only on specified properties import { Component, DoCheck, Input } from '@angular/core'; @Component({ selector: 'so-docheck-component', templateUrl: 'docheck-component.html', styleUrls: ['docheck-component.'] }) class DoCheckComponent implements DoChe...
CREATE TRIGGER BooksDeleteTrigger ON MyBooksDB.Books AFTER DELETE AS INSERT INTO BooksRecycleBin SELECT * FROM deleted; GO
You can start some slow process in parallel and then collect the results when they are done: Public Sub Main() Dim results = Task.WhenAll(SlowCalculation, AnotherSlowCalculation).Result For Each result In results Console.WriteLine(result) Next End Sub Async Functio...
Import the CoreLocation module in your classes that use CoreLocation functionality. //Swift import CoreLocation //Objective-C #import <CoreLocation/CoreLocation.h>
Check the app's authorization status with: //Swift let status: CLAuthorizationStatus = CLLocationManager.authorizationStatus() //Objective-C CLAuthorizationStatus status = [CLLocationManager authorizationStatus]; Test the status against the follow constants: //Swift switch status { case ...
ASDF provides the package ASDF-USER for developers to define their packages in.
Example: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <textarea id="content"></textarea> <input type="button" id="copy...
1. Character Class Character class is denoted by []. Content inside a character class is treated as single character separately. e.g. suppose we use [12345] In the example above, it means match 1 or 2 or 3 or 4 or 5 . In simple words, it can be understood as or condition for single characters (...
The blockquote element can be used for a (block-level) quote: <blockquote> <p>The answer is 42.</p> </blockquote> Source URL (cite attribute) The cite attribute can be used to reference the URL of the quoted source: <blockquote cite="http://example.com/blog/...
Observe the notifications UIKeyboardWillShowNotification and UIKeyboardWillHideNotification, update the scrollView content insets according to keyboard height, then scroll to the focused control. - (void)viewDidLoad { [super viewDidLoad]; // register for keyboard notifications [[...
To set a cookie i.e. to create it and schedule for sending to the browser you need to create new \yii\web\Cookie class instance and add it to response cookies collection: $cookie = new Cookie([ 'name' => 'cookie_monster', 'value' => 'Me want cookie!', 'expire' => time() + 86...

Page 232 of 826