Implement Sleep Method of Thread in C#

Samual Sam
Updated on 19-Jun-2020 11:27:24

428 Views

The sleep method of the thread is used to pause the thread for a specific period.If you want to set sleep for some seconds, then use it like the following code snippet −int sleepfor = 2000; Thread.Sleep(sleepfor);ExampleYou can try to run the following code to implement the sleep method of the thread.Live Demousing System; using System.Threading; namespace MyApplication {    class ThreadCreationProgram {       public static void CallToChildThread() {          Console.WriteLine("Child thread starts");          int sleepfor = 2000;          Console.WriteLine("Child Thread Paused for {0} seconds", sleepfor / 1000);   ... Read More

Chash Program to Illustrate Lower Triangular Matrix

karthikeya Boyini
Updated on 19-Jun-2020 11:26:45

294 Views

For the lower triangular matrix, set all the elements above the main diagonal to zero.Set the following condition −if (i >= j)    Console.Write(A[i, j] + "\t"); else    Console.Write("0\t");ExampleYou can try to run the following code to display a lower triangular matrix.Live Demousing System; using System.Linq; class Demo {    static void Main() {       int m, n, i, j;       Console.Write("Enter number of rows and columns of the matrix ");       m = Convert.ToInt16(Console.ReadLine());       n = Convert.ToInt16(Console.ReadLine());       int[, ] A = new int[10, 10];     ... Read More

NOT NULL Constraint with ALTER TABLE in SQL

karthikeya Boyini
Updated on 19-Jun-2020 11:26:11

283 Views

In this case, MySQL will return an error message regarding data truncated for the column. Following is an example of demonstrating it −ExampleSuppose we have a table ‘test2’ which contains a NULL value in column ‘ID’ at 2nd row. Now, if we will try to declare the column ID to NOT NULL then MySQL will return the error as follows −mysql> Select * from test2; +------+--------+ | ID   | Name   | +------+--------+ | 1    | Gaurav | | NULL | Rahul  | +------+--------+ 2 rows in set (0.00 sec) mysql> ALTER TABLE TEST2 MODIFY ID INT NOT NULL; ERROR 1265 (01000): Data truncated for column 'ID' at row 2

Count Vowels in a String using C#

Samual Sam
Updated on 19-Jun-2020 11:25:55

9K+ Views

You need to check for both the vowels and consonants, but do not forget to check for both the uppercase as well lowercase.For counting vowels, check for “aeiou” characters separately i.e.if (myStr[i] == 'a' || myStr[i] == 'e' || myStr[i] == 'i' || myStr[i] == 'o' || myStr[i] == 'u' || myStr[i] == 'A' || myStr[i] == 'E' || myStr[i] == 'I' || myStr[i] == 'O' || myStr[i] == 'U') {    vowel_count++; }ExampleThe following is the code to count the number of Vowels in a string.Live Demousing System; public class Demo {    public static void Main() {   ... Read More

MySQL NOT NULL Constraint and Field Declaration

Samual Sam
Updated on 19-Jun-2020 11:24:42

460 Views

Actually, MySQL NOT NULL constraint restricts a column of the table from having a NULL value. Once we applied NOT NULL constraint to a column, then we cannot pass a null value to that column. It cannot be declared on the whole table i.e., in other words, we can say that NOT NULL is a column level constraint.For declaring a field NOT NULL, we have to use NOT NULL keyword while defining the column in CREATE TABLE statement.Examplemysql> Create table Employee(ID Int NOT NULL, First_Name Varchar(20), Last_name Varchar(20), Designation Varchar(15)); Query OK, 0 rows affected (0.59 sec)In the query above, ... Read More

Call a Function in JavaScript

Nancy Den
Updated on 19-Jun-2020 11:24:12

1K+ Views

JavaScript allows us to write our own functions as well. To invoke a function somewhere later in the script, you would simply need to write the name of that function.ExampleYou can try to run the following code to learn how to call a function in JavaScript −                    function sayHello() {             document.write ("Hello there!");          }                     Click the following button to call the function                             Use different text in write method and then try...    

Call a JavaScript Function on Click

Govinda Sai
Updated on 19-Jun-2020 11:23:44

2K+ Views

To call a function on click of a button in JavaScript, use onclick. Try to run the following code to call a function onclick in JavaScript −Example                    function sayHello() {             document.write ("Hello there!");          }                     Click the following button to call the function                             Use different text in write method and then try...    

Create Empty Values String in JavaScript

seetha
Updated on 19-Jun-2020 11:20:59

3K+ Views

To create empty values string in JavaScript, you can try to run the following code −Example                    var val;          val = "";          document.write("Value: "+val);          document.write("Type: "+typeof val);                  

What is onsubmit Event in JavaScript

V Jyothi
Updated on 19-Jun-2020 11:19:19

4K+ Views

The onsubmit event is an event that occurs when you try to submit a form. You can put your form validation against this event type. The following example shows how to use onsubmit. Here we are calling a validate() function before submitting a form data to the web server. If validate() function returns true, the form will be submitted, otherwise, it'll not submit the data.ExampleThe following example is a code snippet showing the usage of the onsubmit event −                                                  .......                    

What is onkeyup Event in JavaScript

vanithasree
Updated on 19-Jun-2020 11:18:47

424 Views

The onkeyup event triggers when a key is released.ExampleYou can try to run the following code to learn how to work with onkeyup event in JavaScript −                                         Enter subject below in upper case and see what happpens.          

Advertisements