Tutorial by Examples: n

While you can use the @testSetup annotation to designate a method to be run before tests are executed, this method will usually only be run once. If you need code to be run before each test, you can use a static block: @isTest public class MyTest { static { // code here will be run before ...
The browser identifies tokens from stylesheet and coverts them into nodes which are linked into a tree structure. The entire map of all the nodes with their associated styles of a page would be the CSS Object Model. To display the webpage, a web browser takes following steps. The web browser exa...
using (SQLiteConnection conn = new SQLiteConnection(@"Data Source=data.db;Pooling=true;FailIfMissing=false")) { conn.Open(); using (SQLiteCommand cmd = new SQLiteCommand(conn)) { cmd.CommandText = "query"; using (SqlDataReader dr = cmd.ExecuteReade...
The two mapAccum functions combine the operations of folding and mapping. -- A Traversable structure -- | -- A seed value | ...
Although GameplayKit (which is introduced with iOS 9 SDK) is about implementing game logic, it could also be used to generate random numbers, which is very useful in apps and games. Beside the GKRandomSource.sharedRandom which is used in the following chapters there are three additional types of GK...
Charts can be created by working directly with the Series object that defines the chart data. In order to get to the Series without an exisitng chart, you create a ChartObject on a given Worksheet and then get the Chart object from it. The upside of working with the Series object is that you can s...
The starting point for the vast majority of charting code is to create an empty Chart. Note that this Chart is subject to the default chart template that is active and may not actually be empty (if the template has been modified). The key to the ChartObject is determining its location. The syntax...
For complete control over a new Chart and Series object (especially for a dynamic Series name), you must resort to modifying the SERIES formula directly. The process to set up the Range objects is straightforward and the main hurdle is simply the string building for the SERIES formula. The SERIES ...
A common chore with charts in Excel is standardizing the size and layout of multiple charts on a single sheet. If done manually, you can hold down ALT while resizing or moving the chart to "stick" to cell boundaries. This works for a couple charts, but a VBA approach is much simpler. Co...
If a type t is Traversable then values of t a can be split into two pieces: their "shape" and their "contents": data Traversed t a = Traversed { shape :: t (), contents :: [a] } where the "contents" are the same as what you'd "visit" using a Foldable insta...
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...
Suppose you have a Post model with a hasMany relationship with Comment. You may insert a Comment object related to a post by doing the following: $post = Post::find(1); $commentToAdd = new Comment(['message' => 'This is a comment.']); $post->comments()->save($commentToAdd); You ca...
However, x in the generator expression is not just variable, but can be any pattern. In cases of pattern mismatch the generated element is skipped over, and processing of the list continues with the next element, thus acting like a filter: [x | Just x <- [Just 1, Nothing, Just 3]] -- [1, 3] ...
List comprehensions can also draw elements from multiple lists, in which case the result will be the list of every possible combination of the two elements, as if the two lists were processed in the nested fashion. For example, [ (a,b) | a <- [1,2,3], b <- ['a','b'] ] -- [(1,'a'), (1,'b'),...
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)]
A tuple is a heterogeneous collection of two to twenty-two values. A tuple can be defined using parentheses. For tuples of size 2 (also called a 'pair') there's an arrow syntax. scala> val x = (1, "hello") x: (Int, String) = (1,hello) scala> val y = 2 -> "world" y:...
The TIMESTAMP column will show when the row was last updated. CREATE TABLE `TestLastUpdate` ( `ID` INT NULL, `Name` VARCHAR(50) NULL, `Address` VARCHAR(50) NULL, `LastUpdate` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) COMMENT='Last Update' ;
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(); ...
Sometimes you need to fetch data asynchronously before passing it to a child component to use. If the child component tries to use the data before it has been received, it will throw an error. You can use ngOnChanges to detect changes in a components' @Inputs and wait until they are defined before a...
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...

Page 554 of 1088