To retrieve the system’s reference to the specified String, the code is as follows −Example Live Demousing System; public class Demo{ public static void Main(string[] args){ string str1 = "David"; string str2 = string.Intern(str1); Console.WriteLine("String1 = "+str1); Console.WriteLine("System reference of String1 = "+str2); } }OutputThis will produce the following output −String1 = David System reference of String1 = DavidExampleLet us now see another example − Live Demousing System; public class Demo{ public static void Main(string[] args){ string str1 = "50"; ... Read More
For this, use DECIMAL(21,20). Let us first create a table −mysql> create table DemoTable1493 -> ( -> LongValue DECIMAL(21,20) -> ); Query OK, 0 rows affected (0.48 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1493 values(1.0047464644664677373); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1493 values(5.999999484757773); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1493 values(0.009994995885885); Query OK, 1 row affected (0.21 sec)Display all records from the table using select statement −mysql> select * from DemoTable1493;This will produce the following output −+------------------------+ | LongValue | +------------------------+ | 1.00474646446646773730 | | 5.99999948475777300000 | | 0.00999499588588500000 | +------------------------+ 3 rows in set (0.00 sec)
To remove the element from the specified index of the List, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main(String[] args){ List list = new List(); list.Add("Ryan"); list.Add("Kevin"); list.Add("Andre"); list.Add("Tom"); list.Add("Fred"); list.Add("Jason"); list.Add("Jacob"); list.Add("David"); Console.WriteLine("Count of elements in the List = "+list.Count); Console.WriteLine("Enumerator iterates through the list elements..."); List.Enumerator demoEnum = list.GetEnumerator(); ... Read More
This error may occur if you have used an incorrect syntax. Let’s say the following is the create table statement −mysql> create table DemoTable1492 -> ( -> timestamp TIMESTAMP, -> event int, -> ); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 5You need to remove extra comma above after the event column to fix. Let us first create a −mysql> create table DemoTable1492 -> ( -> timestamp TIMESTAMP, ... Read More
To play user modified beep sound through Console, the code is as follows −Example Live Demousing System; public class Demo { public static void Main(String[] args){ Console.WriteLine("Displaying standard output stream..."); Console.WriteLine("Standard Output Stream = "+Console.Out); Console.WriteLine("Beep sound through Console"); Console.Beep(); Console.WriteLine("Beep sound through Console with frequence 1000 hertz and duration 500 milliseconds"); Console.Beep(1000, 500); } }OutputThis will produce the following output −Displaying standard output stream... Standard Output Stream = System.IO.TextWriter+SyncTextWriter Beep sound through Console Beep sound through Console with frequence 1000 ... Read More
In order to store PayPal decimal amount in the MySQL database, you can use DECIMAL(10, 2). Let us first create a table −mysql> create table DemoTable1491 -> ( -> Amount DECIMAL(10, 2) -> ); Query OK, 0 rows affected (0.66 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1491 values(987664.50); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1491 values(18783874.90); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1491 values(35363738.50); Query OK, 1 row affected (0.15 sec)Display all records from the table using select statement −mysql> select * from ... Read More
To get the HashCode 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(150, 400, 500, 700, 100, 1200, 1500, Tuple.Create(50, 100)); var tuple2 = Tuple.Create(150, 400, 500, 700, 100, 1200, 1500, Tuple.Create(100, 200)); Console.WriteLine("Is Tuple1 equal to Tuple2? = "+tuple1.Equals(tuple2)); Console.WriteLine("HashCode of Tuple1 = "+tuple1.GetHashCode()); Console.WriteLine("HashCode of Tuple2 = "+tuple2.GetHashCode()); } }OutputThis will produce the following output −Is Tuple1 equal to Tuple2? = False HashCode of Tuple1 = ... Read More
For this, use AVG() for average and GROUP BY to group records of duplicate column (Product Id). Let us first create a table −mysql> create table DemoTable1490 -> ( -> ProductId varchar(20), -> ProductPrice int -> ); Query OK, 0 rows affected (0.43 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1490 values('PRODUCT_100', 700); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1490 values('PRODUCT_200', 500); Query OK, 1 row affected (0.31 sec) mysql> insert into DemoTable1490 values('PRODUCT_200', 1000); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1490 values('PRODUCT_100', ... Read More
To create a StringCollection in C#, the code is as follows −Example Live Demousing System; using System.Collections.Specialized; public class Demo { public static void Main(){ StringCollection strCol = new StringCollection(); String[] strArr = new String[] { "A", "B", "C", "D", "E", "F", "G", "H" }; Console.WriteLine("StringCollection elements..."); foreach (string str in strArr){ Console.WriteLine(str); } strCol.AddRange(strArr); Console.WriteLine("Element at 5th index = "+strCol[5]); Console.WriteLine("Count of strings in StringCollection = " + strCol.Count); } ... Read More
Let us first create a table −mysql> create table DemoTable1489 -> ( -> ProductId int, -> ProductPrice int -> ); Query OK, 0 rows affected (0.49 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1489 values(100, 900); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable1489 values(115, 1000); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable1489 values(119, 2100); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable1489 values(125, 2100); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable1489 values(128, 2900); Query OK, 1 ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP