Tutorial by Examples

When implementing more than one interface that have methods of the same name that include default implementations, it is ambiguous to the compiler which implementation should be used. In the case of a conflict, the developer must override the conflicting method and provide a custom implementation. ...
Empty array np.empty((2,3)) Note that in this case, the values in this array are not set. This way of creating an array is therefore only useful if the array is filled later in the code. From a list np.array([0,1,2,3]) # Out: array([0, 1, 2, 3]) Create a range np.arange(4) # Out: array(...
x = np.arange(4) x #Out:array([0, 1, 2, 3]) scalar addition is element wise x+10 #Out: array([10, 11, 12, 13]) scalar multiplication is element wise x*2 #Out: array([0, 2, 4, 6]) array addition is element wise x+x #Out: array([0, 2, 4, 6]) array multiplication is element wise x...
Slice syntax is i:j:k where i is the starting index (inclusive), j is the stopping index (exclusive) and k is the step size. Like other python data structures, the first element has an index of 0: x = np.arange(10) x[0] # Out: 0 x[0:4] # Out: array([0, 1, 2, 3]) x[0:4:2] # Out:array([0, 2...
The basics After making changes to your source code, you should stage those changes with Git before you can commit them. For example, if you change README.md and program.py: git add README.md program.py This tells git that you want to add the files to the next commit you do. Then, commit your...
Notation As of jQuery 3.0, only this form is recommended: jQuery(function($) { // Run when document is ready // $ (first argument) will be internal reference to jQuery // Never rely on $ being a reference to jQuery in the global namespace }); All other document-ready handlers are depr...
Compares two values for equality. It can compare strings, integers, and Boolean values only. Assert.AreEqual(documentElement.LocalName, "xamlControls", "Xaml files must have a root node named 'xamlControls'.");
$(element).hide() // sets display: none $(element).show() // sets display to original value $(element).toggle() // toggles between the two $(element).is(':visible') // returns true or false $('element:visible') // matches all elements that are visible $...
If an object is defined with static, thread, or automatic storage duration, and it has a character type, either: char, unsigned char, or signed char, it may not be accessed by a non-character type. In the below example a char array is reinterpreted as the type int, and the behavior is undefined on e...
First download anaconda from the Continuum site. Either via the graphical installer (Windows/OSX) or running a shell script (OSX/Linux). This includes pandas! If you don't want the 150 packages conveniently bundled in anaconda, you can install miniconda. Either via the graphical installer (Window...
Installing Jasmine standalone Download the latest Jasmine release from the Jasmine release page: Running Jasmine locally Run Jasmine in the browser by downloading the zip file, extracting it, the referencing the files as follows: <link rel="shortcut icon" type="image/png&qu...
jQuery offers a variety of methods that can be used for DOM manipulation. The first is the .empty() method. Imagine the following markup: <div id="content"> <div>Some text</div> </div> By calling $('#content').empty();, the inner div would be removed. This...
A query engine is required in order to execute SPARQL queries over a dataset. Query engines may be embedded in applications, or accessed remotely. Remote access may be through a vendor-specific API, or through the SPARQL protocol if an implementation supports it. This documentation will not cover ho...
Forms can be defined, in a similar manner to models, by subclassing django.forms.Form. Various field input options are available such as CharField, URLField, IntegerField, etc. Defining a simple contact form can be seen below: from django import forms class ContactForm(forms.Form): contac...
Detailed instructions on getting Zend Framework 2 set up or installed. There are various ways of installing the framework. Below are some of them: Using Composer - Recommended way Assuming composer is installed on the target box. To install a skeleton MVC application, run in your terminal to crea...
When creating a SOAP Client in PHP, you can also set a classmap key in the configuration array. This classmap defines which types defined in the WSDL should be mapped to actual classes, instead of the default StdClass. The reason you would want to do this is because you can get auto-completion of fi...
use std::fs::File; use std::io::Read; fn main() { let filename = "src/main.rs"; // Open the file in read-only mode. match File::open(filename) { // The file is open (no error). Ok(mut file) => { let mut content = String::new(); ...
use std::fs::File; use std::io::{BufRead, BufReader}; fn main() { let filename = "src/main.rs"; // Open the file in read-only mode (ignoring errors). let file = File::open(filename).unwrap(); let reader = BufReader::new(file); // Read the file line by line us...
use std::env; use std::fs::File; use std::io::Write; fn main() { // Create a temporary file. let temp_directory = env::temp_dir(); let temp_file = temp_directory.join("file"); // Open a file in write-only (ignoring errors). // This creates the file if it doe...
Channels can be used to send data from one thread to another. Below is an example of a simple producer-consumer system, where the main thread produces the values 0, 1, ..., 9, and the spawned thread prints them: use std::thread; use std::sync::mpsc::channel; fn main() { // Create a channel...

Page 161 of 1336