Tutorial by Examples: c

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...
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}...
Array References are scalars ($) which refer to Arrays. my @array = ("Hello"); # Creating array, assigning value from a list my $array_reference = \@array; These can be created more short-hand as follows: my $other_array_reference = ["Hello"]; Modifying / Using array ref...
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 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...
Flash will not load data from a domain other than the one your application is running on unless that domain has an XML crossdomain policy either in the root of the domain (e.g. http://somedomain.com/crossdomain.xml) or somewhere that you can target with Security.loadPolicyFile(). The crossdomain.xml...
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 ...
If you need to roll for a true or false in an "x% chance" situation, use: function roll(chance:Number):Boolean { return Math.random() >= chance; } Used like: var success:Boolean = roll(0.5); // True 50% of the time. var again:Boolean = roll(0.25); // True 25% of the time. ...
To get any random color: function randomColor():uint { return Math.random() * 0xFFFFFF; } If you need more control over the red, green and blue channels: var r:uint = Math.random() * 0xFF; var g:uint = Math.random() * 0xFF; var b:uint = Math.random() * 0xFF; var color:uint = r <&...
To display the hunks that are staged for commit: git diff --cached
To get started with Thymeleaf visit official download page. Maven dependency <dependency> <groupId>org.thymeleaf</groupId> <artifactId>thymeleaf</artifactId> <version>3.0.1.RELEASE</version> </dependency> Gradle dependency compile gr...
Current file You can get the name of the current PHP file (with the absolute path) using the __FILE__ magic constant. This is most often used as a logging/debugging technique. echo "We are in the file:" , __FILE__ , "\n"; Current directory To get the absolute path to the di...
2.2 func removeCharactersNotInSetFromText(text: String, set: Set<Character>) -> String { return String(text.characters.filter { set.contains( $0) }) } let text = "Swift 3.0 Come Out" var chars = Set([Character]("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLKMNOPQRSTUVWXYZ&...
array_chunk() splits an array into chunks Let's say we've following single dimensional array, $input_array = array('a', 'b', 'c', 'd', 'e'); Now using array_chunk() on above PHP array, $output_array = array_chunk($input_array, 2); Above code will make chunks of 2 array elements and create a...
The first step in optimizing for speed is finding the slowest sections of code. The Timer VBA function returns the number of seconds elapsed since midnight with a precision of 1/256th of a second (3.90625 milliseconds) on Windows based PCs. The VBA functions Now and Time are only accurate to a secon...
std::sort, found in the standard library header algorithm, is a standard library algorithm for sorting a range of values, defined by a pair of iterators. std::sort takes as the last parameter a functor used to compare two values; this is how it determines the order. Note that std::sort is not stable...
A series is a one-dimension data structure. It's a bit like a supercharged array, or a dictionary. import pandas as pd s = pd.Series([10, 20, 30]) >>> s 0 10 1 20 2 30 dtype: int64 Every value in a series has an index. By default, the indices are integers, running fro...
Simple example of how to create a custom plugin and DSL for your gradle project. This sample uses one of the three possible ways of creating plugins. The three ways are: inline buildSrc standalone plugins This example shows creating a plugin from the buildSrc folder. This sample will crea...
You can destructure nested vectors: (def my-vec [[1 2] [3 4]]) (let [[[a b][c d]] my-vec] (println a b c d)) ;; 1 2 3 4

Page 143 of 826