Tutorial by Examples

Ordered sequences may hurt performance when dealing with a large number of elements. To mitigate this, it's possible to call AsUnordered when the sequence order is no longer necessary. var sequence = Enumerable.Range(1, 10000).Select(x => -1 * x); // -1, -2, ... var evenNumbers = sequence.AsPar...
Derives from Object Key members public Dispatcher Dispatcher { get; } Summary Most objects in WPF derive from DispatcherObject, which provides the basic constructs for dealing with concurrency and threading. Such objects are associated with a Dispatcher. Only the thread that the Dispatcher w...
Derives from DispatcherObject Key members public object GetValue(DependencyProperty dp); public void SetValue(DependencyProperty dp, object value); Summary Classes derived from DependencyObject participate in the dependency property system, which includes registering dependency properties ...
a, b = 1, 2 import math math.sin(a) # returns the sine of 'a' in radians # Out: 0.8414709848078965 math.cosh(b) # returns the inverse hyperbolic cosine of 'b' in radians # Out: 3.7621956910836314 math.atan(math.pi) # returns the arc tangent of 'pi' in radians # Out: 1.2626272556789...
A typical use case for SpriteKit is where the SKView fills the whole screen. To do this in Xcode's Interface Builder, first create a normal ViewController, then select the contained view and change its Class from UIView to SKView: Within the code for the View Controller, in the viewDidLoad metho...
One might argue that there are greater resource hogs in Unity than the humble string, but it is one of the easier aspects to fix early on. String operations build garbage Most string operations build tiny amounts of garbage, but if those operations are called several times over the course of a s...
In case your activities, fragments and UI require some background processing a good thing to use is a MockWebServer which runs localy on an android device which brings a closed and testable enviroment for your UI. https://github.com/square/okhttp/tree/master/mockwebserver First step is including t...
The power of idling resources lies in not having to wait for some app's processing (networking, calculations, animations, etc.) to finish with sleep(), which brings flakiness and/or prolongs the tests run. The official documentation can be found here. Implementation There are three things that you...
fastlane is an open source build automation tool for Android and iOS for developers. It reduce your build generation time. It is a command line tool that uses Ruby, so you need Ruby on your computer. Most Macs already have Ruby installed by default. Install fastlane Open a terminal. Run sudo ge...
2 Dimensional arrays 6 In ES6, we can flatten the array by the spread operator ...: function flattenES6(arr) { return [].concat(...arr); } var arrL1 = [1, 2, [3, 4]]; console.log(flattenES6(arrL1)); // [1, 2, 3, 4] 5 In ES5, we can acheive that by .apply(): function flatten(arr) { ...
As Angular uses HTML to extend a web page and plain Javascript to add logic, it makes it easy to create a web page using ng-app, ng-controller and some built-in directives such as ng-if, ng-repeat, etc. With the new controllerAs syntax, newcomers to Angular users can attach functions and data to the...
Like in many other languages, Python uses the % operator for calculating modulus. 3 % 4 # 3 10 % 2 # 0 6 % 4 # 2 Or by using the operator module: import operator operator.mod(3 , 4) # 3 operator.mod(10 , 2) # 0 operator.mod(6 , 4) # 2 You can also use negative nu...
This is the basic HTML file that can be used as a boilerplate when starting a project. This boilerplate uses orbit controls with damping (camera that can move around an object with deceleration effect) and creates a spinning cube. <!DOCTYPE html> <html> <head> <t...
Factors are one method to represent categorical variables in R. Given a vector x whose values can be converted to characters using as.character(), the default arguments for factor() and as.factor() assign an integer to each distinct element of the vector as well as a level attribute and a label attr...
public function drawDisplayObjectUsingBounds(source:DisplayObject):BitmapData { var bitmapData:BitmapData;//declare a BitmapData var bounds:Rectangle = source.getBounds(source);//get the source object actual size //round bounds to integer pixel values (to aviod 1px str...
One of the most common errors in compilation happens during the linking stage. The error looks similar to this: $ gcc undefined_reference.c /tmp/ccoXhwF0.o: In function `main': undefined_reference.c:(.text+0x15): undefined reference to `foo' collect2: error: ld returned 1 exit status $ So l...
UIBezierPath using to create a circular path ShapeLayer CAShapeLayer *circleLayer = [CAShapeLayer layer]; [circleLayer setPath:[[UIBezierPath bezierPathWithOvalInRect: CGRectMake(50, 50, 100, 100)] CGPath]]; circleLayer.lineWidth = 2.0; [circleLayer setStrokeColor:[[UIColor redColor] CGColor]];...
Const baseString As String = "Hello World" Dim charLength As Long charLength = Len(baseString) 'charlength = 11
Const baseString As String = "Hello World" Dim byteLength As Long byteLength = LenB(baseString) 'byteLength = 22
When checking if a string is zero-length, it is better practice, and more efficient, to inspect the length of the string rather than comparing the string to an empty string. Const myString As String = vbNullString 'Prefer this method when checking if myString is a zero-length string If Len(mySt...

Page 475 of 1336