Tutorial by Examples: e

Enumerable.Repeat generates a sequence of a repeated value. In this example it generates "Hello" 4 times. var repeats = Enumerable.Repeat("Hello", 4); foreach (var item in repeats) { Console.WriteLine(item); } /* output: Hello Hello Hello Hell...
import random probability = 0.3 if random.random() < probability: print("Decision with probability 0.3") else: print("Decision with probability 0.7")
The fundamental concept of the customizer is that admins can live preview changes to their site, and then permanently add them. The following can be copied and pasted into a theme's functions.php file to Add a customizer section called My First Section Add a customizer setting called Hello Worl...
MySQL3.19 Checks if a string matches a regular expression (defined by another string). SELECT 'bedded' REGEXP '[a-f]' -- returns True SELECT 'beam' REGEXP '[a-f]' -- returns False
Instantiating a socket can be done in various ways. by 2 line declaration & instantiation: First we need to define a variable which will hold a Socket class object: Socket socket; then we can create a Socket class object: socket = new Socket(); We can also make a one line defin...
The simplest way to run your job is to use mpiexec or mpirun (they are usually the same thing and aliases of each other). mpiexec -n 2 ./my_prog
Alternate return is a facility to control the flow of execution on return from a subroutine. It is often used as a form of error handling: real x call sub(x, 1, *100, *200) print*, "Success:", x stop 100 print*, "Negative input value" stop 200 print*, "Input va...
Installing aws cli in Ubuntu / Debian Instance sudo apt-get install -y python-dev python-pip sudo pip install awscli aws --version aws configure Installing aws cli using python Using pip you can install aws cli in windows, OS X and Linux sudo pip install awscli Configuring the AWS Comman...
Unit Test Unit tests are used to ensure that your code has no syntax error and to test the logic of your code to work as what you expected. Quick example: src/AppBundle/Calculator/BillCalculator.php <?php namespace AppBundle\Calculator; use AppBundle\Calculator\TaxCalculator; class Bi...
A subprogram (which defines a procedure), can be either a subroutine or a function; it is said to be an internal subprogram if it is called or invoked from the same program or subprogram that contains it, as follows program my_program ! declarations ! executable statements, ! among which...
A subprogram is said to be external when it is not contained in the main program, nor in a module or antoher subprogram. In particular it can be defined by means of a programming language other than Fortran. When an external subprogram is invoked, the compiler cannot access to its code, so all the ...
Most advanced user interfaces require the user to be able to pass information between the various functions which make up a user interface. MATLAB has a number of different methods to do so. guidata MATLAB's own GUI Development Environment (GUIDE) prefers to use a struct named handles to pass da...
Controlled form components are defined with a value property. The value of controlled inputs is managed by React, user inputs will not have any direct influence on the rendered input. Instead, a change to the value property needs to reflect this change. class Form extends React.Component { con...
Uncontrolled components are inputs that do not have a value property. In opposite to controlled components, it is the application's responsibility to keep the component state and the input value in sync. class Form extends React.Component { constructor(props) { super(props); th...
There are various methods available for explicitly converting a string to an integer, such as: Convert.ToInt16(); Convert.ToInt32(); Convert.ToInt64(); int.Parse(); But all these methods will throw a FormatException, if the input string contains non-numeric characters. For t...
Use the continuation character (ellipsis) ... to continue long statement. Example: MyFunc( parameter1,parameter2,parameter3,parameter4, parameter5, parameter6,parameter7, parameter8, parameter9) can be replaced by: MyFunc( parameter1, ... parameter2, ... parameter3, ... ...
Floating-point numbers cannot represent all real numbers. This is known as floating point inaccuracy. There are infinitely many floating points numbers and they can be infinitely long (e.g. π), thus being able to represent them perfectly would require infinitely amount of memory. Seeing this was a ...
To add/subtract time, use POSIXct, since it stores times in seconds ## adding/subtracting times - 60 seconds as.POSIXct("2016-01-01") + 60 # [1] "2016-01-01 00:01:00 AEDT" ## adding 3 hours, 14 minutes, 15 seconds as.POSIXct("2016-01-01") + ( (3 * 60 * 60) + (14 ...
Objective-C NSString *textToShare = @"StackOverflow Documentation!! Together, we can do for Documentation what we did for Q&A."; NSURL *documentationURL = [NSURL URLWithString:@"http://stackoverflow.com/tour/documentation"]; NSArray *objectsToShare = @[textToShare, docum...
Steps to create Hello Spring: Investigate Spring Boot to see if that would better suit your needs. Have a project set up with the correct dependencies. It is recommended that you are using Maven or Gradle. create a POJO class, e.g. Employee.java create a XML file where you can define your clas...

Page 329 of 1191