How to check if String is Palindrome using C#?

Ankith Reddy
Updated on 22-Jun-2020 10:54:50

529 Views

Let’s say we need to find that the following string is Palindrome or not −str = "Level";For that, convert the string into character array to chec each character −char[] ch = str.ToCharArray();Now find the reverse −Array.Reverse(ch);Use the Equals method to find whether the reverse is equal to original array or not −bool res = str.Equals(rev, StringComparison.OrdinalIgnoreCase);The following is the complete code −Example Live Demousing System; namespace Demo {    class Program {       static void Main(string[] args) {          string str, rev;          str = "Level";          char[] ch ... Read More

How to find the file using C#?

George John
Updated on 22-Jun-2020 10:53:53

173 Views

Use the GetDirectories in C# to get a list of sub-folder that appears first −Directory.GetDirectoriesNow loop through those directories and repeat the process for the sub folder.string path = @"d:/New/Myfile"; string[] myDir = Directory.GetDirectories(path, "xml", SearchOption.AllDirectories); Console.WriteLine(myDir.Length.ToString()); foreach (string res in myDir) Console.WriteLine(res);

How can we convert subqueries to RIGHT JOIN?

Arjun Thakur
Updated on 22-Jun-2020 10:52:59

233 Views

To make it understand we are using the data from the following tables −mysql> Select * from Customers; +-------------+----------+ | Customer_Id | Name     | +-------------+----------+ | 1           | Rahul    | | 2           | Yashpal  | | 3           | Gaurav   | | 4           | Virender | +-------------+----------+ 4 rows in set (0.00 sec) mysql> Select * from Reserve; +------+------------+ | ID   | Day        | +------+------------+ | 1    | 2017-12-30 | | ... Read More

C# program to merge two Dictionaries

Chandu yadav
Updated on 22-Jun-2020 10:52:52

2K+ Views

Set the two dictionaries −Dictionary < string, int > dict1 = new Dictionary < string, int > (); dict1.Add("laptop", 1); dict1.Add("desktop", 2); Dictionary < string, int > dict2 = new Dictionary < string, int > (); dict2.Add("desktop", 3); dict2.Add("tablet", 4); dict2.Add("mobile", 5);Now use HashSet and UnionWith() method to merge the two dictionaries −HashSet < string > hSet = new HashSet < string > (dict1.Keys); hSet.UnionWith(dict2.Keys);Here is the complete code −Exampleusing System; using System.Collections.Generic; class Program {    static void Main() {       Dictionary < string, int > dict1 = new Dictionary < string, int > ();     ... Read More

Deadlock and Starvation in C#

George John
Updated on 22-Jun-2020 10:52:20

2K+ Views

Deadlock occurs when a resource is locked by a thread and is required by another thread at the same time. This problem occur frequenty in a multiprocessing system.It can occur when two or more threads wait for a resource that belon to another thread. Here is an example −Thread OneThread TwoTakes Lock PTakes Lock QRequests Lock QRequests Lock PThread One will not get Lock Q since it belongs to Thread Two. In the same way, Thread Two won’t get Lock P since its original owner is Thread One.Deadlocks can also be a three-way deadlock that occurs if three threads and ... Read More

What are the restrictions, in terms of a number of rows and columns, with MySQL query having no table list?

vanithasree
Updated on 22-Jun-2020 10:51:26

139 Views

The restriction on MySQL query having a notable list is that it can return, as a result, exactly one row but that result can contain multiple columns.Examplemysql> Select 65/NULL,65+NULL,65*NULL,65-NULL,65%NULL; +------------+--------------+-------------+-------------+---------+ | 65/NULL    | 65+NULL      | 65*NULL     | 65-NULL     | 65%NULL | +------------+--------------+-------------+-------------+---------+ |       NULL |         NULL |        NULL |        NULL |    NULL | +------------+--------------+-------------+-------------+---------+ 1 row in set (0.00 sec)In the above example, we can see that MySQL returns only one row with five columns, having the result of five expressions, as a result when we do not have any table list in the statement.

Execution time while running a SQL query in HANA Studio

John SAP
Updated on 22-Jun-2020 10:49:45

835 Views

When a SQL query is executed, you can see the confirmation that the query is executed in time duration and also with server processing time. In this scenario, you can see the time taken by SAP HANA processor to create a new table in the HANA database as below −“Statement 'Create Table Demo_HANA ( ID INTEGER, NAME VARCHAR(10), PRIMARY KEY (ID) )' successfully executed in 3 ms 117 µs  (server processing time − 2 ms 458 µs) - Rows Affected − 0”

Create table SQL query in SAP HANA

John SAP
Updated on 22-Jun-2020 10:48:44

9K+ Views

In below SQL query, you can see a create table command in SQL editor to create a new table with name-“Demo_HANA” in schema name AA_HANA11 with column names- ID and NAME and corresponding data types. In the below example, we have defined ID as “Primary Key” which means it is unique and not null.Create Table Demo_HANA (    ID INTEGER,    NAME VARCHAR(10),    PRIMARY KEY (ID) );

In a Multiple-line query, what is the significance of the change of MySQL prompt after the first line?

V Jyothi
Updated on 22-Jun-2020 10:47:10

103 Views

After writing the first line of multiple-line queries, MySQL changes promptly from ‘mysql>’ to ‘→’. It is significant because with the help of it we got an indication that MySQL has not seen a complete statement yet and is waiting for the rest. Consider the example below,mysql> Select *     -> from     -> stock_item;We know that after writing the first line i.e. ‘Select *’ Mysql changes its prompts which means that yet the state has not been completed. After the semicolon, MySQL considers the statement completed and throws the output.

Viewing data in a table in SAP HANA database

John SAP
Updated on 22-Jun-2020 10:45:47

2K+ Views

When the data is entered, you can see the data in this row-based table by going to the Data Preview option. To see the data, right-click on table name → Open Data PreviewWhen you run Data Preview of a table, you can see full data under the Raw Data tab. You can also view distinct values and perform some analysis.

Advertisements