Looping through All Nodes in an XML Document using c# .NET

This example demonstrates an application that loops through all the nodes of an XML document and prints out the name of the element or the text contained in the element in the case of an XmlText element. Input xml Books.xml: <?xml version="1.0"?> <books> <book> <title>This is title1</title> <author>author1</author> <code>1234</code> </book> <book> <title>This is title2</title> <author>author2</author> […]
Continue reading…

Enjoyed this post? Share it!

 
 

Do while loop in Javascript

We can use the do-while construct when we want the code to be processed atleast once, irrespective whether the condition is true or false. Unlike the while loop, the do…while loop doesn’t evaluate the conditional expression until the end of the code block. Hence, the block is executed atleast once always. var intval = 0; […]
Continue reading…

Enjoyed this post? Share it!

 
 

Loop through an array and read values in Javascript

To loop through all entries of an array and read their values, we can use a for loop to build an incrementing index counter, limited by the length of the array. Example: var myArray = ["Mani", "Kaka", "Biryani", "Mad"]; for (var i = 0; i < myArray.length; i++) { document.write("Item " + i + " […]
Continue reading…

Enjoyed this post? Share it!

 
 

Creating multiple threads in C#

The following is an example on how multiple threads can be created in csharp within a for loop. This demonstrates how a single function is invoked by multiple threads. static void doWork() { Console.WriteLine("Thread id of current thread is {0}", Thread.CurrentThread.ManagedThreadId); } ThreadStart Op = new ThreadStart(doWork);   for(int i = 0; i < 5; […]
Continue reading…

Enjoyed this post? Share it!

 
 

Flow control in PHP : Part 3 – Looping constructs FOR LOOP

The for loop is also similar to the while loop, but with the initialization and increment operations embedded within the loops statement.The initialize expression sets the value of the variable to an initial value. This is executed only during the first iteration. The condition checks the value of the variable during each iteration and the […]
Continue reading…

Enjoyed this post? Share it!

 
 

Flow control in PHP : Part 2 – Looping constructs DO-WHILE

The do-while loop is similar to the while loop except that the condition is checked after executing the statements instead of at the beginning. The block of code within the loop is executed atleast once. Syntax: do { code to be executed; } while (condition); The default part of the code is executed if the […]
Continue reading…

Enjoyed this post? Share it!

 
 

Flow control in PHP : Part 1 – Looping constructs WHILE

The while loop repeats the execution of a set of statements as long as a condition is satisfied.The code within the loop is executed until the condition is TRUE. The condition is checked each time before beginning the execution of the code. Each cycle of executing og the code within the loops is called an […]
Continue reading…

Enjoyed this post? Share it!