Tutorial by Examples: l

File level metadata applies to all the code within the file and should be placed at the top of the file: <?php /** * @author John Doe ([email protected]) * @copyright MIT */
Let's say you need to implement an automatic search box, but the search operation is somewhat costly, like sending a web request or hitting up a database. You may want to limit the amount of search being done. For example, the user is typing "C# Reactive Extensions" in the search box : I...
There are two operators for filtering duplicates: emails.Distinct(); // Never see the same value twice emails.DistinctUntilChanged(); // Never see the same value twice in a row You can also pass in a predicate: emails.DistinctUntilChanged(x => x.Length); // Never see the same length email t...
Let's use *norm as an example. From the documentation: dnorm(x, mean = 0, sd = 1, log = FALSE) pnorm(q, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE) qnorm(p, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE) rnorm(n, mean = 0, sd = 1) So if I wanted to know the value of a standard no...
In order to define a variable inside a linq expression, you can use the let keyword. This is usually done in order to store the results of intermediate sub-queries, for example: int[] numbers = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; var aboveAverages = from number in numbers l...
# load the library library(ggplot2) # create a blank canvas g <- ggplot(data = diamonds) g + geom_bar(aes(x = cut, fill = cut)) + scale_fill_discrete(guide = guide_legend(title = "CUT", keywidth = 2, ...
In order to enable a multidex configuration you need: to change your Gradle build configuration to use a MultiDexApplication or enable the MultiDex in your Application class Gradle configuration In app/build.gradle add these parts: android { compileSdkVersion 24 buildToolsVersion ...
The dexcount plugin counts methods and class resource count after a successful build. Add the plugin in the app/build.gradle: apply plugin: 'com.android.application' buildscript { repositories { mavenCentral() // or jcenter() } dependencies { classpath 'com.ge...
While in insert mode, press <C-o> to temporarily leave insert mode and execute a one-off normal command. Example <C-o>2w jumps to the second word to the left and returns to insert mode. Note: Repeating with . will only repeat the actions from returning to insert mode This allows for ...
C++11 introduced final specifier which forbids method overriding if appeared in method signature: class Base { public: virtual void foo() { std::cout << "Base::Foo\n"; } }; class Derived1 : public Base { public: // Overriding Base::foo void foo() f...
Detailed instructions on getting android-activity set up or installed.
A reference is a scalar variable (one prefixed by $ ) which “refers to” some other data. my $value = "Hello"; my $reference = \$value; print $value; # => Hello print $reference; # => SCALAR(0x2683310) To get the referred-to data, you de-reference it. say ${$reference}...
Html5-Canvas ... Is an Html5 element. Is supported in most modern browsers (Internet Explorer 9+). Is a visible element that is transparent by default Has a default width of 300px and a default height of 150px. Requires JavaScript because all content must be programmatically added to the Canv...
The URLRequest and URLLoader classes work together to make requests from Flash to external resources. The URLRequest defines information about the request e.g. the request body and the request method type, and the URLLoader references this to perform the actual request and provide a means of being n...
The URLVariables class allows you to define data to be sent along with a URLRequest. Example: var variables:URLVariables = new URLVariables(); variables.prop = "hello"; variables.anotherProp = 10; var request:URLRequest = new URLRequest('http://someservice.com'); request.data = v...
The URLRequestMethod class contains constants for the various request types you can make. These constants are to be allocated to URLRequest's method property: var request:URLRequest = new URLRequest('http://someservice.com'); request.method = URLRequestMethod.POST; Note that only GET and POST...
When Flash makes a request for data from an external source, that operation is asynchronous. The most basic explanation of what this means is that the data loads "in the background" and triggers the event handler you allocate to Event.COMPLETE when it is received. This can happen at any po...
Assuming we have an array myArray: var value:* = myArray[int(Math.random() * myArray.length)]; Note we use int to cast the result of Math.random() to an int because values like 2.4539543 would not be a valid array index.
First define the circle radius and its center: var radius:Number = 100; var center:Point = new Point(35, 70); Then generate a random angle in radians from the center: var angle:Number = Math.random() * Math.PI * 2; Then generate an effective radius of the returned point, so it'll be inside ...
function randomAngleRadians():Number { return Math.random() * Math.PI * 2; } Example outputs: 5.490068569213088 3.1984284719180205 4.581117863808207

Page 144 of 861