Tutorial by Examples: al

To check if a method was called on a mocked object you can use the Mockito.verify method: Mockito.verify(someMock).bla(); In this example, we assert that the method bla was called on the someMock mock object. You can also check if a method was called with certain parameters: Mockito.verify(som...
If a scoped enum is converted to an integral type that is too small to hold its value, the resulting value is unspecified. Example: enum class E { X = 1, Y = 1000, }; // assume 1000 does not fit into a char char c1 = static_cast<char>(E::X); // c1 is 1 char c2 = static_cast<c...
Multidimensional Arrays As the name indicates, multi dimensional arrays are arrays that contain more than one dimension, usually two or three but it can have up to 32 dimensions. A multi array works like a matrix with various levels, take in example a comparison between one, two, and three Dimensi...
Sitecore Instance Manager is open-source tool which is used for managing the local park of Sitecore instances. You can install, locate, maintain, reinstal or delete Sitecore products. It also helps you install your sitecore instance with any sitecore packages, modules and only thing you need to do i...
If static_cast is used to convert a pointer (resp. reference) to base class to a pointer (resp. reference) to derived class, but the operand does not point (resp. refer) to an object of the derived class type, the behavior is undefined. See Base to derived conversion.
c++11 The alignment requirement of a type can be queried using the alignof keyword as a unary operator. The result is a constant expression of type std::size_t, i.e., it can be evaluated at compile time. #include <iostream> int main() { std::cout << "The alignment requiremen...
enum SomeEnum { A, B } let enumValues:Array<string>= []; for(let value in SomeEnum) { if(typeof SomeEnum[value] === 'number') { enumValues.push(value); } } enumValues.forEach(v=> console.log(v)) //A //B
The following C code uses the OpenMP parallel programming model to write the thread ID and number of threads to stdout using multiple threads. #include <omp.h> #include <stdio.h> int main () { #pragma omp parallel { // ID of the thread in the current team ...
A model can also be added to the partial view : @model Solution.Project.Namespace.MyModelClass <p>@Model.Property</p> In the View you can now just use: <div> @Html.Partial("PartialViewExample", new MyModelClass(){Property="my property value"}) <...
Please note that continued use of Sublime Text requires that you purchase a license and you are asked to note the terms and conditions. The process of installing Sublime Text is different for each platform, but in each case you need to visit the download page. After installing ST3, it is common to...
With Parallel List Comprehensions language extension, [(x,y) | x <- xs | y <- ys] is equivalent to zip xs ys Example: [(x,y) | x <- [1,2,3] | y <- [10,20]] -- [(1,10),(2,20)]
Code snippet: import java.util.Set; public class ThreadStatus { public static void main(String args[]) throws Exception { for (int i = 0; i < 5; i++){ Thread t = new Thread(new MyThread()); t.setName("MyThread:" + i); t.start(); ...
We consume rest API as a JSON format and then unmarshal it to a POJO. Jackson’s org.codehaus.jackson.map.ObjectMapper “just works” out of the box and we really don’t do anything in most cases. But sometimes we need custom deserializer to fulfill our custom needs and this tutorial will guide you thro...
The function np.loadtxt can be used to read csv-like files: # File: # # Col_1 Col_2 # 1, 1 # 2, 4 # 3, 9 np.loadtxt('/path/to/dir/csvlike.txt', delimiter=',', comments='#') # Output: # array([[ 1., 1.], # [ 2., 4.], # [ 3., 9.]]) The same file could be read ...
When data is "tidy," it is often organized into several tables. To combine the data for analysis, we need to "update" one table with values from another. For example, we might have sales data for performances, where attributes of the performer (their budget) and of the location ...
Consider an array of work items. The time needed for an each work item to complete varies greatly. In order to balance the work distribution between blocks it may be prudent for each block to fetch the next item only when previous one is complete. This is in contrast to a-priori assigning items to...
// application/controllers/Company_controller.php <?php if(!defined('BASEPATH')) exit('No direct script access allowed'); class Company_controller extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('companies_mo...
If a void* value is converted to a pointer to object type, T*, but is not properly aligned for T, the resulting pointer value is unspecified. Example: // Suppose that alignof(int) is 4 int x = 42; void* p1 = &x; // Do some pointer arithmetic... void* p2 = static_cast<char*>(p1) + 2; ...
Assuming you have Eclipse IDE for Java Developers installed, start Eclipse, click "Help" -> "Install New Software..." Select "--All Available Sites--" at "Work with:", and navigate to "Eclipse Plugin Development Tools". Select "Eclipse Pl...
Phoenix framework is written in Elixir, and Elixir itself is based on Erlang language and leverages the Erlang VM, known for running low-latency, distributed and fault-tolerant systems. Both languages are required for using phoenix framework. Following following step to install phoenix framework: 1...

Page 133 of 269