Get or Set Number of Elements in BitArray in C#

AmitDiwan
Updated on 10-Dec-2019 06:17:55

141 Views

To get or set the number of elements in the BitArray, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       BitArray arr1 = new BitArray(2);       BitArray arr2 = new BitArray(2);       arr1[0] = false;       arr1[1] = true;       Console.WriteLine("BitArray1 length = "+arr1.Length);       Console.WriteLine("Elements in BitArray1...");       foreach (bool res in arr1) {          Console.WriteLine(res);       }       arr2[0] = false;       arr2[1] ... Read More

Set ScrollTop Position in jQuery

Alex Onsman
Updated on 10-Dec-2019 06:16:20

8K+ Views

To set scrolltop position in jQuery, use the scrollTop() method. The scrollTop( ) method gets the scroll top offset of the first matched element. This method works for both visible and hidden elements.ExampleYou can try to run the following code to set scrollTop() method in jQuery:Live Demo           jQuery scrollTop() method                              $(document).ready(function(){             $("div.demo").scrollTop( 200 );                             $("div.demo").mousemove(function () {     ... Read More

MySQL Query to Get Next Closest Day Between Two Days

AmitDiwan
Updated on 10-Dec-2019 06:15:51

196 Views

Following is the syntax −select * from yourTableName order by ( yourColumnName> now()) desc, (case when yourColumnName > now() then yourColumnName end) ,    yourColumnName  desc limit 1;Let us first create a table −mysql> create table DemoTable1454    -> (    -> ShippingDate date    -> ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1454 values('2019-10-01'); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable1454 values('2019-10-03'); Query OK, 1 row affected (0.25 sec) mysql> insert into DemoTable1454 values('2019-10-05'); Query OK, 1 row affected (0.25 sec) mysql> insert ... Read More

Scroll to Element in Horizontal Div Using jQuery

Alex Onsman
Updated on 10-Dec-2019 06:14:49

2K+ Views

To scroll to element in horizontal div, use the scrollleft.ExampleYou can try to run the following code to learn how to scroll to element in jQuery:Live Demo               jQuery Scroll                              $(document).ready(function(){            document.addEventListener('DOMContentLoaded', function () {               var frames = document.getElementById('frames');               frames.addEventListener('click', function (e) {                  if (e.target.classList.contains('item')) {                    e.target.parentNode.scrollLeft = e.target.offsetLeft;                  }              });           });                          });                                   .myclass {             width: 300px;             display: flex;             position: relative;             overflow-x: scroll;         }             .item {             width: 400px;             background: #FFB563;             margin-right: 40px;         }                                     demo1         demo2         demo3         demo4         demo5         demo6         demo7         demo8            

Union of SortedSet to a Collection in C#

AmitDiwan
Updated on 10-Dec-2019 06:13:06

159 Views

To compute the Union of SortedSet to a Collection, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main() {       SortedSet set1 = new SortedSet();       set1.Add(50);       set1.Add(100);       set1.Add(150);       Console.WriteLine("SortedSet1 elements...");       foreach(int ele in set1) {          Console.WriteLine(ele);       }       SortedSet set2 = new SortedSet();       set2.Add(100);       set2.Add(150);       set2.Add(200);       set2.Add(250);       Console.WriteLine("SortedSet2 elements..."); ... Read More

Print Structured MySQL SELECT at Command Prompt

AmitDiwan
Updated on 10-Dec-2019 06:09:40

242 Views

To print, the syntax is as follows −mysql -uroot -t -e "your Select Query  " -pTo implement the above syntax, let us open the command prompt −Now, reach the MySQL bin −Let us implement the above syntax to easily print structured SQL select. Following is the query −This will produce the following output −

Bitwise OR Operation Between Elements of BitArray in C#

AmitDiwan
Updated on 10-Dec-2019 06:07:37

106 Views

Let us see how to implement Bitwise OR operation between the elements of BitArray −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       BitArray arr1 = new BitArray(5);       BitArray arr2 = new BitArray(5);       arr1[0] = false;       arr1[1] = false;       arr2[0] = false;       arr2[1] = true;       Console.WriteLine("BitArray1 elements...");       foreach (bool res in arr1) {          Console.WriteLine(res);       }       Console.WriteLine("BitArray2 elements...");       ... Read More

Count Duplicate IDs and Display Result in MySQL

AmitDiwan
Updated on 10-Dec-2019 06:06:06

221 Views

Let us first create a table −mysql> create table DemoTable1453    -> (    -> CustomerId int,    -> CustomerReviewNumber int    -> ); Query OK, 0 rows affected (0.58 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1453 values(10, 4); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable1453 values(10, 4); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable1453 values(11, 5); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1453 values(11, 5); Query OK, 1 row affected (0.07 sec) mysql> insert into DemoTable1453 values(11, 5); Query OK, 1 ... Read More

Get or Set Element at Specified Index in ArrayList in C#

AmitDiwan
Updated on 10-Dec-2019 06:04:38

1K+ Views

To get or set the element at the specified index in ArrayList, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       ArrayList arrList = new ArrayList();       arrList.Add("Laptop");       arrList.Add("Desktop");       arrList.Add("Notebook");       arrList.Add("Ultrabook");       arrList.Add("Tablet");       arrList.Add("Headphone");       arrList.Add("Speaker");       Console.WriteLine("Elements in ArrayList...");       foreach(string str in arrList) {          Console.WriteLine(str);       }       Console.WriteLine("Element at index 5 = " ... Read More

Count Multiple Rows and Display Result in Different Columns with MySQL

AmitDiwan
Updated on 10-Dec-2019 06:02:38

742 Views

Let us first create a table −mysql> create table DemoTable1452    -> (    -> FavouriteColor varchar(50)    -> ); Query OK, 0 rows affected (2.42 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1452 values('Red'); Query OK, 1 row affected (0.31 sec) mysql> insert into DemoTable1452 values('Yellow'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable1452 values('Yellow'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable1452 values('Yellow'); Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable1452 values('Blue'); Query OK, 1 row affected (0.42 sec) mysql> insert into DemoTable1452 values('Blue'); ... Read More

Advertisements