Tutorial by Examples: c

For simple array comparison you can use JSON stringify and compare the output strings: JSON.stringify(array1) === JSON.stringify(array2) Note: that this will only work if both objects are JSON serializable and do not contain cyclic references. It may throw TypeError: Converting circular struct...
In the HTTP server code (e.g. server.js): const EventEmitter = require('events') const serverEvents = new EventEmitter() // Set up an HTTP server const http = require('http') const httpServer = http.createServer((request, response) => { // Handler the request... // Then emit an event...
Event Emitters are built into Node, and are for pub-sub, a pattern where a publisher will emit events, which subscribers can listen and react to. In Node jargon, publishers are called Event Emitters, and they emit events, while subscribers are called listeners, and they react to the events. // Requ...
from http://flex.apache.org/doc-getstarted.html Download the SDK installer Run the SDK installer. The first question you will be asked is the installation directory. on a Mac, use /Applications/Adobe Flash Builder 4.7/sdks/4.14.0/ on a PC, use C:\Program Files(x86)\Adobe Flash Builder ...
Objective-C NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:@"Your String here"]; [attributeString addAttribute:NSStrikethroughStyleAttributeName value:@2 range:NSMakeRange(0, [attributeString length...
A VectorDrawable should consist of at least one <path> tag defining a shape <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24.0" android:viewpor...
A <clip-path> defines a shape which acts as a window, only allowing parts of a <path> to show if they are within the <clip-path> shape and cutting off the rest. <vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.an...
An AnimatedVectorDrawable requires at least 3 components: A VectorDrawable which will be manipulated An objectAnimator which defines what property to change and how The AnimatedVectorDrawable itself which connects the objectAnimator to the VectorDrawable to create the animation The following...
In AS3, display assets are not visible until they are added to the Display List. The AIR/Flash runtime has a hierarchical display structure (parent child relationship where children can have their own children), with the stage being the top level parent. To add something to the display list, you u...
Add an accessory view above the keyboard. This is commonly used for adding next/previous buttons, or additional buttons like Done/Submit (especially for the number/phone/decimal pad keyboard types which don't have a built-in return key). Swift let textField = UITextField() // initialized however ...
Swift textField.autocapitalizationType = .None Objective-C textField.autocapitalizationType = UITextAutocapitalizationTypeNone; All options: .None \ UITextAutocapitalizationTypeNone : Don't autocapitalize anything .Words \ UITextAutocapitalizationTypeWords : Autocapitalize every word .S...
Given the following CSV file: Id,Name 1,"Joel" 2,"Adam" 3,"Ryan" 4,"Matt" You can read the data with the following script: #r "FSharp.Data.dll" open FSharp.Data type PeopleDB = CsvProvider<"people.csv"> let people = Pe...
Create Subtree Add a new remote called plugin pointing to the plugin's repository: git remote add plugin https://path.to/remotes/plugin.git Then Create a subtree specifying the new folder prefix plugins/demo. plugin is the remote name, and master refers to the master branch on the subtree's rep...
String concatenation can be performed using the + operator. For example: String s1 = "a"; String s2 = "b"; String s3 = "c"; String s = s1 + s2 + s3; // abc Normally a compiler implementation will perform the above concatenation using methods involving a StringBui...
0.18.0 Prior to 0.18.0 you can create ranges like this: > range = [1..5] [1,2,3,4,5] : List number > > negative = [-5..3] [-5,-4,-3,-2,-1,0,1,2,3] : List number 0.18.0 In 0.18.0 The [1..5] syntax has been removed. > range = List.range 1 5 [1,2,3,4,5] : List number > &g...
> listOfNumbers = [1,4,99] [1,4,99] : List number > > listOfStrings = ["Hello","World"] ["Hello","World"] : List String > > emptyList = [] -- can be anything, we don't know yet [] : List a > Under the hood, List (linked list) is ...
def multiply(factor: Int)(numberToBeMultiplied: Int): Int = factor * numberToBeMultiplied val multiplyBy3 = multiply(3)_ // resulting function signature Int => Int val multiplyBy10 = multiply(10)_ // resulting function signature Int => Int val sixFromCurriedCall = multiplyBy3(2) //6...
def numberOrCharacterSwitch(toggleNumber: Boolean)(number: Int)(character: Char): String = if (toggleNumber) number.toString else character.toString // need to explicitly specify the type of the parameter to be curried // resulting function signature Boolean => String val switchBetween3A...
def minus(left: Int, right: Int) = left - right val numberMinus5 = minus(_: Int, 5) val fiveMinusNumber = minus(5, _: Int) numberMinus5(7) // 2 fiveMinusNumber(7) // -2
To create a collection of n copies of some object x, use the fill method. This example creates a List, but this can work with other collections for which fill makes sense: // List.fill(n)(x) scala > List.fill(3)("Hello World") res0: List[String] = List(Hello World, Hello World, Hello...

Page 123 of 826