Tutorial by Examples: al

If an iterator method has a yield inside a try...finally, then the returned IEnumerator will execute the finally statement when Dispose is called on it, as long as the current point of evaluation is inside the try block. Given the function: private IEnumerable<int> Numbers() { yield re...
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...
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}...
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.
This is the built-in way to deal with "exceptions" without relying on third party libraries like Try::Tiny. my $ret; eval { $ret = some_function_that_might_die(); 1; } or do { my $eval_error = $@ || "Zombie error!"; handle_error($eval_error); }; # use $ret ...
In [11]: df = pd.DataFrame([[1, 2, None, 3], [4, None, 5, 6], [7, 8, 9, 10], [None, None, None, None]]) Out[11]: 0 1 2 3 0 1.0 2.0 NaN 3.0 1 4.0 NaN 5.0 6.0 2 7.0 8.0 9.0 10.0 3 NaN NaN NaN NaN Fill missing values with a sin...
When creating a DataFrame None (python's missing value) is converted to NaN (pandas' missing value): In [11]: df = pd.DataFrame([[1, 2, None, 3], [4, None, 5, 6], [7, 8, 9, 10], [None, None, None, None]]) Out[11]: 0 1 2 3 0 1.0 2.0 NaN 3.0 1 ...
function isEven(n:Number):Boolean { return ((n & 1) == 0); } Examples: isEven(1); // false isEven(2); // true isEven(1.1); // false isEven(1.2); // false isEven(2.1); // true isEven(2.2); // true
function isOdd(n:Number):Boolean { return ((n & 1) == 1); } Examples: isOdd(1); // true isOdd(2); // false isOdd(1.1); // true isOdd(1.2); // true isOdd(2.1); // false isOdd(2.2); // false
Detailed instructions on getting openerp set up or installed in Debian/Ubuntu. To install from source code, we need Python 2.7, Git and a PostgreSQL database: $ sudo apt-get install git python-pip python2.7-dev -y $ sudo apt-get install postgresql -y $ sudo su -c "createuser -s $(whoami)&qu...
var alphabet:Vector.<String> = new <String>[ "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", &q...
Imagine the following XML: <root> <element>hello</element> <another> hello </another> <example>Hello, <nested> I am an example </nested>.</example> </root> The following XPath expression: //*[text() = 'hel...
This command is useful if you want to serve a single site in a directory and not the entire directory. cd ~/Projects/my-blog/ valet link awesome-blog Valet will create a symbolic link in ~/.valet/Sites which points to your current working directory. After running the link command, you can acce...

Page 47 of 269