AmitDiwan has Published 10744 Articles

Getting the Largest Window Height and Width of the Console in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:57:36

231 Views

To get the largest window height of the Console, the code is as follows −Example Live Demousing System; public class Demo{    public static void Main(string[] args){       Console.WriteLine("Largest Window Height of the Console = "+Console.LargestWindowHeight);    } }OutputThis will produce the following output −Largest Window Height of the ... Read More

MySQL query for sorting on a columns partial value like number in “John_120 “

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:56:26

152 Views

For this, you can use SUBSTRING_INDEX() along with ORDER BY. Let us first create a table −mysql> create table DemoTable1502    -> (    -> StudentId varchar(40)    -> ); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1502 values('John_120'); ... Read More

How to get Fourth Element of the Tuple in C#?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:54:53

96 Views

To get the fourth element of the Tuple, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(String[] args){       var tuple1 = Tuple.Create(75, 200, 500, 700, 100, 1200, 1500);       var tuple2 = Tuple.Create(75, 200, 500, 700, 100, ... Read More

MySQL query to select multiple rows effectively?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:53:17

3K+ Views

You need to use index to select multiple rows effectively. Let us first create a table −mysql> create table DemoTable1501    -> (    -> Id int NOT NULL PRIMARY KEY,    -> URL text    -> ); Query OK, 0 rows affected (0.62 sec)Here is the query to create ... Read More

Get the number of key/values pairs contained in OrderedDictionary in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:52:21

101 Views

To get the number of key/values pairs contained in OrderedDictionary, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo {    public static void Main(){       OrderedDictionary dict = new OrderedDictionary();       dict.Add("A", "Home Appliances");       dict.Add("B", "Electronics"); ... Read More

Only return fields which appear a certain number of times using MySQL DISTINCT?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:49:49

70 Views

To return fields appearing a certain number of times, the syntax is as follows −select distinct yourColumnName, count(yourColumnName) from yourTableName where yourColumnName LIKE 'J%' group by yourColumnName having count(*) > 1 order by yourColumnName;Let us first create a table −mysql> create table DemoTable1500    -> (    -> Name varchar(20) ... Read More

Check if HybridDictionary is Synchronized in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:49:05

114 Views

To check if HybridDictionary is synchronized, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo {    public static void Main(){       HybridDictionary dict1 = new HybridDictionary();       dict1.Add("A", "Books");       dict1.Add("B", "Electronics");       dict1.Add("C", "Smart ... Read More

MySQL query to sum up values of rows and sort the result?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:46:53

232 Views

For this, you can use GROUP BY along with ORDER BY clause. Let us first create a table −mysql> create table DemoTable1499    -> (    -> StudentName varchar(20),    -> StudentMarks int    -> ); Query OK, 0 rows affected (0.46 sec)Insert some records in the table using insert ... Read More

Check if Input, Output and Error is redirected on the Console or not in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:45:53

225 Views

To check if the input is redirected on the Console or not, the code is as follows −Example Live Demousing System; public class Demo{    public static void Main(string[] args){       Console.WriteLine("Input Redirected? = "+Console.IsInputRedirected);    } }OutputThis will produce the following output −Input Redirected? = FalseExampleTo check if ... Read More

Duplicate a MySQL Database without using mysqldump?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:44:21

783 Views

To duplicate a MySQL database, the syntax is as follows −create table yourdatabaseName1.yourTableName1 select * from yourdatabaseName2.yourTableName2;Let us first create a table −mysql> use sample; Database changed mysql> create table DemoTable101    -> (    -> Id int,    -> Name varchar(20)    -> ); Query OK, 0 rows affected ... Read More

Advertisements