Tutorial by Examples: is

Equality: value equality x == y (1 == 1.0 # true) value inequality x == y (1 != 1.0 # false) strict equality x === y (1 === 1.0 # false) strict inequality x === y (1 !== 1.0 # true) Comparison: x > y x >= y x < y x <= y If types are compatible, comparison uses natural o...
When you need to iterate over the list of jQuery elements. Consider this DOM structure: <div class="container"> <div class="red one">RED 1 Info</div> <div class="red two">RED 2 Info</div> <div class="red three"...
Validates value as float, and converts to float on success. var_dump(filter_var(1, FILTER_VALIDATE_FLOAT)); var_dump(filter_var(1.0, FILTER_VALIDATE_FLOAT)); var_dump(filter_var(1.0000, FILTER_VALIDATE_FLOAT)); var_dump(filter_var(1.00001, FILTER_VALIDATE_FLOAT)); var_dump(filter_var('1', FILTE...
Asynchronously var fs = require('fs'); fs.stat('path/to/file', function(err) { if (!err) { console.log('file or directory exists'); } else if (err.code === 'ENOENT') { console.log('file or directory does not exist'); } }); Synchronously here, we must wr...
Callback-based: db.notification.email.find({subject: 'promisify callback'}, (error, result) => { if (error) { console.log(error); } // normal code here }); This uses bluebird's promisifyAll method to promisify what is conventionally callback-based code like above. blueb...
TCO is only available in strict mode As always check browser and Javascript implementations for support of any language features, and as with any javascript feature or syntax, it may change in the future. It provides a way to optimise recursive and deeply nested function calls by eliminating the n...
/// <summary> /// Gets displayName from DataAnnotations attribute /// </summary> /// <typeparam name="TModel"></typeparam> /// <typeparam name="TProperty"></typeparam> /// <param name="htmlHelper"></param> /// <pa...
In this example we show how to generate a simple sine wave, and output it on the user's speakers/headphones. let audioContext = new (window.AudioContext || window.webkitAudioContext)(); let sourceNode = audioContext.createOscillator(); sourceNode.type = 'sine'; sourceNode.frequency.value = 261...
In Index page change the following: error_reporting(E_ALL | E_STRICT); to error_reporting(E_ALL); Set $_SERVER['MAGE_IS_DEVELOPER_MODE'] = true and uncomment this line (remove the #) #ini_set('display_errors', 1); You can also Set Dev Mode using SetEnv in your .htaccess file To make th...
SP.SOD.executeOrDelayUntilScriptLoaded( function(){ deleteItem(1); }, "sp.js"); function deleteItem(id){ var clientContext = new SP.ClientContext(); var list = clientContext.get_web().get_lists().getByTitle("List Title"); var item = list.getItemById(id); it...
SP.SOD.executeOrDelayUntilScriptLoaded(showDialog,"sp.js"); function showDialog(){ var options = SP.UI.$create_DialogOptions(); options.url = "/mySite/lists/myList/NewForm.aspx"; options.dialogReturnValueCallback = myCallBackFunction; SP.UI.ModalDialog.show...
SP.SOD.executeOrDelayUntilScriptLoaded(showDialog,"sp.js"); function showDialog(){ SP.UI.ModalDialog.showModalDialog( { url: "/org/it/web/wik/Lists/ExampleCode/DispForm.aspx?ID=6" } ); }
SP.SOD.executeOrDelayUntilScriptLoaded(myFunction,"sp.js"); function myFunction(){ var clientContext = new SP.ClientContext(); var list = clientContext.get_web().get_lists().getByTitle("List Title"); var item = list.getItemById(1); // get item with ID == 1 ...
Basic Example Use the set_viewXml method of the SP.CamlQuery object to specify a CAML query to retrieve items. SP.SOD.executeOrDelayUntilScriptLoaded(showListItems,"core.js"); function showListItems(){ var clientContext = new SP.ClientContext(); var list = clientContext.get_...
Sometimes it is useful to create union types with only one case to implement record-like types: type Point = Point of float * float let point1 = Point(0.0, 3.0) let point2 = Point(-2.5, -4.0) These become very useful because they can be decomposed via pattern matching in the same way as tu...
Example : CLLocationManager *locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; locationManager.desiredAccuracy = kCLLocationAccuracyBest; locationManager.distanceFilter = 5; E.g. In the above example code above, location changes of less than 5 m...
List<T> is a list of a given type. Items can be added, inserted, removed and addressed by index. using System.Collections.Generic; var list = new List<int>() { 1, 2, 3, 4, 5 }; list.Add(6); Console.WriteLine(list.Count); // 6 list.RemoveAt(3); Console.WriteLine(list.Count); // 5 ...
IronPython is completly written using managed .net (c#) code. So all builtin python methods and libraries (such as next(), int(), etc.) are writtin in .net. This example shows the implementation of len() for a list of different types (only a few): .... public static int len([NotNull]List/*!*/ l...
Any permission required by your application to access a protected part of the API or to interact with other applications must be declared in your AndroidManifest.xml file. This is done using the <uses-permission /> tag. Syntax <uses-permission android:name="string" android...
The = operator is used for assignment. The == operator is used for comparison. One should be careful not to mix the two. Sometimes one mistakenly writes /* assign y to x */ if (x = y) { /* logic */ } when what was really wanted is: /* compare if x is equal to y */ if (x == y) { ...

Page 24 of 109