Find Max Capacity of a StringBuilder in C#

AmitDiwan
Updated on 10-Dec-2019 07:52:41

255 Views

To find the MaxCapacity of a StringBuilder, the code is as follows −Example Live Demousing System; using System.Text; public class Demo {    public static void Main(String[] args) {       StringBuilder strBuilder1 = new StringBuilder("Amy");       StringBuilder strBuilder2 = new StringBuilder("Katie");       StringBuilder strBuilder3 = new StringBuilder();       StringBuilder strBuilder4 = new StringBuilder(5);       strBuilder2 = strBuilder3;       Console.WriteLine("Is StringBuilder3 equal to StringBuilder2? = "+strBuilder3.Equals(strBuilder2));       Console.WriteLine("StringBuider1 capacity = "+strBuilder1.Capacity);       Console.WriteLine("StringBuider1 maximum capacity = "+strBuilder1.MaxCapacity);       Console.WriteLine("StringBuider2 capacity = "+strBuilder2.Capacity);   ... Read More

Single MySQL Select Query on Two Tables

AmitDiwan
Updated on 10-Dec-2019 07:49:57

283 Views

Yes, it is possible. Following is the syntax −select * from yourTableName1, yourTableName2;Let us first create a table −mysql> create table DemoTable1    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY    -> ); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(), (), (); Query OK, 3 rows affected (0.14 sec) Records: 3  Duplicates: 0  Warnings: 0Display all records from the table using select statement −mysql> select * from DemoTable1;This will produce the following output −+----+ | Id | +----+ |  1 | |  2 ... Read More

Find Length of StringBuilder in C#

AmitDiwan
Updated on 10-Dec-2019 07:47:55

258 Views

To find the length of the StringBuilder in C#, the code is as follows −Example Live Demousing System; using System.Text; public class Demo {    public static void Main(String[] args) {       StringBuilder strBuilder1 = new StringBuilder("Amy");       StringBuilder strBuilder2 = new StringBuilder("Katie");       StringBuilder strBuilder3 = new StringBuilder();       StringBuilder strBuilder4 = new StringBuilder(5);       strBuilder2 = strBuilder3;       Console.WriteLine("Is StringBuilder3 equal to StringBuilder2? = "+strBuilder3.Equals(strBuilder2));       Console.WriteLine("StringBuider1 capacity = "+strBuilder1.Capacity);       Console.WriteLine("StringBuider1 maximum capacity = "+strBuilder1.MaxCapacity);       Console.WriteLine("StringBuider1 length = "+strBuilder1.Length); ... Read More

Using Logarithm in SAP ABAP

Swarali Sree
Updated on 10-Dec-2019 07:46:01

746 Views

Yes, there is a log function. You can use it to implement your requirement.Here is a code snippet which might be of some help for your implementation.DATA:  NUMBER  TYPE INT,        BASE TYPE INT,        RESULT  TYPE FLOATLet’s say:Number=16 BASE=4 RESULT= log(NUMBER)/log(BASE)RESULT will be 2.

Fetch a Value Between Different Values in MySQL

AmitDiwan
Updated on 10-Dec-2019 07:45:53

168 Views

Use MySQL BETWEEN to fetch a value between different values. Let us first create a table −mysql> create table DemoTable1473    -> (    -> EmployeeCode varchar(20)    -> ); Query OK, 0 rows affected (0.47 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1473 values('EMP_120'); Query OK, 1 row affected (0.25 sec) mysql> insert into DemoTable1473 values('EMP_125'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1473 values('EMP_30'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1473 values('EMP_130'); Query OK, 1 row affected (0.10 sec)Display all records from the table using select ... Read More

Create StringDictionary in C#

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

100 Views

To create a StringDictionary in C#, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo {    public static void Main() {       StringDictionary strDict = new StringDictionary();       strDict.Add("A", "John");       strDict.Add("B", "Andy");       strDict.Add("C", "Tim");       strDict.Add("D", "Ryan");       strDict.Add("E", "Kevin");       strDict.Add("F", "Katie");       strDict.Add("G", "Brad");       Console.WriteLine("StringDictionary elements...");       foreach(DictionaryEntry de in strDict) {          Console.WriteLine(de.Key + " " + de.Value);       }    } ... Read More

Change CSS Using jQuery

David Meador
Updated on 10-Dec-2019 07:44:10

738 Views

To change CSS using jQuery, use the jQuery css() method.ExampleYou can try to run the following code to change CSS using jQuery:Live Demo $(document).ready(function(){     $("h2").css("backgroundColor", "red");     $("#myid").css({         "backgroundColor": "gray",         "color": "white"});     $(".myclass").css("border", "2px solid black"); }); Heading 2 This is some text. This is some text.

Convert CHAR Field to DATETIME Field in MySQL

AmitDiwan
Updated on 10-Dec-2019 07:42:39

384 Views

Let us first create a table. Here, we have declared dates in char type −mysql> create table DemoTable1472    -> (    -> ShippingDate char(35)    -> ); Query OK, 0 rows affected (0.46 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1472 values('12/31/2017 10:50'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable1472 values('01/10/2018 12:00'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable1472 values('03/20/2019 09:30'); Query OK, 1 row affected (0.14 sec)Display all records from the table using select statement −mysql> select * from DemoTable1472;This will produce the following output ... Read More

Find Left Position of Element in Horizontal Scroll Container using jQuery

David Meador
Updated on 10-Dec-2019 07:42:23

2K+ Views

To find the left position of element in horizontal scroll container using jQuery, use the animate() function with the scrollLeft() function.ExampleYou can try to run the following code to learn how to find left position of an element in horizontal scroll container:Live Demo $(document).ready(function() {        var scrollArea = $('#box');    var toScroll = $('#box .myclass');    function myScroll() {      toScroll.each(function() {         var self = $(this);         $(this).css('cursor', 'pointer');         $(this).on('click', function () {             var ... Read More

Create Shallow Copy of Hashtable in C#

AmitDiwan
Updated on 10-Dec-2019 07:41:43

280 Views

To create a shallow copy of Hashtable, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       Hashtable hash = new Hashtable();       hash.Add("1", "AB");       hash.Add("2", "BC");       hash.Add("3", "DE");       hash.Add("4", "EF");       hash.Add("5", "GH");       hash.Add("6", "IJ");       hash.Add("7", "KL");       hash.Add("8", "MN");       hash.Add("9", "OP");       hash.Add("10", "QR");       Console.WriteLine("Hashtable elements...");       foreach(DictionaryEntry d in hash) {     ... Read More

Advertisements