To find the JavaScript function definition in Google Chrome, open the web browser and press F12 to reach Developer Tools.Now press Ctrl + Shift + FCheck Regular Expression as shown below −Search for function and that’s it.
Set the drive for which you want to display the name −DriveInfo info = new DriveInfo("C");Now, to get the drive name, use the Name property −info.NameHere is the complete code with output −Exampleusing System; using System.Linq; using System.IO; public class Demo { public static void Main() { DriveInfo info = new DriveInfo("C"); Console.WriteLine(“Drive: “+info.Name); } }OutputThe following is the output −D:/
Use the RootDirectory property to get the name of the root directory.Firstly, use DriveInfo to set the drive for which you want the root directory −DriveInfo dInfo = new DriveInfo("C");Now, the RootDirectory gives you the result −dInfo.RootDirectoryExampleHere is the complete code −using System; using System.Linq; using System.IO; public class Demo { public static void Main() { DriveInfo dInfo = new DriveInfo("C"); Console.WriteLine("Root Directory: "+dInfo.RootDirectory); } }OutputThe following is the output −C:\
Firstly, use GetDrives to get the name of all the drives −var drv = DriveInfo.GetDrives();Loop through to get the name of all the drives on the system −foreach (DriveInfo dInfo in drv) { Console.WriteLine(dInfo.Name); }Let us see the complete code −Example Live Demousing System; using System.Linq; using System.IO; public class Demo { public static void Main() { var drv = DriveInfo.GetDrives(); foreach (DriveInfo dInfo in drv) { Console.WriteLine(dInfo.Name); } } }Output/etc/resolv.conf /etc/hostname /etc/hosts /run/secrets /home/cg/rootNote: The result will vary on different Operating Systems. The above ... Read More
We can write the following PHP script to get the list of available MySQL databases −Example
With the TakeWhile() method, you can get methods by setting a condition base on Predicate.Firstly, declare and initialize an array −int[] arr = { 25, 40, 65, 70};Now, use the TakeWhile() method and predicate to get all the elements that are less than 30.var val = arr.TakeWhile(ele => ele < 30);Let us see the same example, wherein we have displayed the values less than 30 using Predicate −Example Live Demousing System; using System.Linq; using System.IO; public class Demo { public static void Main() { int[] arr = { 25, 40, 65, 70}; var val = arr.TakeWhile(ele => ele < 30); foreach (int res in val) { Console.WriteLine(res); } } }Output25
Use the Aggregate method in C# to perform mathematical operations such as Sum, Min, Max, Average, etc.Let us see an example to multiply array elements using Aggregate method.Here is our array −int[] arr = { 10, 15, 20 };Now, use Aggregate() method −arr.Aggregate((x, y) => x * y);Here is the complete code −Example Live Demousing System; using System.Linq; using System.IO; public class Demo { public static void Main() { int[] arr = { 10, 15, 20 }; // Multiplication int res = arr.Aggregate((x, y) => x * y); Console.WriteLine(res); } }Output3000
PHP uses mysql_affected_rows( ) function to find out how many rows a query changed. To illustrate it we are having the following example −Example Rows affected by query
The All() extension method is part of the System.Linq namepspace. Using this method, you can check whether all the elements match a certain condition or not.Set an array −int[] arr = { 6, 7, 15, 40, 55 };The following is an example. It checks whether all the elements in the array is greater than and equal to 2 or not −arr.All(element => element > = 2);Here is the complete code −Example Live Demousing System; using System.Linq; class Program { static void Main() { int[] arr = { 6, 7, 15, 40, 55 }; bool res = arr.All(element => element >= 2); Console.WriteLine(res); } }OutputTrue
Basically generated columns are a feature that can be used in CREATE TABLE or ALTER TABLE statements and is a way of storing the data without actually sending it through the INSERT or UPDATE clause in SQL. This feature has been added in MySQL 5.7. A generated column works within the table domain. Its syntax would be as follows −Syntaxcolumn_name data_type [GENERATED ALWAYS] AS (expression) [VIRTUAL | STORED] [UNIQUE [KEY]]Here, first of all, specify the column name and its data type.Then add the GENERATED ALWAYS clause to indicate that the column is a generated column.Then, indicate whether the type of ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP