Tutorial by Examples

Transformations alter a given point's starting position by moving, rotating & scaling that point. Translation: Moves a point by a distanceX and distanceY. Rotation: Rotates a point by a radian angle around it's rotation point. The default rotation point in Html Canvas is the top-left origin ...
Canvas allows you to context.translate, context.rotate and context.scale in order to draw your shape in the position & size you require. Canvas itself uses a transformation matrix to efficiently track transformations. You can change Canvas's matrix with context.transform You can change Canv...
Spark uses lazy evaluation; that means it will not do any work, unless it really has to. That approach allows us to avoid unnecessary memory usage, thus making us able to work with big data. A transformation is lazy evaluated and the actual work happens, when an action occurs. Example: In [1]: li...
You want to combine arrays into one. For example, you have fruits = ['Broccoli', 'Carrots'] spices = ['Thyme', 'Cinnamon'] and you want to combine them into ingredients = ['Broccoli', 'Carrots', 'Thyme', 'Cinnamon'] Method 1 - using .concat ingredients = fruits.concat spices Method 2 -...
Detailed instructions on getting windows-azure-storage set up or installed.
Make sure the following dependency is added to your app's build.gradle file under dependencies: compile 'com.android.support:support-core-ui:24.2.0' Then add the SwipeRefreshLayout in your layout: <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/swipe_refresh_layo...
Block strings can be used to hold formatted or indentation-sensitive text (or, if you just don't feel like escaping quotes and apostrophes). The indentation level that begins the block is maintained throughout, so you can keep it all aligned with the body of your code. html = """ ...
Multiline strings are allowed in CoffeeScript. Lines are joined by a single space unless they end with a backslash. Indentation is ignored. mobyDick = "Call me Ishmael. Some years ago -- never mind how long precisely -- having little or no money in my purse, and nothing particular to ...
Complete the Installation and setup part to connect your app to Firebase. This will create the project in Firebase. Add the dependency for Firebase Realtime Database to your module-level build.gradle file: compile 'com.google.firebase:firebase-database:10.2.1' Configure Firebase ...
While the if ()... else statement allows to define only one (default) behaviour which occurs when the condition within the if () is not met, chaining two or more if () ... else statements allow to define a couple more behaviours before going to the last else branch acting as a "default", i...
In .NET, the GC allocates objects when there are no references left to them. Therefore, while an object can still be reached from code (there is a strong reference to it), the GC will not allocate this object. This can become a problem if there are a lot of large objects. A weak reference is a ref...
Plenty has been written about Python's GIL. It can sometimes cause confusion when dealing with multi-threaded (not to be confused with multiprocess) applications. Here's an example: import math from threading import Thread def calc_fact(num): math.factorial(num) num = 600000 t = Threa...
In most object oriented languages, allocating memory for an object and initializing it is an atomic operation: // Both allocates memory and calls the constructor MyClass object = new MyClass(); In Objective-C, these are separate operations. The class methods alloc (and its historic sibling allo...
Use the following piece of code to set the badge number from within your application (suppose someNumber has been declared before): Objective-C [UIApplication sharedApplication].applicationIconBadgeNumber = someNumber; Swift UIApplication.shared.applicationIconBadgeNumber = someNumber In order ...
module.exports.routes = { 'GET /blog/:year/:month/:day/:posttitle/': 'BlogController.showPost', 'GET /blog/:year/:month/:day/': 'BlogController.showDayArchive', 'GET /blog/:year/:month/': 'BlogController.showMonthArchive', 'GET /blog/:year/': 'BlogController.showYearArchive', }; The ...
There's an installation guide for running a JIRA Server under Windows or Linux / Mac ( see Installing JIRA applications) For local testing there's an SDK, which starts a JIRA test instance and can be used to develop JIRA Plugins (see Set up the Atlassian Plugin SDK and Build a Project)
import React, { Component } from 'react' import { View, Text, AppRegistry } from 'react-native' class Example extends Component { render () { return ( <View> <Text> I'm a basic Component </Text> </View> ) } } AppRegistry.registe...
These components will have changing States. import React, { Component } from 'react' import { View, Text, AppRegistry } from 'react-native' class Example extends Component { constructor (props) { super(props) this.state = { name: "Sriraman" } } render ...
As the name implies, Stateless Components do not have any local state. They are also known as Dumb Components. Without any local state, these components do not need lifecycle methods or much of the boilerplate that comes with a stateful component. Class syntax is not required, you can simply do con...
Consider the following example: public final class Person { private final String firstName; private final String lastName; public Person(String firstName, String lastName) { this.firstName = (firstName == null) ? "" : firstName; this.lastName = (lastN...

Page 773 of 1336