Tutorial by Examples

[ContractClass(typeof(ValidationContract))] interface IValidation { string CustomerID{get;set;} string Password{get;set;} } [ContractClassFor(typeof(IValidation))] sealed class ValidationContract:IValidation { string IValidation.CustomerID { [Pure] get ...
Swift class PickerViewExampleViewController : UIViewController, UIPickerViewDelegate, UIPickerViewDataSource { @IBOutlet weak var btnFolder: UIButton! let pickerView = UIPickerView() let pickerViewRows = ["First row,", "Secound row,","Third row,","F...
A common use-case for iterators is to perform some operation over a collection of numbers. The example below demonstrates how each element within an array of numbers can be individually printed out to the console. This is possible because arrays implement the IEnumerable interface, allowing clients...
Swift let isPushEnabled = UIApplication.sharedApplication().isRegisteredForRemoteNotifications()
The logic of registering for push notification is recommended to be added in AppDelegate.swift as the callback functions (success, failure) will be called their. To register just do the following: let application = UIApplication.sharedApplication() let settings = UIUserNotificationSettings(forType...
Once user clicks on a push notification, the following callback function will be called. You can parse the JSON to get any specific info sent from backend that will helps you in deep linking: Swift func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : ...
Assume you want to create an extension property that is expensive to compute. Thus you would like to cache the computation, by using the lazy property delegate and refer to current instance (this), but you cannot do it, as explained in the Kotlin issues KT-9686 and KT-13053. However, there is an off...
cURL is the name of the project which depicts: 'Client for URLs' and also be called as Client URL Request Library it combines two separate packages: curl and libcurl. curl is a command line tool used to get documents/files from or send documents to a server, using any of the supported protocol...
Python 2.x2.3 python -m SimpleHTTPServer 9000 Python 3.x3.0 python -m http.server 9000 Running this command serves the files of the current directory at port 9000. If no argument is provided as port number then server will run on default port 8000. The -m flag will search sys.path for ...
A stream is closed by sending a closing </stream> tag. After the closing stream tag is sent, no more data should be sent on the stream (even in response to data received from the other party). Before closing the connection, the sending entity should wait for a response </stream> tag to g...
Once a TCP connection is established, the initial stream header is sent by the initiating entity. Similarly, whenever a stream restart is required (eg. after negotiating a security layer such as TLS) a stream header must also be sent: <?xml version='1.0'?> <stream:stream from='juliet...
Mixins are a beautiful way to achieve something similar to multiple inheritance. It allows us to inherit or rather include methods defined in a module into a class. These methods can be included as either instance or class methods. The below example depicts this design. module SampleModule def...
The WHILE loop can be used as an alternative to CURSORS. The following example will print numbers from 0 to 99. DECLARE @i int = 0; WHILE(@i < 100) BEGIN PRINT @i; SET @i = @i+1 END
ToLookup returns a data structure that allows indexing. It is an extension method. It produces an ILookup instance that can be indexed or enumerated using a foreach-loop. The entries are combined into groupings at each key. - dotnetperls string[] array = { "one", "two", &...
dplyr::filter() - Select a subset of rows in a data frame that meet a logical criteria: dplyr::filter(iris,Sepal.Length>7) # Sepal.Length Sepal.Width Petal.Length Petal.Width Species # 1 7.1 3.0 5.9 2.1 virginica # 2 7.6 3.0 ...
Displaying all the logs from the default buffer on the Command Line can be accomplished by: adb logcat This command will show you all the logs from the device's main buffer. Notice that if you use it for the first time, you'll get a lot of information, an enormous stream of data. So you may want...
Creates a new menu in the Spreadsheet UI. Each menu entry runs a user-defined function. var activeSheet = SpreadsheetApp.getActiveSpreadsheet(); var menuItems = []; // When the user clicks on "addMenuExample" then "Menu 1", the function Myfunction1 is executed. me...
To install dplyr simply type in the R console. install.packages("dplyr") And then to load dplyr, type library("dplyr") It's also possible to install the latest development version from Github with: if (packageVersion("devtools") < 1.6) { install.packages...
Python Windows The easiest way to install GTK3 for Python is by using PyGObject for Windows. It offers an installer that installs most things you need to develop GTK appilcations. The number of options the PyGObject installer offers can be daunting, but for most GTK projects the only option you h...
Use tuples in a switch let switchTuple = (firstCase: true, secondCase: false) switch switchTuple { case (true, false): // do something case (true, true): // do something case (false, true): // do something case (false, false): // do something } Or in combina...

Page 574 of 1336