Tutorial by Examples: c

A common usecase is to discard certain rest-calls, that are not needed any more after certain user-inputs. The most prominent example would be, when a user uses some search-function, makes a request, makes another request and for some reason the first request arrives after the second request and the...
In the same way as in Open Terminal in current Xcode project folder example, you can add clear of derived data folder with hotkey. Create custom behavior (follow the steps in Open Terminal in current Xcode project folder). But use another script. Script text: #!/bin/bash rm -rf $HOME"/Lib...
Using bash you can easily locate a file with the locate command. For example say you are looking for the file mykey.pem: locate mykey.pem Sometimes files have strange names for example you might have a file like random7897_mykey_0fidw.pem. Let's say you're looking for this file but you only reme...
Integer literals provide values that can be used where you need a byte, short, int, long or char instance. (This example focuses on the simple decimal forms. Other examples explain how to literals in octal, hexadecimal and binary, and the use of underscores to improve readability.) Ordinary integ...
<canvas id = "canvas" height='400' width='500'></canvas> var canvas = new fabric.Canvas(document.getElementById('canvas')); console.log(JSON.stringify(canvas)); // '{"objects":[],"background":""}' canvas.add(new fabric.Rect({ left: 10, ...
First Test.class: package foo.bar public class Test { } Also Test.class in another package package foo.bar.baz public class Test { } The above is fine because the two classes exist in different packages.
In Java if you don't provide an access modifier the default scope for variables is package-protected level. This means that classes can access the variables of other classes within the same package as if those variables were publicly available. package foo.bar public class ExampleClass { do...
Refer to this original Post by e.James According to Apple's NSInvocation class reference: An NSInvocation is an Objective-C message rendered static, that is, it is an action turned into an object. And, in a little more detail: The concept of messages is central to the objective-c philosophy....
First declare a property like this in the ViewController @property (nonatomic) UIRefreshControl *refreshControl; Later in the viewDidLoad() set up the refreshControl as given below: self.refreshControl = [[UIRefreshControl alloc]init]; [self.tableView addSubview:self.refreshControl]; [self.re...
For an easier transition to Angular 2, it's recommended to use Component, available since Angular 1.5.8 myModule.ts import { MyModuleComponent } from "./components/myModuleComponent"; import { MyModuleService } from "./services/MyModuleService"; angular .module("m...
Navigator works for both IOS and android. import React, { Component } from 'react'; import { Text, Navigator, TouchableHighlight } from 'react-native'; export default class NavAllDay extends Component { render() { return ( <Navigator initialRoute={{ title: 'Awesome Sc...
What is Concurrency? Doing multiple things at the same time. Taking advantage of number of cores available in multicore CPUs. Running multiple programs in parallel. Objectives of Concurrency Running program in background without hogging CPU. Define Tasks, Define Rules and let...
// plugin initialization $.fn.greenify = function() { // within the function you can use any of the jQuery methods // and `this` context refers to jQuery object this.css( "color", "green" ); }; // apply plugin $( "a" ).greenify();
This works, but there are a couple of things we need to do for our plugin to survive in the real world. One of jQuery's features is chaining, when you link five or six actions onto one selector. This is accomplished by having all jQuery object methods return the original jQuery object again (there a...
When a class needs to be provided with hard dependencies best practice is to use a constructor injection pattern where those dependencies are injected using a factory. Let's assume that MyClass is hard dependent on a value $dependency that needs to be resolved from the application config. <?php...
var person = { name: 'John Doe', age: 42, gender: 'male', bio: function() { console.log('My name is ' + this.name); } }; person.bio(); // logs "My name is John Doe" var bio = person.bio; bio(); // logs "My name is undefined" In the above code, person.bi...
One common pitfall is to try and use this in a nested function or an object, where the context has been lost. document.getElementById('myAJAXButton').onclick = function(){ makeAJAXRequest(function(result){ if (result) { // success this.className = 'success'; } }) }...
5.1 Every function has a bind method, which will create a wrapped function that will call it with the correct context. See here for more information. var monitor = { threshold: 5, check: function(value) { if (value > this.threshold) { this.display("Value is too high!&quot...
When using a function as a constructor, it has a special this binding, which refers to the newly created object: function Cat(name) { this.name = name; this.sound = "Meow"; } var cat = new Cat("Tom"); // is a Cat object cat.sound; // Returns "Meow" var ca...
There are various ways to use colours in Processing since Processing is very flexible with colour formats. RGB and RGBA This is the standard RGB(A) notation and the default color mode. The first three colour values (red, green, blue) range from 0 to 255. For example, the below example is the colou...

Page 664 of 826