Tutorial by Examples: each

A deadlock is what occurs when two or more threads are waiting for eachother to complete or to release a resource in such a way that they wait forever. A typical scenario of two threads waiting on eachother to complete is when a Windows Forms GUI thread waits for a worker thread and the worker thre...
When building a custom release track, it's common to keep packages in the /packages directory as git submodules. The following command allows you to fetch all of the latest commits for the submodules in your /packages directory at the same time. git submodule foreach git pull origin master
int [] arr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; for(int value : arr) { System.out.print(value); System.out.print("\n"); } *Note that the Java foreach is just a for loop with different syntax. Some languages do this and some such as C# use foreach.
Scope guards allow executing statements at certain conditions if the current block is left. import core.stdc.stdlib; void main() { int* p = cast(int*)malloc(int.sizeof); scope(exit) free(p); }
For Each row As DataRow In FooDataTable.Rows Me.RowsToProcess.Add(row) Next Dim myOptions As ParallelOptions = New ParallelOptions() myOptions.MaxDegreeOfParallelism = environment.processorcount Parallel.ForEach(RowsToProcess, myOptions, Sub(currentRow, state) ...
The @each directive allows you to iterate through any list or map. It takes the form of @each $var or <list or map> {} where $var can be any variable name and <list or map> can be anything that returns a list or map. In the following example, the loop will iterate through the $authors l...
The angular.forEach accepts an object and an iterator function. It then runs the iterator function over each enumerable property/value of the object. This function also works on arrays. Like the JS version of Array.prototype.forEach The function does not iterate over inherited properties (prototype...
Each resource directory under the res folder (listed in the example above) can have different variations of the contained resources in similarly named directory suffixed with different qualifier-values for each configuration-type. Example of variations of `` directory with different qualifier value...
for k in `git branch -a | sed s/^..//`; do echo -e `git log -1 --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k --`\\t"$k";done | sort
Foreach allows a less error-prone and better readable way to iterate collections. The attribute ref can be used if we want to directly modify the iterated element. void main() { import std.stdio : writeln; int[] arr = [1, 3, 4]; foreach (ref el; arr) { el *= 2; } ...
In the below example value in map $color-array is treated as list of pairs. SCSS Input $color-array:( black: #4e4e4e, blue: #0099cc, green: #2ebc78 ); @each $color-name, $color-value in $color-array { .bg-#{$color-name} { background: $color-value; } } ...
foreach varlist1 list1 ?varlist2 list2 ...? body foreach is a powerful control structure that allows looping over a list or multiple lists. set alpha [list a b c d e f] foreach {key} $alpha { puts "key: $key" } Multiple variable names may be specified. set alphaindexes [list a ...
All proxy services events are logged in the wso2carbon log file (located in %CARBON_HOME%/repository/logs). If you want, you can have separate log files for each proxy service. Keep in mind, though, that they will still be logged in wso2carbon log file as well. To do so, you should change the log4...
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 ...
foreach is unusual among the collections iterators in that it does not return a result. Instead it applies a function to each element that has only side effects. For example: scala> val x = List(1,2,3) x: List[Int] = List(1, 2, 3) scala> x.foreach { println } 1 2 3 The function sup...
When we want to handle array of data, its better to use async.each. When we want to perform something with all data & want to get the final callback once everything is done, then this method will be useful. This is handled in parallel way. function createUser(userName, callback) { //creat...
A for-each loop in Less has the same key components as a for loop except for the following differences: A variable which contains the list of items that has to be iterated over. An extract() function to extract each item in the variable based on the loop's index. A length() function to calculat...
Direct loop foreach ($colors as $color) { echo "I am the color $color<br>"; } Loop with keys $foods = ['healthy' => 'Apples', 'bad' => 'Ice Cream']; foreach ($foods as $key => $food) { echo "Eating $food is $key"; } Loop by reference In the fo...
In some very specific scenarios we would feel the need to perform a specific action for each flag of the source enumeration. We can write a simple Generic extension method to realize this task. <DebuggerStepThrough> <Extension> <EditorBrowsable(EditorBrowsableState.Always)> Pu...
When reading a potentially large file, a while loop has a significant memory advantage over foreach. The following will read the file record by record (by default, "record" means "a line", as specified by $/), assigning each one to $_ as it is read: while(<$fh>) { pri...

Page 3 of 4